EG Information

Main Index
EG Manual
Disclaimer
Legal Information
Hall of Fame
Hall of Shame
Member Rankings
Members List
Meet the Staff

Training Missions

Read Me First New
Basic Skills
Realistic Scenarios
Cryptography
Software Cracking
Linux ELF Binary Cracking
Logical Thinking
Programming
Patching
Steganography
Deface This Wall
/dev/null
/dev/urandom

Knowledge Bank

Discussion Forums
Enigma Chat New
RSS Feeds RSS
Articles / Tutorials
Videos
Online EG MP3 Player Radio
Enigma Zine
Downloads
Tools New

Code Resources

Submit Code
Ajax
ASM
Bash
C
CPP
Csharp
Delphi
Haskell
Java
Javascript
Jython
Lisp
mIRC
MySQL
Perl
PHP
Python
QBASIC
VisualBasic

Hakipedia: An open collaborative for all your information security needs.

The Urinal

Click Here To Vote For EG!

Has Enigma Group Helped You? Then Help Us By Advertising For Us. Place One Of The Following Images On Your Site.

enigma group

enigma group

enigma group

enigma group

Enigma Group's Code Bank


sha1crack.pl

By: toast  -  Date Submitted: 2009-05-17 04:54:27

  1. #!/usr/bin/perl
  2. #=======================================================================#
  3. # This is a modified version of md5crack.pl availble from #
  4. # ttp://www.securiteam.com/tools/5OP0F0UKKG.html deigned to crack #
  5. # SHA1 hashes #
  6. # SHA1 Hash Bruteforce #
  7. # By: toast #
  8. # This is like I mentioned a modified version of MD5 Hash #
  9. # Bruteforce Kit availible from #
  10. # http://www.securiteam.com/tools/5OP0F0UKKG.html #
  11. # I did type it up myself but I used MD5 Hash Bruteforce Kit as a #
  12. # model and template. #
  13. # Written under Slackware linux tested and working #
  14. # ======================================================================#
  15. $tmr = '1';
  16.  
  17. if ($tmr<=0){ die "Set tmr to a value >=1 !n";};
  18. use Digest::SHA1 qw(sha1_hex);
  19. use Time::HiRes qw(gettimeofday);
  20.  
  21. if ($ARGV[0]=~"A") {
  22. $alph = "QWERTYUIOPASDFGHJKLZXCVBNM";}
  23. if ($ARGV[0]=~"a") {
  24. $alph = $alph. "qwertyuiopasdfghjklzxcvbnm";}
  25. if ($ARGV[0]=~"s") {
  26. $alph = $alph. "1234567890";}
  27. if ($ARGV[0]=~"d") {
  28. $alph = $alph. "`~!@#$%^&*()-_=+[]\{}|;:,.<>/? ";}
  29.  
  30. if ($alph eq "" or $ARGV[3] eq "") {usage();};
  31. if (length($ARGV[3]) != 40) { die "That is not a valid SHA1 hashn";};
  32.  
  33. print "Select charset for attack: '$alph'n";
  34. print "Going to crack '$ARGV[3]'n";
  35.  
  36. for (my $t=$ARGV[1];$t<=$ARGV[2];$t++){crack($t);}
  37.  
  38. sub usage{
  39. print "nSHA1 Hash Bruteforce Kitn";
  40. print "Usagen";
  41. print "perl sha1crack.pl <charset> <mincount> <maxcount> <SHA1 to crack>n";
  42. print " Charset can be: [Aasd]n";
  43. print " A = {'A','b','c',...}n";
  44. print " a = {'a','b','c',..}n";
  45. print " s = {'0','1','2','3',...}n";
  46. print " d = {'`','~','!','@','#',...}n";
  47. print "Example for cracking SHA1 hashn";
  48. print "perl sha1crack.pl Aa 1 5 4e7afebcfbae000b22c7c85e5560f89a2a0280b4n";
  49. print " This will try to crack the hash useing only with capitol alphas and lowercase alphasn";
  50. print " and only those between one and five characters long.n";
  51. print " perl sha1crack.pl Aasd 1 7 f18200a905e60dcc22c37cb39b29844ee5320550n";
  52. print " This will try to crack the hash useing all the charactersn";
  53. print " but will only try cracking passwords between one and seven characters longn";
  54. die "exitingn";
  55. }
  56. sub crack{
  57. $charset = shift;
  58. @rawstring = ();
  59. for (my $i =0;$i<$charset;$i++){ $rawstring[i] = 0;}
  60. $start = gettimeofday();
  61. do{
  62. for (my $i =0;$i<$charset;$i++){
  63. if ($rawstring[$i] > length($alph)-1){
  64. if ($i==$charset-1){
  65. print "Bruteforcing done with $charset chars. No results.n";
  66. $cnt=0;
  67. return 0;
  68. }
  69. $rawstring[$i+1]++;
  70. $rawstring[$i]=0;
  71. }
  72. }
  73. #========================================================================#
  74. $ret = "";
  75. for (my $i =0;$i<$charset;$i++){ $ret = $ret . substr($alph,$rawstring[$i],1);}
  76. $hash = sha1_hex($ret);
  77. $cnt++;
  78. $stop = gettimeofday();
  79. if ($stop-$start>$tmr){
  80. $cnt = int($cnt/$tmr);
  81. print "$cnt hashes\second.tLast pass '$ret'n";
  82. $cnt=0;
  83. $start = gettimeofday();
  84. }
  85. print "$ARGV[3] != $hash ($ret)n";
  86. if ($ARGV[3] eq $hash){
  87. die "n Password is -> $retn";
  88. }
  89. #========================================================================#
  90. $rawstring[0]++;
  91. }
  92. while($rawstring[$charset-1]<length($alph));
  93. }
  94.  
  95. sub checkhash{
  96. $charset = shift;
  97. $ret = "";
  98. for (my $i =0;$i<$charset;$i++){ $ret = $ret . substr($alph,$rawstring[$i],1);}
  99. $hash = sha1_hex($ret);
  100. $cnt++;
  101. $stop = gettimeofday();
  102. if ($stop-$start>$tmr){
  103. $cnt = int($cnt/$tmr);
  104. print "$cnt hashes\second.tLast pass '$ret'n";
  105. $cnt=0;
  106. $start = gettimeofday();
  107. }
  108. if ($ARGV[3] eq $hash){
  109. die "nPassward is -> $retn";
  110. }
  111. }
