-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
common.py
33 lines (27 loc) · 856 Bytes
/
common.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import argparse
import os
import sys
import pwnlib
from pwnlib.context import context
pwnlib.log.console.stream = sys.stderr
choices = map(str, [16,32,64])
choices += list(context.oses)
choices += list(context.architectures)
choices += list(context.endiannesses)
def context_arg(arg):
try: context.arch = arg
except Exception: pass
try: context.os = arg
except Exception: pass
try: context.bits = int(arg)
except Exception: arg
try: context.endian = arg
except Exception: pass
return arg
parser = argparse.ArgumentParser(description='Pwntools Command-line Interface')
parser_commands = parser.add_subparsers(dest='command')
def main(file=sys.argv[0]):
import pwnlib.commandline.main
sys.argv.insert(0, 'pwn')
sys.argv[1] = os.path.splitext(os.path.basename(file))[0]
pwnlib.commandline.main.main()