Advertisement
Guest User

Untitled

a guest
Apr 14th, 2012
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void MemoryMapper::readMemory(unsigned int procId, unsigned long long offset)
  2. {
  3.     ptrace(PTRACE_ATTACH, procId, NULL, NULL);
  4.     while (true)
  5.     {
  6.         long memoryData = ptrace(PTRACE_PEEKDATA, procId, offset);
  7.         if (memoryData == -1)
  8.         {
  9.             cout << "broke" << endl;
  10.                 break;
  11.         }
  12.         cout << memoryData;
  13.     }
  14.  
  15. }
  16.  
  17.  
  18. // main()
  19.     MemoryMapper mapper;
  20.     const unsigned int pid = 27589; //xchat
  21.     const unsigned long long offset = 0x7f64e21c3000; // confirmed in /proc/27589/maps
  22.     mapper.readMemory(pid, offset);
  23.  
  24. // output:
  25. broke
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement