| 5 | #include "pe.h" |
| 6 | |
| 7 | int main(int argc, char* argv[]) |
| 8 | { |
| 9 | if (argc != 4) |
| 10 | { |
| 11 | std::cerr << "usage: binaryshield.exe <target binary path> <start-rva> <end-rva>" << std::endl; |
| 12 | return 1; |
| 13 | } |
| 14 | |
| 15 | std::cout << "starting..." << std::endl; |
| 16 | |
| 17 | PE pe(argv[1]); |
| 18 | |
| 19 | if (!pe.load()) |
| 20 | return 1; |
| 21 | |
| 22 | pe.addFunctionByRva(std::stoi(argv[2], nullptr, 16), std::stoi(argv[3], nullptr, 16)); |
| 23 | |
| 24 | std::cout << "virtualizing function(s)..." << std::endl; |
| 25 | |
| 26 | if (!pe.virtualizeFunctions()) |
| 27 | return 1; |
| 28 | |
| 29 | std::cout << "success" << std::endl; |
| 30 | |
| 31 | if (!pe.addVmSection()) |
| 32 | return 1; |
| 33 | |
| 34 | if (!pe.save("protected.exe")) |
| 35 | return 1; |
| 36 | |
| 37 | std::cout << "exiting..." << std::endl; |
| 38 | |
| 39 | return 0; |
| 40 | } |
nothing calls this directly
no test coverage detected