-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
37 lines (31 loc) · 994 Bytes
/
Copy pathmain.cpp
File metadata and controls
37 lines (31 loc) · 994 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <iostream>
#include "Debugger.h"
using namespace std;
#include <string>
int main(int argc, char *argv[])
{
Debugger dbg;
if (argc > 1){
int pid = stoi(argv[1]);
dbg.attach(pid);
int x;
LPVOID printf_address =(LPVOID) dbg.resolve_function("msvcrt.dll", "printf");
printf("[*] Address of printf: 0x%08x\n" , printf_address);
//dbg.software_breakpoint((LPVOID)printf_address);
// if(!dbg.SetHardwareBreakpoint(printf_address , 1 , HW_EXECUTE)){
// printf("setting hardware breakpoint failed");
// return 0;
// }
if(!dbg.SetMemoryBreakpoint2(printf_address,4096)){
printf("setting memory breakpoint failed");
return 0;
}
dbg.run();
}
// else {
// dbg.load("C:\\Windows\\SysWOW64\\calc.exe");
// dbg.run();
// dbg.detach();
// }
return 0;
}