Advertisement
Guest User

WeAreDev exploit api (c#) leaked src code

a guest
Jul 20th, 2021
3,907
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 12.49 KB | None | 0 0
  1. using System;
  2. using System.Diagnostics;
  3. using System.IO;
  4. using System.IO.Pipes;
  5. using System.Net;
  6. using System.Runtime.InteropServices;
  7. using System.Text;
  8. using System.Windows.Forms;
  9.  
  10. namespace WeAreDevs_API
  11. {
  12.   public class ExploitAPI
  13.   {
  14.     private WebClient client = new WebClient();
  15.     private ExploitAPI.BasicInject injector = new ExploitAPI.BasicInject();
  16.     private string cmdpipe = "WeAreDevsPublicAPI_CMD";
  17.     private string luacpipe = "WeAreDevsPublicAPI_LuaC";
  18.     private string luapipe = "WeAreDevsPublicAPI_Lua";
  19.  
  20.     [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
  21.     [return: MarshalAs(UnmanagedType.Bool)]
  22.     private static extern bool WaitNamedPipe(string name, int timeout);
  23.  
  24.     public static bool NamedPipeExist(string pipeName)
  25.     {
  26.       try
  27.       {
  28.         int timeout = 0;
  29.         if (!ExploitAPI.WaitNamedPipe(Path.GetFullPath(string.Format("\\\\.\\pipe\\{0}", (object) pipeName)), timeout))
  30.         {
  31.           switch (Marshal.GetLastWin32Error())
  32.           {
  33.             case 0:
  34.               return false;
  35.             case 2:
  36.               return false;
  37.           }
  38.         }
  39.         return true;
  40.       }
  41.       catch (Exception ex)
  42.       {
  43.         return false;
  44.       }
  45.     }
  46.  
  47.     private void SMTP(string pipe, string input)
  48.     {
  49.       if (ExploitAPI.NamedPipeExist(pipe))
  50.       {
  51.         try
  52.         {
  53.           using (NamedPipeClientStream pipeClientStream = new NamedPipeClientStream(".", pipe, PipeDirection.Out))
  54.           {
  55.             pipeClientStream.Connect();
  56.             using (StreamWriter streamWriter = new StreamWriter((Stream) pipeClientStream))
  57.             {
  58.               streamWriter.Write(input);
  59.               streamWriter.Dispose();
  60.             }
  61.             pipeClientStream.Dispose();
  62.           }
  63.         }
  64.         catch (IOException ex)
  65.         {
  66.           int num = (int) MessageBox.Show("Error occured sending message to the game!", "Connection Failed!", MessageBoxButtons.OK, MessageBoxIcon.Hand);
  67.         }
  68.         catch (Exception ex)
  69.         {
  70.           int num = (int) MessageBox.Show(ex.Message.ToString());
  71.         }
  72.       }
  73.       else
  74.       {
  75.         int num1 = (int) MessageBox.Show("Error occured. Did the dll properly inject?", "Oops", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  76.       }
  77.     }
  78.  
  79.     private string ReadURL(string url) => this.client.DownloadString(url);
  80.  
  81.     private string GetLatestData()
  82.     {
  83.       string str1 = this.ReadURL("https://cdn.wearedevs.net/software/exploitapi/latestdata.txt");
  84.       if (str1.Length > 0)
  85.         return str1;
  86.       string str2 = this.ReadURL("https://pastebin.com/raw/Ly9mJwH7");
  87.       return str2.Length > 0 ? str2 : "";
  88.     }
  89.  
  90.     public bool IsUpdated()
  91.     {
  92.       bool flag = false;
  93.       string latestData = this.GetLatestData();
  94.       if (latestData.Length > 0)
  95.       {
  96.         flag = Convert.ToBoolean(latestData.Split(' ')[0]);
  97.       }
  98.       else
  99.       {
  100.         int num = (int) MessageBox.Show("Could not check for the latest version. Did your fireall block us?", "Error");
  101.       }
  102.       return flag;
  103.     }
  104.  
  105.     private bool DownloadLatestVersion()
  106.     {
  107.       if (System.IO.File.Exists("exploit-main.dll"))
  108.         System.IO.File.Delete("exploit-main.dll");
  109.       string latestData = this.GetLatestData();
  110.       if (latestData.Length > 0)
  111.         this.client.DownloadFile(latestData.Split(' ')[1], "exploit-main.dll");
  112.       return System.IO.File.Exists("exploit-main.dll");
  113.     }
  114.  
  115.     public bool isAPIAttached() => ExploitAPI.NamedPipeExist(this.cmdpipe);
  116.  
  117.     public bool LaunchExploit()
  118.     {
  119.       if (ExploitAPI.NamedPipeExist(this.cmdpipe))
  120.       {
  121.         int num1 = (int) MessageBox.Show("Dll already injected", "No problems");
  122.       }
  123.       else if (this.IsUpdated())
  124.       {
  125.         if (this.DownloadLatestVersion())
  126.         {
  127.           if (this.injector.InjectDLL())
  128.             return true;
  129.           int num2 = (int) MessageBox.Show("DLL failed to inject", "Error");
  130.         }
  131.         else
  132.         {
  133.           int num3 = (int) MessageBox.Show("Could not download the latest version! Did your firewall block us?", "Error");
  134.         }
  135.       }
  136.       else
  137.       {
  138.         int num4 = (int) MessageBox.Show("Exploit is currently patched... Please wait for the developers to fix it! Meanwhile, check wearedevs.net for updates/info.", "Error");
  139.       }
  140.       return false;
  141.     }
  142.  
  143.     public void SendCommand(string Command) => this.SMTP(this.cmdpipe, Command);
  144.  
  145.     [Obsolete("SendScript is deprecated, please use SendLuaCScript instead.")]
  146.     public void SendScript(string script) => this.SendLuaCScript(script);
  147.  
  148.     public void SendLuaCScript(string Script)
  149.     {
  150.       foreach (string input in Script.Split("\r\n".ToCharArray()))
  151.       {
  152.         try
  153.         {
  154.           this.SMTP(this.luacpipe, input);
  155.         }
  156.         catch (Exception ex)
  157.         {
  158.           int num = (int) MessageBox.Show(ex.Message.ToString());
  159.         }
  160.       }
  161.     }
  162.  
  163.     [Obsolete("SendLimitedLuaScript is deprecated, please use SendLuaScript instead.")]
  164.     public void SendLimitedLuaScript(string script) => this.SendLuaScript(script);
  165.  
  166.     public void SendLuaScript(string Script) => this.SMTP(this.luapipe, Script);
  167.  
  168.     public void LuaC_getglobal(string service) => this.SendScript("getglobal " + service);
  169.  
  170.     public void LuaC_getfield(int index, string instance) => this.SendScript("getglobal " + index.ToString() + " " + instance);
  171.  
  172.     public void LuaC_setfield(int index, string property) => this.SendScript("setfield " + index.ToString() + " " + property);
  173.  
  174.     public void LuaC_pushvalue(int index) => this.SendScript("pushvalue " + index.ToString());
  175.  
  176.     public void LuaC_pushstring(string text) => this.SendScript("pushstring " + text);
  177.  
  178.     public void LuaC_pushnumber(int number) => this.SendScript("pushnumber " + number.ToString());
  179.  
  180.     public void LuaC_pcall(int numberOfArguments, int numberOfResults, int ErrorFunction) => this.SendScript("pushnumber " + numberOfArguments.ToString() + " " + numberOfResults.ToString() + " " + ErrorFunction.ToString());
  181.  
  182.     public void LuaC_settop(int index) => this.SendScript("settop " + index.ToString());
  183.  
  184.     public void LuaC_pushboolean(string value = "false") => this.SendScript("pushboolean " + value);
  185.  
  186.     public void LuaC_gettop() => this.SendScript("gettop");
  187.  
  188.     public void LuaC_pushnil() => this.SendScript("pushnil");
  189.  
  190.     public void LuaC_next(int index) => this.SendScript("next");
  191.  
  192.     public void LuaC_pop(int quantity) => this.SendScript("pop " + quantity.ToString());
  193.  
  194.     public void DoBTools(string username = "me") => this.SendCommand("btools " + username);
  195.  
  196.     public void DoKill(string username = "me") => this.SendCommand("kill " + username);
  197.  
  198.     public void CreateForceField(string username = "me") => this.SendCommand("ff " + username);
  199.  
  200.     public void RemoveForceField(string username = "me") => this.SendCommand("noff " + username);
  201.  
  202.     public void DoFloat(string username = "me") => this.SendCommand("float " + username);
  203.  
  204.     public void DoNoFloat(string username = "me") => this.SendCommand("nofloat " + username);
  205.  
  206.     public void RemoveLimbs(string username = "me") => this.SendCommand("nolimbs " + username);
  207.  
  208.     public void RemoveArms(string username = "me") => this.SendCommand("noarms " + username);
  209.  
  210.     public void RemoveLegs(string username = "me") => this.SendCommand("nolegs " + username);
  211.  
  212.     public void AddFire(string username = "me") => this.SendCommand("fire " + username);
  213.  
  214.     public void RemoveFire(string username = "me") => this.SendCommand("nofire " + username);
  215.  
  216.     public void AddSparkles(string username = "me") => this.SendCommand("sparkles " + username);
  217.  
  218.     public void RemoveSparkles(string username = "me") => this.SendCommand("nosparkles " + username);
  219.  
  220.     public void AddSmoke(string username = "me") => this.SendCommand("smoke " + username);
  221.  
  222.     public void DoBlockHead(string username = "me") => this.SendCommand("blockhead " + username);
  223.  
  224.     public void ForceBubbleChat(string username = "me", string text = "WeAreDevs Website") => this.SendCommand("chat " + username + " " + text);
  225.  
  226.     public void ConsolePrint(string text = "WeAreDevs Website") => this.SendCommand("print " + text);
  227.  
  228.     public void ConsoleWarn(string text = "meWeAreDevs Website") => this.SendCommand("warn " + text);
  229.  
  230.     public void SetWalkSpeed(string username = "me", int value = 100) => this.SendCommand("speed " + username + " " + value.ToString());
  231.  
  232.     public void ToggleClickTeleport() => this.SendCommand("toggleclickteleport");
  233.  
  234.     public void SetFogEnd(int value = 0) => this.SendCommand("fogend " + value.ToString());
  235.  
  236.     public void SetJumpPower(int value = 100) => this.SendCommand("jumppower " + value.ToString());
  237.  
  238.     public void TeleportMyCharacterTo(string target_username = "me") => this.SendCommand("teleport " + target_username);
  239.  
  240.     public void PlaySoundInGame(string assetid = "1071384374") => this.SendCommand("music " + assetid);
  241.  
  242.     public void SetSkyboxImage(string assetid = "2143522") => this.SendCommand("skybox " + assetid);
  243.  
  244.     private class BasicInject
  245.     {
  246.       [DllImport("kernel32", CharSet = CharSet.Ansi, SetLastError = true)]
  247.       internal static extern IntPtr LoadLibraryA(string lpFileName);
  248.  
  249.       [DllImport("kernel32", CharSet = CharSet.Ansi, SetLastError = true)]
  250.       internal static extern UIntPtr GetProcAddress(IntPtr hModule, string procName);
  251.  
  252.       [DllImport("kernel32.dll", SetLastError = true)]
  253.       [return: MarshalAs(UnmanagedType.Bool)]
  254.       internal static extern bool FreeLibrary(IntPtr hModule);
  255.  
  256.       [DllImport("kernel32.dll")]
  257.       internal static extern IntPtr OpenProcess(
  258.         ExploitAPI.BasicInject.ProcessAccess dwDesiredAccess,
  259.         [MarshalAs(UnmanagedType.Bool)] bool bInheritHandle,
  260.         int dwProcessId);
  261.  
  262.       [DllImport("kernel32.dll", SetLastError = true)]
  263.       internal static extern IntPtr VirtualAllocEx(
  264.         IntPtr hProcess,
  265.         IntPtr lpAddress,
  266.         uint dwSize,
  267.         uint flAllocationType,
  268.         uint flProtect);
  269.  
  270.       [DllImport("kernel32.dll", SetLastError = true)]
  271.       internal static extern bool WriteProcessMemory(
  272.         IntPtr hProcess,
  273.         IntPtr lpBaseAddress,
  274.         byte[] lpBuffer,
  275.         uint nSize,
  276.         out UIntPtr lpNumberOfBytesWritten);
  277.  
  278.       [DllImport("kernel32.dll")]
  279.       internal static extern IntPtr CreateRemoteThread(
  280.         IntPtr hProcess,
  281.         IntPtr lpThreadAttributes,
  282.         uint dwStackSize,
  283.         UIntPtr lpStartAddress,
  284.         IntPtr lpParameter,
  285.         uint dwCreationFlags,
  286.         out IntPtr lpThreadId);
  287.  
  288.       [DllImport("kernel32.dll", SetLastError = true)]
  289.       internal static extern bool ReadProcessMemory(
  290.         IntPtr hProcess,
  291.         IntPtr lpBaseAddress,
  292.         [Out] byte[] lpBuffer,
  293.         int dwSize,
  294.         out int lpNumberOfBytesRead);
  295.  
  296.       public bool InjectDLL()
  297.       {
  298.         if (Process.GetProcessesByName("RobloxPlayerBeta").Length == 0)
  299.           return false;
  300.         Process process = Process.GetProcessesByName("RobloxPlayerBeta")[0];
  301.         byte[] bytes = new ASCIIEncoding().GetBytes(AppDomain.CurrentDomain.BaseDirectory + "exploit-main.dll");
  302.         IntPtr hModule = ExploitAPI.BasicInject.LoadLibraryA("kernel32.dll");
  303.         UIntPtr procAddress = ExploitAPI.BasicInject.GetProcAddress(hModule, "LoadLibraryA");
  304.         ExploitAPI.BasicInject.FreeLibrary(hModule);
  305.         if (procAddress == UIntPtr.Zero)
  306.           return false;
  307.         IntPtr hProcess = ExploitAPI.BasicInject.OpenProcess(ExploitAPI.BasicInject.ProcessAccess.AllAccess, false, process.Id);
  308.         if (hProcess == IntPtr.Zero)
  309.           return false;
  310.         IntPtr num = ExploitAPI.BasicInject.VirtualAllocEx(hProcess, (IntPtr) 0, (uint) bytes.Length, 12288U, 4U);
  311.         return !(num == IntPtr.Zero) && ExploitAPI.BasicInject.WriteProcessMemory(hProcess, num, bytes, (uint) bytes.Length, out UIntPtr _) && !(ExploitAPI.BasicInject.CreateRemoteThread(hProcess, (IntPtr) 0, 0U, procAddress, num, 0U, out IntPtr _) == IntPtr.Zero);
  312.       }
  313.  
  314.       [System.Flags]
  315.       public enum ProcessAccess
  316.       {
  317.         AllAccess = 1050235, // 0x0010067B
  318.         CreateThread = 2,
  319.         DuplicateHandle = 64, // 0x00000040
  320.         QueryInformation = 1024, // 0x00000400
  321.         SetInformation = 512, // 0x00000200
  322.         Terminate = 1,
  323.         VMOperation = 8,
  324.         VMRead = 16, // 0x00000010
  325.         VMWrite = 32, // 0x00000020
  326.         Synchronize = 1048576, // 0x00100000
  327.       }
  328.     }
  329.   }
  330. }
  331.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement