0

I'd to ask whether it is possible to read memory of other process while using .NET Core on Linux

on Windows I'm using DllImports

[DllImport("kernel32.dll")]
public static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);

[DllImport("kernel32.dll")]
public static extern bool ReadProcessMemory(int hProcess, int lpBaseAddress, byte[] lpBuffer, int dwSize, ref int lpNumberOfBytesRead);

but how can I achieve that on Linux?

I'd want to read value from address e.g ProcessBaseMemoryAddresss + 0x210438

Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179
Axelly
  • 589
  • 3
  • 7
  • 26
  • https://nullprogram.com/blog/2016/09/03/ – Lex Li May 25 '19 at 16:37
  • You should be able to string together [process_vm_readv](http://man7.org/linux/man-pages/man2/process_vm_readv.2.html) (as suggested in https://nullprogram.com/blog/2016/09/03/) with https://stackoverflow.com/questions/38202027/p-invoke-in-net-core-with-linux to try to access memory directly from your process. Also check out [How do I read from /proc/$pid/mem under Linux?](https://unix.stackexchange.com/questions/6301/how-do-i-read-from-proc-pid-mem-under-linux) – Alexei Levenkov May 25 '19 at 17:22

0 Answers0