Not the best year.
Search This Blog
Monday, October 16, 2023
Friday, August 04, 2023
Generate pseudo-random, incremental serial numbers for motherboards
@echo off
setlocal enableextensions disabledelayedexpansion
for /f "tokens=1,* delims=:" %%a in ('
findstr /l /b /c:":::persist:::" "%~f0"
') do set "%%~b"
if not defined savedValue (
set "savedValue=%random%" && ( call :persist.write savedValue )
)
set /a savedValue=%savedValue%+1 && ( call :persist.write savedValue )
;;echo DEBUG: Recorded data %savedValue%
set ss=DW173878110%savedValue%
set bs=BTDN8389450%savedValue%
set su=00020003000400050006000700080i%savedValue%
AMIDEWINx64.EXE /CM "My Corporation" /BM "My Corporation" /BV J83500-205 /BP NUC7i7DNB /SM "My Corporation" /SV J85489-205 /SP NUC7i7DNHE /SS %ss% /BS %bs% /SU %su%
timeout 10 /nobreak >nul
goto :eof
:persist.write varName
if "%~1"=="" goto :eof
for %%a in ("%temp%\%~nx0.%random%%random%%random%.tmp") do (
findstr /l /v /b /c:":::persist::: %~1=" "%~f0" > "%%~fa"
>"%~f0" (
type "%%~fa"
setlocal enabledelayedexpansion
echo(:::persist::: %~1=!%~1!
endlocal
)
del /q "%%~fa"
)
goto :eof
Friday, May 05, 2023
Pingresults
Ping a host once every X seconds and save the result in a csv:
@echo off
SETLOCAL
if [%1]==[/?] goto :help
::Set the address to ping
set address=%1
if [%1]==[] goto :fatal
::Set the destination filename
set filename=%2
if [%2]==[] set filename=pingres.csv
::Set delay between pings (seconds)
set delay=%3
if [%3]==[] set delay=30
:: some info
echo.
echo Running %0 %address% %filename% %delay% - press "Q" for at least %delay%s to quit.
echo.
:: Prepare csv header
echo Time, Target, Lag > %filename%
:loop
::Ping
for /F "tokens=7 delims== " %%l in ('ping -n 1 %address%^|findstr /i "time="') do set lag=%%l
::echo Current ping for %address%: %ping%
<nul set /p =.
::Set Timestamp
set curTime= %date:~0,4%/%DATE:~5,2%/%DATE:~8,3%-%time:~0,2%:%time:~3,2%:%time:~6,2%
::Write in .csv
echo %curTime%, %address%, %lag% >> %filename%
::delay
timeout /T %delay% /nobreak >nul
::keypress
choice /c QWERTY /d Y /t 1 /n >nul
if %errorlevel%==1 ( exit /B 0)
goto :loop
:help
echo.
echo Usage: %0 target resultfile delay
echo if not specified, resultfile is "pingres.csv" and delay is 30s
:fatal
echo.
echo You need to provide at least the hostname/IP of the target
echo type %0 /? for help
exit /B 1
ENDLOCAL
Sunday, April 09, 2023
Stop a service and wait for it to stop
Friday, March 31, 2023
Reset ILO password without OS
If you have an OS installed is simple, just use hponcfg and you can change the password as explained in https://blog.toma.guru/2015/04/hp-ilo-linux-reset-password.html but if no OS is available, then hope is not lost, you can use the iLO Physical Presence Button.
On RX2800 Itanium iLO Physical Presence Button is hidden behind the small red hole
As stated on https://support.hpe.com/hpesc/public/docDisplay?docId=c02728748
The iLO 3 physical presence button enables to reset iLO 3 and reset the user-specific values to factory default values. A momentary press causes a soft reset of iLO 3 when the button is released. The iLO 3 Physical Presence button enables to reset iLO, enter TPM physical presence mode, and enter security override mode.
-
A momentary press of the button resets iLO and clears any security override or TPM physical presence mode that were initiated by this button.
-
A greater than 4 seconds less than 8 seconds, press of the button places the system in physical presence mode for up to 15 minutes.
-
A greater than 8 seconds less than 12 seconds, press of this button places iLO into security override mode for up to 15 minutes. Security override mode enables to enter iLO without being challenged for a password enabling to set up users.
The UID LED blinks once after holding the button for 4 seconds and once after holding the button for 8 seconds to help gauge how long the button press has been held.
Sunday, December 18, 2022
Verify if the files refered by a variable in another files exists
If the file does not exist, rename the referencing file in *.BAD
set di=c:\temp
for %%f in (%di%\*.ctl) do (
for /f "tokens=1,* delims==" %%a in ('findstr /i "object_name=" "%%f"') do (
if not exist "%di%\%%b"(
move /y "%%f" "%%f.BAD" >>%di%\script_report.log
)
)
)
ENDLOCAL
type aaa.ctl:
[...]
object_name=File.txt
[...]
Sunday, October 16, 2022
Sunday, July 17, 2022
Intel AMT revisited
The old article refers to using the Intel AMT SDK and Real VNC Plus for connecting to the remote console, but a better solution is to use meshcommander - this allows you to control all the available devices in your local network form one place.
In order to install meshcommander, only NodeJS and the corresponding npm is needed, so it all resumes to:
cd ~/.meshcommander
npm install meshcommander
node meshcommander [--any (default is 127.0.0.1) --port (default is 3000)]
and you can use the web console (http://localhost:3000):
Friday, June 24, 2022
EliteBook ambientlight sensor
echo $((1 - $(cat /sys/devices/platform/hp-wmi/als))) | sudo tee -a /sys/devices/platform/hp-wmi/als
Saturday, April 23, 2022
HiSilicon Hi3516Ev200 debrick
HiSilicon Hi3516Ev200 camera gets bricked if tried to update the OpenIPC from the web interface running on :85, as the mtd block erase crashes the system during the process.
Download the latest build from github, unpack it and put it on the tftp directory.
Set the local IP as 192.168.1.254
Start tftp server: in.tftpd -L -vvvv -a 192.168.1.254:69 -s /tmp/tftpboot
Connect the USBSerial adapter and configure minicom speed at 115200bps.
Connect power to the HiSilicon board and press CTRL+C
At the prompt, type:
setenv bootargs 'mem=${osmem:-32M} console=ttyAMA0,115200 panic=20 root=/dev/mtdblock3 rootfstype=squashfs init=/init mtdparts=hi_sfc:256k(boot),64k(env),2048k(kernel),5120k(rootfs),-(rootfs_data)'
setenv bootcmd 'setenv setargs setenv bootargs ${bootargs}; run setargs; sf probe 0; sf read 0x42000000 0x50000 0x200000; bootm 0x42000000'
setenv uk 'mw.b 0x42000000 ff 1000000; tftp 0x42000000 uImage.${soc} && sf probe 0; sf erase 0x50000 0x200000; sf write 0x42000000 0x50000 ${filesize}'
setenv ur 'mw.b 0x42000000 ff 1000000; tftp 0x42000000 rootfs.squashfs.${soc} && sf probe 0; sf erase 0x250000 0x500000; sf write 0x42000000 0x250000 ${filesize}'
setenv soc hi3516ev200
setenv osmem 32M
setenv totalmem 64M
setenv ipaddr 192.168.1.10
setenv serverip 192.168.1.254
saveenv
run uk; run ur; reset 