home *** CD-ROM | disk | FTP | other *** search
/ Hackers Toolkit 2.0 / Hackers_Toolkit_v2.0.iso / HTML / archive / Porting / unix / broadscan.c next >
Encoding:
C/C++ Source or Header  |  1999-11-04  |  1.7 KB  |  89 lines

  1.  /* Broadscan v 0.31
  2.    DUP Broadcast IP scanner
  3.    by Vacuum http://www.technotronic.com
  4.    09-03-98
  5.    This is a very lame scanner written to
  6.    stop people from asking how to find
  7.    DUP broadcast ip addresses. Use this in
  8.    conjunction with smurf, fraggle,
  9.    or papasmurf. DoS kiddies enjoy!
  10. */
  11.  
  12. #include <stdlib.h>
  13. #include <stdio.h>
  14.  
  15. #define DEBUG 1
  16.  
  17. FILE *stream;
  18.  
  19. void pingz0r(int first, int second, int start, int end)
  20. {
  21. int counter,flag;
  22. FILE *stream;
  23. char tempstring[2048];
  24. char parse[2048];
  25.  
  26. for (counter=start; counter <end; counter++)
  27. {
  28.  flag=0;
  29.  sprintf(tempstring,"ping -c 2 -n  %d.%d.%d.255 2>/dev/null",first,
  30.                      second, counter);
  31.  stream=popen(tempstring,"r");
  32.  while (fgets(parse,sizeof(parse),stream)!=NULL)
  33.  {
  34.   if (DEBUG) printf("Results:%s",parse);
  35.   if (strstr(parse,"DUP"))
  36.   {
  37.     flag=1;
  38.     fclose(stream);
  39.     break;
  40.   }
  41.  }
  42.  if (flag==1)
  43.  stream=fopen("broadcast.txt", "a"); 
  44.  fprintf(stream, "%d.%d.%d.255\n",first,second,counter);
  45.  fclose( stream);
  46. }
  47. }
  48.  
  49. main(int argc, char *argv[])
  50.  
  51. {
  52. int first,second;
  53.  
  54. if (argc!=3)
  55.  {
  56.   printf("\nusage : %s <octet> <octet>\n\n",argv[0]);
  57.   exit(0);
  58.  }
  59.  
  60. first=atoi(argv[1]);
  61. second=atoi(argv[2]);
  62.  
  63. if (first==127)
  64.  {
  65.  printf("%d is a localhost. You have no clue or are trying to break this program",first);
  66.  exit(0);
  67.  }
  68. if (first>254  || first <0)
  69.  {
  70.  printf("First octet is: %d. It must be between <1-254>",first);
  71.  exit(0);
  72.  }
  73. if (second>254 || second<0)
  74.  {
  75.  printf("Second octet is: %d. It must be <1-254>",second);
  76.  exit(0);
  77.  } 
  78.  
  79. printf("Scanning for DUP broadcast ip addresses\n");
  80. printf("Results output to broadcast.txt\n");
  81.  
  82. if (fork()!=0)
  83.     pingz0r(first,second,0,128);
  84. else
  85.     pingz0r(first,second,128,255);
  86.  
  87. }
  88.  
  89.