Return to perl category list

Who's Online

479 Guests, 101 Users
asapong, CollapsingWalls, Diznablo, mehtaparag, bitstrike, jnony, C, Nicid1, Nusquam-Redono-Sapientia, bazcrown, saifulfaizan, The End, Ultraminor, psychomarine, st3alth, themastersinner, pgmrlink, login, lionaneesh, ishkur88, mahraja, Mac, chekifr, gandalf88, Vap0r, t0ast, tantrum6226, BnE, Distorted, Psiber_Syn, Ausome1, invas10n, oldgoat, freedaysbecumei, BinaryShinigami, Rex_Mundi, Red_beard, Strobeflux, s0m3nak3dguy, Descent, teehee, machupicchu, Genetix, Anandarl, NotMyOwn, thegamerdude, Godzila, popo12341234, RedEvolution, rabbidmind, velocity_b, myne17, teto111, aVoid, Central-Gsm, 1101, JackalReborn, Nasrudin, InjectioN, h4lted, c0re, DisPater, markt4death, splatta, Jackowacko, saint556, Pyron2312, Azerion, howsens, white.hat.gone.bad, vazzilly, pwunkz, Ios, Inverted, QuarterCask, Infernoe11, deskata, cr4ck3rj4ck, Blizer, jasonmax, j0sh, gwenwavor, N4g4c3N, spizeyboy, Network X, Uino59, Jae Cee, ianFDK, saykov, medhaavee, zofy, demonkiller410, Stumble, SaMTHG, kishore, Raze, helasraizam, Venom1019, Jakabo, sharpie392, Y34RZ3R0