-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
40 lines (33 loc) · 1.24 KB
/
Copy pathmain.cpp
File metadata and controls
40 lines (33 loc) · 1.24 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
#include <iostream>
#include "dependecies/cli11/include/CLI11.hpp"
#include "dependecies/lazy_importer/include/LazyImporter.h"
#include "include/injector.h"
int main(int argc, char** argv)
{
#ifdef NDEBUG
CLI::App app{ "Smart Injector v2 build 0002 rev 01 (production)" };
#else
CLI::App app{ "Smart Injector v2 build 0002 rev 01 (development)" };
#endif
argv = app.ensure_utf8(argv);
std::string process_name = "notepad.exe";
std::string dll_path = "C:\\test.dll";
app.add_option("-p, --process", process_name, "Specify the process to inject to");
app.add_option("-d, --dllpath", dll_path, "Specify the dll that gets injected into the process");
CLI11_PARSE(app, argc, argv);
if (dll_path.find("\\") == std::string::npos) {
printf("[%s] Please specify a valid path\n", __FUNCTION__);
exit(0);
}
Process p(process_name);
if (p.get_pid() == 0) {
printf("[%s] Process was not found (%s)\n", __FUNCTION__, process_name.c_str());
exit(0);
}
printf("[%s] Name = %s\n", __FUNCTION__, p.get_name().c_str());
printf("[%s] PID = %i\n", __FUNCTION__, p.get_pid());
printf("[%s] Handle = 0x%x\n", __FUNCTION__, p.get_handle());
printf("[%s] Main Thread ID = %i\n", __FUNCTION__, p.get_mainthread().get_tid());
Injector i(p, dll_path);
return 0;
}