Posted August 24, 200420 yr This is a multithreaded IRC proxy checker It's also available here // IRC Proxy checker // by blocky // [email protected] // May 2003 #pragma comment(lib,"ws2_32.lib") #include <windows.h> #include <stdio.h> #include <fstream.h> #include <winsock.h> char outfile[256]; char infile[256]; BOOL working=TRUE; HANDLE file; char ofile[128]; char server[96]; int svport=0; int openthreads=0; int currproxy = -1; int maxproxies; int done=0; int dgood=0; DWORD starttime=0; typedef struct proxycombo { char host[64]; int port; } proxycombo; proxycombo *proxy; BOOL DoConnect(proxycombo currprox); proxycombo GetNextProxy(); DWORD WINAPI CheckProxy(LPVOID param); int main(int argc, char* argv[]) { starttime=GetTickCount(); if (argc < 5) { printf("usage: %s <inlist> <outlist> <threads> <server> <port>\n",argv[0]); system("pause"); return 0; } strcpy(ofile,argv[2]); strcpy(server,argv[4]); svport = atoi(argv[5]); char *port; int lines=1; char ch; int i=0; HANDLE hnd = CreateFile(argv[1],0,NULL,NULL,OPEN_EXISTING,NULL,NULL); if (hnd == INVALID_HANDLE_VALUE) { printf("File %s does not exist...\n",argv[1]); system("pause"); return 0; } CloseHandle(hnd); if (!(atoi(argv[3]) > 1 )) { printf("you must specify more threads than %s . . .\n",argv[3]); system("pause"); return 0; } ifstream cnt(argv[1]); while(cnt.get(ch)){if (ch == 10) { lines++;}} maxproxies = lines-1; char iline[128]; cnt.close(); proxy = new proxycombo[lines]; int j=0; ifstream ifile(argv[1]); ifile.getline(iline,128); while(j<maxproxies) { strcpy(proxy[j].host,strtok(iline,":")); port = strtok(NULL,":"); if (port) { proxy[j].port = atoi(port); } else { break; } ifile.getline(iline,128); j++; } ifile.close(); for (i=0;i < atoi(argv[3]);i++) { CreateThread(0,0,&CheckProxy,0,0,0); openthreads++; } while(openthreads>0) { system("cls"); printf("IRC Proxy checker by blocky\nProxies checked: %i/%i\n%i are IRC Compatible\n%i Threads running\nElapsed time: %d seconds\n",done,maxproxies,dgood,openthreads,(GetTickCount()-starttime)/1000); Sleep(200); } system("pause"); delete proxy; return 0; } proxycombo GetNextProxy() { currproxy++; return proxy[currproxy]; } DWORD WINAPI CheckProxy(LPVOID param) { BOOL goin; while (currproxy<maxproxies) { proxycombo prx; prx = GetNextProxy(); goin = DoConnect(prx); if (goin == FALSE) { openthreads--; break; } } openthreads--; return 0; } BOOL DoConnect(proxycombo currprox) { done++; if (currproxy == maxproxies ) { return FALSE; } char host[96]; char odat[96]; int port; strcpy(host,currprox.host); port = currprox.port; WORD vers = MAKEWORD(1,1); WSADATA wsadata; SOCKADDR_IN addr; LPHOSTENT hostent; char data[256]; WSAStartup(vers,&wsadata); SOCKET sock; hostent = gethostbyname(host); if (WSAGetLastError() != 0) { return TRUE; } sock = socket (AF_INET,SOCK_STREAM,IPPROTO_TCP); addr.sin_addr = *((LPIN_ADDR)*hostent->h_addr_list); addr.sin_port = htons(port); addr.sin_family = AF_INET; connect(sock,(LPSOCKADDR)&addr,sizeof(addr)); sprintf(data,"CONNECT %s:%i HTTP/1.0\n\n",server,svport); send(sock,data,strlen(data),0); recv(sock,data,sizeof(data),0); if (strstr(data,"200")) { ofstream output(ofile,ios::app); sprintf(odat,"%s:%i\n",currprox.host,currprox.port); output << odat; output.close(); dgood++; } closesocket(sock); WSACleanup(); return TRUE; } copyright infinity by me etc
January 14, 200520 yr nice work but some asshole is going copy it and say he wrote it, thats just the way of life
March 15, 200520 yr Hey why don't you throw in some comments so you everybody including me know what your talking about... Instead of copy/pasting code down...
March 15, 200520 yr How the hell is this a hot topic I think the code is pretty substandard and has many syntax errors... it's flawed and needs revised what program you base this one??? add comments so I know what the hell your tring to do for each snippet of code simply copy/pasting makes you look like a jackass who stole the code somewhere else... I think in most likely hood you got this code somewhere else....
March 15, 200520 yr Instead of complaining about his code, you could always write your own. And in case you didn't notice, this topic is "stickied" in the programming forum. Check the dates of the other posts...
July 23, 200519 yr nice work but some asshole is going copy it and say he wrote it, thats just the way of life Dont worry, I wont do that. Nice script! I find that utterly hillarious for some reason
April 4, 200619 yr nice work but some asshole is going copy it and say he wrote it, thats just the way of life rofl.. asshole comes out of no where..