Sort imports

This commit is contained in:
Zach Riggle 2015-04-13 16:22:08 -04:00
parent b6ac73a0e7
commit 1b36cbc5a3
49 changed files with 179 additions and 137 deletions

View File

@ -8,4 +8,3 @@ directory = path.abspath(directory)
sys.path.append(directory) sys.path.append(directory)
import pwndbg import pwndbg

View File

@ -1,7 +1,10 @@
import xmlrpclib
import threading import threading
import xmlrpclib
from SimpleXMLRPCServer import SimpleXMLRPCServer from SimpleXMLRPCServer import SimpleXMLRPCServer
import idc, idautils, idaapi
import idaapi
import idautils
import idc
xmlrpclib.Marshaller.dispatch[type(0L)] = lambda _, v, w: w("<value><i8>%d</i8></value>" % v) xmlrpclib.Marshaller.dispatch[type(0L)] = lambda _, v, w: w("<value><i8>%d</i8></value>" % v)
xmlrpclib.Marshaller.dispatch[type(0)] = lambda _, v, w: w("<value><i8>%d</i8></value>" % v) xmlrpclib.Marshaller.dispatch[type(0)] = lambda _, v, w: w("<value><i8>%d</i8></value>" % v)

View File

@ -1,8 +1,9 @@
import struct import struct
import sys import sys
import gdb import gdb
import pwndbg.memoize
import pwndbg.events import pwndbg.events
import pwndbg.memoize
import pwndbg.typeinfo import pwndbg.typeinfo
current = 'i386' current = 'i386'

View File

@ -1,12 +1,12 @@
import gdb
import sys import sys
import pwndbg.memory import gdb
import pwndbg.arch
import pwndbg.events import pwndbg.events
import pwndbg.info import pwndbg.info
import pwndbg.memory
import pwndbg.regs import pwndbg.regs
import pwndbg.typeinfo import pwndbg.typeinfo
import pwndbg.arch
example_info_auxv_linux = """ example_info_auxv_linux = """
33 AT_SYSINFO_EHDR System-supplied DSO's ELF header 0x7ffff7ffa000 33 AT_SYSINFO_EHDR System-supplied DSO's ELF header 0x7ffff7ffa000

View File

@ -2,9 +2,9 @@ import gdb
import pwndbg.color import pwndbg.color
import pwndbg.enhance import pwndbg.enhance
import pwndbg.memory import pwndbg.memory
import pwndbg.symbol
import pwndbg.typeinfo import pwndbg.typeinfo
import pwndbg.vmmap import pwndbg.vmmap
import pwndbg.symbol
LIMIT = 5 LIMIT = 5

View File

@ -1,2 +1,3 @@
import gdb
import subprocess import subprocess
import gdb

View File

@ -1,7 +1,8 @@
import gdb import gdb
import pwndbg.commands
import pwndbg.chain
import pwndbg.auxv import pwndbg.auxv
import pwndbg.chain
import pwndbg.commands
@pwndbg.commands.ParsedCommand @pwndbg.commands.ParsedCommand
@pwndbg.commands.OnlyWhenRunning @pwndbg.commands.OnlyWhenRunning

View File

@ -1,16 +1,17 @@
import gdb import gdb
import pwndbg.commands
import pwndbg.color
import pwndbg.vmmap
import pwndbg.symbol
import pwndbg.regs
import pwndbg.ui
import pwndbg.disasm
import pwndbg.chain import pwndbg.chain
import pwndbg.commands.telescope import pwndbg.color
import pwndbg.commands
import pwndbg.commands.nearpc import pwndbg.commands.nearpc
import pwndbg.commands.telescope
import pwndbg.disasm
import pwndbg.events import pwndbg.events
import pwndbg.ida import pwndbg.ida
import pwndbg.regs
import pwndbg.symbol
import pwndbg.ui
import pwndbg.vmmap
@pwndbg.commands.ParsedCommand @pwndbg.commands.ParsedCommand
@pwndbg.commands.OnlyWhenRunning @pwndbg.commands.OnlyWhenRunning

View File

