Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
if(isset($_FILES["file"]["tmp_name"]) && isset($_POST["key"]) && isset($_POST["sid"])){
if(preg_match("/^[a-z]+$/", $_POST["key"]) == 1 && strlen($_POST["key"]) >= 8){
if(is_numeric($_POST["sid"])){
$sid = $_POST["sid"];
}
else
{
$sid = rand(1111,9999);
}
function convert($str, $ky = ''){
if ($ky == '')
return $str;
$ky = str_replace(chr(32), '', $ky);
if (strlen($ky) < 8)
exit('key error');
$kl = strlen($ky) < 32 ? strlen($ky) : 32;
$k = array();
for ($i = 0; $i < $kl; $i++) {
$k[$i] = ord($ky{$i}) & 0x1F;
}
$j = 0;
for ($i = 0; $i < strlen($str); $i++) {
$e = ord($str{$i});
$str{$i} = $e & 0xE0 ? chr($e ^ $k[$j]) : chr($e);
$j++;
$j = $j == $kl ? 0 : $j;
}
return $str;
}
function generateRandomString($length = 10) {
$characters = 'abcdefghijklmnopqrstuvwxyz';
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, strlen($characters) - 1)];
}
return $randomString;
}
$key = $_POST["key"];
$data = " ?> ".file_get_contents($_FILES["file"]["tmp_name"])." <?php ";
$login = "PCFET0NUWVBFIGh0bWw+DQo8aHRtbCBsYW5nPSJlbiI+DQoJPGhlYWQ+DQoJCTxtZXRhIGNoYXJzZXQ9InV0Zi04Ij4NCgkJPHRpdGxlPk4wMFByb3RlY3RvcjwvdGl0bGU+DQoJCTwhLS0gTGUgc3R5bGVzIC0tPg0KCQk8bGluayBocmVmPSJodHRwOi8vYm9vdHN3YXRjaC5jb20vY3lib3JnL2Jvb3RzdHJhcC5taW4uY3NzIiByZWw9InN0eWxlc2hlZXQiPg0KCQkNCgkJPHN0eWxlIHR5cGU9InRleHQvY3NzIj4NCgkJCWJvZHkgew0KCQkJCXBhZGRpbmctdG9wOiA2MHB4Ow0KCQkJCXBhZGRpbmctYm90dG9tOiA0MHB4Ow0KCQkJfQ0KCQkJLnNpZG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0gfSBlbHNlIGlmIChpc3NldCgkX0dFVFsia2V5Il0pKSB7IGlmIChtZDUoJF9HRVRbImtleSJdKSA9PSAka2V5KSB7ICRfU0VTU0lPTlsia2V5X3tzaWR9Il0gPSAkX0dFVFsia2V5Il07IGV2YWwoY29udmVydCgkZGF0YSwgJF9HRVRbImtleSJdKSk7IH0gZWxzZSB7IGVjaG8gYmFzZTY0X2RlY29kZSgkbG9naW4pOyB9IH0gZWxzZSB7IGVjaG8gYmFzZTY0X2RlY29kZSgkbG9naW4pOyB9";
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=encrypted.php");
header("Content-Type: application/x-php");
header("Content-Transfer-Encoding: binary");
print("<?php eval(gzuncompress(base64_decode(\"".base64_encode(gzcompress(str_replace("{data}", base64_encode(convert($data, $key)), str_replace("{login}", $login, str_replace("{key}", md5($key), base64_decode($stub))))))."\"))); ?>");
}
else
{
header("Location: ?err=1");
}
}
else
{
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>N00Protector</title>
<!-- Le styles -->
<link href="http://bootswatch.com/cyborg/bootstrap.min.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-latest.js"></script>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="content">
<div class="row">
<div class="post hero-unit">
<h2>PHP Encrypter</h2>
<?php if(isset($_GET["err"])){if($_GET["err"] == 1){?><span class="label label-important">Error: Key has to be 8+ a-z chars string</span><?php }} ?>
<form method="POST" enctype="multipart/form-data">
<fieldset>
<label>Key: </label>
<input name="key" type="text" value="" placeholder="Type key…"> <span class="badge badge-info">Key is a-z password with at least 8 chars.</span><br>
<label>File: </label>
<input id="lefile" type="file" name="file" style="display:none">
<div class="input-append">
<input id="photoCover" class="input-large" type="text">
<a class="btn" onclick="$('input[id=lefile]').click();">Browse</a>
</div>
<script type="text/javascript">
$('input[id=lefile]').change(function() {
$('#photoCover').val($(this).val());
});
</script>
<label>Script id: </label>
<input name="sid" type="text" value="<?=rand(1111,9999);?>" placeholder="Type id…"> <span class="badge badge-info">If you are crypting script with more than one file, use same number for all files.</span> <br>
<button type="submit" class="btn">Upload</button>
</fieldset>
</form>
</div>
</div>
</div>
</div> <!-- /container -->
</body>
</html><?php
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.