forked from secrary/InjectProc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
40 lines (37 loc) · 1.33 KB
/
Copy pathmain.cpp
File metadata and controls
40 lines (37 loc) · 1.33 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
#include <Windows.h>
#include "Injection.h"
#include <iostream>
#include <filesystem>
#include <atlconv.h>
int main(int argc, char* argv[])
{
USES_CONVERSION;
if (argc < 2)
{
printf_s( "Usage: ./InjectProc.exe <type of injection> <path/to/exe or process_name> <path/to/dll>\nExample:\n\
./InjectProc.exe dll_inj path/to/dll.dll notepad.exe\n\
./InjectProc.exe proc_rpl path/to/target/exe path/to/exe\n\
./InjectProc.exe hook path/to/target/exe path/to//dll\n\
./InjectProc.exe APC target/proc/name path/to/dll\n\
");
return EXIT_FAILURE;
}
string mode = argv[1];
if (mode == "dll_inj")
Dll_Injection(A2T(argv[2]), A2T(argv[3]));
else if (mode == "proc_rpl")
ProcessReplacement(A2T(argv[2]), A2T(argv[3]));
else if (mode == "hook")
// Windows hooks can be considered one of the most powerful features of Windows.
// With them, you can trap events that will occur, either in your own process or in other processes.
// By "hooking", you tell Windows about a function, filter function also called hook procedure,
// that will be called everytime an event you're interested in occurs.
HookInjection(A2T(argv[2]), A2T(argv[3])); // Inject DLL into remote process
else if (mode == "APC")
APCinjection(A2T(argv[2]), A2T(argv[3]));
else {
printf_s("Incorrect mode\n");
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}