added some scripts
This commit is contained in:
parent
86c787a70f
commit
3941272130
7 changed files with 510 additions and 5 deletions
179
php_scripts/b64img.php
Normal file
179
php_scripts/b64img.php
Normal file
|
@ -0,0 +1,179 @@
|
|||
<?php
|
||||
|
||||
class ImageCreateException extends Exception { }
|
||||
class DecodeException extends Exception { }
|
||||
class NoImagesException extends Exception
|
||||
{
|
||||
protected $reasons = array();
|
||||
public function __construct ($reasons)
|
||||
{
|
||||
$this->reasons = $reasons;
|
||||
}
|
||||
public function getReasons()
|
||||
{
|
||||
return $this->reasons;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($_POST['base64']))
|
||||
{
|
||||
$contents = array();
|
||||
$errors = array();
|
||||
$inputs = array();
|
||||
|
||||
$count = count($_POST['base64']);
|
||||
|
||||
for ($i = 0; $i < $count; $i++)
|
||||
{
|
||||
$inputs[$i] = array("base64" => $_POST['base64'][$i], "name" => $_POST['names'][$i]);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
foreach($inputs as $input)
|
||||
{
|
||||
try
|
||||
{
|
||||
$img_decoded = base64_decode($input['base64']);
|
||||
|
||||
if(empty($img_decoded))
|
||||
{
|
||||
throw new DecodeException("Could not get base64 string");
|
||||
}
|
||||
|
||||
if (!@imagecreatefromstring($img_decoded))
|
||||
{
|
||||
throw new ImageCreateException();
|
||||
}
|
||||
|
||||
$contents[] = array("decoded" => $img_decoded, "name" => $input["name"]);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$errors[] = $e;
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($contents))
|
||||
{
|
||||
$count = count($contents);
|
||||
|
||||
if($count == 1)
|
||||
{
|
||||
$im = imagecreatefromstring($contents[0]["decoded"]);
|
||||
|
||||
header("Content-Type: image/png");
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
|
||||
imagepng($im);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$file = tempnam("tmp", "zip");
|
||||
|
||||
$zip = new ZipArchive();
|
||||
$zip->open($file, ZipArchive::OVERWRITE);
|
||||
|
||||
for($i = 0; $i < $count; $i++)
|
||||
{
|
||||
$filename = empty($contents[$i]["name"]) ? "image_{$i}" : $contents[$i]["name"];
|
||||
$zip->addFromString($filename . ".png", $contents[$i]["decoded"]);
|
||||
}
|
||||
|
||||
if(!empty($errors))
|
||||
{
|
||||
$errorstring = print_r($errors, true);
|
||||
|
||||
$info = "In total, " . count($errors) . " errors occurred:\r\n\r\n";
|
||||
|
||||
$info .= "- " . substr_count($errorstring, "DecodeException") . " times, decoding the string didnt work\r\n";
|
||||
$info .= "- " . substr_count($errorstring, "ImageCreateException") . " times, creating the image didnt work";
|
||||
|
||||
$zip->addFromString("errors.txt", $info);
|
||||
}
|
||||
|
||||
$zip->close();
|
||||
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Content-Type: application/zip");
|
||||
header("Content-Length: " . filesize($file));
|
||||
header("Content-Disposition: attachment; filename=\"images.zip\"");
|
||||
readfile($file);
|
||||
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NoImagesException($errors);
|
||||
}
|
||||
}
|
||||
catch (DecodeException $e)
|
||||
{
|
||||
echo "Could not decode the given string.";
|
||||
}
|
||||
catch (ImageCreateException $e)
|
||||
{
|
||||
echo "Could not create an image from the decoded string. The base64 string is invalid or does not contain an image.";
|
||||
}
|
||||
catch (NoImagesException $e)
|
||||
{
|
||||
echo "No images found. The following errors occurred:";
|
||||
echo "<pre>" . print_r($e->getReasons(), true) . "</pre>";
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
print_r($e);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
echo '<?xml version="1.0" ?>';
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<title>/dev/nulll - Base 64 to Image Converter</title>
|
||||
<script src="scripts.js" type="text/javascript"></script>
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<link rel="shortcut icon" href="/favicon.png" type="image/png">
|
||||
|
||||
<link rel="icon" href="/favicon.png" type="image/png">
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
|
||||
<header>
|
||||
<a href="http://0l.de"><img src="http://0l.de/_media/nulll_small.png" alt="0l" /></a>
|
||||
<h1>Base 64 to Image Converter</h1>
|
||||
</header>
|
||||
|
||||
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
|
||||
|
||||
<div id="basestrings">
|
||||
<textarea name="base64[]" rows="10" id="focus" style="width:100%"></textarea><br />Name (optional): <input name="names[]" type="text" size="30" />
|
||||
</div><br />
|
||||
|
||||
<a href="#" onclick="addTextArea()">Add another input field</a>
|
||||
<br /><br />
|
||||
|
||||
<input name="convert" type="submit" value="Convert!" />
|
||||
</form>
|
||||
|
||||
<footer>
|
||||
<p>by <a href="http://www.michaschwab.de">Micha Schwab</a> - <a href="http://0l.de/tools/base64img">help</a></p>
|
||||
</footer>
|
||||
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
<?php }
|
41
php_scripts/ckfinder_keygen.php
Executable file → Normal file
41
php_scripts/ckfinder_keygen.php
Executable file → Normal file
|
@ -1,17 +1,48 @@
|
|||
<?php
|
||||
|
||||
/* Keygen for CKFinder
|
||||
/**
|
||||
* Keygen for CKFinder
|
||||
* tested successfully with version 1.4.1.1
|
||||
* written by Steffen Vogel (info@steffenvogel.de)
|
||||
* reverse engenering by Micha Schwab & Steffen Vogel
|
||||
*/
|
||||
?>
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de-DE" lang="de-DE">
|
||||
<head>
|
||||
<title>Keygen for CKFinder</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<script src="scripts.js" type="text/javascript"></script>
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<header>
|
||||
<a href="http://0l.de"><img src="http://0l.de/_media/nulll_small.png" alt="0l" /></a>
|
||||
<h1>Keygen for CKFinder</h1>
|
||||
</header>
|
||||
|
||||
<p>tested successfully with version 1.4.1.1</p>
|
||||
|
||||
<pre>
|
||||
|
||||
<?php
|
||||
$chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZ';
|
||||
|
||||
for ($p = 0; $p <= 100; $p++) {
|
||||
for ($p = 0; $p <= 10; $p++) {
|
||||
for ($i = 0; $i < 13; $i++) $key[$i] = $chars{mt_rand(0, strlen($chars) - 1)};
|
||||
$key[0] = $chars{5 * mt_rand(0, floor((strlen($chars) - 1) / 5)) + 1};
|
||||
$key[12] = $chars{(strpos($chars, $key[11]) + strpos($chars, $key[8]) * 9) % (strlen($chars) - 1)};
|
||||
echo implode($key) . ', ';
|
||||
echo implode($key) . '<br />';
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
</pre>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
159
php_scripts/contactimg.php
Normal file
159
php_scripts/contactimg.php
Normal file
|
@ -0,0 +1,159 @@
|
|||
<?php
|
||||
|
||||
function getExtension($filename) {
|
||||
return strtolower(substr(strrchr($filename,"."),1));
|
||||
}
|
||||
|
||||
if (!empty($_FILES["contacts"]))
|
||||
{
|
||||
$count = count($_FILES["contacts"]["tmp_name"]);
|
||||
$files = array("zip" => array(),
|
||||
"vcf" => array(),
|
||||
"contact" => array());
|
||||
|
||||
for($i = 0; $i < $count; $i++)
|
||||
{
|
||||
$extension = getExtension($_FILES["contacts"]["name"][$i]);
|
||||
|
||||
if($extension == "zip")
|
||||
$files["zip"][] = $i;
|
||||
elseif($extension == "contact")
|
||||
$files["contact"] = $i;
|
||||
elseif($extension == "vcf")
|
||||
$files["vcf"][] = $i;
|
||||
}
|
||||
|
||||
$contents["contact"] = array();
|
||||
$contents["vcf"] = array();
|
||||
|
||||
foreach($files["contact"] as $contactfile)
|
||||
{
|
||||
$contents["contact"][] = file_get_contents($_FILES["contacts"]["tmp_name"][$contactfile]);
|
||||
}
|
||||
|
||||
foreach($files["vcf"] as $contactfile)
|
||||
{
|
||||
$contents["vcf"][] = file_get_contents($_FILES["contacts"]["tmp_name"][$contactfile]);
|
||||
}
|
||||
|
||||
|
||||
foreach($files["zip"] as $zipfile)
|
||||
{
|
||||
$zip = new ZipArchive();
|
||||
$zip->open($_FILES["contacts"]["tmp_name"][$zipfile]);
|
||||
|
||||
for ($i = 0; $i < $zip->numFiles; $i++)
|
||||
{
|
||||
$extension = getExtension($zip->getNameIndex($i));
|
||||
|
||||
if($extension == "contact")
|
||||
$contents["contact"][] = $zip->getFromIndex($i);
|
||||
elseif($extension == "vcf")
|
||||
$contents["vcf"][] = $zip->getFromIndex($i);
|
||||
}
|
||||
|
||||
$zip->close();
|
||||
}
|
||||
|
||||
$images = array();
|
||||
|
||||
foreach($contents["contact"] as $contact)
|
||||
{
|
||||
$image = array();
|
||||
$image["name"] = preg_replace('=.*?<c:FormattedName>(.*?)</c:FormattedName>.*=si',"\\1", $contact);
|
||||
$image["imgb64"] = preg_replace('=.*?<c:Value c:ContentType\="binary".*?>(.*?)</c:Value>.*=si',"\\1", $contact);
|
||||
|
||||
$images[] = $image;
|
||||
}
|
||||
|
||||
foreach($contents["vcf"] as $vcf)
|
||||
{
|
||||
preg_match_all('=FN:(.*?)\n=si', $vcf, $names);
|
||||
$count = preg_match_all('=PHOTO.*?:(.*?)\n[A-Z]=si', $vcf, $imgb64s);
|
||||
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$images[] = array("name" => $names[1][$i], "imgb64" => $imgb64s[1][$i]);
|
||||
}
|
||||
}
|
||||
|
||||
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Windows Contact to Image Converter</title>
|
||||
</head>
|
||||
<body onload="document.getElementsByName('base64finisher')[0].submit()">
|
||||
<div id="content">
|
||||
<h1>Windows Contact to Image Converter</h1>
|
||||
|
||||
<form action="b64img.php" method="post" name="base64finisher">
|
||||
<p>Alright, we extracted the images from the files as base64. We now need to convert them to images.
|
||||
If you do not have JavaScript, please click "Convert!" again.</p>
|
||||
|
||||
<?php
|
||||
foreach ($images as $image)
|
||||
{ ?>
|
||||
<textarea name="base64[]" style="display:none"><?php echo $image["imgb64"]; ?></textarea>
|
||||
<input name="names[]" type="text" style="display:none" value="<?php echo $image["name"]; ?>" />
|
||||
<?php } ?>
|
||||
|
||||
<input name="convert" type="submit" value="Convert!" />
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
echo '<?xml version="1.0" ?>';
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<title>/dev/nulll - Windows Contact to Image Converter</title>
|
||||
<script src="scripts.js" type="text/javascript"></script>
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<link rel="shortcut icon" href="/favicon.png" type="image/png">
|
||||
|
||||
<link rel="icon" href="/favicon.png" type="image/png">
|
||||
</head>
|
||||
<body><div id="content">
|
||||
|
||||
<header>
|
||||
<a href="http://0l.de"><img src="http://0l.de/_media/nulll_small.png" alt="0l" /></a>
|
||||
<h1>Windows Contact to Image Converter</h1>
|
||||
</header>
|
||||
|
||||
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" name="base" method="post" target="ifr" enctype="multipart/form-data">
|
||||
<p>You can either choose contact files or a zip file containing contact files.</p>
|
||||
|
||||
<div id="files">
|
||||
<input type="file" name="contacts[]" id="focus" />
|
||||
</div><br />
|
||||
<a href="#" onclick="addUploader()">Add another upload field</a>
|
||||
<br /><br />
|
||||
<input name="convert" type="submit" value="Convert!" />
|
||||
</form>
|
||||
|
||||
<iframe name="ifr" id="ifr"></iframe>
|
||||
|
||||
|
||||
<footer>
|
||||
<p>by <a href="http://www.michaschwab.de">Micha Schwab</a> - <a href="http://0l.de/tools/contactimg">help</a></p>
|
||||
|
||||
<a href="#" onclick="document.getElementById('iPhoneExport').style.display='block'">You can also use this tool to get the contact photos you made with your iPhone</a>
|
||||
<div id="iPhoneExport" style="display:none">
|
||||
<p>In iTunes, define the contact sync setting so that it exports your contacts to the Windows contacts.
|
||||
You will then find the .contact files somewhere in your profile files, ready to upload them here.</p>
|
||||
</footer>
|
||||
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<?php }
|
0
php_scripts/google_statistics.php
Executable file → Normal file
0
php_scripts/google_statistics.php
Executable file → Normal file
75
php_scripts/scripts.js
Normal file
75
php_scripts/scripts.js
Normal file
|
@ -0,0 +1,75 @@
|
|||
function addUploader()
|
||||
{
|
||||
addHtmlProperly(document.getElementById("files"), '<br /><input type="file" name="contacts[]" />');
|
||||
|
||||
var inputs = document.getElementsByTagName('input');
|
||||
inputs[inputs.length-2].focus();
|
||||
}
|
||||
|
||||
function addTextArea()
|
||||
{
|
||||
addHtmlProperly(document.getElementById("basestrings"),'<br /><br /><textarea name="base64[]" rows="10" style="width:100%"></textarea><br />Name (optional): <input name="names[]" type="text" size="30" />');
|
||||
|
||||
var inputs = document.getElementsByTagName('textarea');
|
||||
inputs[inputs.length-1].focus();
|
||||
}
|
||||
|
||||
function addHtmlProperly(element, html)
|
||||
{
|
||||
var htmlarea = document.createElement("div");
|
||||
htmlarea.setAttribute('name', 'htmlarea');
|
||||
|
||||
element.appendChild(htmlarea);
|
||||
|
||||
var areas = document.getElementsByName('htmlarea');
|
||||
areas[areas.length-1].innerHTML = html;
|
||||
}
|
||||
|
||||
window.onload = function()
|
||||
{
|
||||
document.getElementById('focus').focus();
|
||||
|
||||
document.getElementsByTagName('iframe')[0].style.height = 0;
|
||||
document.forms.base.onsubmit = checkFormFinished;
|
||||
}
|
||||
|
||||
var ie = (navigator.appName.indexOf("Explorer") != -1) ? true : false;
|
||||
var mousemoved = 0;
|
||||
var fadestep = ie ? 5 : 0.05;
|
||||
var destOpacity = ie ? 100 : 1;
|
||||
|
||||
window.onmousemove = function()
|
||||
{
|
||||
mousemoved++;
|
||||
|
||||
if (mousemoved > 5)
|
||||
{
|
||||
window.onmousemove = function() { };
|
||||
fadeIn(document.getElementsByTagName("footer")[0], 0);
|
||||
}
|
||||
}
|
||||
|
||||
function fadeIn(element, opacity)
|
||||
{
|
||||
if (opacity < destOpacity)
|
||||
{
|
||||
opacity += fadestep;
|
||||
ie ? element.style.filter = "alpha(opacity=" + opacity + ")" : element.style.opacity = opacity;
|
||||
|
||||
window.setTimeout(function() { fadeIn(element, opacity); }, 50);
|
||||
}
|
||||
}
|
||||
|
||||
function checkFormFinished()
|
||||
{
|
||||
imgs = parent.ifr.document.getElementsByTagName('img');
|
||||
|
||||
if (imgs.length == 0)
|
||||
{
|
||||
window.setTimeout("checkFormFinished()", 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
document.getElementsByTagName('iframe')[0].style.height = imgs[0].clientHeight + 'px';
|
||||
}
|
||||
}
|
61
php_scripts/style.css
Normal file
61
php_scripts/style.css
Normal file
|
@ -0,0 +1,61 @@
|
|||
body {
|
||||
margin: 80px 0;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
input, select, textarea {
|
||||
border: 1px solid #C3C3C3;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-top: 5px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
#content {
|
||||
margin: auto;
|
||||
width: 800px;
|
||||
text-align: center
|
||||
}
|
||||
|
||||
dl {
|
||||
width: 300px;
|
||||
margin: auto;
|
||||
}
|
||||
dt {
|
||||
float: left;
|
||||
}
|
||||
dt a {
|
||||
color: #555
|
||||
}
|
||||
dd {
|
||||
text-align: right;
|
||||
padding-bottom: 4px
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
empty-cells: show;
|
||||
}
|
||||
|
||||
td, th {
|
||||
padding: 2px 5px 2px 5px;
|
||||
border: 1px solid grey;
|
||||
}
|
||||
|
||||
a img {
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
footer {
|
||||
opacity: 0;
|
||||
alpha(opacity=0);
|
||||
display: block;
|
||||
margin-top: 50px;
|
||||
}
|
||||
iframe{
|
||||
border: 0;
|
||||
height: 300px;
|
||||
width: 700px;
|
||||
margin: 0;
|
||||
}
|
0
php_scripts/wake_on_lan.php
Executable file → Normal file
0
php_scripts/wake_on_lan.php
Executable file → Normal file
Loading…
Add table
Reference in a new issue