Skip to content

Instantly share code, notes, and snippets.

@jhidding
Last active February 15, 2017 12:26
Show Gist options
  • Save jhidding/55ee9b58ef1d3f6e38f912df34382b79 to your computer and use it in GitHub Desktop.
Save jhidding/55ee9b58ef1d3f6e38f912df34382b79 to your computer and use it in GitHub Desktop.
Example of easy-docker decoding a secret message
sed_program = """# usage: sed -f rot13.sed <filename>
y/abcdefghijklmnopqrstuvwxyz/nopqrstuvwxyzabcdefghijklm/
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/NOPQRSTUVWXYZABCDEFGHIJKLM/
"""
message = "Vf gurer nalobql BHG gurer?"
with DockerContainer('busybox') as c:
c.put_archive(
Archive('w')
.add_text_file('rot13.sed', sed_program)
.add_text_file('input.txt', message)
.close())
c.run([
'/bin/sh', '-c',
"/bin/sed -f 'rot13.sed' < input.txt > output.txt"])
secret = c.get_archive('output.txt').get_text_file('output.txt')
print(secret)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment