mirror of https://github.com/pwndbg/pwndbg
Sort imports
This commit is contained in:
parent
b6ac73a0e7
commit
1b36cbc5a3
|
@ -8,4 +8,3 @@ directory = path.abspath(directory)
|
||||||
sys.path.append(directory)
|
sys.path.append(directory)
|
||||||
|
|
||||||
import pwndbg
|
import pwndbg
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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'
|
||||||
|
@ -39,4 +40,4 @@ def pack(integer):
|
||||||
return struct.pack(fmt, integer & ptrmask)
|
return struct.pack(fmt, integer & ptrmask)
|
||||||
|
|
||||||
def unpack(data):
|
def unpack(data):
|
||||||
return struct.unpack(fmt, data)[0]
|
return struct.unpack(fmt, data)[0]
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
@ -58,4 +58,4 @@ def format(value):
|
||||||
if len(chain) == 1:
|
if len(chain) == 1:
|
||||||
return enhanced
|
return enhanced
|
||||||
|
|
||||||
return ' --> '.join(rest) + ' <-- ' + enhanced
|
return ' --> '.join(rest) + ' <-- ' + enhanced
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
import gdb
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
import gdb
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -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):
|
||||||
|
@ -19,4 +20,4 @@ class ida(gdb.Function):
|
||||||
def invoke(self, name):
|
def invoke(self, name):
|
||||||
return pwndbg.ida.LocByName(name.string())
|
return pwndbg.ida.LocByName(name.string())
|
||||||
|
|
||||||
ida()
|
ida()
|
||||||
|
|
|
@ -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
|
||||||
|
@ -64,4 +65,4 @@ def nearpc(pc=None, lines=None, to_string=False):
|
||||||
if not to_string:
|
if not to_string:
|
||||||
print('\n'.join(result))
|
print('\n'.join(result))
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
import gdb
|
import gdb
|
||||||
|
|
||||||
|
|
||||||
def pack(data, size=None):
|
def pack(data, size=None):
|
||||||
|
|
|
@ -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()
|
||||||
|
|
||||||
|
|
|
@ -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):
|
||||||
"""
|
"""
|
||||||
|
@ -17,4 +19,4 @@ def rop(start=None, stop=None):
|
||||||
'--rawMode=32',
|
'--rawMode=32',
|
||||||
'--binary=dump',
|
'--binary=dump',
|
||||||
'--offset=0xdeadbeef']
|
'--offset=0xdeadbeef']
|
||||||
os.system(' '.join(cmd))
|
os.system(' '.join(cmd))
|
||||||
|
|
|
@ -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):
|
||||||
|
@ -26,4 +29,4 @@ def search(value):
|
||||||
region = pwndbg.color.get(address, region)
|
region = pwndbg.color.get(address, region)
|
||||||
addr = pwndbg.color.get(address)
|
addr = pwndbg.color.get(address)
|
||||||
display = pwndbg.enhance.enhance(address)
|
display = pwndbg.enhance.enhance(address)
|
||||||
print(region,addr,display)
|
print(region,addr,display)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import gdb
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
import gdb
|
||||||
import pwndbg.commands
|
import pwndbg.commands
|
||||||
|
|
||||||
shellcmds = [
|
shellcmds = [
|
||||||
|
|
|
@ -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",
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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'])
|
||||||
|
@ -130,4 +131,4 @@ def color(ins):
|
||||||
if mnem in branches:
|
if mnem in branches:
|
||||||
asm = pwndbg.color.yellow(asm)
|
asm = pwndbg.color.yellow(asm)
|
||||||
asm += '\n'
|
asm += '\n'
|
||||||
return asm
|
return asm
|
||||||
|
|
|
@ -97,4 +97,4 @@ powerpc = """
|
||||||
bzlr+ bzlr- bzlrl+ bzlrl-
|
bzlr+ bzlr- bzlrl+ bzlrl-
|
||||||
""".strip().split()
|
""".strip().split()
|
||||||
|
|
||||||
branches = set(map(lambda x: x.rstrip('+-'), powerpc))
|
branches = set(map(lambda x: x.rstrip('+-'), powerpc))
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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
|
||||||
|
@ -283,4 +284,4 @@ def map_inner(ei_class, ehdr, objfile):
|
||||||
@pwndbg.events.stop
|
@pwndbg.events.stop
|
||||||
def update_main_exe():
|
def update_main_exe():
|
||||||
addr = int(exe().address)
|
addr = int(exe().address)
|
||||||
map(addr)
|
map(addr)
|
||||||
|
|
|
@ -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',
|
||||||
|
@ -134,4 +134,4 @@ def enhance(value):
|
||||||
if len(retval) == 1:
|
if len(retval) == 1:
|
||||||
return retval[0]
|
return retval[0]
|
||||||
|
|
||||||
return retval[0] + ' /* {} */'.format('; '.join(retval[1:]))
|
return retval[0] + ' /* {} */'.format('; '.join(retval[1:]))
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import gdb
|
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
|
import gdb
|
||||||
|
|
||||||
debug = False
|
debug = False
|
||||||
pause = 0
|
pause = 0
|
||||||
|
|
||||||
|
@ -52,4 +53,4 @@ def on_reload():
|
||||||
for event, functions in registered.items():
|
for event, functions in registered.items():
|
||||||
for function in functions:
|
for function in functions:
|
||||||
event.disconnect(function)
|
event.disconnect(function)
|
||||||
registered[event] = []
|
registered[event] = []
|
||||||
|
|
|
@ -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()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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():
|
||||||
"""
|
"""
|
||||||
|
@ -33,4 +33,4 @@ def argument(n):
|
||||||
|
|
||||||
sp = pwndbg.regs.sp + (n * pwndbg.arch.ptrsize)
|
sp = pwndbg.regs.sp + (n * pwndbg.arch.ptrsize)
|
||||||
|
|
||||||
return int(pwndbg.memory.poi(pwndbg.typeinfo.ppvoid, sp))
|
return int(pwndbg.memory.poi(pwndbg.typeinfo.ppvoid, sp))
|
||||||
|
|
|
@ -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]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -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:
|
||||||
|
@ -214,4 +215,4 @@ def isASCII(flags):
|
||||||
@withIDA
|
@withIDA
|
||||||
@pwndbg.memoize.reset_on_objfile
|
@pwndbg.memoize.reset_on_objfile
|
||||||
def isFunc(flags):
|
def isFunc(flags):
|
||||||
return _ida.isASCII(flags)
|
return _ida.isASCII(flags)
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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):
|
||||||
|
|
|
@ -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
|
||||||
|
@ -24,4 +25,4 @@ def find():
|
||||||
# pwntools/binjitsu. See the documentation there:
|
# pwntools/binjitsu. See the documentation there:
|
||||||
#
|
#
|
||||||
# - https://github.com/binjitsu/binjitsu/blob/master/pwnlib/dynelf.py
|
# - https://github.com/binjitsu/binjitsu/blob/master/pwnlib/dynelf.py
|
||||||
#
|
#
|
||||||
|
|
|
@ -15,4 +15,4 @@ def chunk2mem(p):
|
||||||
|
|
||||||
def mem2chunk(mem):
|
def mem2chunk(mem):
|
||||||
"conversion from user pointer to malloc header"
|
"conversion from user pointer to malloc header"
|
||||||
return p + (2-pwndbg.arch.ptrsize)
|
return p + (2-pwndbg.arch.ptrsize)
|
||||||
|
|
|
@ -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()
|
||||||
|
|
||||||
|
|
|
@ -149,4 +149,4 @@ class Page(object):
|
||||||
def __lt__(self, other):
|
def __lt__(self, other):
|
||||||
return self.vaddr < getattr(other, 'vaddr', other)
|
return self.vaddr < getattr(other, 'vaddr', other)
|
||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
return hash((self.vaddr, self.memsz, self.flags, self.offset, self.objfile))
|
return hash((self.vaddr, self.memsz, self.flags, self.offset, self.objfile))
|
||||||
|
|
|
@ -2,10 +2,11 @@ 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
|
||||||
|
|
||||||
# Disassemble forward until we find *any* branch instruction
|
# Disassemble forward until we find *any* branch instruction
|
||||||
# Set a temporary, internal breakpoint on it so the user is
|
# Set a temporary, internal breakpoint on it so the user is
|
||||||
# not bothered.
|
# not bothered.
|
||||||
|
|
|
@ -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):
|
||||||
|
@ -19,4 +20,4 @@ class module(ModuleType):
|
||||||
# To prevent garbage collection
|
# To prevent garbage collection
|
||||||
tether = sys.modules[__name__]
|
tether = sys.modules[__name__]
|
||||||
|
|
||||||
sys.modules[__name__] = module(__name__, '')
|
sys.modules[__name__] = module(__name__, '')
|
||||||
|
|
|
@ -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
|
||||||
|
@ -228,4 +230,4 @@ class module(ModuleType):
|
||||||
|
|
||||||
# To prevent garbage collection
|
# To prevent garbage collection
|
||||||
tether = sys.modules[__name__]
|
tether = sys.modules[__name__]
|
||||||
sys.modules[__name__] = module(__name__, '')
|
sys.modules[__name__] = module(__name__, '')
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
@ -34,4 +36,4 @@ def search(searchfor):
|
||||||
break
|
break
|
||||||
hits.append(start)
|
hits.append(start)
|
||||||
start += len(searchfor)
|
start += len(searchfor)
|
||||||
return hits
|
return hits
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
@ -34,4 +35,4 @@ def get(address):
|
||||||
if len(sz) < length:
|
if len(sz) < length:
|
||||||
return sz
|
return sz
|
||||||
|
|
||||||
return sz[:length] + '...'
|
return sz[:length] + '...'
|
||||||
|
|
|
@ -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):
|
||||||
|
@ -56,4 +57,4 @@ def address(symbol):
|
||||||
address = next(r for r in result if r.startswith('0x'))
|
address = next(r for r in result if r.startswith('0x'))
|
||||||
return int(address, 0)
|
return int(address, 0)
|
||||||
except gdb.error:
|
except gdb.error:
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -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__]
|
||||||
|
@ -116,4 +116,4 @@ def load(name):
|
||||||
with pwndbg.events.Pause():
|
with pwndbg.events.Pause():
|
||||||
gdb.execute('add-symbol-file %s.o 0' % filename, from_tty=False, to_string=True)
|
gdb.execute('add-symbol-file %s.o 0' % filename, from_tty=False, to_string=True)
|
||||||
|
|
||||||
return gdb.lookup_type(name)
|
return gdb.lookup_type(name)
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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.
|
||||||
|
@ -326,4 +326,4 @@ def check_aslr():
|
||||||
if "is off." in output:
|
if "is off." in output:
|
||||||
vmmap.aslr = True
|
vmmap.aslr = True
|
||||||
|
|
||||||
return vmmap.aslr
|
return vmmap.aslr
|
||||||
|
|
Loading…
Reference in New Issue