超变态代码,通过SOCKET向服务器发送数据
晚上写的一个小程序,今天是星期天。。咦,,是凌晨1:15分了。。汗一个
写这个程序的初衷是为了被蠕虫感染的机器之间通信之用的。。
通过SOCKET发送数据,感染机器SNIFFER本机数据包。。当SNIFFER特定的指令则。。嘿嘿,,想干嘛干嘛..
根本就无需开启任何端口。。咱们只需利用本机开放的端口便可以实现SERVER->CLIEN之间的通信问题 。。
防火墙去死吧..~!
代码写的有点变态..纯粹好玩 。。大家将就着看吧..
#include<stdio.h>
#include<winsock2.h>
#pragma comment(lib,"msvcrt.lib")
#pragma comment(linker, "/MERGE:.rdata=.data")
#pragma comment(linker, "/MERGE:.text=.data")
typedef struct _API_ADDRESS
{
DWORD dwWSAStartup ;
DWORD dwSocket ;
DWORD dwConnect;
DWORD dwSend ;
DWORD dwRecv ;
DWORD dwHtons ;
DWORD dwInet_addr;
DWORD dwWSAGetLastError ;
DWORD dwClosesocket ;
}API_ADDRESS,*PAPI_ADDRESS ;
typedef UINT_PTR (__stdcall *W_SOCKET ) (int , int , int);
typedef int (__stdcall *W_WSAStartup) (WORD , LPWSADATA);
typedef int (__stdcall *W_Connect) (SOCKET ,const sockaddr * , int) ;
typedef u_short (__stdcall *W_Htons) (u_short);
typedef unsigned int (__stdcall *W_Inet_addr) (const char *);
typedef int (__stdcall *W_Send) (SOCKET , const char * ,int , int) ;
typedef int (__stdcall *W_Recv) (SOCKET , const char * ,int , int) ;
typedef int (__stdcall *W_WSAGetLastError) ();
typedef int (__stdcall *W_Closesocket) (SOCKET);
typedef void (*VPY_EMPTY)();
void help();
void main(int argc , char ** argv)
{
puts("SendData V 1.07.03.19 ");
puts("By M80 E-Mail:VxV_-_Net2K@126.CoM \n");
if (argc < 1 || argc > 4)
(*(VPY_EMPTY)help)();
HINSTANCE hwsock32 ;
WSADATA wsa;
int ret;
PAPI_ADDRESS paa = (PAPI_ADDRESS)malloc(sizeof(PAPI_ADDRESS));
//加载 wsock32.dll
hwsock32=LoadLibrary("wsock32.dll");
paa->dwWSAStartup = (DWORD)GetProcAddress(hwsock32, "WSAStartup");
paa->dwSocket = (DWORD)GetProcAddress(hwsock32, "socket");
paa->dwConnect = (DWORD)GetProcAddress(hwsock32,"connect");
paa->dwHtons = (DWORD)GetProcAddress(hwsock32,"htons");
paa->dwInet_addr = (DWORD)GetProcAddress(hwsock32,"inet_addr");
paa->dwSend = (DWORD)GetProcAddress(hwsock32,"send");
paa->dwRecv = (DWORD)GetProcAddress(hwsock32,"recv");
paa->dwWSAGetLastError = (DWORD)GetProcAddress(hwsock32,"WSAGetLastError");
paa->dwClosesocket = (DWORD)GetProcAddress(hwsock32,"closesocket");
W_WSAStartup ww = (W_WSAStartup)paa->dwWSAStartup ;
W_SOCKET ws = (W_SOCKET)paa->dwSocket;
W_Connect wc = (W_Connect)paa->dwConnect ;
W_Htons wh = (W_Htons)paa->dwHtons ;
W_Inet_addr wia = (W_Inet_addr)paa->dwInet_addr ;
W_Send wsd = (W_Send)paa->dwSend ;
W_Recv wr = (W_Recv)paa->dwRecv ;
W_WSAGetLastError wwr = (W_WSAGetLastError)paa->dwWSAGetLastError ;
W_Closesocket wct = (W_Closesocket)paa->dwClosesocket ;
//初始化SOCKET
if ((ret=ww(WINSOCK_VERSION,&wsa)) != 0) {
printf("Error Code %d\n",wwr());
exit(1);
}
UINT_PTR s = ws(AF_INET,SOCK_STREAM,IPPROTO_TCP);
if (s == INVALID_SOCKET) {
printf("Error Code %d\n",wwr());
exit(1);
}
//填写远程地址信息
sockaddr_in servAddr;
servAddr.sin_family = AF_INET ;
servAddr.sin_port=wh((u_short)atoi(argv[2]));
servAddr.sin_addr.S_un.S_addr=wia(argv[1]);
if (wc(s,(sockaddr*)&servAddr,sizeof(servAddr)) == -1) {
printf("Error Code %d\n",wwr());
exit(1);
}
//发送数据
if (wsd(s,argv[3],strlen(argv[3]),0) == SOCKET_ERROR ) {
printf("Error Code %d\n",wwr());
exit(1);
}
//接受数据
char buffer[_MAX_PATH];
int nRecv=wr(s,buffer,_MAX_PATH,0);
if (nRecv > 0) {
buffer[nRecv]='\0';
printf("%s\n",buffer);
}
wct(s);
exit(0);
}
void help() {
puts("SD.exe Server Port Data\n");
exit(1);
}
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!