-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrack_classic.php
More file actions
81 lines (74 loc) · 2.44 KB
/
crack_classic.php
File metadata and controls
81 lines (74 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE html>
<head><title>Charles Severance MD5 Cracker</title></head>
<body>
<h1>MD5 cracker</h1>
<p>This application takes an MD5 hash
of a two-character lower case string and
attempts to hash all two-character combinations
to determine the original two characters.</p>
<pre>
Debug Output:
<?php
$goodtext = "Not found";
// If there is no parameter, this code is all skipped
if ( isset($_GET['md5']) ) {
$time_pre = microtime(true);
$md5 = $_GET['md5'];
// This is our alphabet
$txt = "0123456789";
$show = 15;
// Outer loop to go through the alphabet for the
// first position in our "possible" pre-hash
// text
for($i=0; $i<strlen($txt); $i++ ) {
$ch1 = $txt[$i]; // The first of two characters
// Our inner loop. Note the use of new variables
// $j and $ch2
for($j=0; $j<strlen($txt); $j++ ) {
$ch2 = $txt[$j]; // Our second character
for ($k=0; $k<strlen($txt); $k++){
$ch3 = $txt[$k]; // Our third character
for ($l=0; $l<strlen($txt); $l++){
$ch4 = $txt[$l]; // Our fourth character
// Concatenate the two characters together to
// form the "possible" pre-hash text
$try = $ch1.$ch2.$ch3.$ch4;
// Run the hash and then check to see if we match
$check = hash('md5', $try);
if ( $check == $md5 ) {
$goodtext = $try;
break; // Exit the inner loop
}
// Debug output until $show hits 0
if ( $show > 0 ) {
print "$check $try\n";
$show = $show - 1;
}
}
}
}
}
// Compute elapsed time
$time_post = microtime(true);
print "Elapsed time: ";
print $time_post-$time_pre;
print "\n";
}
?>
</pre>
<!-- Use the very short syntax and call htmlentities() -->
<p>Original Text: <?= htmlentities($goodtext); ?></p>
<form>
<input type="text" name="md5" size="60" />
<input type="submit" value="Crack MD5"/>
</form>
<ul>
<li><a href="index.php">Reset</a></li>
<li><a href="md5.php">MD5 Encoder</a></li>
<li><a href="makecode.php">MD5 Code Maker</a></li>
<li><a
href="https://github.com/csev/wa4e/tree/master/code/crack"
target="_blank">Source code for this application</a></li>
</ul>
</body>
</html>