Bo2 | Online SAFE Tools | SOURCE EDITION | MemoryModule
Final Release and goodbye!
Many of you have been asking me to come back so I can release some quality content, I have given a very small amount
of lucky people a free ESP which I had been working back a few weeks ago but as for now I'm leaving and not coming back.
Here is some source code which the leeches like to use that can be used with BO2, I'm also sharing this as people will try
to charge you for this shit yet it's aids code.
Code Below
Many of you have been asking me to come back so I can release some quality content, I have given a very small amount
of lucky people a free ESP which I had been working back a few weeks ago but as for now I'm leaving and not coming back.
Here is some source code which the leeches like to use that can be used with BO2, I'm also sharing this as people will try
to charge you for this shit yet it's aids code.
Code Below
Code:
using Microsoft.VisualBasic.CompilerServices;
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
namespace HERE ADD YOUR PROJECT NAME
{
[StandardModule]
internal sealed class MemoryModule
{
private static string TargetProcess = "t6mp";
private static IntPtr ProcessHandle = IntPtr.Zero;
private static int LastKnownPID = -1;
private const uint PROCESS_VM_WRITE = 32;
private const uint PROCESS_VM_READ = 16;
private const uint PROCESS_VM_OPERATION = 8;
[DllImport("kernel32.dll")]
private static extern IntPtr OpenProcess(uint dwDesiredAccess, [MarshalAs(UnmanagedType.Bool)] bool bInheritHandle, int dwProcessId);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, IntPtr nSize, out IntPtr lpNumberOfBytesWritten);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [Out] byte[] lpBuffer, IntPtr dwSize, ref IntPtr lpNumberOfBytesRead);
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool CloseHandle(IntPtr hObject);
private static bool ProcessIDExists(int pID)
{
Process[] processesByName = Process.GetProcessesByName(MemoryModule.TargetProcess);
int index = 0;
while (index < processesByName.Length)
{
if (processesByName[index].Id == pID)
return true;
checked { ++index; }
}
return false;
}
public static void SetProcessName(string processName)
{
MemoryModule.TargetProcess = processName;
if (MemoryModule.ProcessHandle != IntPtr.Zero)
MemoryModule.CloseHandle(MemoryModule.ProcessHandle);
MemoryModule.LastKnownPID = -1;
MemoryModule.ProcessHandle = IntPtr.Zero;
}
public static string GetCurrentProcessName()
{
return MemoryModule.TargetProcess;
}
public static bool UpdateProcessHandle()
{
if (MemoryModule.LastKnownPID == -1 || !MemoryModule.ProcessIDExists(MemoryModule.LastKnownPID))
{
if (MemoryModule.ProcessHandle != IntPtr.Zero)
MemoryModule.CloseHandle(MemoryModule.ProcessHandle);
Process[] processesByName = Process.GetProcessesByName(MemoryModule.TargetProcess);
if (processesByName.Length == 0)
return false;
MemoryModule.LastKnownPID = processesByName[0].Id;
MemoryModule.ProcessHandle = MemoryModule.OpenProcess(56U, false, processesByName[0].Id);
if (MemoryModule.ProcessHandle == IntPtr.Zero)
return false;
}
return true;
}
public static T ReadMemory<T>(object address)
{
return MemoryModule.ReadMemory<T>(Conversions.ToLong(address));
}
public static T ReadMemory<T>(int address)
{
return MemoryModule.ReadMemory<T>(new IntPtr(address), 0, false);
}
public static T ReadMemory<T>(long address)
{
return MemoryModule.ReadMemory<T>(new IntPtr(address), 0, false);
}
public static T ReadMemory<T>(IntPtr address)
{
return MemoryModule.ReadMemory<T>(address, 0, false);
}
public static byte[] ReadMemory(IntPtr address, int length)
{
return MemoryModule.ReadMemory<byte[]>(address, length, false);
}
public static byte[] ReadMemory(int address, int length)
{
return MemoryModule.ReadMemory<byte[]>(new IntPtr(address), length, false);
}
public static byte[] ReadMemory(long address, int length)
{
return MemoryModule.ReadMemory<byte[]>(new IntPtr(address), length, false);
}
public static T ReadMemory<T>(IntPtr address, int length, bool unicodeString)
{
byte[] bytes = (object) typeof (T) != (object) typeof (string) ? ((object) typeof (T) != (object) typeof (byte[]) ? new byte[checked (Marshal.SizeOf(typeof (T)) - 1 + 1)] : new byte[checked (length - 1 + 1)]) : (!unicodeString ? new byte[checked (length - 1 + 1)] : new byte[checked (length * 2 - 1 + 1)]);
T obj;
if (!MemoryModule.UpdateProcessHandle())
{
obj = default (T);
}
else
{
IntPtr processHandle = MemoryModule.ProcessHandle;
IntPtr lpBaseAddress = address;
byte[] lpBuffer = bytes;
IntPtr dwSize = new IntPtr(bytes.Length);
IntPtr zero = IntPtr.Zero;
// ISSUE: explicit reference operation
// ISSUE: variable of a reference type
IntPtr& lpNumberOfBytesRead = @zero;
if (!MemoryModule.ReadProcessMemory(processHandle, lpBaseAddress, lpBuffer, dwSize, lpNumberOfBytesRead))
obj = default (T);
else if ((object) typeof (T) == (object) typeof (byte[]))
obj = Conversions.ToGenericParameter<T>((object) bytes);
else if ((object) typeof (T) == (object) typeof (string))
{
obj = !unicodeString ? Conversions.ToGenericParameter<T>((object) Encoding.ASCII.GetString(bytes)) : Conversions.ToGenericParameter<T>((object) Encoding.Unicode.GetString(bytes));
}
else
{
GCHandle gcHandle = GCHandle.Alloc((object) bytes, GCHandleType.Pinned);
T genericParameter = Conversions.ToGenericParameter<T>(Marshal.PtrToStructure(gcHandle.AddrOfPinnedObject(), typeof (T)));
gcHandle.Free();
obj = genericParameter;
}
}
return obj;
}
private static byte[] GetObjectBytes(object value)
{
if ((object) value.GetType() == (object) typeof (byte[]))
return (byte[]) value;
byte[] destination = new byte[checked (Marshal.SizeOf(RuntimeHelpers.GetObjectValue(value)) - 1 + 1)];
IntPtr num = Marshal.AllocHGlobal(destination.Length);
Marshal.StructureToPtr(RuntimeHelpers.GetObjectValue(value), num, true);
Marshal.Copy(num, destination, 0, destination.Length);
Marshal.FreeHGlobal(num);
return destination;
}
public static bool WriteMemory<T>(object address, T value)
{
return MemoryModule.WriteMemory<T>(Conversions.ToLong(address), value);
}
public static bool WriteMemory<T>(object address, object value)
{
return MemoryModule.WriteMemory<T>(Conversions.ToLong(address), Conversions.ToGenericParameter<T>(value));
}
public static bool WriteMemory<T>(int address, T value)
{
return MemoryModule.WriteMemory<T>(new IntPtr(address), value);
}
public static bool WriteMemory<T>(int address, object value)
{
return MemoryModule.WriteMemory<T>(address, Conversions.ToGenericParameter<T>(value));
}
public static bool WriteMemory<T>(long address, T value)
{
return MemoryModule.WriteMemory<T>(new IntPtr(address), value);
}
public static bool WriteMemory<T>(long address, object value)
{
return MemoryModule.WriteMemory<T>(address, Conversions.ToGenericParameter<T>(value));
}
public static bool WriteMemory<T>(IntPtr address, T value)
{
return MemoryModule.WriteMemory<T>(address, value, false);
}
public static bool WriteMemory<T>(IntPtr address, object value)
{
return MemoryModule.WriteMemory<T>(address, Conversions.ToGenericParameter<T>(value), false);
}
public static bool WriteMemory<T>(object address, T value, bool unicode)
{
return MemoryModule.WriteMemory<T>(Conversions.ToLong(address), value, unicode);
}
public static bool WriteMemory<T>(int address, T value, bool unicode)
{
return MemoryModule.WriteMemory<T>(new IntPtr(address), value, unicode);
}
public static bool WriteMemory<T>(long address, T value, bool unicode)
{
return MemoryModule.WriteMemory<T>(new IntPtr(address), value, unicode);
}
public static bool WriteMemory<T>(IntPtr address, T value, bool unicode)
{
if (!MemoryModule.UpdateProcessHandle())
return false;
byte[] numArray = !((object) value is string) ? MemoryModule.GetObjectBytes((object) value) : (!unicode ? Encoding.ASCII.GetBytes(value.ToString()) : Encoding.Unicode.GetBytes(value.ToString()));
IntPtr processHandle = MemoryModule.ProcessHandle;
IntPtr lpBaseAddress = address;
byte[] lpBuffer = numArray;
IntPtr nSize = new IntPtr(numArray.Length);
IntPtr zero = IntPtr.Zero;
// ISSUE: explicit reference operation
// ISSUE: variable of a reference type
IntPtr& lpNumberOfBytesWritten = @zero;
return MemoryModule.WriteProcessMemory(processHandle, lpBaseAddress, lpBuffer, nSize, lpNumberOfBytesWritten);
}
}
}

