diff --git a/tools/corrupt/corrupt.php b/tools/corrupt/corrupt.php new file mode 100644 index 0000000..1a0be37 --- /dev/null +++ b/tools/corrupt/corrupt.php @@ -0,0 +1,83 @@ + (500 * 1024)) die("File is too big"); + + function jpegIsValid($filename) { + // load the file + $img = @imageCreateFromJPEG($filename); + + // return 0 if the image is invalid + if(!$img) return(0); + + // return 1 otherwise + return(1); + } + + function scramble($content, $size) { + $sStart = 10; + $sEnd = $size-1; + $nReplacements = rand(1, 30); + + for($i = 0; $i < $nReplacements; $i++) { + $PosA = rand($sStart, $sEnd); + $PosB = rand($sStart, $sEnd); + + $tmp = $content[$PosA]; + $content[$PosA] = $content[$PosB]; + $content[$PosB] = $tmp; + } + + return($content); + } + + // first check if 'upfile' is set + if(empty($upfile) or empty($upfile_name)) { + die("No file to corrupt, please go back and select a JPEG image to upload."); + } + + // then check if it is a JPEG file + if($upfile_type != "image/jpeg") { + die("The image does not seem to be JPEG but of type '$upfile_type', please go back and select a JPEG image to upload."); + } + + // load the file and get its size + $content = file_get_contents($upfile); + $size = $upfile_size; + + // now store the original one + $fd = fopen("images/$upfile_name", "w") or die("The first fopen went wrong, e-mail webmaster Ben."); + fwrite($fd, $content, $size) or die("The first fwrite went wrong, e-mail webmaster Ben."); + fclose($fd); + + // check the copied image + if(!imageCreateFromJPEG("images/$upfile_name")) { + die("This JPEG is not valid, please go back and try another one."); + } + + // create a folder to store the corrupted versions + @mkdir("images/$upfile_name-corrupted"); + + // corrupt it a few times + for($c = 0, $r = 0; $c < $nCorrupts && $r < $nRetries; $r++) { + // corrupt the file + $corrupted = scramble($content, $size); + + // save it to disc + $fd = fopen("images/$upfile_name-corrupted/$c.jpg", "w") or die("The fopen went wrong, e-mail webmaster Ben."); + fwrite($fd, $corrupted, $size) or die("The fwrite went wrong, e-mail webmaster Ben."); + fclose($fd); + + // count succeeded corrupts + if(jpegIsValid("images/$upfile_name-corrupted/$c.jpg")) $c++; + } + + // jippie! we're done! now go to the list of images... + Header("Location: index.php"); +?> diff --git a/tools/corrupt/index.html b/tools/corrupt/index.html new file mode 100644 index 0000000..5367a12 --- /dev/null +++ b/tools/corrupt/index.html @@ -0,0 +1,106 @@ + + + + +CORRUPT™ + + + + + +
+ + + + + + + +

+ + + + + + + + +"); + echo(""); + echo(""); + echo(""); + } +?> + + + +
+ + +

Corrupt™ - data corruption software 3.0

+Creative Commons License
Corrupt by Corrupt by Recyclism is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Based on a work at www.recyclism.com. +

+ + + + +
+
+Upload and Corrupt™ a JPEG file - Max 500kb +
+
+
3 Latest uploaded imageCorrupted version
\"$fname\""); + echo(""); + echo(""); + + // open the directory containing the corrupted versions + $dir = opendir("$fname-corrupted"); + + // list all files in the corrupted directory + while($file = readdir($dir)) { + // skip directories in the corrupted folder + if(is_dir("$fname-corrupted/$file")) continue; + + // show corrupted image + echo(""); + } + + // close table row + echo(""); + echo("
\"$fname
"); + echo("
+
+ + + diff --git a/tools/corrupt/line.gif b/tools/corrupt/line.gif new file mode 100644 index 0000000..d893629 Binary files /dev/null and b/tools/corrupt/line.gif differ diff --git a/tools/corrupt/pattern.gif b/tools/corrupt/pattern.gif new file mode 100644 index 0000000..d62ebf8 Binary files /dev/null and b/tools/corrupt/pattern.gif differ diff --git a/tools/corrupt/readme.txt b/tools/corrupt/readme.txt new file mode 100644 index 0000000..065fa78 --- /dev/null +++ b/tools/corrupt/readme.txt @@ -0,0 +1,19 @@ +Corrupt by Corrupt by Recyclism is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. Based on a work at http://corrupt.recyclism.com/ + +I DO NOT OFFER SUPPORT TO SET UP CORRUPT on your server. I leave up to you to set up (it's nothing complicated), simply upload the corrupt folder and allow the image folder to be written. + +I do not take any responsibility for vulnerability that your web server may occur by allowing php upload and I do not take any responsibility for any virus or malware you may get once you let people use it. + +If you decide to host your own CORRUPT page, please make sure to keep the mentions and license details as they are in the html (see below): + + +

Corrupt™ - data corruption software 3.0

+Creative Commons License
Corrupt by Corrupt by Recyclism is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Based on a work at www.recyclism.com. +

+ + + +Feel free to update, modify and share corrupt with as many people as possible, however make sure you follow the terms and conditions sated in the license (Attribution-NonCommercial-ShareAlike 3.0 Unported) +http://creativecommons.org/licenses/by-nc-sa/3.0/ + +I'd also appreciate to know about CORRUPT pages out there and would like to link them from my website so feel free to send me a link to your page using this form: http://www.recyclism.com/contact.php diff --git a/tools/corrupt/styles.css b/tools/corrupt/styles.css new file mode 100644 index 0000000..9aa74c1 --- /dev/null +++ b/tools/corrupt/styles.css @@ -0,0 +1,32 @@ +body,table,td,tr,div,p,pre,h1,h2,h3,h4,ul {font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;} +body,td,div,p,pre,ul {font-size: 12px;color: #000000;} +/*BODY {background-color:#FFFFFF;}*/ +BODY { background-image: url("pattern.gif") } + +h1 {font-size: 12px;} +h2 {font-size: 12px;} +h3 {font-size: 12px;} + +.menue {font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; font-size: 12px;color: #0099FF;} +.lesen {font-size: 12px; color: #000000;} +.head {font-size: 12px; letter-spacing : 2px; color: #ffffff;} +.mhead {font-size: 12px; letter-spacing : 2px; color: #ffffff;} + +.invert {color: #000000;background-color:#E0E2D4; font-weight : bold; letter-spacing : 2px; font-size: 12px} + +a {font-size: 12px; text-decoration: none; font-weight : bold;} + +a:link { text-decoration: none; color: #000000; } +a:visited { text-decoration: none; color: #000000; } +a:hover { text-decoration: none; color: #0099FF; } +a:active { text-decoration: none; color: #FF0000; } + + +.sb {scrollbar-3dlight-color:#666666; + scrollbar-arrow-color:#cc3300; + scrollbar-base-color:#ffffff; + scrollbar-darkshadow-color:#6666666; + scrollbar-face-color:#ffffff; + scrollbar-highlight-color:#ffffff; + scrollbar-shadow-color:} + diff --git a/tools/corrupt/upload.php b/tools/corrupt/upload.php new file mode 100644 index 0000000..18ee708 --- /dev/null +++ b/tools/corrupt/upload.php @@ -0,0 +1,15 @@ + +CORRUPT™ + + + + +
+ Corrupt an image:
+
+ + +

Corrupt™ - data corruption software 3.0

+Creative Commons License
Corrupt by Corrupt by Recyclism is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Based on a work at www.recyclism.com. +

+