diff --git a/.isort.cfg b/.isort.cfg new file mode 100644 index 00000000..58c4a54d --- /dev/null +++ b/.isort.cfg @@ -0,0 +1,4 @@ +[settings] +indent=' ' +not_skip = __init__.py +force_single_line = 1 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index c9baf26e..7848d689 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,4 +17,6 @@ install: - lsb_release -a - pip install -r requirements.txt - sudo ./setup.sh +before_script: + - isort --check-only --diff pwndbg script: nosetests ./tests/ diff --git a/gdbinit.py b/gdbinit.py index 98dcec4b..e3b9e606 100644 --- a/gdbinit.py +++ b/gdbinit.py @@ -1,4 +1,5 @@ from __future__ import print_function + import sys from os import path @@ -8,4 +9,4 @@ directory = path.abspath(directory) sys.path.append(directory) -import pwndbg +import pwndbg # isort:skip diff --git a/ida_script.py b/ida_script.py index dfde2ae8..936993e2 100644 --- a/ida_script.py +++ b/ida_script.py @@ -1,9 +1,7 @@ from __future__ import print_function -import idaapi -import idautils -import idc -import functools + import datetime +import functools import threading import xmlrpclib from SimpleXMLRPCServer import SimpleXMLRPCServer diff --git a/pwndbg/__init__.py b/pwndbg/__init__.py index 6b09c9df..f8ac2a0c 100755 --- a/pwndbg/__init__.py +++ b/pwndbg/__init__.py @@ -1,10 +1,45 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function -import gdb + import sys + +import gdb +import pwndbg.android import pwndbg.arch import pwndbg.arguments +import pwndbg.argv +import pwndbg.color +import pwndbg.commands +import pwndbg.commands.argv +import pwndbg.commands.aslr +import pwndbg.commands.auxv +import pwndbg.commands.checksec +import pwndbg.commands.config +import pwndbg.commands.context +import pwndbg.commands.cpsr +import pwndbg.commands.dt +import pwndbg.commands.dumpargs +import pwndbg.commands.elf +import pwndbg.commands.gdbinit +import pwndbg.commands.heap +import pwndbg.commands.hexdump +import pwndbg.commands.ida +import pwndbg.commands.misc +import pwndbg.commands.next +import pwndbg.commands.peda +import pwndbg.commands.procinfo +import pwndbg.commands.reload +import pwndbg.commands.rop +import pwndbg.commands.search +import pwndbg.commands.segments +import pwndbg.commands.shell +import pwndbg.commands.start +import pwndbg.commands.telescope +import pwndbg.commands.vmmap +import pwndbg.commands.windbg +import pwndbg.commands.xor +import pwndbg.constants import pwndbg.disasm import pwndbg.disasm.arm import pwndbg.disasm.jump @@ -12,6 +47,17 @@ import pwndbg.disasm.mips import pwndbg.disasm.ppc import pwndbg.disasm.sparc import pwndbg.disasm.x86 +import pwndbg.dt +import pwndbg.elf +import pwndbg.inthook +import pwndbg.memory +import pwndbg.net +import pwndbg.proc +import pwndbg.regs +import pwndbg.stack +import pwndbg.stdio +import pwndbg.typeinfo +import pwndbg.vmmap try: import unicorn @@ -19,50 +65,6 @@ try: except: pass -import pwndbg.vmmap -import pwndbg.dt -import pwndbg.memory -import pwndbg.inthook -import pwndbg.elf -import pwndbg.proc -import pwndbg.regs -import pwndbg.stack -import pwndbg.stdio -import pwndbg.color -import pwndbg.typeinfo -import pwndbg.constants -import pwndbg.argv -import pwndbg.net -import pwndbg.android -import pwndbg.commands -import pwndbg.commands.hexdump -import pwndbg.commands.context -import pwndbg.commands.telescope -import pwndbg.commands.vmmap -import pwndbg.commands.dt -import pwndbg.commands.search -import pwndbg.commands.start -import pwndbg.commands.procinfo -import pwndbg.commands.auxv -import pwndbg.commands.windbg -import pwndbg.commands.ida -import pwndbg.commands.reload -import pwndbg.commands.rop -import pwndbg.commands.shell -import pwndbg.commands.aslr -import pwndbg.commands.misc -import pwndbg.commands.next -import pwndbg.commands.dumpargs -import pwndbg.commands.cpsr -import pwndbg.commands.argv -import pwndbg.commands.heap -import pwndbg.commands.segments -import pwndbg.commands.xor -import pwndbg.commands.peda -import pwndbg.commands.gdbinit -import pwndbg.commands.elf -import pwndbg.commands.checksec -import pwndbg.commands.config __all__ = [ diff --git a/pwndbg/abi.py b/pwndbg/abi.py index 06999235..4ab36745 100644 --- a/pwndbg/abi.py +++ b/pwndbg/abi.py @@ -1,7 +1,9 @@ # -*- coding: utf-8 -*- from __future__ import print_function + import pwndbg.arch + class ABI(object): """ Encapsulates information about a calling convention. diff --git a/pwndbg/android.py b/pwndbg/android.py index 4993cd62..329c6466 100644 --- a/pwndbg/android.py +++ b/pwndbg/android.py @@ -1,10 +1,12 @@ from __future__ import print_function + import gdb import pwndbg.color import pwndbg.events import pwndbg.file import pwndbg.remote + def is_android(): try: if pwndbg.file.get('/system/etc/hosts'): diff --git a/pwndbg/arch.py b/pwndbg/arch.py index 373a3f02..5805f75c 100644 --- a/pwndbg/arch.py +++ b/pwndbg/arch.py @@ -1,18 +1,19 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function + import collections import struct import sys +from capstone import * + import gdb import pwndbg.events import pwndbg.memoize import pwndbg.regs import pwndbg.typeinfo -from capstone import * - current = 'i386' qemu = current ptrmask = 0xfffffffff @@ -73,4 +74,3 @@ def signed(integer): def unsigned(integer): return unpack(pack(integer)) - diff --git a/pwndbg/arguments.py b/pwndbg/arguments.py index 5ed4b8b8..f6fda928 100644 --- a/pwndbg/arguments.py +++ b/pwndbg/arguments.py @@ -5,21 +5,23 @@ Allows describing functions, specifically enumerating arguments which may be passed in a combination of registers and stack values. """ from __future__ import print_function + +from capstone import CS_GRP_CALL +from capstone import CS_GRP_INT + import gdb import pwndbg.abi import pwndbg.arch import pwndbg.constants import pwndbg.disasm -import pwndbg.functions import pwndbg.funcparser +import pwndbg.functions import pwndbg.ida import pwndbg.memory import pwndbg.regs import pwndbg.symbol import pwndbg.typeinfo -from capstone import CS_GRP_CALL, CS_GRP_INT - ida_replacements = { '__int64': 'signed long long int', '__int32': 'signed int', @@ -172,4 +174,3 @@ def argument(n, abi=None): sp = pwndbg.regs.sp + (n * pwndbg.arch.ptrsize) return int(pwndbg.memory.poi(pwndbg.typeinfo.ppvoid, sp)) - diff --git a/pwndbg/argv.py b/pwndbg/argv.py index 8c34f4de..c44b2231 100644 --- a/pwndbg/argv.py +++ b/pwndbg/argv.py @@ -1,6 +1,6 @@ from __future__ import print_function -import gdb +import gdb import pwndbg.arch import pwndbg.events import pwndbg.memory @@ -47,4 +47,3 @@ def update(): envc += 1 except gdb.MemoryError: pass - diff --git a/pwndbg/auxv.py b/pwndbg/auxv.py index 92275f4c..df8d7cce 100644 --- a/pwndbg/auxv.py +++ b/pwndbg/auxv.py @@ -1,4 +1,5 @@ from __future__ import print_function + import os import re import sys diff --git a/pwndbg/chain.py b/pwndbg/chain.py index 0c845a2f..9b3b3263 100644 --- a/pwndbg/chain.py +++ b/pwndbg/chain.py @@ -1,4 +1,5 @@ from __future__ import print_function + import gdb import pwndbg.color import pwndbg.enhance diff --git a/pwndbg/color.py b/pwndbg/color.py index c46a8a80..55fcc3d4 100644 --- a/pwndbg/color.py +++ b/pwndbg/color.py @@ -1,5 +1,7 @@ from __future__ import print_function + import functools + import gdb import pwndbg.config import pwndbg.enhance diff --git a/pwndbg/commands/__init__.py b/pwndbg/commands/__init__.py index dad90005..5cba6ba1 100644 --- a/pwndbg/commands/__init__.py +++ b/pwndbg/commands/__init__.py @@ -1,11 +1,13 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function + import argparse import functools +import sys import traceback -import gdb +import gdb import pwndbg.chain import pwndbg.color import pwndbg.enhance @@ -16,9 +18,6 @@ import pwndbg.stdio import pwndbg.symbol import pwndbg.ui -import sys - - debug = True class _Command(gdb.Command): diff --git a/pwndbg/commands/argv.py b/pwndbg/commands/argv.py index 0da47952..90042062 100644 --- a/pwndbg/commands/argv.py +++ b/pwndbg/commands/argv.py @@ -1,4 +1,5 @@ from __future__ import print_function + import gdb import pwndbg.arch import pwndbg.argv diff --git a/pwndbg/commands/aslr.py b/pwndbg/commands/aslr.py index 5b4f2281..fd9d6f37 100644 --- a/pwndbg/commands/aslr.py +++ b/pwndbg/commands/aslr.py @@ -1,5 +1,7 @@ from __future__ import print_function + import argparse + import gdb import pwndbg.color import pwndbg.commands diff --git a/pwndbg/commands/asm.py b/pwndbg/commands/asm.py index 83a7fd1b..938ba973 100644 --- a/pwndbg/commands/asm.py +++ b/pwndbg/commands/asm.py @@ -1,4 +1,5 @@ from __future__ import print_function + import subprocess import gdb diff --git a/pwndbg/commands/checksec.py b/pwndbg/commands/checksec.py index 18b06eca..a47f4f45 100755 --- a/pwndbg/commands/checksec.py +++ b/pwndbg/commands/checksec.py @@ -7,6 +7,7 @@ import gdb import pwndbg.commands import pwndbg.which + @pwndbg.commands.Command def checksec(file=None): ''' diff --git a/pwndbg/commands/context.py b/pwndbg/commands/context.py index 767a58ae..ea317652 100644 --- a/pwndbg/commands/context.py +++ b/pwndbg/commands/context.py @@ -1,9 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function -import gdb + import sys +import gdb import pwndbg.arguments import pwndbg.chain import pwndbg.color @@ -19,6 +20,7 @@ import pwndbg.symbol import pwndbg.ui import pwndbg.vmmap + # @pwndbg.events.stop @pwndbg.commands.Command @pwndbg.commands.OnlyWhenRunning diff --git a/pwndbg/commands/cpsr.py b/pwndbg/commands/cpsr.py index 7192b2f0..e1193e98 100644 --- a/pwndbg/commands/cpsr.py +++ b/pwndbg/commands/cpsr.py @@ -1,12 +1,14 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function + import gdb import pwndbg.arch import pwndbg.color import pwndbg.commands import pwndbg.regs + @pwndbg.commands.Command @pwndbg.commands.OnlyWhenRunning def cpsr(): diff --git a/pwndbg/commands/defcon.py b/pwndbg/commands/defcon.py index 88486d5c..e43e7eee 100644 --- a/pwndbg/commands/defcon.py +++ b/pwndbg/commands/defcon.py @@ -1,12 +1,15 @@ from __future__ import print_function + import gdb - -import pwndbg.vmmap import pwndbg.commands -import pwndbg.symbol import pwndbg.memory +import pwndbg.symbol +import pwndbg.vmmap +from pwndbg.color import blue +from pwndbg.color import bold +from pwndbg.color import green +from pwndbg.color import red -from pwndbg.color import bold, blue, green, red @pwndbg.commands.Command @pwndbg.commands.OnlyWhenRunning diff --git a/pwndbg/commands/dt.py b/pwndbg/commands/dt.py index 45cd6836..37bf8952 100644 --- a/pwndbg/commands/dt.py +++ b/pwndbg/commands/dt.py @@ -1,4 +1,5 @@ from __future__ import print_function + import gdb import pwndbg.color import pwndbg.commands diff --git a/pwndbg/commands/dumpargs.py b/pwndbg/commands/dumpargs.py index 75aed6ea..eb1b909c 100644 --- a/pwndbg/commands/dumpargs.py +++ b/pwndbg/commands/dumpargs.py @@ -1,10 +1,12 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function -import pwndbg.commands + import pwndbg.arguments +import pwndbg.commands import pwndbg.disasm + @pwndbg.commands.Command @pwndbg.commands.OnlyWhenRunning def dumpargs(*a): diff --git a/pwndbg/commands/elf.py b/pwndbg/commands/elf.py index f049a78e..ae486ef7 100755 --- a/pwndbg/commands/elf.py +++ b/pwndbg/commands/elf.py @@ -1,8 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +from elftools.elf.elffile import ELFFile + import gdb import pwndbg.commands -from elftools.elf.elffile import ELFFile + @pwndbg.commands.Command def elfheader(): diff --git a/pwndbg/commands/gdbinit.py b/pwndbg/commands/gdbinit.py index 031a5218..19c48347 100644 --- a/pwndbg/commands/gdbinit.py +++ b/pwndbg/commands/gdbinit.py @@ -6,9 +6,11 @@ Compatibility functionality for GDBINIT users. https://github.com/gdbinit/Gdbinit/blob/master/gdbinit """ from __future__ import print_function + import gdb import pwndbg.commands + @pwndbg.commands.Command @pwndbg.commands.OnlyWhenRunning def init(): @@ -40,4 +42,3 @@ def entry_point(): """GDBINIT compatibility alias to print the entry point. See also the 'entry' command.""" print(hex(pwndbg.elf.entry())) - diff --git a/pwndbg/commands/heap.py b/pwndbg/commands/heap.py index 276baa7b..a88a88f9 100644 --- a/pwndbg/commands/heap.py +++ b/pwndbg/commands/heap.py @@ -1,11 +1,13 @@ #!/usr/bin/env python from __future__ import print_function + import gdb - import pwndbg.commands - -from pwndbg.color import bold, yellow, red, underline +from pwndbg.color import bold +from pwndbg.color import red +from pwndbg.color import underline +from pwndbg.color import yellow PREV_INUSE = 1 IS_MMAPED = 2 diff --git a/pwndbg/commands/hexdump.py b/pwndbg/commands/hexdump.py index cf2294f4..ffbfcb6b 100644 --- a/pwndbg/commands/hexdump.py +++ b/pwndbg/commands/hexdump.py @@ -1,7 +1,9 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function + import argparse + import pwndbg.arch import pwndbg.commands import pwndbg.config diff --git a/pwndbg/commands/ida.py b/pwndbg/commands/ida.py index 6481cbce..3dc8bfe0 100644 --- a/pwndbg/commands/ida.py +++ b/pwndbg/commands/ida.py @@ -1,4 +1,5 @@ from __future__ import print_function + import bz2 import datetime import os diff --git a/pwndbg/commands/misc.py b/pwndbg/commands/misc.py index ff9ef202..4be3951f 100644 --- a/pwndbg/commands/misc.py +++ b/pwndbg/commands/misc.py @@ -1,14 +1,14 @@ from __future__ import print_function -import gdb + import errno as _errno import struct -import pwndbg as _pwndbg +import gdb +import pwndbg as _pwndbg import pwndbg.arch as _arch import pwndbg.commands -import pwndbg.symbol import pwndbg.regs - +import pwndbg.symbol _errno.errorcode[0] = 'OK' diff --git a/pwndbg/commands/nearpc.py b/pwndbg/commands/nearpc.py index f397315e..c73224f0 100644 --- a/pwndbg/commands/nearpc.py +++ b/pwndbg/commands/nearpc.py @@ -1,11 +1,12 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function -from capstone import * import collections -import gdb +from capstone import * + +import gdb import pwndbg.arguments import pwndbg.color import pwndbg.disasm diff --git a/pwndbg/commands/next.py b/pwndbg/commands/next.py index 145c1e34..19e7433c 100644 --- a/pwndbg/commands/next.py +++ b/pwndbg/commands/next.py @@ -4,10 +4,12 @@ Stepping until an event occurs """ from __future__ import print_function + import gdb import pwndbg.commands import pwndbg.next + @pwndbg.commands.Command @pwndbg.commands.OnlyWhenRunning def nextjmp(*args): @@ -72,4 +74,3 @@ def nextsc(*args): Breaks at the next syscall. """ next_syscall(*args) - diff --git a/pwndbg/commands/packing.py b/pwndbg/commands/packing.py index d184fd1a..ff463d4e 100644 --- a/pwndbg/commands/packing.py +++ b/pwndbg/commands/packing.py @@ -1,4 +1,5 @@ from __future__ import print_function + import struct import gdb diff --git a/pwndbg/commands/peda.py b/pwndbg/commands/peda.py index 0344e2c2..1d9cfe5a 100644 --- a/pwndbg/commands/peda.py +++ b/pwndbg/commands/peda.py @@ -1,15 +1,17 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function -import gdb + import sys +import gdb import pwndbg.auxv import pwndbg.commands import pwndbg.commands.context import pwndbg.commands.telescope import pwndbg.proc + @pwndbg.commands.Command @pwndbg.commands.OnlyWhenRunning def getfile(): diff --git a/pwndbg/commands/procinfo.py b/pwndbg/commands/procinfo.py index c1bdefaf..dcd04221 100644 --- a/pwndbg/commands/procinfo.py +++ b/pwndbg/commands/procinfo.py @@ -1,13 +1,14 @@ from __future__ import print_function + import os import string import gdb import pwndbg.auxv import pwndbg.commands +import pwndbg.file import pwndbg.memoize import pwndbg.net -import pwndbg.file import pwndbg.proc try: diff --git a/pwndbg/commands/reload.py b/pwndbg/commands/reload.py index 066feff7..bca362b3 100644 --- a/pwndbg/commands/reload.py +++ b/pwndbg/commands/reload.py @@ -1,8 +1,5 @@ from __future__ import print_function -try: - from __builtins__ import reload as _reload -except: - from imp import reload as _reload + import imp import os import sys @@ -14,6 +11,12 @@ import pwndbg.commands import pwndbg.events import pwndbg.memoize +try: + from __builtins__ import reload as _reload +except: + from imp import reload as _reload + + def rreload(module, mdict=None): """Recursively reload modules.""" diff --git a/pwndbg/commands/rop.py b/pwndbg/commands/rop.py index ea17a3a2..df649d1e 100644 --- a/pwndbg/commands/rop.py +++ b/pwndbg/commands/rop.py @@ -1,4 +1,5 @@ from __future__ import print_function + import argparse import re import subprocess @@ -52,4 +53,4 @@ def rop(grep, argument): for line in stdout.splitlines(): if re.search(grep, line): - print(line) \ No newline at end of file + print(line) diff --git a/pwndbg/commands/search.py b/pwndbg/commands/search.py index 0ca72b80..b6552c02 100644 --- a/pwndbg/commands/search.py +++ b/pwndbg/commands/search.py @@ -1,4 +1,5 @@ from __future__ import print_function + import argparse import codecs import os @@ -99,4 +100,3 @@ def search(type, hex, string, executable, writable, value, mapping): # Perform the search print_search(value, mapping=mapping, executable=executable, writable=writable) - diff --git a/pwndbg/commands/segments.py b/pwndbg/commands/segments.py index c2705969..22cb55e3 100644 --- a/pwndbg/commands/segments.py +++ b/pwndbg/commands/segments.py @@ -1,7 +1,9 @@ from __future__ import print_function + import gdb -import pwndbg.regs import pwndbg.commands +import pwndbg.regs + class segment(gdb.Function): """Get the flat address of memory based off of the named segment register. diff --git a/pwndbg/commands/shell.py b/pwndbg/commands/shell.py index 55223bb9..d981f6d9 100644 --- a/pwndbg/commands/shell.py +++ b/pwndbg/commands/shell.py @@ -4,6 +4,7 @@ Wrapper for shell commands. """ from __future__ import print_function + import os import gdb diff --git a/pwndbg/commands/start.py b/pwndbg/commands/start.py index be4f9235..ea66906d 100644 --- a/pwndbg/commands/start.py +++ b/pwndbg/commands/start.py @@ -5,6 +5,7 @@ Launches the target process after setting a breakpoint at a convenient entry point. """ from __future__ import print_function + import gdb import pwndbg.commands import pwndbg.elf diff --git a/pwndbg/commands/telescope.py b/pwndbg/commands/telescope.py index ba19fc7c..9d1285d0 100644 --- a/pwndbg/commands/telescope.py +++ b/pwndbg/commands/telescope.py @@ -6,7 +6,9 @@ Prints out pointer chains starting at some address in memory. Generally used to print out the stack or register values. """ from __future__ import print_function + import collections + import pwndbg.arch import pwndbg.chain import pwndbg.commands diff --git a/pwndbg/commands/vmmap.py b/pwndbg/commands/vmmap.py index 864fedb7..55e6f097 100644 --- a/pwndbg/commands/vmmap.py +++ b/pwndbg/commands/vmmap.py @@ -4,6 +4,7 @@ Command to print the vitual memory map a la /proc/self/maps. """ from __future__ import print_function + import gdb import pwndbg.color import pwndbg.commands diff --git a/pwndbg/commands/windbg.py b/pwndbg/commands/windbg.py index 1e8d08b0..d474f478 100644 --- a/pwndbg/commands/windbg.py +++ b/pwndbg/commands/windbg.py @@ -4,9 +4,10 @@ Compatibility functionality for Windbg users. """ from __future__ import print_function + import codecs -import sys import math +import sys import gdb import pwndbg.arch diff --git a/pwndbg/commands/xor.py b/pwndbg/commands/xor.py index be9e2759..175e0454 100644 --- a/pwndbg/commands/xor.py +++ b/pwndbg/commands/xor.py @@ -3,6 +3,7 @@ from __future__ import print_function import pwndbg.commands import pwndbg.memory + @pwndbg.commands.Command @pwndbg.commands.OnlyWhenRunning def xor(self, address, key, count): diff --git a/pwndbg/compat.py b/pwndbg/compat.py index 455facec..2e0af5b0 100644 --- a/pwndbg/compat.py +++ b/pwndbg/compat.py @@ -6,6 +6,7 @@ running under Python2 or Python3, and resolving any inconsistencies which arise from this. """ from __future__ import print_function + import sys # Quickly determine which version is running diff --git a/pwndbg/config.py b/pwndbg/config.py index 53dc3e4f..3374b7eb 100644 --- a/pwndbg/config.py +++ b/pwndbg/config.py @@ -17,10 +17,11 @@ module, for example: >>> int(pwndbg.config.example_value) 7 """ -import gdb import sys import types +import gdb + TYPES = { # The value is an integer. # This is like PARAM_INTEGER, except 0 is interpreted as itself. diff --git a/pwndbg/constants/__init__.py b/pwndbg/constants/__init__.py index ee3155a9..50af9707 100644 --- a/pwndbg/constants/__init__.py +++ b/pwndbg/constants/__init__.py @@ -1,6 +1,13 @@ from __future__ import print_function + import pwndbg.arch -from . import arm, aarch64, thumb, mips, amd64, i386 + +from . import aarch64 +from . import amd64 +from . import arm +from . import i386 +from . import mips +from . import thumb arches = { 'arm': arm, diff --git a/pwndbg/constants/aarch64.py b/pwndbg/constants/aarch64.py index 62ccc945..6d19d349 100644 --- a/pwndbg/constants/aarch64.py +++ b/pwndbg/constants/aarch64.py @@ -1,4 +1,5 @@ from .constant import Constant + __NR_io_setup = Constant('__NR_io_setup',0) __NR_io_destroy = Constant('__NR_io_destroy',1) __NR_io_submit = Constant('__NR_io_submit',2) diff --git a/pwndbg/constants/alpha.py b/pwndbg/constants/alpha.py index a4527b4e..ce5f64a5 100644 --- a/pwndbg/constants/alpha.py +++ b/pwndbg/constants/alpha.py @@ -1,4 +1,5 @@ from .constant import Constant + __NR_osf_syscall = Constant('__NR_osf_syscall',0) __NR_exit = Constant('__NR_exit',1) __NR_fork = Constant('__NR_fork',2) diff --git a/pwndbg/constants/amd64.py b/pwndbg/constants/amd64.py index e532cbe4..c5fa4afa 100644 --- a/pwndbg/constants/amd64.py +++ b/pwndbg/constants/amd64.py @@ -1,4 +1,5 @@ from .constant import Constant + __NR_read = Constant('__NR_read',0) __NR_write = Constant('__NR_write',1) __NR_open = Constant('__NR_open',2) diff --git a/pwndbg/constants/arm.py b/pwndbg/constants/arm.py index 8d815bbe..013bf624 100644 --- a/pwndbg/constants/arm.py +++ b/pwndbg/constants/arm.py @@ -1,4 +1,5 @@ from .constant import Constant + __NR_OABI_SYSCALL_BASE = Constant('__NR_OABI_SYSCALL_BASE',0x900000) __NR_SYSCALL_BASE = Constant('__NR_SYSCALL_BASE',0) __NR_restart_syscall = Constant('__NR_restart_syscall',(0+ 0)) diff --git a/pwndbg/constants/i386.py b/pwndbg/constants/i386.py index 75fe732c..e95f7920 100644 --- a/pwndbg/constants/i386.py +++ b/pwndbg/constants/i386.py @@ -1,4 +1,5 @@ from .constant import Constant + __NR_exit = Constant('__NR_exit',1) __NR_fork = Constant('__NR_fork',2) __NR_read = Constant('__NR_read',3) diff --git a/pwndbg/constants/ia64.py b/pwndbg/constants/ia64.py index 951a9115..d07dd596 100644 --- a/pwndbg/constants/ia64.py +++ b/pwndbg/constants/ia64.py @@ -1,4 +1,5 @@ from .constant import Constant + __NR_ni_syscall = Constant('__NR_ni_syscall',1024) __NR_exit = Constant('__NR_exit',1025) __NR_read = Constant('__NR_read',1026) diff --git a/pwndbg/constants/mips.py b/pwndbg/constants/mips.py index 1eaa0f99..6064fd1d 100644 --- a/pwndbg/constants/mips.py +++ b/pwndbg/constants/mips.py @@ -1,4 +1,5 @@ from .constant import Constant + __NR_Linux = Constant('__NR_Linux',4000) __NR_syscall = Constant('__NR_syscall',(4000 + 0)) __NR_exit = Constant('__NR_exit',(4000 + 1)) diff --git a/pwndbg/constants/powerpc.py b/pwndbg/constants/powerpc.py index a3d19d83..b71a9791 100644 --- a/pwndbg/constants/powerpc.py +++ b/pwndbg/constants/powerpc.py @@ -1,4 +1,5 @@ from .constant import Constant + __NR_exit = Constant('__NR_exit',1) __NR_fork = Constant('__NR_fork',2) __NR_read = Constant('__NR_read',3) diff --git a/pwndbg/constants/powerpc64.py b/pwndbg/constants/powerpc64.py index d2b2518f..45fdc9f0 100644 --- a/pwndbg/constants/powerpc64.py +++ b/pwndbg/constants/powerpc64.py @@ -1,4 +1,5 @@ from .constant import Constant + __NR_exit = Constant('__NR_exit',1) __NR_fork = Constant('__NR_fork',2) __NR_read = Constant('__NR_read',3) diff --git a/pwndbg/constants/s390.py b/pwndbg/constants/s390.py index efa50738..d7c51641 100644 --- a/pwndbg/constants/s390.py +++ b/pwndbg/constants/s390.py @@ -1,4 +1,5 @@ from .constant import Constant + __NR_exit = Constant('__NR_exit',1) __NR_fork = Constant('__NR_fork',2) __NR_read = Constant('__NR_read',3) diff --git a/pwndbg/constants/s390x.py b/pwndbg/constants/s390x.py index db4b54a8..3ab84a96 100644 --- a/pwndbg/constants/s390x.py +++ b/pwndbg/constants/s390x.py @@ -1,4 +1,5 @@ from .constant import Constant + __NR_exit = Constant('__NR_exit',1) __NR_fork = Constant('__NR_fork',2) __NR_read = Constant('__NR_read',3) diff --git a/pwndbg/constants/sparc.py b/pwndbg/constants/sparc.py index f30a9737..6ce18a12 100644 --- a/pwndbg/constants/sparc.py +++ b/pwndbg/constants/sparc.py @@ -1,4 +1,5 @@ from .constant import Constant + __NR_exit = Constant('__NR_exit',1) __NR_fork = Constant('__NR_fork',2) __NR_read = Constant('__NR_read',3) diff --git a/pwndbg/constants/sparc64.py b/pwndbg/constants/sparc64.py index 8cd7caa3..d73a2aa1 100644 --- a/pwndbg/constants/sparc64.py +++ b/pwndbg/constants/sparc64.py @@ -1,4 +1,5 @@ from .constant import Constant + __NR_exit = Constant('__NR_exit',1) __NR_fork = Constant('__NR_fork',2) __NR_read = Constant('__NR_read',3) diff --git a/pwndbg/constants/thumb.py b/pwndbg/constants/thumb.py index 8d815bbe..013bf624 100644 --- a/pwndbg/constants/thumb.py +++ b/pwndbg/constants/thumb.py @@ -1,4 +1,5 @@ from .constant import Constant + __NR_OABI_SYSCALL_BASE = Constant('__NR_OABI_SYSCALL_BASE',0x900000) __NR_SYSCALL_BASE = Constant('__NR_SYSCALL_BASE',0) __NR_restart_syscall = Constant('__NR_restart_syscall',(0+ 0)) diff --git a/pwndbg/disasm/__init__.py b/pwndbg/disasm/__init__.py index e38cb1a3..26840426 100644 --- a/pwndbg/disasm/__init__.py +++ b/pwndbg/disasm/__init__.py @@ -5,21 +5,21 @@ Functionality for disassmebling code at an address, or at an address +/- a few instructions. """ from __future__ import print_function -import collections -import gdb -import pwndbg.arch -import pwndbg.disasm.arch -import pwndbg.ida -import pwndbg.memory -import pwndbg.symbol -import pwndbg.memoize -import pwndbg.jump -import pwndbg.emu.emulator +import collections import capstone from capstone import * +import gdb +import pwndbg.arch +import pwndbg.disasm.arch +import pwndbg.emu.emulator +import pwndbg.ida +import pwndbg.jump +import pwndbg.memoize +import pwndbg.memory +import pwndbg.symbol disassembler = None last_arch = None diff --git a/pwndbg/disasm/arch.py b/pwndbg/disasm/arch.py index 41c292c9..64fee4bc 100644 --- a/pwndbg/disasm/arch.py +++ b/pwndbg/disasm/arch.py @@ -1,9 +1,12 @@ from __future__ import print_function + +import collections + +import capstone +from capstone import * + import pwndbg.memoize import pwndbg.symbol -import capstone -import collections -from capstone import * CS_OP_IMM diff --git a/pwndbg/disasm/arm.py b/pwndbg/disasm/arm.py index dd0d0b13..44ea546c 100644 --- a/pwndbg/disasm/arm.py +++ b/pwndbg/disasm/arm.py @@ -1,18 +1,17 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function + import collections +from capstone import * +from capstone.arm import * + import pwndbg.arch import pwndbg.disasm.arch import pwndbg.memory import pwndbg.regs -from capstone import * -from capstone.arm import * - -import pwndbg.disasm.arch - class DisassemblyAssistant(pwndbg.disasm.arch.DisassemblyAssistant): def memory_sz(self, instruction, op): @@ -71,4 +70,3 @@ class DisassemblyAssistant(pwndbg.disasm.arch.DisassemblyAssistant): return cc assistant = DisassemblyAssistant('arm') - diff --git a/pwndbg/disasm/color.py b/pwndbg/disasm/color.py index 6c652cc0..5ef0a6fb 100644 --- a/pwndbg/disasm/color.py +++ b/pwndbg/disasm/color.py @@ -1,7 +1,9 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function + import capstone + import pwndbg.chain import pwndbg.color import pwndbg.disasm.jump diff --git a/pwndbg/disasm/jump.py b/pwndbg/disasm/jump.py index 32e98e5e..c32ab414 100644 --- a/pwndbg/disasm/jump.py +++ b/pwndbg/disasm/jump.py @@ -1,10 +1,12 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function + +from capstone import CS_GRP_JUMP + import pwndbg.arch import pwndbg.disasm.x86 -from capstone import CS_GRP_JUMP def is_jump_taken(instruction): """ diff --git a/pwndbg/disasm/x86.py b/pwndbg/disasm/x86.py index 4254e0e2..f8a6c04a 100644 --- a/pwndbg/disasm/x86.py +++ b/pwndbg/disasm/x86.py @@ -1,16 +1,17 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function + import collections +from capstone import * +from capstone.x86 import * + import pwndbg.arch import pwndbg.memory import pwndbg.regs import pwndbg.typeinfo -from capstone import * -from capstone.x86 import * - groups = {v:k for k,v in globals().items() if k.startswith('X86_GRP_')} ops = {v:k for k,v in globals().items() if k.startswith('X86_OP_')} regs = {v:k for k,v in globals().items() if k.startswith('X86_REG_')} diff --git a/pwndbg/dt.py b/pwndbg/dt.py index d969a402..00457877 100644 --- a/pwndbg/dt.py +++ b/pwndbg/dt.py @@ -4,6 +4,7 @@ Prints structures in a manner similar to Windbg's "dt" command. """ from __future__ import print_function + import glob import os import re diff --git a/pwndbg/elf.py b/pwndbg/elf.py index adad0f9b..b9e40cf8 100644 --- a/pwndbg/elf.py +++ b/pwndbg/elf.py @@ -22,7 +22,6 @@ import pwndbg.memoize import pwndbg.memory import pwndbg.proc import pwndbg.stack - from pwndbg.elftypes import * # ELF constants diff --git a/pwndbg/emu/__init__.py b/pwndbg/emu/__init__.py index 73c02f12..ac125814 100644 --- a/pwndbg/emu/__init__.py +++ b/pwndbg/emu/__init__.py @@ -1,2 +1,3 @@ from __future__ import print_function + import pwndbg.emu.x86 diff --git a/pwndbg/emu/emulator.py b/pwndbg/emu/emulator.py index dd18601e..7c92778f 100644 --- a/pwndbg/emu/emulator.py +++ b/pwndbg/emu/emulator.py @@ -2,16 +2,19 @@ Emulation assistance from Unicorn. """ from __future__ import print_function + import binascii -import gdb import inspect -import unicorn as U + import capstone as C +import unicorn as U + +import gdb import pwndbg.arch import pwndbg.disasm +import pwndbg.emu.emulator import pwndbg.memory import pwndbg.regs -import pwndbg.emu.emulator # Map our internal architecture names onto Unicorn Engine's architecture types. arch_to_UC = { diff --git a/pwndbg/emu/x86.py b/pwndbg/emu/x86.py index 4f916a50..f70e765e 100644 --- a/pwndbg/emu/x86.py +++ b/pwndbg/emu/x86.py @@ -1,2 +1,3 @@ from __future__ import print_function + import pwndbg.emu.emulator diff --git a/pwndbg/enhance.py b/pwndbg/enhance.py index 79606f5b..dd0e8e6e 100644 --- a/pwndbg/enhance.py +++ b/pwndbg/enhance.py @@ -9,6 +9,7 @@ dependent on page permissions, the contents of the data, and any supplemental information sources (e.g. active IDA Pro connection). """ from __future__ import print_function + import string import gdb diff --git a/pwndbg/events.py b/pwndbg/events.py index 5f9c189b..aa3209a5 100644 --- a/pwndbg/events.py +++ b/pwndbg/events.py @@ -6,6 +6,7 @@ when various events occur to the debuggee (e.g. STOP on SIGINT) by using a decorator. """ from __future__ import print_function + import functools import sys import traceback diff --git a/pwndbg/file.py b/pwndbg/file.py index 62e68343..54652005 100755 --- a/pwndbg/file.py +++ b/pwndbg/file.py @@ -6,6 +6,7 @@ debugging a remote process over SSH or similar, where e.g. /proc/FOO/maps is needed from the remote system. """ from __future__ import print_function + import binascii import errno as _errno import os diff --git a/pwndbg/funcparser.py b/pwndbg/funcparser.py index 0ed317f8..2508d30a 100644 --- a/pwndbg/funcparser.py +++ b/pwndbg/funcparser.py @@ -1,6 +1,10 @@ from __future__ import print_function + import collections -from pycparser import c_ast, CParser + +from pycparser import CParser +from pycparser import c_ast + def extractTypeAndName(n, defaultName=None): if isinstance(n, c_ast.EllipsisParam): diff --git a/pwndbg/functions.py b/pwndbg/functions.py index e148fcf5..5a82db3e 100644 --- a/pwndbg/functions.py +++ b/pwndbg/functions.py @@ -1,4 +1,5 @@ import collections + Function = collections.namedtuple('Function', ('type', 'derefcnt', 'name', 'args')) Argument = collections.namedtuple('Argument', ('type', 'derefcnt', 'name')) diff --git a/pwndbg/gcc.py b/pwndbg/gcc.py index 1f314f5c..5f2241cb 100644 --- a/pwndbg/gcc.py +++ b/pwndbg/gcc.py @@ -5,6 +5,7 @@ Functions for determining the architecture-dependent path to GCC and any flags it should be executed with. """ from __future__ import print_function + import collections import glob import os diff --git a/pwndbg/heap/__init__.py b/pwndbg/heap/__init__.py index fbae1012..6d19d971 100644 --- a/pwndbg/heap/__init__.py +++ b/pwndbg/heap/__init__.py @@ -1,6 +1,7 @@ from __future__ import print_function -import pwndbg.heap.heap + import pwndbg.heap.dlmalloc +import pwndbg.heap.heap import pwndbg.heap.ptmalloc current = pwndbg.heap.heap.Heap() diff --git a/pwndbg/heap/dlmalloc.py b/pwndbg/heap/dlmalloc.py index 37ffb0c7..57134518 100644 --- a/pwndbg/heap/dlmalloc.py +++ b/pwndbg/heap/dlmalloc.py @@ -1,4 +1,5 @@ from __future__ import print_function + import gdb import pwndbg.events import pwndbg.typeinfo diff --git a/pwndbg/heap/heap.py b/pwndbg/heap/heap.py index c0e3b5da..50273b5c 100644 --- a/pwndbg/heap/heap.py +++ b/pwndbg/heap/heap.py @@ -1,7 +1,9 @@ from __future__ import print_function + import pwndbg.events import pwndbg.symbol + class Heap(object): """Heap abstraction layer.""" diff --git a/pwndbg/heap/libheap.py b/pwndbg/heap/libheap.py index fc7d81aa..8a7a41fb 100644 --- a/pwndbg/heap/libheap.py +++ b/pwndbg/heap/libheap.py @@ -22,11 +22,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ from __future__ import print_function -import gdb -import sys + import struct +import sys from os import uname +import gdb + # bash color support color_support = True if color_support: diff --git a/pwndbg/heap/ptmalloc.py b/pwndbg/heap/ptmalloc.py index 37ffb0c7..57134518 100644 --- a/pwndbg/heap/ptmalloc.py +++ b/pwndbg/heap/ptmalloc.py @@ -1,4 +1,5 @@ from __future__ import print_function + import gdb import pwndbg.events import pwndbg.typeinfo diff --git a/pwndbg/hexdump.py b/pwndbg/hexdump.py index ff31827c..3d9a48f9 100644 --- a/pwndbg/hexdump.py +++ b/pwndbg/hexdump.py @@ -4,6 +4,7 @@ Hexdump implementation, ~= stolen from pwntools. """ from __future__ import print_function + import copy import string diff --git a/pwndbg/ida.py b/pwndbg/ida.py index 578cefd8..0add5cbd 100644 --- a/pwndbg/ida.py +++ b/pwndbg/ida.py @@ -6,6 +6,7 @@ in order to query it about the database. Allows symbol resolution and interactive debugging. """ from __future__ import print_function + import errno import functools import os diff --git a/pwndbg/info.py b/pwndbg/info.py index 8337c20a..a8ec7763 100644 --- a/pwndbg/info.py +++ b/pwndbg/info.py @@ -6,6 +6,7 @@ Runs a few useful commands which are available under "info". We probably don't need this anymore. """ from __future__ import print_function + import gdb import pwndbg.memoize diff --git a/pwndbg/inthook.py b/pwndbg/inthook.py index a2ae0594..3e6d027f 100644 --- a/pwndbg/inthook.py +++ b/pwndbg/inthook.py @@ -6,6 +6,7 @@ since they cannot directly cast to integer a gdb.Value object that is not already an integer type. """ from __future__ import print_function + import sys import gdb diff --git a/pwndbg/jump/__init__.py b/pwndbg/jump/__init__.py index 95e4c5fe..c32c7a58 100644 --- a/pwndbg/jump/__init__.py +++ b/pwndbg/jump/__init__.py @@ -15,4 +15,3 @@ # @property # def foobar(self): # return self._foobar - diff --git a/pwndbg/malloc.py b/pwndbg/malloc.py index 5cf9b847..7eba4e6e 100644 --- a/pwndbg/malloc.py +++ b/pwndbg/malloc.py @@ -6,6 +6,7 @@ Describes the EGLIBC heap mechanisms. Work-in-progress. """ from __future__ import print_function + import pwndbg.arch import pwndbg.events diff --git a/pwndbg/memory.py b/pwndbg/memory.py index 7a894239..1782c3fd 100644 --- a/pwndbg/memory.py +++ b/pwndbg/memory.py @@ -4,11 +4,13 @@ Reading, writing, and describing memory. """ from __future__ import print_function + +import traceback + import gdb import pwndbg.arch import pwndbg.compat import pwndbg.typeinfo -import traceback PAGE_SIZE = 0x1000 PAGE_MASK = ~(PAGE_SIZE-1) diff --git a/pwndbg/net.py b/pwndbg/net.py index bef0ef54..549a172b 100644 --- a/pwndbg/net.py +++ b/pwndbg/net.py @@ -3,6 +3,7 @@ Re-implements some psutil functionality to be able to get information from remote debugging sessions. """ from __future__ import print_function + import binascii import socket diff --git a/pwndbg/next.py b/pwndbg/next.py index b2c00d9f..f94bbaec 100644 --- a/pwndbg/next.py +++ b/pwndbg/next.py @@ -5,12 +5,13 @@ Commands for setting temporary breakpoints on the next instruction of some type (call, branch, etc.) """ from __future__ import print_function + +import capstone + import gdb import pwndbg.disasm import pwndbg.regs -import capstone - jumps = set(( capstone.CS_GRP_CALL, capstone.CS_GRP_JUMP, @@ -90,5 +91,3 @@ def break_on_next(address=None): gdb.Breakpoint("*%#x" % (ins.address + ins.size), temporary=True) gdb.execute('continue', from_tty=False, to_string=True) - - diff --git a/pwndbg/proc.py b/pwndbg/proc.py index 1644abd9..025b3497 100644 --- a/pwndbg/proc.py +++ b/pwndbg/proc.py @@ -5,6 +5,7 @@ Provides values which would be available from /proc which are not fulfilled by other modules. """ from __future__ import print_function + import functools import sys from types import ModuleType diff --git a/pwndbg/qemu.py b/pwndbg/qemu.py index a3c93783..2fb49386 100644 --- a/pwndbg/qemu.py +++ b/pwndbg/qemu.py @@ -4,12 +4,15 @@ Determine whether the target is being run under QEMU. """ from __future__ import print_function -import gdb + import os + import psutil -import pwndbg.remote +import gdb import pwndbg.events +import pwndbg.remote + @pwndbg.memoize.reset_on_stop def is_qemu(): @@ -90,5 +93,3 @@ def pid(): for c in connections: if c.laddr in targets: return process.pid - - diff --git a/pwndbg/regs.py b/pwndbg/regs.py index 744cf93a..efdfab97 100644 --- a/pwndbg/regs.py +++ b/pwndbg/regs.py @@ -5,6 +5,7 @@ Reading register value from the inferior, and provides a standardized interface to registers like "sp" and "pc". """ from __future__ import print_function + import collections import ctypes import re diff --git a/pwndbg/remote.py b/pwndbg/remote.py index a9102707..52fa4877 100644 --- a/pwndbg/remote.py +++ b/pwndbg/remote.py @@ -5,8 +5,10 @@ Information about whether the debuggee is local (under GDB) or remote (under GDBSERVER or QEMU stub). """ from __future__ import print_function + import gdb + def is_remote(): # N.B.: We cannot use "info program" because of: # https://sourceware.org/bugzilla/show_bug.cgi?id=18335 diff --git a/pwndbg/search.py b/pwndbg/search.py index d8b5af97..d4b1b0f5 100644 --- a/pwndbg/search.py +++ b/pwndbg/search.py @@ -4,6 +4,7 @@ Search the address space for byte patterns. """ from __future__ import print_function + import struct import gdb diff --git a/pwndbg/stack.py b/pwndbg/stack.py index 91c1df03..aeab99ad 100644 --- a/pwndbg/stack.py +++ b/pwndbg/stack.py @@ -8,6 +8,7 @@ Generally not needed, except under qemu-user and for when binaries do things to remap the stack (e.g. pwnies' postit). """ from __future__ import print_function + import gdb import pwndbg.events import pwndbg.memoize diff --git a/pwndbg/stdio.py b/pwndbg/stdio.py index 9c02b4f5..ef759162 100644 --- a/pwndbg/stdio.py +++ b/pwndbg/stdio.py @@ -5,6 +5,7 @@ Provides functionality to circumvent GDB's hooks on sys.stdin and sys.stdout which prevent output from appearing on-screen inside of certain event handlers. """ from __future__ import print_function + import codecs import io import os @@ -13,8 +14,6 @@ import sys import gdb import pwndbg.compat -import gdb -import pwndbg.compat def get(fd, mode): if pwndbg.compat.python3: diff --git a/pwndbg/strings.py b/pwndbg/strings.py index e140673a..e57aeb11 100644 --- a/pwndbg/strings.py +++ b/pwndbg/strings.py @@ -5,6 +5,7 @@ Functionality for resolving ASCII printable strings within the debuggee's address space. """ from __future__ import print_function + import string import gdb diff --git a/pwndbg/symbol.py b/pwndbg/symbol.py index 1d05c97c..3702429e 100644 --- a/pwndbg/symbol.py +++ b/pwndbg/symbol.py @@ -9,14 +9,16 @@ information available. """ from __future__ import print_function +import os +import re +import tempfile + import elftools.common.exceptions import elftools.elf.constants import elftools.elf.elffile import elftools.elf.segments + import gdb -import re -import os -import tempfile import pwndbg.elf import pwndbg.events import pwndbg.file @@ -28,6 +30,7 @@ import pwndbg.remote import pwndbg.stack import pwndbg.vmmap + def get_directory(): """ Retrieve the debug file directory path. diff --git a/pwndbg/typeinfo.py b/pwndbg/typeinfo.py index 8f9cc6bc..e783cb11 100644 --- a/pwndbg/typeinfo.py +++ b/pwndbg/typeinfo.py @@ -5,6 +5,7 @@ Common types, and routines for manually loading types from file via GCC. """ from __future__ import print_function + import glob import os import subprocess diff --git a/pwndbg/ui.py b/pwndbg/ui.py index 78433738..36998216 100644 --- a/pwndbg/ui.py +++ b/pwndbg/ui.py @@ -4,6 +4,7 @@ A few helpers for making things print pretty-like. """ from __future__ import print_function + import fcntl import struct import sys diff --git a/pwndbg/vmmap.py b/pwndbg/vmmap.py index 96daac97..91475895 100644 --- a/pwndbg/vmmap.py +++ b/pwndbg/vmmap.py @@ -8,6 +8,7 @@ The reason that we need robustness is that not every operating system has /proc/$$/maps, which backs 'info proc mapping'. """ from __future__ import print_function + import sys import gdb @@ -379,4 +380,3 @@ def check_aslr(): vmmap.aslr = True return vmmap.aslr - diff --git a/pwndbg/which.py b/pwndbg/which.py index 6254a68d..946c945d 100644 --- a/pwndbg/which.py +++ b/pwndbg/which.py @@ -31,6 +31,7 @@ import os import stat + def which(name, all = False): """which(name, flags = os.X_OK, all = False) -> str or str set diff --git a/requirements.txt b/requirements.txt index 574e31af..4dcd752f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,5 @@ pip pycparser psutil>=3.1.0 python-ptrace>=0.8 -pyelftools \ No newline at end of file +pyelftools +isort diff --git a/tests/common.py b/tests/common.py index b31d6c94..4fede045 100644 --- a/tests/common.py +++ b/tests/common.py @@ -2,6 +2,7 @@ import subprocess import tempfile import unittest + def pywrite(data): return write(data, suffix='.py') @@ -23,4 +24,4 @@ def run_gdb_with_script(pybefore='', pyafter=''): command += ['--eval-command', 'quit'] - return subprocess.check_output(command, stderr=subprocess.STDOUT) \ No newline at end of file + return subprocess.check_output(command, stderr=subprocess.STDOUT) diff --git a/tests/testLoadsWithoutCrashing.py b/tests/testLoadsWithoutCrashing.py index c73c9f86..8f95fffc 100644 --- a/tests/testLoadsWithoutCrashing.py +++ b/tests/testLoadsWithoutCrashing.py @@ -1,5 +1,6 @@ import common + def test_loads_wivout_crashing_bruv(): output = common.run_gdb_with_script() - assert 'Type pwndbg for a list' in output, output \ No newline at end of file + assert 'Type pwndbg for a list' in output, output