Advertisement
Cyb3r_h4ck3r

Superfast WordList Generator Script

Jun 25th, 2015
2,948
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 4.77 KB | None | 0 0
  1. #!/usr/bin/perl
  2. local( $word_pattern, $output_file );
  3. local( %pat_codes );
  4. local( $CHAR_SETS ) = 0;
  5. $| = 1;
  6. print ("\n\t**************************************************");
  7. print ("\n\t*                Wordlist Generator              *");
  8. print ("\n\t*            written By : Cyb3r_h4ck3r           *");
  9. print ("\n\t*    Shouts out to : Team IHC & Indian hackers   *");
  10. print ("\n\t*         Website :- www.team-ihc.in             *");
  11. print ("\n\t**************************************************");
  12.  
  13. if ( $ARGV[ 0 ] eq "--?" ) { $CHAR_SETS = 1; }
  14.  
  15. ###
  16. push( @{ $pat_codes{ 'X' }}, 65,    90    );
  17. push( @{ $pat_codes{ 'x' }}, 97,    122   );
  18. push( @{ $pat_codes{ '!' }}, 0,     47    );
  19. push( @{ $pat_codes{ '@' }}, 58,    64    );
  20. push( @{ $pat_codes{ '$' }}, 91,    96    );
  21. push( @{ $pat_codes{ '^' }}, 123,   256   );
  22. push( @{ $pat_codes{ '#' }}, 48,    57    );
  23. print "\nPattern codes : \n";
  24.  
  25. if ( $CHAR_SETS ) {
  26. print "Many characters avaiable cannot be rendered with ascii,\n";
  27. print " so you may not see values within your [ ]'s for all of\n";
  28. print " the characterset. ex. 184 [ ]\n";
  29. }
  30.  
  31. print "X    : Upper case characters\n";
  32. if ( $CHAR_SETS ) { disp_range( @{ $pat_codes{ 'X' } } ); }
  33. print "x    : Lower case characters\n";
  34. if ( $CHAR_SETS ) { disp_range( @{ $pat_codes{ 'x' } } ); }
  35. print "!    : Special chars 1\n";
  36. if ( $CHAR_SETS ) { disp_range( @{ $pat_codes{ '!' } } ); }
  37. print "\@    : Special chars 2\n";
  38. if ( $CHAR_SETS ) { disp_range( @{ $pat_codes{ '@' } } ); }
  39. print "\$    : Special chars 3\n";
  40. if ( $CHAR_SETS ) { disp_range( @{ $pat_codes{ '$' } } ); }
  41. print "^    : Special chars 4\n";
  42. if ( $CHAR_SETS ) { disp_range( @{ $pat_codes{ '^' } } ); }
  43. print "#    : Numeric chars\n";
  44. if ( $CHAR_SETS ) { disp_range( @{ $pat_codes{ '#' } } ); }
  45.  
  46. print "Rerun this program with --? if you would like output\n";
  47. print "     of the character sets.\n";
  48. print "     WARNING : It may mess up your terminal session\n";
  49.  
  50. local( $good_params ) = 'no';
  51. while( $good_params eq 'no' ) {
  52. $word_pattern        = get_line( 'Enter the word pattern you would like'
  53. );
  54. $output_file         = get_line( 'Enter the name of the output file' );
  55. print "The values I have are : \n";
  56. print "    Word Pattern          : $word_pattern\n";
  57. print "    Output File           : $output_file\n";
  58. local $temp = 'y';
  59. $temp = get_line( 'Are these correct [y]', 1 );
  60. if ( $temp =~ /y/i || $temp eq '' ) { $good_params = 'yes'; }
  61. }
  62.  
  63. print "Building code : ";
  64. # Meat and potatoe time ....
  65. local $eval_code = '';
  66. local $eval_code = <<"EVAL_HEAD";
  67. open( OUT_FILE, "> $output_file" ) || die "Could not open output file :
  68. \$!\\n\\n";
  69. local \$smash_me = '';
  70. EVAL_HEAD
  71.  
  72. local $open_loops = 0;
  73. for( $i = 0; $i < length( $word_pattern ); $i++ ) {
  74.    local $cur_letter = '';
  75.    local $bat_letter = '';
  76.    $cur_letter = substr( $word_pattern, $i, 1 );
  77.    foreach $pat_letter ( keys %pat_codes ) {
  78.       if ( $pat_letter eq $cur_letter ) {
  79.          $bat_letter = $pat_letter;
  80.       }
  81.    }
  82.    if ( $bat_letter eq '' ) {
  83.       $eval_code .= '$smash_me_' . $i . ' = "' . $cur_letter . '";' .
  84. "\n";
  85.    } else {
  86.       $open_loops++;
  87.       @temp = @{ $pat_codes{ $cur_letter } };
  88.       $low_value = $temp[ 0 ];
  89.       $high_value = $temp[ 1 ];
  90.  
  91.       $eval_code .= <<"EVAL_LOOP";
  92. for( \$xx_$open_loops = $low_value; \$xx_$open_loops <= $high_value;
  93.  \$xx_$open_loops++ ) {
  94.       \$smash_me_$i = pack( 'c', \$xx_$open_loops );
  95.  
  96. EVAL_LOOP
  97.    }
  98. }
  99.  
  100. $eval_code .= 'print OUT_FILE ';
  101. for( $i = 0; $i < length( $word_pattern ); $i++ ) {
  102.    $eval_code .= '$smash_me_' . $i . ' . ' . "\n";
  103. }
  104. $eval_code .= '"\n";';
  105. for( $i = 0; $i < $open_loops; $i ++ ) {
  106.    $eval_code .= '}' . "\n";
  107. }
  108.  
  109. $eval_code .= 'close( OUT_FILE );';
  110. print "Done!\n";
  111.  
  112. #print $eval_code;
  113. print "Running word create, this may take some time : ";
  114. eval( $eval_code );
  115. print "Done!\n";
  116.  
  117. # Gets a line of input from the user
  118. sub get_line {
  119.    local $prompt, $can_be_empty, $temp;
  120.    local $input_ok = 'no';
  121.  
  122.    $prompt           = shift;
  123.    $can_be_empty     = shift;
  124.  
  125.    while( $input_ok eq 'no' ) {
  126.    print $prompt . ' : ';
  127.    $temp = <STDIN>; $temp =~ s/\n//g; $temp =~ s/\r//g;
  128.    if ( $temp  eq "" && $can_be_empty != 1) {
  129.       print "I'm sorry but i require input for this value,";
  130.       print " please try again.\n";
  131.    } else {
  132.    $input_ok = 'yes';
  133.    }
  134.  
  135.    }
  136.    return $temp;
  137. }
  138. # Display a range of character values
  139. sub disp_range {
  140.    local ( $start_val, $end_val ) = @_;
  141.  
  142.    print "Characters in set ( $start_val -> $end_val ) : \n";
  143.    $line_break = 0;
  144.    for( $i = $start_val; $i <= $end_val; $i++ ) {
  145.       $line_break++;
  146.       print $i . ' [ ' . pack( 'c', $i ) . ' ] ';
  147.       if ( $line_break == 5 ) {
  148.          $line_break = 0;
  149.          print "\n";
  150.       }
  151.    }
  152.    print "\n\n";
  153. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement