Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
37 lines (32 loc) · 768 Bytes

File metadata and controls

37 lines (32 loc) · 768 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#include <stdio.h>
#include <windows.h>
int main(int argc,char* argv[])
{
//打开要执行的ShellCode文件
HANDLE hFile = CreateFileA("ShellCode.bin", GENERIC_READ, 0, NULL, OPEN_ALWAYS, 0, NULL);
if (hFile==INVALID_HANDLE_VALUE)
{
printf("CreateFile Error");
return -1;
}
DWORD dwSize = 0;
//获取ShellCode的总大小
dwSize = GetFileSize(hFile, NULL);
//申请一块可读可写可执行的内存
LPVOID lpAddress = VirtualAlloc(NULL, dwSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
if (lpAddress == NULL)
{
printf("VirtualAlloc Error");
CloseHandle(hFile);
return -1;
}
//将文件读取到申请的内存中
DWORD dwRead = 0;
ReadFile(hFile, lpAddress, dwSize, &dwRead, 0);
//执行ShellCode
__asm
{
call lpAddress;
}
return 0;
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.