RE: PHP MD5-SHA1 Cracker 04-05-2013, 01:30 PM
#11
I've secured the script a bit:
Added:
Unfortunately, it looks like I broke the design a bit. I'm sorry for that!
The script right now is not vulnerable to XSS nor file location brute-force
PHP Code:
<?php
//Enter in the array locations of the wordlists
$files = array('tools/wordlist.txt');
?>
<html>
<head>
<div align="center" style="position: absolute; top: 37px; left: 7px; width: 187px; color: red; font-family: helvetica; font-size: 14px;">
Coded by Noize at<br>
HackCommunity.com<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
MD5 Hash Cracker
</div>
<link rel="stylesheet" type="text/css" href="http://noizethehacker.altervista.org/style.css" />
<title>MD5 Hash Cracker</title>
<script type="text/javascript">
window.onload = function() {
document.getElementById('hash').focus();
}
</script>
</head>
<body bgcolor="black">
<div id="center_body">
<font color="#00ff00">
#########################################################<br>
<font face="sans-serif" size="4" color="white"><b>Noize's MD5 Hash Cracker</b></font><br>
#########################################################<br>
<form method='post' action='' style="position: relative; left: 6px;">
<br>
Hash: <input type="text" name="hash" id="hash" placeholder="MD5 Hash" /><br>
Wordlist: <select name="wordlist">
<?php
//Writing out the options based on our array:
foreach($files as $key => $file){
echo "<option value=$key>$file</option>";
}
?>
</select><br>
<input type="submit" value=" Crack " style="position: relative; top: 3px; left: 95px; margin-bottom: -5px; color: #00ff00; background-color: black; font-family: arial; font-size: 13px; cursor: pointer;" /><br>
<input type="hidden" name="submit" />
</form>
#########################################################<br>
</font>
<br>
<?php
if (isset($_POST['submit'])) {
//Checking if the wordlist is set. If yes, filter out everything except numbers
$wordlist = empty($_POST['wordlist']) ? NULL : preg_replace("/[^0-9]+/", "", $_POST['wordlist']);
//Check if the wordlist is empty (it could have been set with characters other than numbers - for example in hack attempt)
//Also check if the ID is valid in our array
if(empty($wordlist) && !is_numeric($wordlist) || $wordlist > count($files)){
echo '<font color="red">Invalid wordlist.</font>';
exit();
}
$hash = trim($_POST['hash']);
//Opening the file defined in our array
$wordlist = file($files[$wordlist]);
$bFound = false;
foreach( $wordlist as $line ) {
$line = trim($line);
if(md5($line)==$hash) {
$bFound = true;
echo 'Hash cracked!<br>The root of the hash is ' . $line . '.';
break;
}
}
if(!$bFound){
echo"Failed to crack the hash.";
}
}
?>
</div>
<div align="center" style="position: relative; bottom: -432px; left: -8px; font-family: verdana; color: #666; font-size: 12px;">
© Special thanks go to my friend
<a href="http://www.hackcommunity.com/User-zomgwtfbbq" style="
font-size: 12px;
font-family: verdana;
color: blue;">
zomgwtfbbq</a> ·
All rights are shit
</div>
</body>
</html>
Added:
- Array of pre-defined wordlists named $files (add wordlist locations there)
- SELECT tag where user chooses the wordlist (This tag is automatically generated from the $files array).
- Secured passing of values. Now only integer values can be submitted as wordlist
Unfortunately, it looks like I broke the design a bit. I'm sorry for that!
The script right now is not vulnerable to XSS nor file location brute-force

Staff will never ever ask you for your personal information.
We know everything about you anyway.
We know everything about you anyway.