@ -1,8 +1,9 @@
import gdb import gdb
import pwndbg.vmmap
import pwndbg.commands
import pwndbg.color import pwndbg.color
import pwndbg.commands
import pwndbg.dt import pwndbg.dt
import pwndbg.vmmap
@pwndbg.commands.Command @pwndbg.commands.Command
@pwndbg.commands.OnlyWhenRunning @pwndbg.commands.OnlyWhenRunning

View File

@ -1,7 +1,8 @@
import pwndbg.regs
import pwndbg.commands import pwndbg.commands
import pwndbg.memory
import pwndbg.hexdump import pwndbg.hexdump
import pwndbg.memory
import pwndbg.regs
@pwndbg.commands.ParsedCommand @pwndbg.commands.ParsedCommand
@pwndbg.commands.OnlyWhenRunning @pwndbg.commands.OnlyWhenRunning
@ -24,4 +25,3 @@ def hexdump(address=None, count=64):
for line in pwndbg.hexdump.hexdump(data, address=address): for line in pwndbg.hexdump.hexdump(data, address=address):
print(line) print(line)

View File

@ -1,8 +1,9 @@
import gdb import gdb
import pwndbg.ida
import pwndbg.commands import pwndbg.commands
import pwndbg.ida
import pwndbg.regs import pwndbg.regs
@pwndbg.commands.ParsedCommand @pwndbg.commands.ParsedCommand
@pwndbg.commands.OnlyWhenRunning @pwndbg.commands.OnlyWhenRunning
def j(*args): def j(*args):

View File

@ -1,10 +1,11 @@
import pwndbg.regs
import pwndbg.ui
import pwndbg.symbol
import pwndbg.vmmap
import pwndbg.disasm
import pwndbg.color import pwndbg.color
import pwndbg.disasm
import pwndbg.ida import pwndbg.ida
import pwndbg.regs
import pwndbg.symbol
import pwndbg.ui
import pwndbg.vmmap
@pwndbg.commands.ParsedCommand @pwndbg.commands.ParsedCommand
@pwndbg.commands.OnlyWhenRunning @pwndbg.commands.OnlyWhenRunning

View File

@ -1,4 +1,6 @@
import struct import struct
import gdb import gdb
def pack(data, size=None): def pack(data, size=None):

View File

@ -6,10 +6,12 @@ import imp
import os import os
import sys import sys
import types import types
import gdb import gdb
import pwndbg.events
import pwndbg.commands
import pwndbg import pwndbg
import pwndbg.commands
import pwndbg.events
def rreload(module, mdict=None): def rreload(module, mdict=None):
"""Recursively reload modules.""" """Recursively reload modules."""
@ -35,4 +37,3 @@ def reload(*a):
pwndbg.events.on_reload() pwndbg.events.on_reload()
rreload(pwndbg) rreload(pwndbg)
pwndbg.events.after_reload() pwndbg.events.after_reload()

View File

@ -1,7 +1,9 @@
import os import os
import gdb import gdb
import pwndbg.commands import pwndbg.commands
@pwndbg.commands.Command @pwndbg.commands.Command
def rop(start=None, stop=None): def rop(start=None, stop=None):
""" """

View File

@ -1,13 +1,16 @@
from __future__ import print_function from __future__ import print_function
import gdb
import os import os
import struct import struct
import pwndbg.commands
import pwndbg.search import gdb
import pwndbg.enhance
import pwndbg.color import pwndbg.color
import pwndbg.commands
import pwndbg.enhance
import pwndbg.search
import pwndbg.vmmap import pwndbg.vmmap
@pwndbg.commands.Command @pwndbg.commands.Command
@pwndbg.commands.OnlyWhenRunning @pwndbg.commands.OnlyWhenRunning
def search(value): def search(value):

View File

