Skip to content

Instantly share code, notes, and snippets.

@wideglide
Created May 1, 2018 02:47
Show Gist options
  • Save wideglide/59318a9c9c59ac52f63e521c0a558f57 to your computer and use it in GitHub Desktop.
Save wideglide/59318a9c9c59ac52f63e521c0a558f57 to your computer and use it in GitHub Desktop.
solve.py template
#!/usr/bin/env python
from pwn import *
import argparse
from struct import pack
# challenge specific
FILE = './syscaller'
SVR = 'chal1.swampctf.com'
PORT = 1800
# set up environ
parser = argparse.ArgumentParser()
parser.add_argument('-r', dest='remote', action='store_true',default=False,help='run remotely')
parser.add_argument('-d', dest='debug', action='store_true',default=False,help='debug in GDB')
args = parser.parse_args()
level= ['debug','info','error'][1]
context(arch='amd64',os='linux',log_level=level)
context.terminal = ["terminator", "-e"]
# context.terminal = ['tmux', 'splitw', '-h']
if args.remote:
r = remote(SVR, PORT)
else:
r = process(FILE)
if args.debug and not args.remote:
gdb.attach(r)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment