Code:
using GameHackingLib;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
namespace WindowsFormsApplication6
{
public class Form1 : Form
{
private uint baseadressEngine;
private uint baseadressClient;
private ProcessMemory pm;
private uint adress;
private uint[] pointers;
private IContainer components;
private Button button1;
private Label label1;
private Button button2;
private Label label2;
private Button button3;
private Button button4;
private Button button6;
private Button button5;
public Form1()
{
this.InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.button1.Enabled = false;
this.button2.Enabled = false;
char[] c = new char[]
{
'Ĉ',
'Ĝ',
'Ĥ',
'Ĵ',
'Ŝ',
'Ŭ',
'ĉ',
'ĝ',
'ĥ',
'ĵ',
'ŝ',
'ŭ',
'1',
'2',
'5'
};
this.Text = this.randomShit(c, 11);
}
public uint getBaseAdress(string procName, string dllName)
{
Process[] processesByName = Process.GetProcessesByName(procName);
Process[] array = processesByName;
for (int i = 0; i < array.Length; i++)
{
Process process = array[i];
ProcessModuleCollection modules = process.Modules;
foreach (ProcessModule processModule in modules)
{
if (processModule.ModuleName.Contains(dllName))
{
return Convert.ToUInt32(string.Concat(processModule.BaseAddress.ToInt32()));
}
}
}
return 0u;
}
private void button1_Click_1(object sender, EventArgs e)
{
this.label1.ForeColor = Color.Blue;
this.label1.Text = "ON";
this.pm.WriteInt32(this.pm.FindMultiLvlPtrAddr(new MultiLvlPtr(this.adress, this.pointers)), 2);
}
private void button2_Click_1(object sender, EventArgs e)
{
this.label1.ForeColor = Color.Red;
this.label1.Text = "OFF";
this.pm.WriteInt32(this.pm.FindMultiLvlPtrAddr(new MultiLvlPtr(this.adress, this.pointers)), 1);
}
public string randomShit(char[] c, int i)
{
int j = 0;
string text = "";
Random random = new Random();
while (j < i)
{
text += c[random.Next(c.Count<char>() - 1)];
j++;
}
return text;
}
private void button3_Click(object sender, EventArgs e)
{
this.button3.Enabled = false;
this.button4.Enabled = false;
this.button6.Enabled = false;
this.button1.Enabled = true;
this.button2.Enabled = true;
this.button5.Enabled = false;
this.baseadressEngine = this.getBaseAdress("hl2", "engine");
this.baseadressClient = this.getBaseAdress("hl2", "client");
this.adress = this.baseadressEngine + 3941292u;
this.pointers = new uint[]
{
488u,
452u
};
this.pm = new ProcessMemory(ProcessMemory.GetWindowHandleByProcessName("hl2"));
}
private void button4_Click(object sender, EventArgs e)
{
this.button3.Enabled = false;
this.button4.Enabled = false;
this.button6.Enabled = false;
this.button1.Enabled = true;
this.button2.Enabled = true;
this.button5.Enabled = false;
this.baseadressEngine = this.getBaseAdress("hl2", "engine");
this.baseadressClient = this.getBaseAdress("hl2", "client");
this.adress = this.baseadressEngine + 3941204u;
this.pointers = new uint[]
{
32u,
428u
};
this.pm = new ProcessMemory(ProcessMemory.GetWindowHandleByProcessName("hl2"));
}
private void button6_Click(object sender, EventArgs e)
{
this.button3.Enabled = false;
this.button4.Enabled = false;
this.button6.Enabled = false;
this.button1.Enabled = true;
this.button2.Enabled = true;
this.button5.Enabled = false;
this.baseadressEngine = this.getBaseAdress("left4dead2", "engine");
this.baseadressClient = this.getBaseAdress("left4dead2", "client");
this.adress = this.baseadressEngine + 4500496u;
this.pointers = new uint[]
{
720u,
24u,
4u,
244u,
160u
};
this.pm = new ProcessMemory(ProcessMemory.GetWindowHandleByProcessName("left4dead2"));
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void button5_Click(object sender, EventArgs e)
{
}
private void button5_Click_1(object sender, EventArgs e)
{
this.button3.Enabled = false;
this.button4.Enabled = false;
this.button6.Enabled = false;
this.button1.Enabled = true;
this.button2.Enabled = true;
this.button5.Enabled = false;
this.baseadressEngine = this.getBaseAdress("csgo", "engine");
this.baseadressClient = this.getBaseAdress("csgo", "client");
this.adress = this.baseadressEngine + 7893028u;
this.pointers = new uint[]
{
764u,
2032u,
32u,
376u,
176u
};
this.pm = new ProcessMemory(ProcessMemory.GetWindowHandleByProcessName("csgo"));
}
protected override void Dispose(bool disposing)
{
if (disposing && this.components != null)
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.button1 = new Button();
this.label1 = new Label();
this.button2 = new Button();
this.label2 = new Label();
this.button3 = new Button();
this.button4 = new Button();
this.button6 = new Button();
this.button5 = new Button();
base.SuspendLayout();
this.button1.Enabled = false;
this.button1.ForeColor = Color.Blue;
this.button1.Location = new Point(3, 36);
this.button1.Name = "button1";
this.button1.Size = new Size(135, 23);
this.button1.TabIndex = 0;
this.button1.Text = "ON";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new EventHandler(this.button1_Click_1);
this.label1.AutoSize = true;
this.label1.Font = new Font("Microsoft Sans Serif", 14.25f, FontStyle.Bold, GraphicsUnit.Point, 162);
this.label1.ForeColor = Color.Red;
this.label1.Location = new Point(156, 0);
this.label1.Name = "label1";
this.label1.Size = new Size(52, 24);
this.label1.TabIndex = 1;
this.label1.Text = "OFF";
this.button2.Enabled = false;
this.button2.ForeColor = Color.Red;
this.button2.Location = new Point(228, 36);
this.button2.Name = "button2";
this.button2.Size = new Size(135, 23);
this.button2.TabIndex = 2;
this.button2.Text = "OFF";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new EventHandler(this.button2_Click_1);
this.label2.AutoSize = true;
this.label2.Location = new Point(236, 109);
this.label2.Name = "label2";
this.label2.Size = new Size(127, 13);
this.label2.TabIndex = 3;
this.label2.Text = "ßy Can Bölük ( can1357 )";
this.button3.Location = new Point(3, 65);
this.button3.Name = "button3";
this.button3.Size = new Size(75, 23);
this.button3.TabIndex = 4;
this.button3.Text = "CS:Source";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new EventHandler(this.button3_Click);
this.button4.Location = new Point(267, 65);
this.button4.Name = "button4";
this.button4.Size = new Size(96, 23);
this.button4.TabIndex = 5;
this.button4.Text = "Team Fortress 2";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new EventHandler(this.button4_Click);
this.button6.Location = new Point(91, 65);
this.button6.Name = "button6";
this.button6.Size = new Size(75, 23);
this.button6.TabIndex = 9;
this.button6.Text = "Left4Dead2";
this.button6.UseVisualStyleBackColor = true;
this.button6.Click += new EventHandler(this.button6_Click);
this.button5.Location = new Point(181, 65);
this.button5.Name = "button5";
this.button5.Size = new Size(75, 23);
this.button5.TabIndex = 10;
this.button5.Text = "CS: GO";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new EventHandler(this.button5_Click_1);
base.AutoScaleDimensions = new SizeF(6f, 13f);
base.AutoScaleMode = AutoScaleMode.Font;
base.ClientSize = new Size(364, 131);
base.Controls.Add(this.button5);
base.Controls.Add(this.button6);
base.Controls.Add(this.button4);
base.Controls.Add(this.button3);
base.Controls.Add(this.label2);
base.Controls.Add(this.button2);
base.Controls.Add(this.label1);
base.Controls.Add(this.button1);
base.Name = "Form1";
this.Text = "asdasdsada";
base.Load += new EventHandler(this.Form1_Load);
base.ResumeLayout(false);
base.PerformLayout();
}
}
}
namespace GameHackingLib
{
public class MultiLvlPtr
{
private uint baseAddress;
private uint[] offsets;
public uint BaseAddress
{
get
{
return this.baseAddress;
}
}
public uint[] Offsets
{
get
{
return this.offsets;
}
}
public MultiLvlPtr(uint baseAddress, params uint[] offsets)
{
this.baseAddress = baseAddress;
this.offsets = offsets;
}
}
public class ProcessMemory
{
private const uint PROCESS_ALL_ACCESS = 2097151u;
private const uint PAGE_EXECUTE_READWRITE = 64u;
private ulong dwPid;
private IntPtr hWnd;
private IntPtr hProcess;
public ProcessMemory(IntPtr windowHandle)
{
this.hWnd = windowHandle;
if (!ProcessMemory.GetWindowThreadProcessId(windowHandle, out this.dwPid))
{
throw new Exception("GetWindowThreadProcessId() returned FALSE");
}
this.hProcess = ProcessMemory.OpenProcess(2097151u, false, (uint)this.dwPid);
}
public ProcessMemory(string windowTitle)
{
this.hWnd = ProcessMemory.FindWindow(null, windowTitle);
ProcessMemory.GetWindowThreadProcessId(this.hWnd, out this.dwPid);
this.hProcess = ProcessMemory.OpenProcess(2097151u, false, (uint)this.dwPid);
}
public static IntPtr GetWindowHandleByProcessName(string processName)
{
return Process.GetProcessesByName(processName)[0].MainWindowHandle;
}
public uint FindMultiLvlPtrAddr(MultiLvlPtr mp)
{
if (mp.Offsets.Length == 0)
{
return mp.BaseAddress;
}
uint num = this.ReadUInt32(mp.BaseAddress) + mp.Offsets[0];
for (int i = 1; i < mp.Offsets.Length; i++)
{
num = this.ReadUInt32(num) + mp.Offsets[i];
}
return num;
}
public string ReadASCIIString(uint address, uint allocator)
{
byte[] bytes = new byte[allocator];
this.ReadBytes(address, ref bytes);
return Encoding.ASCII.GetString(bytes);
}
public string ReadASCIIString(uint address)
{
byte[] bytes = new byte[256];
this.ReadBytes(address, ref bytes);
return Encoding.ASCII.GetString(bytes);
}
public string ReadUnicodeString(uint address, uint allocator)
{
byte[] bytes = new byte[allocator];
this.ReadBytes(address, ref bytes);
return Encoding.Unicode.GetString(bytes);
}
public string ReadUnicodeString(uint address)
{
byte[] bytes = new byte[512];
this.ReadBytes(address, ref bytes);
return Encoding.Unicode.GetString(bytes);
}
public double ReadDouble(uint address)
{
byte[] value = new byte[8];
this.ReadBytes(address, ref value);
return BitConverter.ToDouble(value, 0);
}
public float ReadFloat(uint address)
{
byte[] value = new byte[4];
this.ReadBytes(address, ref value);
return BitConverter.ToSingle(value, 0);
}
public ulong ReadUInt64(uint address)
{
byte[] value = new byte[8];
this.ReadBytes(address, ref value);
return BitConverter.ToUInt64(value, 0);
}
public long ReadInt64(uint address)
{
byte[] value = new byte[8];
this.ReadBytes(address, ref value);
return BitConverter.ToInt64(value, 0);
}
public uint ReadUInt32(uint address)
{
byte[] value = new byte[4];
this.ReadBytes(address, ref value);
return BitConverter.ToUInt32(value, 0);
}
public int ReadInt32(uint address)
{
byte[] value = new byte[4];
this.ReadBytes(address, ref value);
return BitConverter.ToInt32(value, 0);
}
public bool ReadBytes(uint address, ref byte[] buffer)
{
IntPtr intPtr = new IntPtr(0);
return ProcessMemory.ReadProcessMemory(this.hProcess, new IntPtr((long)((ulong)address)), buffer, (UIntPtr)((ulong)((long)buffer.Length)), ref intPtr);
}
public bool WriteASCIIString(uint address, string value)
{
return this.WriteBytes(address, Encoding.ASCII.GetBytes(value.ToCharArray()));
}
public bool WriteUnicodeString(uint address, string value)
{
return this.WriteBytes(address, Encoding.Unicode.GetBytes(value.ToCharArray()));
}
public bool WriteDouble(uint address, double value)
{
return this.WriteBytes(address, BitConverter.GetBytes(value));
}
public bool WriteFloat(uint address, float value)
{
return this.WriteBytes(address, BitConverter.GetBytes(value));
}
public bool WriteUInt64(uint address, ulong value)
{
return this.WriteBytes(address, BitConverter.GetBytes(value));
}
public bool WriteInt64(uint address, long value)
{
return this.WriteBytes(address, BitConverter.GetBytes(value));
}
public bool WriteUInt32(uint address, uint value)
{
return this.WriteBytes(address, BitConverter.GetBytes(value));
}
public bool WriteInt32(uint address, int value)
{
return this.WriteBytes(address, BitConverter.GetBytes(value));
}
public bool WriteBytes(uint address, byte[] value)
{
UIntPtr dwSize = (UIntPtr)8u;
uint num;
ProcessMemory.VirtualProtectEx(this.hProcess, new IntPtr((long)((ulong)address)), dwSize, 64u, out num);
IntPtr intPtr;
return ProcessMemory.WriteProcessMemory(this.hProcess, new IntPtr((long)((ulong)address)), value, (UIntPtr)((ulong)((long)value.Length)), out intPtr);
}
[DllImport("User32.dll", SetLastError = true)]
private static extern IntPtr FindWindow(string szClassName, string szWindowName);
[DllImport("User32.dll", SetLastError = true)]
private static extern bool GetWindowThreadProcessId(IntPtr hWnd, out ulong lpdwProcessId);
[DllImport("Kernel32.dll", SetLastError = true)]
private static extern IntPtr OpenProcess(uint dwDesiredAccess, bool bInheritHandle, uint dwProcessId);
[DllImport("Kernel32.dll", SetLastError = true)]
private static extern bool VirtualProtectEx(IntPtr hProcess, IntPtr lpAddress, UIntPtr dwSize, uint flNewProtect, out uint lpflOldProtect);
[DllImport("Kernel32.dll", SetLastError = true)]
private static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, UIntPtr nSize, ref IntPtr lpNumberOfBytesRead);
[DllImport("Kernel32.dll", SetLastError = true)]
private static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, UIntPtr nSize, out IntPtr lpNumberOfBytesWritten);
}
}
Also this hack was already detected.