Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 4.93 KB | None | 0 0
  1. // niceforce v1.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5.  
  6.  
  7. #include <stdio.h>
  8. #include <windows.h>
  9. #include <winsock.h>
  10. //#include "StdAfx.h"
  11.  
  12. //#include "config.h"
  13.  
  14. #pragma comment(lib, "ws2_32.lib")
  15.  
  16.  
  17. //////////////////////////////////////////////////////////////////////////////
  18. /////                       LOADING DOTS                                 /////
  19. /////                                                                    /////
  20. //////////////////////////////////////////////////////////////////////////////
  21.  
  22. int loading_dots()
  23. {
  24.     printf("."); Sleep(500); printf("."); Sleep(500);
  25.     printf("."); Sleep(500); printf(".\n\n"); Sleep(1000);
  26.     return 0;
  27. }
  28.  
  29. //////////////////////////////////////////////////////////////////////////////
  30. /////                       BRUTE FORCE                                  /////
  31. /////                                                                    /////
  32. //////////////////////////////////////////////////////////////////////////////
  33.  
  34. int brute_force(char *myline)
  35.     {
  36.         for (int w=0; words[w]; w++)
  37.               {
  38.                 for (int u=0; users[u]; u++)
  39.                            {
  40.                             for (int p=0; password[p]; p++)
  41.                                 {
  42.                                     {
  43.                                        {
  44.  
  45.                                             printf("[+] brute_force: Starting %s", myline);
  46.    
  47.                                             loading_dots();
  48.                                             //break;
  49.                                
  50.                                        }
  51.                                     }
  52.                                     Sleep(1000);
  53.                                 }
  54.                             }
  55.                 Sleep(1000);
  56.             }
  57.    
  58.    
  59.     return 0;
  60.     }
  61.  
  62.  
  63. //////////////////////////////////////////////////////////////////////////////
  64. /////                       WRITE TO FILE                                /////
  65. /////                                                                    /////
  66. //////////////////////////////////////////////////////////////////////////////
  67.  
  68. int write_file(char *myline)
  69.     {
  70.    
  71.     printf("[+] write_file: Starting\n");
  72.     //loading_dots();
  73.  
  74.     FILE *f;
  75.     f = fopen("output.txt","a+");
  76.     fprintf(f, myline);
  77.     printf("[+] Writing to file: %s", myline);
  78.     Sleep(500);
  79.     fclose(f);
  80.  
  81.     return 0;
  82.     }
  83. //////////////////////////////////////////////////////////////////////////////
  84. /////                       READ FROM FILE                               /////
  85. /////                                                                    /////
  86. //////////////////////////////////////////////////////////////////////////////
  87.  
  88. int read_file()
  89.     {
  90.        
  91.         printf("[+] read_file: Starting");
  92.         loading_dots();
  93.    
  94.         static const char filename[] = "read.txt";  
  95.         FILE *myfile = fopen (filename, "r");  
  96.         if (myfile != NULL)  
  97.     {
  98.         char myline[128];        
  99.        
  100.         while (fgets(myline, sizeof myline, myfile) != NULL)    
  101.             {        
  102.                 //printf("%s",myline);
  103.                 //brute_force(myline);
  104.                 write_file(myline);
  105.             }    
  106.             fclose(myfile);  
  107.            
  108.             Sleep(1000);
  109.             printf("\n[+] Finished Reading: %s\n", filename );
  110.     }  
  111.         else  
  112.         {    
  113.             Sleep(1500);
  114.             perror ( filename ); /* why didn't the file open? */
  115.             printf("\n[+] Please check: %s and try again\n", filename);
  116.            
  117.             exit(1);
  118.  
  119.         }  
  120.  
  121.     return 0;
  122.     }
  123.  
  124.  
  125. //////////////////////////////////////////////////////////////////////////////
  126. /////                       PRINT HEADER                                 /////
  127. /////                                                                    /////
  128. //////////////////////////////////////////////////////////////////////////////
  129.  
  130. int print_header()
  131. {
  132.     printf("\t\t#################################################\n");
  133.     printf("\t\t###               iCe-ForCe v1.0              ###\n");
  134.     printf("\t\t#################################################\n\n");
  135.     printf("\t\t   usage: iceforce.exe -w words.txt -o output.txt \n\n");
  136.     return 0;
  137. }
  138.  
  139. //////////////////////////////////////////////////////////////////////////////
  140. /////                       CREATE SOCKET                                /////
  141. /////                                                                    /////
  142. //////////////////////////////////////////////////////////////////////////////
  143.  
  144. int create_socket()
  145.     {
  146.         printf("[+] create_socket: Starting");
  147.         loading_dots();
  148.  
  149.         WSADATA wsda;
  150.         WSAStartup(0x0101,&wsda);
  151.  
  152.         struct sockaddr_in server;
  153.         static int sockfd;
  154.         struct hostent *h;
  155.  
  156.             if((sockfd=socket(AF_INET,SOCK_STREAM,0))==-1)
  157.         {
  158.             printf("Socket Error...");
  159.             exit(1);
  160.         }
  161.  
  162.             if((h=gethostbyname("irc.rizon.net"))==NULL)
  163.             {
  164.                 printf("[+] Host name error!\n");
  165.                 exit(1);
  166.             }
  167.  
  168.             server.sin_addr=*((struct in_addr*)h->h_addr);
  169.             server.sin_port=htons(6667);
  170.             server.sin_family=AF_INET;
  171.  
  172.         if(connect(sockfd,(struct sockaddr*)&server,sizeof(struct
  173.         sockaddr))==-1)
  174.         {
  175.         printf("[+] Connection out\n");
  176.         exit(1);
  177.         }
  178.  
  179.         printf("[+] Connected to host\n");
  180.  
  181.     return 0;
  182.     }
  183.  
  184. int main()
  185.     {
  186.     print_header();
  187.     create_socket();
  188.     read_file();
  189. //  brute_force();
  190.     //write_file();
  191.  
  192.     printf("goodbye!\n");
  193.     Sleep(1000);
  194.     return 0;
  195.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement