allen343434

hax

Apr 2nd, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.29 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Net;
  9. using System.IO;
  10. using System.Threading;
  11. using System.Diagnostics;
  12. using System.Runtime.InteropServices;
  13. using System.Windows.Forms;
  14.  
  15. namespace BH_Soldierfront_public_v1
  16. {
  17. public partial class Form1 : Form
  18. {
  19.  
  20. #region DLL Imports
  21. // WebClient webClient = new WebClient();
  22. private const int PROCESS_ALL_ACCESS = 0x1F0FFF;
  23. [DllImport("kernel32")]
  24. private static extern int OpenProcess(int AccessType, int InheritHandle, int ProcessId);
  25. [DllImport("kernel32", EntryPoint = "WriteProcessMemory")]
  26. private static extern byte WriteProcessMemoryByte(int Handle, int Address, ref byte Value, int Size, ref int BytesWritten);
  27. [DllImport("kernel32", EntryPoint = "WriteProcessMemory")]
  28. private static extern int WriteProcessMemoryInteger(int Handle, int Address, ref int Value, int Size, ref int BytesWritten);
  29. [DllImport("kernel32", EntryPoint = "WriteProcessMemory")]
  30. private static extern float WriteProcessMemoryFloat(int Handle, int Address, ref float Value, int Size, ref int BytesWritten);
  31. [DllImport("kernel32", EntryPoint = "WriteProcessMemory")]
  32. private static extern double WriteProcessMemoryDouble(int Handle, int Address, ref double Value, int Size, ref int BytesWritten);
  33.  
  34.  
  35. [DllImport("kernel32", EntryPoint = "ReadProcessMemory")]
  36. private static extern byte ReadProcessMemoryByte(int Handle, int Address, ref byte Value, int Size, ref int BytesRead);
  37. [DllImport("kernel32", EntryPoint = "ReadProcessMemory")]
  38. private static extern int ReadProcessMemoryInteger(int Handle, int Address, ref int Value, int Size, ref int BytesRead);
  39. [DllImport("kernel32", EntryPoint = "ReadProcessMemory")]
  40. private static extern float ReadProcessMemoryFloat(int Handle, int Address, ref float Value, int Size, ref int BytesRead);
  41. [DllImport("kernel32", EntryPoint = "ReadProcessMemory")]
  42. private static extern double ReadProcessMemoryDouble(int Handle, int Address, ref double Value, int Size, ref int BytesRead);
  43. [DllImport("kernel32")]
  44. private static extern int CloseHandle(int Handle);
  45.  
  46. [DllImport("user32")]
  47. private static extern int FindWindow(string sClassName, string sAppName);
  48. [DllImport("user32")]
  49. private static extern int GetWindowThreadProcessId(int HWND, out int processId);
  50.  
  51.  
  52.  
  53. [Flags]
  54. public enum ThreadAccess : int
  55. {
  56. TERMINATE = (0x0001),
  57. SUSPEND_RESUME = (0x0002),
  58. GET_CONTEXT = (0x0008),
  59. SET_CONTEXT = (0x0010),
  60. SET_INFORMATION = (0x0020),
  61. QUERY_INFORMATION = (0x0040),
  62. SET_THREAD_TOKEN = (0x0080),
  63. IMPERSONATE = (0x0100),
  64. DIRECT_IMPERSONATION = (0x0200)
  65. }
  66.  
  67. [DllImport("kernel32.dll")]
  68. static extern IntPtr OpenThread(ThreadAccess dwDesiredAccess, bool bInheritHandle, uint dwThreadId);
  69. [DllImport("kernel32.dll")]
  70. static extern uint SuspendThread(IntPtr hThread);
  71. [DllImport("kernel32.dll")]
  72. static extern int ResumeThread(IntPtr hThread);
  73.  
  74. private void SuspendProcess(int PID)
  75. {
  76. Process proc = Process.GetProcessById(PID);
  77.  
  78. if (proc.ProcessName == string.Empty)
  79. return;
  80.  
  81. foreach (ProcessThread pT in proc.Threads)
  82. {
  83. IntPtr pOpenThread = OpenThread(ThreadAccess.SUSPEND_RESUME, false, (uint)pT.Id);
  84.  
  85. if (pOpenThread == IntPtr.Zero)
  86. {
  87. break;
  88. }
  89.  
  90. SuspendThread(pOpenThread);
  91. }
  92. }
  93. public void ResumeProcess(int PID)
  94. {
  95. Process proc = Process.GetProcessById(PID);
  96.  
  97. if (proc.ProcessName == string.Empty)
  98. return;
  99.  
  100. foreach (ProcessThread pT in proc.Threads)
  101. {
  102. IntPtr pOpenThread = OpenThread(ThreadAccess.SUSPEND_RESUME, false, (uint)pT.Id);
  103.  
  104. if (pOpenThread == IntPtr.Zero)
  105. {
  106. break;
  107. }
  108.  
  109. ResumeThread(pOpenThread);
  110. }
  111. }
  112. #endregion
  113. #region Proccess
  114. public static void WriteInt8(string EXENAME, int Address, byte Value)
  115. {
  116. checked
  117. {
  118. try
  119. {
  120. Process[] Proc = Process.GetProcessesByName(EXENAME);
  121. if (Proc.Length != 0)
  122. {
  123. int Bytes = 0;
  124. int Handle = OpenProcess(PROCESS_ALL_ACCESS, 0, Proc[0].Id);
  125. if (Handle != 0)
  126. {
  127. WriteProcessMemoryByte(Handle, Address, ref Value, 1, ref Bytes);
  128. }
  129. CloseHandle(Handle);
  130. }
  131. }
  132. catch
  133. { }
  134. }
  135. }
  136.  
  137. public static void WriteNOPs(string EXENAME, int address, int count)
  138. {
  139. for (int i = 0; i < count; i++)
  140. {
  141. WriteInt8(EXENAME, address + i, 0x90);
  142. }
  143. }
  144. #endregion
  145.  
  146. public Form1()
  147. {
  148. InitializeComponent();
  149. BHworker.RunWorkerAsync();
  150. }
  151.  
  152. private void BHworker_DoWork(object sender, DoWorkEventArgs e)
  153. {
  154. bool injcs = true;
  155. while (injcs)
  156. {
  157. Process[] NewProc = Process.GetProcessesByName("soldierfront");
  158. if (NewProc.Length == 1)
  159. {
  160. System.Threading.Thread.Sleep(2000);
  161. try
  162. {
  163. WriteNOPs("soldierfront", 0x6e192a, 6);
  164.  
  165. injcs = false;
  166. Application.Exit();
  167. }
  168. catch
  169. {
  170. textBox1.Text = "Failed to inject.";
  171. }
  172.  
  173. }
  174. }
  175. }
  176.  
  177. private void label1_Click(object sender, EventArgs e)
  178. {
  179. Application.Exit();
  180. }
  181.  
  182. private void pictureBox1_Click_1(object sender, EventArgs e)
  183. {
  184. System.Diagnostics.Process.Start("http://buster.net63.net/");
  185. }
  186.  
  187. private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  188. {
  189. System.Diagnostics.Process.Start("http://buster.net63.net/");
  190. }
  191.  
  192. private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  193. {
  194. System.Diagnostics.Process.Start("https://www.facebook.com/Jasper.Buster");
  195. }
  196.  
  197. private void label2_Click(object sender, EventArgs e)
  198. {
  199. var form2 = new Form2();
  200. form2.Show();
  201. }
  202.  
  203. private void studioTheme1_Click(object sender, EventArgs e)
  204. {
  205.  
  206. }
  207. }
  208. }
Add Comment
Please, Sign In to add comment