The CodeIgniter view (decrypter_view.php)
<html>
<head>
<title>Cisco Password Decrypter by RedTeam Security</title>
</head>
<body>
<p>
<?php echo $this->session->flashdata('messages'); ?>
</p><br><br>
<p>Enter the password you'd like to decrypt:</p>
<p>
<form action="<?php echo base_url(); ?>decrypter/doCiscoDecrypt" method="post">
<input type="text" id="ciscocipher" name="ciscocipher" />
<input type="submit" value="Decrypt" />
</form>
</p>
</html>
The CodeIgniter controller (decrypter.php)
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Decrypter extends CI_Controller {
public function index()
{
/*
* Display the decrypter page
*/
$this->load->view('decrypter_view');
}
public function doCiscoDecrypt()
{
/*
* Decrypt Cisco Type 7 Password
*/
// Load CI libraries/helpers
$this->load->helper('security');
$this->load->library('session');
// Get form post value and sanitize
$pass = xss_clean(trim($this->input->post('ciscocipher')));
if ($pass)
{
if (filter_var($pass, FILTER_SANITIZE_STRING))
{
// Clear vars
$z = 0;
$decrypted = '';
// Set array
$x = array (0x64, 0x73, 0x66, 0x64, 0x3b, 0x6b,
0x66, 0x6f, 0x41, 0x2c, 0x2e, 0x69,
0x79, 0x65, 0x77, 0x72, 0x6b, 0x6c,
0x64, 0x4a, 0x4b, 0x44, 0x48, 0x53,
0x55, 0x42);
$unenc_length = (strlen($pass)-2)/2;
$XORindex = (($pass[0]-0)*10)+($pass[1]-0);
settype($XORindex, "integer");
for ($i = 2 ; $i <= strlen($pass); $i=$i+2)
{
$val=(hexdec($pass[$i])*16)+hexdec($pass[$i+1]);
settype($val, "integer");
$passdec[$z]=chr($val ^ $x[$XORindex]);
$z++;
$XORindex++;
}
for ($t=0;$t<=$unenc_length-1;$t++)
{
$decrypted .= $passdec[$t];
}
// Display password to user and redirect
$this->session->set_flashdata('messages', 'The decrypted password is: '.$decrypted);
redirect(base_url().'decrypter');
} else {
// Error, display message and redirect
$this->session->set_flashdata('messages', 'Encountered an error processing the password. Try again!');
redirect(base_url().'decrypter');
}
} else {
// Error, display message and redirect
$this->session->set_flashdata('messages', 'All fields are required. Try again!');
redirect(base_url().'decrypter');
}
}
}
/* End of file decrypter.php */
/* Location: ./system/application/controllers/decrypter.php */
1 comentario:
Excellent article detailed and practical. I do not remember having such a useful article about the man of the researchers. Rather cool that your message is like more.
DedicatedHosting4u.com
Publicar un comentario