Advertisement
opsftw

vComboGen

Mar 10th, 2015
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.64 KB | None | 0 0
  1. #!/usr/bin/php
  2. <?php
  3. set_time_limit(0);
  4. /* Author: Tux
  5.  * Description: A combolist generator written in PHP
  6.  */
  7. $ops = getopt("eh");
  8.  
  9. if(isset($ops['h'])) {
  10.     die(cout("Usage: vComboGen [-e]\n-e extended creation (much larger lists)\n"));
  11. }
  12.  
  13. cout('# Welcome to vComboGen v1.0', 'blue');
  14. $fUsernames = cin('> Username List [file]: ');
  15. $fPasswords = cin('> Password List [file]: ');
  16. $fOutput    = cin('> Cobmbo Output [file]: ');
  17.  
  18. if(!file_exists($fUsernames) || !file_exists($fPasswords))
  19.     die(cout('There was an error...', 'red'));
  20.  
  21. cout('* Generating Combolist', 'blue');
  22.  
  23. $details = array(
  24.     'usernames' => explode("\n", file_get_contents($fUsernames)),
  25.     'passwords' => explode("\n", file_get_contents($fPasswords))
  26. );
  27.  
  28. $return = array();
  29. $count = count($details['passwords']) - 1;
  30.  
  31. foreach($details['usernames'] as $user) {
  32.     if(isset($ops['e'])) {
  33.         foreach($details['passwords'] as $pass) {
  34.             $return[] = "{$user}:{$pass}";
  35.         }
  36.     } else {
  37.         $rand = rand(0, $count);
  38.         while($details['passwords'][$rand] === '') {
  39.             $rand = rand(0, $count);
  40.         }
  41.         $return[] = "{$user}:{$details['passwords'][$rand]}";
  42.     ]
  43. }
  44. $list = implode("\n", $return);
  45.  
  46. file_put_contents($fOutput, $list);
  47.  
  48. cout("* Combolist generated and stored in '{$fOutput}'!", 'green');
  49.  
  50. # functions
  51. function cin($prompt='') {
  52.     echo $prompt;
  53.     $handle = fopen("php://stdin","r");
  54.     return str_replace("\n", '', fgets($handle));
  55. }
  56. function cout($text, $color = 'white') {
  57.     $colors = array(
  58.         'white'  => '[0m',
  59.         'red'    => '[31m',
  60.         'green'  => '[32m',
  61.         'blue'   => '[34m',
  62.         'yellow' => '[33m'
  63.     );
  64.     echo "\033{$colors[$color]} {$text} \033[0m\n";
  65. }
  66. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement