-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.cpp
More file actions
61 lines (49 loc) · 1.64 KB
/
main.cpp
File metadata and controls
61 lines (49 loc) · 1.64 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
#include "stdafx.h"
#include "ShellcodeInjector.h"
#include "process.h"
#include <iostream>
using namespace std;
BYTE MessageBoxHelloWorld_32b[] = {
0x31, 0xF6, 0x56, 0x64, 0x8B, 0x76, 0x30, 0x8B, 0x76, 0x0C, 0x8B, 0x76, 0x1C, 0x8B,
0x6E, 0x08, 0x8B, 0x36, 0x8B, 0x5D, 0x3C, 0x8B, 0x5C, 0x1D, 0x78, 0x01, 0xEB, 0x8B,
0x4B, 0x18, 0x67, 0xE3, 0xEC, 0x8B, 0x7B, 0x20, 0x1, 0xEF, 0x8B, 0x7C, 0x8F, 0xFC,
0x01, 0xEF, 0x31, 0xC0, 0x99, 0x32, 0x17, 0x66, 0xC1, 0xCA, 0x1, 0xAE, 0x75, 0xF7,
0x66, 0x81, 0xFA, 0x2A, 0xB6, 0x74, 0x9, 0x66, 0x81, 0xFA, 0xAA, 0x1A, 0xE0, 0xDB,
0x75, 0xC5, 0x8B, 0x53, 0x24, 0x1, 0xEA, 0xF, 0xB7, 0x14, 0x4A, 0x8B, 0x7B, 0x1C,
0x1, 0xEF, 0x3, 0x2C, 0x97, 0x85, 0xF6, 0x74, 0x16, 0x68, 0x33, 0x32, 0x20, 0x20,
0x68, 0x75, 0x73, 0x65, 0x72, 0x54, 0xFF, 0xD5, 0x95, 0x31, 0xF6, 0x56, 0xE9, 0x9F,
0xFF, 0xFF, 0xFF, 0x68, 0x72, 0x6C, 0x64, 0x21, 0x68, 0x6F, 0x20, 0x77, 0x6F, 0x68,
0x48, 0x65, 0x6C, 0x6C, 0x54, 0x87, 0x4, 0x24, 0x50, 0x50, 0x56, 0xFF, 0xD5, 0xCC
};
int main(int argc, char* argv[])
{
ShellcodeInjector inj;
Process proc;
int pid;
inj = ShellcodeInjector();
proc = Process();
proc.init();
/*
* No need for calc.exe
*
if (proc.SetDebugPrivileges()) {
cerr << "Unable to get privileges" << endl;
system("pause");
exit(EXIT_FAILURE);
}*/
if (inj.setShellcode(MessageBoxHelloWorld_32b, 140) == NULL) {
cerr << "Error copying the shellcode" << endl;
system("pause");
exit(EXIT_FAILURE);
}
try {
do {
pid = proc.getPidByName(L"calc.exe");
inj.Inject(pid);
} while(pid != proc.PROCESS_NO_EXISTS);
}
catch(const std::exception & except) {
cerr << except.what() << endl;
}
return 0;
}