M3GAFAB

PERL MD5 HASH CRACKER .

Dec 6th, 2013
454
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.92 KB | None | 0 0
  1. ##########################################################################################
  2. # PERL FILE .
  3. # MD5 hash cracker .
  4. # Author : IllyrianW
  5. ##########################################################################################
  6.  
  7. --------------------------------------------------------------------------------------------------------------
  8.  
  9. #!/Perl/bin/perl
  10.  
  11. # MD5 Hash Cracker
  12. # by IllyrianW ( KHScr3w )
  13. # Date : 04/12/2013
  14.  
  15.  
  16.  
  17. $dbgtmr = "1"; #Intervall of showing the current speed + lastpassword in seconds.
  18.  
  19.  
  20.  
  21. if ($dbgtmr<=0){ die "Set dbgtmr to a value >=1 !\n";};
  22.  
  23. use Digest::MD5 qw(md5_hex);
  24.  
  25. use Time::HiRes qw(gettimeofday);
  26.  
  27.  
  28.  
  29. if ($ARGV[0]=~"a") {
  30.  
  31. $alpha = "abcdefghijklmnopqrstuvwxyz";}
  32.  
  33. if ($ARGV[0]=~"A") {
  34.  
  35. $alpha = $alpha. "ABCDEFGHIJKLMNOPQRSTUVWXYZ";}
  36.  
  37. if ($ARGV[0]=~"n") {
  38.  
  39. $alpha = $alpha."1234567890";}
  40.  
  41. if ($ARGV[0]=~"s") {
  42.  
  43. $alpha = $alpha. "!\"\$%&/()=?-.:\\*'-_:.;,";}
  44.  
  45.  
  46.  
  47. if ($alpha eq "" or $ARGV[3] eq "") {usage();};
  48.  
  49. if (length($ARGV[3]) != 32) { die "Sorry but it seems that the MD5 is not valid!\n";};
  50.  
  51.  
  52.  
  53. print "Selected charset for attack: '$alpha\'\n";
  54.  
  55. print "Going to Crack '$ARGV[3]'...\n";
  56.  
  57.  
  58.  
  59. for (my $t=$ARGV[1];$t<=$ARGV[2];$t++){
  60.  
  61. crack ($t);
  62.  
  63. }
  64.  
  65.  
  66.  
  67. sub usage{
  68.  
  69. print "\n";
  70. print " #############################################################################\n";
  71. print " # #\n";
  72. print " # MD5 Hash Cracker - Version 1.0.0 #\n";
  73. print " # by IllyrianW #\n";
  74. print " # Usage: ./md5crack.pl <setkarakter> <minkarakter> <maxkarakter> <hashMD5> #\n";
  75. print " # Character options: a - small letters # a,b,c #\n";
  76. print " # A - big letters # A,B,C #\n";
  77. print " # n - numbers # 1,2,3 #\n";
  78. print " # s - symbols # !,#,@ #\n";
  79. print " # Example: ./md5crack.pl an 1 3 1bc29b36f623ba82aaf6724fd3b16718 #\n";
  80. print " # #\n";
  81. print " #############################################################################\n";
  82. sys.exit(1)
  83.  
  84. }
  85.  
  86.  
  87.  
  88. sub crack{
  89.  
  90. $CharSet = shift;
  91.  
  92. @RawString = ();
  93.  
  94. for (my $i =0;$i<$CharSet;$i++){ $RawString[i] = 0;}
  95.  
  96. $Start = gettimeofday();
  97.  
  98. do{
  99.  
  100. for (my $i =0;$i<$CharSet;$i++){
  101.  
  102. if ($RawString[$i] > length($alpha)-1){
  103.  
  104. if ($i==$CharSet-1){
  105.  
  106. print "Bruteforcing done with $CharSet Chars. No Results.\n";
  107.  
  108. $cnt=0;
  109.  
  110. return false;
  111.  
  112. }
  113.  
  114. $RawString[$i+1]++;
  115.  
  116. $RawString[$i]=0;
  117.  
  118. }
  119.  
  120. }
  121.  
  122. ###################################################
  123.  
  124. $ret = "";
  125.  
  126. for (my $i =0;$i<$CharSet;$i++){ $ret = $ret . substr($alpha,$RawString[$i],1);}
  127.  
  128. $hash = md5_hex($ret);
  129.  
  130. $cnt++;
  131.  
  132. $Stop = gettimeofday();
  133.  
  134. if ($Stop-$Start>$dbgtmr){
  135.  
  136. $cnt = int($cnt/$dbgtmr);
  137.  
  138. print "$cnt hashes\\second.\tLast Pass '$ret\'\n";
  139.  
  140. $cnt=0;
  141.  
  142. $Start = gettimeofday();
  143.  
  144. }
  145.  
  146. print "$ARGV[3] != $hash ($ret)\n";
  147.  
  148. if ($ARGV[3] eq $hash){
  149.  
  150. die "\nPassword Cracked! => $ret\n";
  151.  
  152. }
  153.  
  154. ###################################################
  155.  
  156. #checkhash($CharSet)."\n";
  157.  
  158.  
  159.  
  160. $RawString[0]++;
  161.  
  162. }while($RawString[$CharSet-1]<length($alpha));
  163.  
  164. }
  165.  
  166.  
  167.  
  168. sub checkhash{
  169.  
  170. $CharSet = shift;
  171.  
  172. $ret = "";
  173.  
  174. for (my $i =0;$i<$CharSet;$i++){ $ret = $ret . substr($alpha,$RawString[$i],1);}
  175.  
  176. $hash = md5_hex($ret);
  177.  
  178. $cnt++;
  179.  
  180. $Stop = gettimeofday();
  181.  
  182. if ($Stop-$Start>$dbgtmr){
  183.  
  184. $cnt = int($cnt/$dbgtmr);
  185.  
  186. print "$cnt hashes\\second.\tLast Pass '$ret\'\n";
  187.  
  188. $cnt=0;
  189.  
  190. $Start = gettimeofday();
  191.  
  192. }
  193.  
  194.  
  195.  
  196. if ($ARGV[3] eq $hash){
  197.  
  198. die "\nPassword Cracked! => $ret\n";
  199.  
  200. }
  201.  
  202.  
  203.  
  204.  
  205. }
Add Comment
Please, Sign In to add comment