-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmain.cpp
More file actions
61 lines (58 loc) · 1.87 KB
/
Copy pathmain.cpp
File metadata and controls
61 lines (58 loc) · 1.87 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <memory>
#include "PEFormat.h"
#include "shared.h"
int
main(int argc, char* argv[])
{
try
{
std::cout << std::endl << "\t\t" << __c(36, PROJECT_NAME) << ' '
<< __c(36, PROJECT_VERSION) << std::endl
<< "\tCopyright (C) 2025-2026. Augusto Goulart." << std::endl
<< "\tLicensed under Microsoft Reciprocal License (Ms-RL)."
<< std::endl;
std::cout << std::endl << " Parsing arguments..." << std::endl;
if (argc > 1)
{
if ((!strcmp(argv[1], "--help") ||
!strcmp(argv[1], "-h")))
{
std::cout << std::endl << "Usage: wrappem [-h | --help] "
<< __c(95, "<target> <payload> <dummyname> <output>")
<< std::endl
<< " -h, --help\t show this help message" << std::endl
<< " " << __c(95, "target")
<< "\t filename of the targeted PE file" << std::endl
<< " " << __c(95, "payload")
<< "\t name of the DLL to be imported by the target"
<< std::endl
<< " " << __c(95, "dummyname") << "\t dummy function name"
<< std::endl
<< " " << __c(95, "output") << "\t output filename"
<< std::endl;
exit(EXIT_SUCCESS);
}
else if (argc < 5)
{
throw std::runtime_error("Not enough arguments, use --help");
}
}
else
{
throw std::runtime_error(
"Arguments must be provided, use --help"
);
}
auto f = std::make_unique<wrappem::PatchPE>(
argv[1], argv[2], argv[3]
);
f->Save(argv[4]);
std::cout << __c(32, " DONE!") << std::endl;
}
catch(const std::exception& e)
{
std::cerr << " " << __c(41, " Error: ") << " " << e.what() << std::endl;
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
}