public int OpenProcess(int processID) { if (ns != null) { OPCommand op = new OPCommand(); op.command = CMD_OPENPROCESS; op.pid = processID; RawSerializer <OPCommand> rs = new RawSerializer <OPCommand>(); byte[] data = rs.RawSerialize(op); ns.Write(data, 0, data.Length); handle = NetReadInt(); Console.WriteLine(String.Format("Handle={0}", handle)); return(handle); } else { return(0); } }
public int WriteProcessMemory(ulong address, byte[] writeData) { if (ns != null) { WriteProcessMemoryCommand cmd = new WriteProcessMemoryCommand(); cmd.command = CMD_WRITEPROCESSMEMORY; cmd.address = address; cmd.handle = handle; cmd.size = writeData.Length; RawSerializer <WriteProcessMemoryCommand> rs = new RawSerializer <WriteProcessMemoryCommand>(); byte[] data = rs.RawSerialize(cmd); ns.Write(data, 0, data.Length); ns.Write(writeData, 0, writeData.Length); int numWrite = NetReadInt(); return(numWrite); } else { return(0); } }
public byte[] ReadProcessMemory(ulong address, int size) { if (ns != null) { ReadProcessMemoryCommand cmd = new ReadProcessMemoryCommand(); cmd.command = CMD_READPROCESSMEMORY; cmd.address = address; cmd.handle = handle; cmd.size = size; cmd.compress = 0; RawSerializer <ReadProcessMemoryCommand> rs = new RawSerializer <ReadProcessMemoryCommand>(); byte[] data = rs.RawSerialize(cmd); ns.Write(data, 0, data.Length); int resultSize = NetReadInt(); byte[] recvData = NetReadByteArray(resultSize); return(recvData); } else { return(null); } }
public static int ByteArrayToInt(byte[] data) { RawSerializer <int> rs2 = new RawSerializer <int>(); return(rs2.RawDeserialize(data)); }
public static byte[] IntToByteArray(int data) { RawSerializer <int> rs = new RawSerializer <int>(); return(rs.RawSerialize(data)); }