10 std::stringstream stream;
14 stream << std::hex <<
"0x" << (
unsigned int)
paddingVal;
18 stream <<
"breakpoint";
26 stream <<
"hook_";
break;
28 stream <<
"addr_replaced_";
break;
30 stream <<
"patch_";
break;
47 stream <<
"+" << diff <<
":";
52 stream <<
"(unnamed)";
62 if (patch_report.is_open()) {
63 patch_report << std::hex << startRva;
64 patch_report << delimiter;
65 patch_report << getFormattedName();
66 patch_report << delimiter;
67 patch_report << (endRva - startRva);
69 patch_report << std::endl;
71 std::cout << std::hex << startRva << std::endl;
81 outs <<
"\"" << std::hex << (ULONGLONG)startRva <<
"\"" <<
",\n";
84 outs << std::dec << (ULONGLONG)(endRva - startRva);
89 outs <<
"\"" << getFormattedName() <<
"\"";
94 OUT_PADDED(outs, (level + 1),
"\"is_hook\" : ");
95 outs << std::dec << isHook;
97 if (this->hooked_func.length() > 0) {
99 OUT_PADDED(outs, (level + 1),
"\"func_name\" : ");
100 outs <<
"\"" << hooked_func <<
"\"";
104 OUT_PADDED(outs, (level + 1),
"\"hook_target\" : {\n");
105 if (hookTargetModName.length() > 0) {
106 OUT_PADDED(outs, (level + 2),
"\"module_name\" : ");
107 outs <<
"\"" << hookTargetModName <<
"\"" <<
",\n";
109 OUT_PADDED(outs, (level + 2),
"\"module\" : ");
110 outs <<
"\"" << std::hex << (ULONGLONG)hookTargetModule <<
"\"" <<
",\n";
112 outs <<
"\"" << std::hex << (ULONGLONG)(hookTargetVA - hookTargetModule) <<
"\"" <<
",\n";
113 OUT_PADDED(outs, (level + 2),
"\"status\" : ");
114 outs << std::dec << (ULONGLONG)this->isTargetSuspicious <<
"\n";
126 ULONGLONG patch_va = (ULONGLONG) this->moduleBase + this->startRva;
127 const peconv::ExportedFunc *func = expMap.find_export_by_va(patch_va);
128 if (func ==
nullptr) {
131 this->hooked_func = func->nameToString();
137 std::vector<Patch*>::iterator itr;
140 patch->
toTAG(patch_report, delimiter);
150 bool is_first =
true;
151 OUT_PADDED(outs, level,
"\"patches_list\" : [\n");
152 std::vector<Patch*>::iterator itr;
159 patch->
toJSON(outs, level + 1, short_info);
169 size_t hookes_exports = 0;
170 std::vector<Patch*>::iterator itr;
177 return hookes_exports;
182 std::vector<Patch*>::iterator itr;
std::string getFormattedName()
std::string hookTargetModName
bool resolveHookedExport(peconv::ExportsMapper &expMap)
const bool toTAG(std::ofstream &patch_report, const char delimiter)
const bool toJSON(std::stringstream &outs, size_t level, bool short_info)
ULONGLONG hookTargetModule
size_t checkForHookedExports(peconv::ExportsMapper &expMap)
std::vector< Patch * > patches
const bool toJSON(std::stringstream &outs, size_t level, bool short_info)
const size_t toTAGs(std::ofstream &patch_report, const char delimiter)