但是时间久了,发n多图片非常的累,论坛的是smartIPB.没有加插件,发6,70张图就累死...
本来的想法是把灌水机改一下,变成自动发图机,
无非是提交图片路径还有提交发送请求.但是对<winsock.h>这个库不太了解.所以想请教.
这是我从网上找的灌水机源码:
#i nclude <stdio.h>
#i nclude <string.h>
#i nclude <winsock.h>
main(int argc,char *argv[]){
char buff[4096];
SOCKET sock;
SOCKADDR_IN addr;
WSADATA wsa;
WORD wVersionRequested;
struct hostent *hs;
int count, len;
char *url=www.sample.com";
if (argc!=4) {printf("Error!\n"); return -1; }
len=(strlen(argv[1])+strlen(argv[2])+strlen(argv[3])+49);
wVersionRequested = MAKEWORD( 2, 0 );
if (WSAStartup(wVersionRequested , &wsa)!=0){
printf("Winsock Initialization failed.\n"); return -1;
}
if ((sock=socket(AF_INET,SOCK_STREAM,0))==INVALID_SOCKET){
printf("Can not create socket.\n"); return -1;
}
addr.sin_family = AF_INET;
addr.sin_port = htons(80);
_snprintf(buff, 4096, "POST /cgi-bin/forum.cgi HTTP/1.1\r\n"
"Host: %s\r\n"
"Content-Type: application/x-www-form-urlencoded\r\n"
"Content-Length: %d\r\n"
"\r\n"
"action=add&Title=%s&URL=http://%s&yuzi=1&Description=%s\r\n",
url,
len,
argv[1],
argv[2],
argv[3]);
if ((addr.sin_addr.s_addr=inet_addr(url))==-1){
if ((hs=gethostbyname(url))==NULL){
printf("Can not resolve specified host.\n"); return -1;
}
addr.sin_family = hs->h_addrtype;
memcpy((void *)&addr.sin_addr.s_addr,hs->h_addr,hs->h_length);
}
if (connect(sock,(LPSOCKADDR)&addr,sizeof(addr))==SOCKET_ERROR){
printf("Can not connect to specified host.\n"); return -1;
}
send(sock,buff,strlen(buff),0);
recv(sock,buff,sizeof(buff),0);
closesocket(sock);
}
return 0;
}
由于没有解释根本看不懂.如果那位仁兄有时间可不可以顺便把这个源码解释一下.
ps:我们的论坛没有任何防灌水机制,人少...所以不用绕过验证什么的.
谢谢~