@ -1,5 +1,6 @@
import gdb
import os import os
import gdb
import pwndbg.commands import pwndbg.commands
shellcmds = [ shellcmds = [

View File

@ -2,6 +2,7 @@ import gdb
import pwndbg.commands import pwndbg.commands
import pwndbg.symbol import pwndbg.symbol
@pwndbg.commands.ParsedCommand @pwndbg.commands.ParsedCommand
def start(): def start():
symbols = ["main", symbols = ["main",

View File

@ -1,8 +1,9 @@
import pwndbg.chain
import pwndbg.commands
import pwndbg.memory import pwndbg.memory
import pwndbg.regs import pwndbg.regs
import pwndbg.typeinfo import pwndbg.typeinfo
import pwndbg.commands
import pwndbg.chain
@pwndbg.commands.ParsedCommand @pwndbg.commands.ParsedCommand
@pwndbg.commands.OnlyWhenRunning @pwndbg.commands.OnlyWhenRunning

View File

@ -1,7 +1,8 @@
import gdb import gdb
import pwndbg.vmmap
import pwndbg.commands
import pwndbg.color import pwndbg.color
import pwndbg.commands
import pwndbg.vmmap
@pwndbg.commands.ParsedCommand @pwndbg.commands.ParsedCommand
@pwndbg.commands.OnlyWhenRunning @pwndbg.commands.OnlyWhenRunning

View File

@ -1,11 +1,13 @@
import codecs import codecs
import gdb
import math import math
import gdb
import pwndbg.arch import pwndbg.arch
import pwndbg.commands import pwndbg.commands
import pwndbg.memory import pwndbg.memory
import pwndbg.typeinfo
import pwndbg.strings import pwndbg.strings
import pwndbg.typeinfo
def get_type(size): def get_type(size):
return { return {

View File

@ -1,10 +1,11 @@
import gdb
import collections import collections
import gdb
import pwndbg.arch
import pwndbg.color import pwndbg.color
import pwndbg.disasm_powerpc import pwndbg.disasm_powerpc
import pwndbg.memory
import pwndbg.arch
import pwndbg.ida import pwndbg.ida
import pwndbg.memory
import pwndbg.symbol import pwndbg.symbol
Instruction = collections.namedtuple('Instruction', ['address', 'length', 'asm']) Instruction = collections.namedtuple('Instruction', ['address', 'length', 'asm'])

View File

@ -1,15 +1,16 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import gdb
import glob import glob
import os import os
import re import re
import subprocess import subprocess
import tempfile import tempfile
import gdb
import pwndbg.memory import pwndbg.memory
import pwndbg.typeinfo import pwndbg.typeinfo
def get_type(v): def get_type(v):
t = v.type t = v.type
while not t.name: while not t.name:

View File

@ -8,18 +8,19 @@ This is necessary for when access to /proc is restricted, or when
working on a BSD system which simply does not have /proc. working on a BSD system which simply does not have /proc.
""" """
from __future__ import print_function from __future__ import print_function
import gdb
import os import os
import re import re
import subprocess import subprocess
import tempfile import tempfile
import gdb
import pwndbg.auxv
import pwndbg.events import pwndbg.events
import pwndbg.info import pwndbg.info
import pwndbg.memory
import pwndbg.memoize import pwndbg.memoize
import pwndbg.memory
import pwndbg.stack import pwndbg.stack
import pwndbg.auxv
import pwndbg.typeinfo import pwndbg.typeinfo
# ELF constants # ELF constants

View File

@ -1,14 +1,14 @@
import gdb
import string import string
import pwndbg.symbol
import pwndbg.memory import gdb
import pwndbg.arch
import pwndbg.color import pwndbg.color
import pwndbg.typeinfo
import pwndbg.strings
import pwndbg.disasm import pwndbg.disasm
import pwndbg.memoize import pwndbg.memoize
import pwndbg.arch import pwndbg.memory
import string import pwndbg.strings
import pwndbg.symbol
import pwndbg.typeinfo
bad_instrs = [ bad_instrs = [
'.byte', '.byte',

View File

@ -1,6 +1,7 @@
import gdb
import traceback import traceback
import gdb
debug = False debug = False
pause = 0 pause = 0

View File

@ -1,8 +1,10 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import tempfile
import gdb import gdb
import pwndbg.remote import pwndbg.remote
import tempfile
def get(path): def get(path):
""" """
@ -25,5 +27,3 @@ def get(path):
with open(local_path,'rb') as f: with open(local_path,'rb') as f:
return f.read() return f.read()

View File

@ -1,9 +1,9 @@
import gdb import gdb
import pwndbg.typeinfo
import pwndbg.arch import pwndbg.arch
import pwndbg.typeinfo
import pwndbg.regs
import pwndbg.memory import pwndbg.memory
import pwndbg.regs
import pwndbg.typeinfo
def arguments(): def arguments():
""" """

View File

@ -1,9 +1,10 @@
import gdb import collections
import platform
import pwndbg.arch
import glob import glob
import os import os
import collections import platform
import gdb
import pwndbg.arch
def flags(): def flags():
@ -72,5 +73,3 @@ def which_binutils(util, **kwargs):
res = sorted(glob.glob(os.path.join(dir, pattern))) res = sorted(glob.glob(os.path.join(dir, pattern)))
if res: if res:
return res[0] return res[0]

View File

@ -1,5 +1,6 @@
import copy import copy
import string import string
import pwndbg.color import pwndbg.color
@ -80,4 +81,3 @@ def hexdump(data, address = 0, width = 16, skip = True):
hexline.append("%#08x " % (base + len(data))) hexline.append("%#08x " % (base + len(data)))
yield ''.join(hexline) yield ''.join(hexline)

View File

@ -1,13 +1,14 @@
import gdb
import pwndbg.memory
import pwndbg.events
import pwndbg.regs
import pwndbg.memoize
import pwndbg.elf
import pwndbg.arch
import socket import socket
from contextlib import closing from contextlib import closing
import gdb
import pwndbg.arch
import pwndbg.elf
import pwndbg.events
import pwndbg.memoize
import pwndbg.memory
import pwndbg.regs
try: try:
import xmlrpc.client as xmlrpclib import xmlrpc.client as xmlrpclib
except: except:

View File

@ -1,7 +1,7 @@
import gdb import gdb
import pwndbg.memoize import pwndbg.memoize
@pwndbg.memoize.reset_on_exit @pwndbg.memoize.reset_on_exit
def proc_mapping(): def proc_mapping():
try: try:

View File

@ -1,8 +1,9 @@
# This hook is necessary for compatibility with Python2.7 versions of GDB # This hook is necessary for compatibility with Python2.7 versions of GDB
# since they cannot directly cast to integer a gdb.Value object that is # since they cannot directly cast to integer a gdb.Value object that is
# not already an integer type. # not already an integer type.
import gdb
import sys import sys
import gdb
import pwndbg.typeinfo import pwndbg.typeinfo
if sys.version_info < (3,0): if sys.version_info < (3,0):

View File

@ -1,9 +1,10 @@
from __future__ import print_function from __future__ import print_function
import gdb import gdb
import pwndbg.elf
import pwndbg.events import pwndbg.events
import pwndbg.memoize import pwndbg.memoize
import pwndbg.memory import pwndbg.memory
import pwndbg.elf
@pwndbg.events.new_objfile @pwndbg.events.new_objfile

View File

@ -1,12 +1,14 @@
from __future__ import print_function from __future__ import print_function
import copy
import collections import collections
import gdb import copy
import functools import functools
import sys import sys
import gdb
import pwndbg.events import pwndbg.events
class memoize(object): class memoize(object):
def __call__(self, *args): def __call__(self, *args):
if not isinstance(args, collections.Hashable): if not isinstance(args, collections.Hashable):
@ -80,4 +82,3 @@ class reset_on_objfile(memoize):
def __reset(): def __reset():
for obj in reset_on_objfile.caches: for obj in reset_on_objfile.caches:
obj.clear() obj.clear()

View File

@ -2,6 +2,7 @@ import gdb
import pwndbg.disasm import pwndbg.disasm
import pwndbg.regs import pwndbg.regs
def next_branch(callback, address=None): def next_branch(callback, address=None):
if address is None: if address is None:
address = pwndbg.regs.pc address = pwndbg.regs.pc

View File

@ -1,9 +1,10 @@
import gdb
import sys import sys
from types import ModuleType from types import ModuleType
import gdb
import pwndbg.memoize import pwndbg.memoize
class module(ModuleType): class module(ModuleType):
@property @property
def pid(self): def pid(self):

View File

@ -1,10 +1,12 @@
import gdb
import sys
import re import re
import sys
from types import ModuleType from types import ModuleType
import pwndbg.memoize import gdb
import pwndbg.arch import pwndbg.arch
import pwndbg.memoize
class RegisterSet(object): class RegisterSet(object):
def __init__(self, pc, stack, frame, retaddr, flags, gpr, misc, args): def __init__(self, pc, stack, frame, retaddr, flags, gpr, misc, args):
self.pc = pc self.pc = pc

View File

@ -2,5 +2,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import gdb import gdb
def is_remote(): def is_remote():
return 'serial line' in gdb.execute('info program',to_string=True) return 'serial line' in gdb.execute('info program',to_string=True)

View File

@ -1,8 +1,10 @@
import gdb
import struct import struct
import gdb
import pwndbg.memory import pwndbg.memory
import pwndbg.vmmap
import pwndbg.typeinfo import pwndbg.typeinfo
import pwndbg.vmmap
def search(searchfor): def search(searchfor):
value = searchfor value = searchfor

View File

@ -1,8 +1,7 @@
import gdb import gdb
import pwndbg.events import pwndbg.events
import pwndbg.memory
import pwndbg.memoize import pwndbg.memoize
import pwndbg.memory
# Dictionary of stack ranges. # Dictionary of stack ranges.
# Key is the gdb thread ptid # Key is the gdb thread ptid
@ -90,4 +89,3 @@ def is_executable():
nx = True nx = True
return not nx return not nx

View File

@ -1,7 +1,8 @@
import gdb
import string import string
import pwndbg.typeinfo
import gdb
import pwndbg.events import pwndbg.events
import pwndbg.typeinfo
length = 15 length = 15

View File

@ -1,9 +1,10 @@
import gdb import gdb
import pwndbg.elf
import pwndbg.ida
import pwndbg.memoize import pwndbg.memoize
import pwndbg.memory import pwndbg.memory
import pwndbg.stack import pwndbg.stack
import pwndbg.ida
import pwndbg.elf
@pwndbg.memoize.reset_on_objfile @pwndbg.memoize.reset_on_objfile
def get(address): def get(address):

View File

@ -1,12 +1,12 @@
import os
import sys
import gdb
import glob import glob
import tempfile import os
import subprocess import subprocess
import sys
import tempfile
import pwndbg.gcc import gdb
import pwndbg.events import pwndbg.events
import pwndbg.gcc
import pwndbg.memoize import pwndbg.memoize
module = sys.modules[__name__] module = sys.modules[__name__]

View File

@ -1,6 +1,11 @@
import struct, termios, fcntl, sys import fcntl
import struct
import sys
import termios
import pwndbg.arch import pwndbg.arch
def banner(title): def banner(title):
title = title.upper() title = title.upper()
try: try:

View File

@ -7,19 +7,19 @@ address ranges with various ELF files and permissions.
The reason that we need robustness is that not every operating The reason that we need robustness is that not every operating
system has /proc/$$/maps, which backs 'info proc mapping'. system has /proc/$$/maps, which backs 'info proc mapping'.
""" """
import gdb
import sys import sys
import pwndbg.remote import gdb
import pwndbg.memory
import pwndbg.typeinfo
import pwndbg.file
import pwndbg.proc
import pwndbg.compat import pwndbg.compat
import pwndbg.memoize
import pwndbg.stack
import pwndbg.events import pwndbg.events
import pwndbg.file
import pwndbg.memoize
import pwndbg.memory
import pwndbg.proc
import pwndbg.regs import pwndbg.regs
import pwndbg.remote
import pwndbg.stack
import pwndbg.typeinfo
# List of manually-explored pages which were discovered # List of manually-explored pages which were discovered
# by analyzing the stack or register context. # by analyzing the stack or register context.