A collections of scripts that progressively turn meaning into garbage.
It's two bash scripts, duh:
- cdevolver.sh - take a bit of code written in C, compile it, then decompile it, then compile/decompile/compile/decompile over and over again, repeatedly.
- jdevolver.sh - take a jpeg image, and save it as a new jpeg image with further compression, repeatedly, then turn it into an animation
Usage Instructions:
cdevolver.sh requires a free api-key from Retargetable Decompiler (aka RetDec), because cdevolver uses their service for decompilation. Check the RetDec website out, even if you won't be using their web service. You can upload and decompile your C binary within your browser for free without registering or acquiring an api key.
P.S. There are a bunch of other freeware and commercial disassemblers and decompilers out there that work on a variety of platforms. RetDec was the first decompiler I found that spit out recompilable code reliably over multiple generations (although my simple hello world c file seg faults after the first recompilation..). There's a great list of decompilers and disassemblers here.
cdevolver.sh also makes use of a third-party bash script to call RetDec's decompliation web service, so go download retdec-sh. There are a number of other clients for the RetDec api in a variety of languages. Check those out here.
Devolver can be acquired from here.
- Make a temporary directory, lets call it
${STUPID_DIRECTORY}
. - Copy
decompiler.sh
from your retdec-sh installation to${STUPID_DIRECTORY}
. - Copy
cdevolver.sh
from your devolver installation to${STUPID_DIRECTORY}
. - Copy your C file to
${STUPID_DIRECTORY}
.
You don't even have a C file yet, do you? Well, make one. Or just use my dumb example happyacro.c included with devolver. Or just copy paste it from here:
#include <stdio.h>
int main (void) {
printf ("HAPPY:/ACRO\n");
return 0;
}
-
Install GCC if you don't already have it. Pro tip: If you're on OSX, you get it for free when you install XCode. On Windows, you're gonna need cygwin to execute cdevolver.sh, and you can get GCC via cygwin as well.
-
Run
gcc yourfile.c -o yourdumbprogram
in a terminal / command line window. -
Execute your program (
yourdumbprogram
) in your terminal window. Does it run? Fix it until it does.
You're going to execute something like this in a terminal window from ${STUPID_DIRECTORY}
:
./cdevolver.sh [RETDEC_API_KEY] [ITERATION_COUNT] [C_FILE_NAME]
Here ITERATION_COUNT
is how many times you want to compile/decompile the code as it gets progressively worse, RET_DEC_API_KEY
is your RetDec API key, and unsurprisingly C_FILE_NAME
is the name of, you guessed it, your input C file.
Example:
./cdevolver.sh SOME_RANDOM_KEY_XYZ 35 yourfile.c
jdevolver makes use of ImageMagick, so install that. You can easily install it with Homebrew on OSX.
You will also need to install FFmpeg, which can also be obtained for OSX simply with Homebrew.
If you don't have bash installed on your system (windows users..), go get and install Cygwin.
Note that the script is going to create a bunch of jpeg files in the same directory as the original, so I recommend making a temp directory and copying your original there.
Running the script is easy:
./jdevolver.sh [YOUR_IMAGE_FILE] [ITERATION_COUNT]
Here ITERATION_COUNT
is how many times you want to run the converter.
Example:
./jdevolver.sh temp/happyacrologo.jpg 30
These scripts were used to generate some shitty jokes for a book.
All scripts are licensed with the Apache license, which is a great license because, essentially it:
- a) covers liability - my code should work, but I'm not liable if you do something stupid with it
- b) allows you to copy, fork, and use the code, even commercially
- c) is non-viral, that is, your derivative code doesn't have to be open source to use it
Other great licensing options for your own code: BSD License, MIT License, or Creative Commons.
Here's the license:
Copyright (c) 2017, Coder Cowboy, LLC. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied.