Advertisement
JunoSeferis

HybridMaker

Jul 1st, 2014
453
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 14.25 KB | None | 0 0
  1. #!usr/bin/perl
  2. my $NumArgs = $#ARGV + 1;#Determine the number of arguments the user has given us
  3. if ($NumArgs <= 1) {
  4.     #Our user has only entered some information. Display help screen.
  5.     header();
  6.     exit();}
  7. if ($NumArgs == 2) {   
  8.     my $dictfile = $ARGV[0]; #Host is the first argument supplied
  9.     my $complexlvl = $ARGV[1]; #Username is the 2nd argument supplied
  10.     print "Working...\n";
  11.    
  12.     if ($complexlvl == 1) {
  13.     #Minimal complexity; all we want to do is
  14.     #1 Plain word
  15.     #2 Plain with 2 digits at the end
  16.     #3 Convert to Uppercase with 2 digits at the end
  17.     #4 Front-End Cap with 2 digits at the end
  18.    
  19.     #Open dictionary file for processing
  20.     open DICTLIST, $dictfile or die$!;
  21.     my @listwords = DICTLIST;
  22.     while (my $curword = <DICTLIST>) {
  23.         chomp($curword);
  24.         my $outfile = 'hybrid.txt'; #Set hydrid output file
  25.         open(HYBRID, ">>$outfile"); #Open file for writing
  26.         #Output as PLAIN
  27.         print HYBRID "$curword\n";
  28.         #Output as PLAN with Front-End Cap
  29.         print HYBRID ucfirst($curword) . "\n";
  30.         #Output as PLAIN with all Caps
  31.         print HYBRID uc $curword . "\n";
  32.         #Output as plain w/ 2 digits
  33.         for $i (0 .. 9) {
  34.             print HYBRID "$curword" . $i . "\n";   
  35.             }
  36.         for (0 .. 99) {
  37.             my $i = sprintf qq{%02d}, $_;
  38.             print HYBRID "$curword" . $i . "\n";
  39.             }
  40.         #Output as Front-End Cap w/ 2 digits
  41.         my $toprint = ucfirst lc $curword;
  42.         for $i (0 .. 9) {
  43.             print HYBRID "$toprint" . $i . "\n";   
  44.             }
  45.         for (0 .. 99) {
  46.             my $i = sprintf qq{%02d}, $_;
  47.             print HYBRID "$toprint" . $i . "\n";
  48.             }
  49.         #Output as Uppercase w/ 2 digits
  50.         my $toprint = uc $curword;
  51.         for $i (0 .. 9) {
  52.             print HYBRID "$toprint" . $i . "\n";   
  53.             }
  54.         for (0 .. 99) {
  55.             my $i = sprintf qq{%02d}, $_;
  56.             print HYBRID "$toprint" . $i . "\n";
  57.             }
  58.             #Done for this iteration
  59.         close(HYBRID);
  60.         }
  61.     } #End routine for Lvl 1
  62.  
  63.     ######  ROUTINE 2  #########
  64.     if ($complexlvl == 2) {
  65.     #Marginal complexity; all we want to do is
  66.     #1 Plain word & !
  67.     #2 Plain with 2 digits at the end & !
  68.     #3 Convert to Uppercase with 2 digits at the end & !
  69.     #4 Front-End Cap with 2 digits at the end  & !
  70.    
  71.     #Open dictionary file for processing
  72.     open DICTLIST, $dictfile or die$!;
  73.     my @listwords = DICTLIST;
  74.     while (my $curword = <DICTLIST>) {
  75.         chomp($curword);
  76.         my $outfile = 'hybrid.txt'; #Set hydrid output file
  77.         open(HYBRID, ">>$outfile"); #Open file for writing
  78.         #Output as PLAIN & !
  79.         print HYBRID "$curword!\n";
  80.         #Output as PLAN with Front-End Cap & !
  81.         print HYBRID ucfirst($curword) . "!\n";
  82.         #Output as PLAIN with all Caps & !
  83.         print HYBRID uc $curword . "!\n";
  84.         #Output as plain w/ 2 digits & !
  85.         for $i (0 .. 9) {
  86.             print HYBRID "$curword" . $i . "!\n";  
  87.             }
  88.         for (0 .. 99) {
  89.             my $i = sprintf qq{%02d}, $_;
  90.             print HYBRID "$curword" . $i . "!\n";
  91.             }
  92.         #Output as Front-End Cap w/ 2 digits & !
  93.         my $toprint = ucfirst lc $curword;
  94.         for $i (0 .. 9) {
  95.             print HYBRID "$toprint" . $i . "!\n";  
  96.             }
  97.         for (0 .. 99) {
  98.             my $i = sprintf qq{%02d}, $_;
  99.             print HYBRID "$toprint" . $i . "!\n";
  100.             }  
  101.         #Output as Uppercase w/ 2 digits & !
  102.         my $toprint = uc $curword;
  103.         for $i (0 .. 9) {
  104.             print HYBRID "$toprint" . $i . "!\n";  
  105.             }
  106.         for (0 .. 99) {
  107.             my $i = sprintf qq{%02d}, $_;
  108.             print HYBRID "$toprint" . $i . "!\n";
  109.             }
  110.             #Done for this iteration
  111.         close(HYBRID);
  112.         }
  113.     } #End routine for Lvl 2       
  114.    
  115.     ######  ROUTINE 3  #########
  116.     if ($complexlvl == 3) {
  117.         #Open dictionary file for processing
  118.         open DICTLIST, $dictfile or die$!;
  119.         my @listwords = DICTLIST;
  120.             while (my $curword = <DICTLIST>) {
  121.             chomp($curword);
  122.             my $outfile = 'hybrid.txt'; #Set hydrid output file
  123.             open(HYBRID, ">>$outfile"); #Open file for writing
  124.             #Begin processing of the word and generate variations  
  125.                     my $totalword = '';
  126.                     my $foundchar = 0; #Variable to cancel variations past one
  127.                     for $i (0 .. length($curword)) {
  128.                     my $curchar = substr($curword, $i, 1);
  129.                     #Begin replacing the first letter found ONLY
  130.                         my $addchar = $curchar; #Default to current character, replace ONLY if a match found.
  131.                         if (($curchar eq 'a') or ($curchar eq 'A')) {
  132.                             if ($foundchar < 1) {
  133.                             $addchar = 4;
  134.                             $foundchar = ($foundchar + 1);
  135.                             }                          
  136.                         }
  137.                         elsif (($curchar eq 'b') or ($curchar eq 'B')) {
  138.                             if ($foundchar < 1) {
  139.                             $addchar = 8;
  140.                             $foundchar = ($foundchar + 1);
  141.                             }
  142.                         }
  143.                         elsif (($curchar eq 'e') or ($curchar eq 'E')) {
  144.                             if ($foundchar < 1) {
  145.                             $addchar = 3;
  146.                             $foundchar = ($foundchar + 1);
  147.                             }
  148.                         }
  149.                         elsif (($curchar eq 'g') or ($curchar eq 'G')) {
  150.                             if ($foundchar < 1) {
  151.                             $addchar = 9;
  152.                             $foundchar = ($foundchar + 1);
  153.                             }
  154.                         }
  155.                         elsif (($curchar eq 'i') or ($curchar eq 'I')) {
  156.                             if ($foundchar < 1) {
  157.                             $addchar = 1;
  158.                             $foundchar = ($foundchar + 1);
  159.                             }
  160.                         }
  161.                         elsif (($curchar eq 'l') or ($curchar eq 'L')) {
  162.                             if ($foundchar < 1) {
  163.                             $addchar = 1;
  164.                             $foundchar = ($foundchar + 1);
  165.                             }
  166.                         }
  167.                         elsif (($curchar eq 'o') or ($curchar eq 'O')) {
  168.                             if ($foundchar < 1) {
  169.                             $addchar = 0;
  170.                             $foundchar = ($foundchar + 1);
  171.                             }
  172.                         }
  173.                         elsif (($curchar eq 's') or ($curchar eq 'S')) {
  174.                             if ($foundchar < 1) {
  175.                             $addchar = 5;
  176.                             $foundchar = ($foundchar + 1);
  177.                             }
  178.                         }
  179.                         elsif (($curchar eq 't') or ($curchar eq 'T')) {
  180.                             if ($foundchar < 1) {
  181.                             $addchar = 7;
  182.                             $foundchar = ($foundchar + 1);
  183.                             }
  184.                         }
  185.                         elsif (($curchar eq 'z') or ($curchar eq 'Z')) {
  186.                             if ($foundchar < 1) {
  187.                             $addchar = 2;
  188.                             $foundchar = ($foundchar + 1);
  189.                             }
  190.                         }
  191.             #Add current character to list and repeat
  192.             $totalword = ($totalword . $addchar);
  193.             }
  194.             #Output as PLAIN
  195.             print HYBRID "$totalword\n";
  196.             #Output as PLAIN with Front-End Cap
  197.             print HYBRID ucfirst($totalword) . "\n";
  198.             #Output as PLAIN with all Caps
  199.             print HYBRID uc $totalword . "\n"; 
  200.         #Done for this iteration   
  201.         close(HYBRID);
  202.         }
  203.     } #End routine for Lvl 3
  204.    
  205.     ######  ROUTINE 4  #########
  206.     if ($complexlvl == 4) {
  207.         #Open dictionary file for processing
  208.         open DICTLIST, $dictfile or die$!;
  209.         my @listwords = DICTLIST;
  210.             while (my $curword = <DICTLIST>) {
  211.             chomp($curword);
  212.             my $outfile = 'hybrid.txt'; #Set hydrid output file
  213.             open(HYBRID, ">>$outfile"); #Open file for writing
  214.             #Begin processing of the word and generate variations  
  215.                     my $totalword = '';
  216.                     for $i (0 .. length($curword)) {
  217.                     my $curchar = substr($curword, $i, 1);
  218.                     #Begin replacing the first letter found ONLY
  219.                         my $addchar = $curchar; #Default to current character, replace ONLY if a match found.
  220.                        
  221.                         if (($curchar eq 'a') or ($curchar eq 'A')) {
  222.                             $addchar = 4;
  223.                         }
  224.                         elsif (($curchar eq 'b') or ($curchar eq 'B')) {
  225.                             $addchar = 8;
  226.                         }
  227.                         elsif (($curchar eq 'e') or ($curchar eq 'E')) {
  228.                             $addchar = 3;
  229.                         }
  230.                         elsif (($curchar eq 'g') or ($curchar eq 'G')) {
  231.                             $addchar = 9;
  232.                         }
  233.                         elsif (($curchar eq 'i') or ($curchar eq 'I')) {
  234.                             $addchar = 1;
  235.                         }
  236.                         elsif (($curchar eq 'l') or ($curchar eq 'L')) {
  237.                             $addchar = 1;
  238.                         }
  239.                         elsif (($curchar eq 'o') or ($curchar eq 'O')) {
  240.                             $addchar = 0;
  241.                         }
  242.                         elsif (($curchar eq 's') or ($curchar eq 'S')) {
  243.                             $addchar = 5;
  244.                         }
  245.                         elsif (($curchar eq 't') or ($curchar eq 'T')) {
  246.                             $addchar = 7;
  247.                         }
  248.                         elsif (($curchar eq 'z') or ($curchar eq 'Z')) {
  249.                             $addchar = 2;
  250.                         }
  251.             #Add current character to list and repeat
  252.             $totalword = ($totalword . $addchar);
  253.             }
  254.             #Output as PLAIN
  255.             print HYBRID "$totalword\n";
  256.             #Output as PLAIN with Front-End Cap
  257.             print HYBRID ucfirst($totalword) . "\n";
  258.             #Output as PLAIN with all Caps
  259.             print HYBRID uc $totalword . "\n";
  260.         #Done for this iteration   
  261.         close(HYBRID);
  262.         }
  263.     } #End routine for Lvl 4   
  264.    
  265.     ######  ROUTINE 5  #########
  266.     if ($complexlvl == 5) {
  267.         #Open dictionary file for processing
  268.         open DICTLIST, $dictfile or die$!;
  269.         my @listwords = DICTLIST;
  270.             while (my $curword = <DICTLIST>) {
  271.             chomp($curword);
  272.             my $outfile = 'hybrid.txt'; #Set hydrid output file
  273.             open(HYBRID, ">>$outfile"); #Open file for writing
  274.             #Begin processing of the word and generate variations  
  275.                     my $totalword = '';
  276.                     my $foundchar = 0; #Variable to cancel variations past one
  277.                     for $i (0 .. length($curword)) {
  278.                     my $curchar = substr($curword, $i, 1);
  279.                     #Begin replacing the first letter found ONLY
  280.                         my $addchar = $curchar; #Default to current character, replace ONLY if a match found.
  281.                         if (($curchar eq 'a') or ($curchar eq 'A')) {
  282.                             if ($foundchar < 1) {
  283.                             $addchar = 4;
  284.                             $foundchar = ($foundchar + 1);
  285.                             }                          
  286.                         }
  287.                         elsif (($curchar eq 'b') or ($curchar eq 'B')) {
  288.                             if ($foundchar < 1) {
  289.                             $addchar = 8;
  290.                             $foundchar = ($foundchar + 1);
  291.                             }
  292.                         }
  293.                         elsif (($curchar eq 'e') or ($curchar eq 'E')) {
  294.                             if ($foundchar < 1) {
  295.                             $addchar = 3;
  296.                             $foundchar = ($foundchar + 1);
  297.                             }
  298.                         }
  299.                         elsif (($curchar eq 'g') or ($curchar eq 'G')) {
  300.                             if ($foundchar < 1) {
  301.                             $addchar = 9;
  302.                             $foundchar = ($foundchar + 1);
  303.                             }
  304.                         }
  305.                         elsif (($curchar eq 'i') or ($curchar eq 'I')) {
  306.                             if ($foundchar < 1) {
  307.                             $addchar = 1;
  308.                             $foundchar = ($foundchar + 1);
  309.                             }
  310.                         }
  311.                         elsif (($curchar eq 'l') or ($curchar eq 'L')) {
  312.                             if ($foundchar < 1) {
  313.                             $addchar = 1;
  314.                             $foundchar = ($foundchar + 1);
  315.                             }
  316.                         }
  317.                         elsif (($curchar eq 'o') or ($curchar eq 'O')) {
  318.                             if ($foundchar < 1) {
  319.                             $addchar = 0;
  320.                             $foundchar = ($foundchar + 1);
  321.                             }
  322.                         }
  323.                         elsif (($curchar eq 's') or ($curchar eq 'S')) {
  324.                             if ($foundchar < 1) {
  325.                             $addchar = 5;
  326.                             $foundchar = ($foundchar + 1);
  327.                             }
  328.                         }
  329.                         elsif (($curchar eq 't') or ($curchar eq 'T')) {
  330.                             if ($foundchar < 1) {
  331.                             $addchar = 7;
  332.                             $foundchar = ($foundchar + 1);
  333.                             }
  334.                         }
  335.                         elsif (($curchar eq 'z') or ($curchar eq 'Z')) {
  336.                             if ($foundchar < 1) {
  337.                             $addchar = 2;
  338.                             $foundchar = ($foundchar + 1);
  339.                             }
  340.                         }
  341.             #Add current character to list and repeat
  342.             $totalword = ($totalword . $addchar);
  343.             }
  344.             #Print final word & !
  345.             print HYBRID "$totalword!\n";
  346.             #Output as PLAIN with Front-End Cap
  347.             print HYBRID ucfirst($totalword) . "!\n";
  348.             #Output as PLAIN with all Caps
  349.             print HYBRID uc $totalword . "!\n";
  350.         #Done for this iteration   
  351.         close(HYBRID);
  352.         }
  353.     } #End routine for Lvl 5
  354.    
  355.     ######  ROUTINE 6  #########
  356.     if ($complexlvl == 6) {
  357.         #Open dictionary file for processing
  358.         open DICTLIST, $dictfile or die$!;
  359.         my @listwords = DICTLIST;
  360.             while (my $curword = <DICTLIST>) {
  361.             chomp($curword);
  362.             my $outfile = 'hybrid.txt'; #Set hydrid output file
  363.             open(HYBRID, ">>$outfile"); #Open file for writing
  364.             #Begin processing of the word and generate variations  
  365.                     my $totalword = '';
  366.                     for $i (0 .. length($curword)) {
  367.                     my $curchar = substr($curword, $i, 1);
  368.                     #Begin replacing the first letter found ONLY
  369.                         my $addchar = $curchar; #Default to current character, replace ONLY if a match found.
  370.                        
  371.                         if (($curchar eq 'a') or ($curchar eq 'A')) {
  372.                             $addchar = 4;
  373.                         }
  374.                         elsif (($curchar eq 'b') or ($curchar eq 'B')) {
  375.                             $addchar = 8;
  376.                         }
  377.                         elsif (($curchar eq 'e') or ($curchar eq 'E')) {
  378.                             $addchar = 3;
  379.                         }
  380.                         elsif (($curchar eq 'g') or ($curchar eq 'G')) {
  381.                             $addchar = 9;
  382.                         }
  383.                         elsif (($curchar eq 'i') or ($curchar eq 'I')) {
  384.                             $addchar = 1;
  385.                         }
  386.                         elsif (($curchar eq 'l') or ($curchar eq 'L')) {
  387.                             $addchar = 1;
  388.                         }
  389.                         elsif (($curchar eq 'o') or ($curchar eq 'O')) {
  390.                             $addchar = 0;
  391.                         }
  392.                         elsif (($curchar eq 's') or ($curchar eq 'S')) {
  393.                             $addchar = 5;
  394.                         }
  395.                         elsif (($curchar eq 't') or ($curchar eq 'T')) {
  396.                             $addchar = 7;
  397.                         }
  398.                         elsif (($curchar eq 'z') or ($curchar eq 'Z')) {
  399.                             $addchar = 2;
  400.                         }
  401.             #Add current character to list and repeat
  402.             $totalword = ($totalword . $addchar);
  403.             }
  404.             #Print final word
  405.             print HYBRID "$totalword!\n";
  406.             #Output as PLAIN with Front-End Cap
  407.             print HYBRID ucfirst($totalword) . "!\n";
  408.             #Output as PLAIN with all Caps
  409.             print HYBRID uc $totalword . "!\n";
  410.         #Done for this iteration   
  411.         close(HYBRID);
  412.         }
  413.     } #End routine for Lvl 6   
  414.    
  415.  
  416. #END OF ALL COMPLEXITY LEVEL ROUTINES
  417. close(DICTLIST);
  418. } #End main function
  419. print "List generated!\n";
  420. exit();
  421. sub header{
  422. print qq{
  423. ----------------------------------------------------------------------
  424.                   Hybrid Maker           
  425.                 Custom Built by Juno             
  426.                               NBTDOTM                                
  427. ----------------------------------------------------------------------
  428. Usage: hybrid [dictionary] [complexity level]
  429.  
  430. Example: hybrid passwords.txt 3
  431.  
  432. This program will take a standard dictionary file (no combo lists) and
  433. create hybrid variations based off of each word in the supplied list.
  434. Additionally, the user may select a level of complexity to control the
  435. size of the output.  For example, the password 'test' will
  436. result in the follow variations:
  437. Lvl 1 (332 variations): test, Test, TEST, test0-99, Test0-99, TEST0-99
  438.     Common caps variation(CCV) with 2 digit numeric bruteforce appended.
  439. Lvl 2 (332 variations): test!, Test!, TEST!, test0-99!, Test0-99!, TEST0-99!
  440.     Same as Lvl 1 with an exclamation mark appended.
  441. Lvl 3: Replaces first possible letter found with hybrid equivilent.
  442.     Example: 'Password' becomes 'P4ssword'.  No appended numbers. CCV.
  443. Lvl 4: Replaces every possible letter with hybrid equivilent.
  444.     Example: 'Password' becomes 'P455w0rd'.  No appended numbers. CCV.
  445. Lvl 5: Replaces first possible letter with hybrid equivilent and appends !.
  446.     Example: 'Password' becomes 'P4ssword!'. CCV.
  447. Lvl 6: Replaces all possible letters with hybrid equivilents and appends !.
  448.     Example: 'Password' becomes 'P455w0rd!'. CCV.
  449.        
  450. The generated file is named hybrid.txt and placed in the current
  451. directory.  This program may also be run again with another complexity
  452. level; the results will simply be appended to hybrid.txt.  Cheers!
  453. };
  454. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement