* Py3k

* Dont run py2 on CI

* Don't launch futurize on CI

* Move to latest isort options

* Modernize imports (isort>=5)

* Fix removed jump dir
This commit is contained in:
Disconnect3d 2020-08-15 21:27:47 +02:00 committed by GitHub
parent ccd8f76803
commit 301012abf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
154 changed files with 56 additions and 821 deletions

View File

@ -13,11 +13,6 @@ jobs:
path: ~/.cache/pip
key: ${{ matrix.os }}-cache-pip
- name: Set up Python 2.7
uses: actions/setup-python@v1
with:
python-version: 2.7
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
@ -25,13 +20,11 @@ jobs:
- name: Install linters
run: |
pip install isort future
pip install isort
- name: Run tests
run: |
futurize --all-imports --stage1 --print-function --write --unicode-literals pwndbg tests
git diff-index --quiet HEAD -- pwndbg tests
isort --check-only --diff --recursive pwndbg tests
python2.7 -m py_compile ida_script.py $(git ls-files 'pwndbg/*.py')
isort --check-only --diff pwndbg tests
python3 -m py_compile $(git ls-files 'pwndbg/*.py')

View File

@ -1,5 +1,4 @@
[settings]
indent=' '
not_skip = __init__.py
force_single_line = 1
known_third_party=capstone,unicorn,six,psutil,pycparser,gdb

View File

@ -24,8 +24,6 @@ Feel free to update the list below!
* Process properties can be retrieved thx to `pwndbg/proc.py` - e.g. using `pwndbg.proc.pid` will give us current process pid
* We have an inthook to make it easier to work with Python 2 and gdb.Value objects - see the docstring in `pwndbg/inthook.py` . Specifically, it makes it so that you can call `int()` on a `gdb.Value` instance and get what you want.
* We have a wrapper for handling exceptions that are thrown by commands - defined in `pwndbg/exception.py` - current approach seems to work fine - by using `set exception-verbose on` - we get a stacktrace. If we want to debug stuff we can always do `set exception-debugger on`.
* Some of pwndbg's functionality - e.g. memory fetching - require us to have an instance of proper `gdb.Type` - the problem with that is that there is no way to define our own types - we have to ask gdb if it detected particular type in this particular binary (that sucks). We do it in `pwndbg/typeinfo.py` and it works most of the time. The known bug with that is that it might not work properly for Golang binaries compiled with debugging symbols.

View File

@ -1,4 +1,4 @@
# pwndbg [![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://github.com/pwndbg/pwndbg/blob/dev/LICENSE.md) [![Py2&3](https://img.shields.io/badge/Python-2%20%26%203-green.svg)]() [![IRC](https://img.shields.io/badge/freenode-%23pwndbg-red.svg)](https://webchat.freenode.net/?channels=#pwndbg)
# pwndbg [![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://github.com/pwndbg/pwndbg/blob/dev/LICENSE.md) [![IRC](https://img.shields.io/badge/freenode-%23pwndbg-red.svg)](https://webchat.freenode.net/?channels=#pwndbg)
`pwndbg` (/poʊndbæg/) is a GDB plug-in that makes debugging with GDB suck less, with a focus on features needed by low-level software developers, hardware hackers, reverse-engineers and exploit developers.

View File

@ -1,31 +1,19 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
import locale
import sys
from os import path
import six
directory, file = path.split(__file__)
directory = path.expanduser(directory)
directory = path.abspath(directory)
sys.path.append(directory)
# this is an unconventional workaround to
# support unicode printing for python2
# https://github.com/pwndbg/pwndbg/issues/117
# on python3 it warns if the user has different
# encoding than utf-8
# warn if the user has different encoding than utf-8
encoding = locale.getpreferredencoding()
if six.PY2:
reload(sys)
sys.setdefaultencoding('utf-8')
elif encoding != 'UTF-8':
if encoding != 'UTF-8':
print('******')
print('Your encoding ({}) is different than UTF-8. pwndbg might not work properly.'.format(encoding))
print('You might try launching gdb with:')

View File

@ -1,10 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import signal
import gdb
@ -68,7 +63,6 @@ import pwndbg.elf
import pwndbg.exception
import pwndbg.gdbutils.functions
import pwndbg.heap
import pwndbg.inthook
import pwndbg.memory
import pwndbg.net
import pwndbg.proc
@ -88,6 +82,7 @@ version = __version__
try:
import unicorn
import pwndbg.emu
except:
pass

View File

@ -1,9 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import functools
import re
@ -13,7 +8,7 @@ import pwndbg.arch
import pwndbg.color.message as M
class ABI(object):
class ABI:
"""
Encapsulates information about a calling convention.
"""

View File

@ -1,10 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import gdb
import pwndbg.color.message as message

View File

@ -1,10 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import struct
import sys
@ -66,10 +61,6 @@ def update():
(8, 'big'): '>Q',
}.get((m.ptrsize, m.endian))
# Work around Python 2.7.6 struct.pack / unicode incompatibility
# See https://github.com/pwndbg/pwndbg/pull/336 for more information.
m.fmt = str(m.fmt)
# Attempt to detect the qemu-user binary name
if m.current == 'arm' and m.endian == 'big':
m.qemu = 'armeb'

View File

@ -4,11 +4,6 @@
Allows describing functions, specifically enumerating arguments which
may be passed in a combination of registers and stack values.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import gdb
from capstone import CS_GRP_CALL
from capstone import CS_GRP_INT

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import gdb

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import re

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import gdb

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import re

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import pwndbg.color.theme as theme
import pwndbg.config as config

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import pwndbg.color.theme as theme
import pwndbg.config as config

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import pwndbg.color.theme as theme
import pwndbg.config as config

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import capstone

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import pwndbg.color.theme as theme
import pwndbg.config as config

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import pwndbg.color.theme as theme
import pwndbg.config as config

View File

@ -1,12 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import re
import six
from pygments.lexer import RegexLexer
from pygments.lexer import include
from pygments.token import Comment
@ -116,20 +110,3 @@ class PwntoolsLexer(RegexLexer):
(r'[-*,.():]+', Punctuation)
]
}
# Note: convert all unicode() to str() if in Python2.7 since unicode_literals is enabled
# The pygments<=2.2.0 (latest stable when commit) in Python2.7 use 'str' type in rules matching
# We must convert all unicode back to str()
if six.PY2:
def _to_str(obj):
type_ = type(obj)
if type_ in (tuple, list):
return type_(map(_to_str, obj))
elif type_ is unicode:
return str(obj)
return obj
PwntoolsLexer.tokens = {
_to_str(k): _to_str(v)
for k, v in PwntoolsLexer.tokens.iteritems()
}

View File

@ -1,12 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import six
import pwndbg.color.theme as theme
import pwndbg.config as config
import pwndbg.vmmap
@ -62,7 +55,7 @@ def get(address, text = None):
old_color = color
color = lambda x: rwx(old_color(x))
if text is None and isinstance(address, six.integer_types) and address > 255:
if text is None and isinstance(address, int) and address > 255:
text = hex(int(address))
if text is None:
text = str(int(address))

View File

@ -1,8 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from pwndbg import config
from pwndbg.color import generateColorFunction

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import pwndbg.color.theme as theme
import pwndbg.config as config

View File

@ -1,8 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import itertools
import os.path
@ -15,8 +11,9 @@ from pwndbg.color import theme
try:
import pygments
import pygments.lexers
import pygments.formatters
import pygments.lexers
from pwndbg.color.lexer import PwntoolsLexer
except ImportError:
pygments = None

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import pwndbg.color.theme as theme
import pwndbg.config as config

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import pwndbg.config

View File

@ -1,15 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import functools
import gdb
import six
import pwndbg.chain
import pwndbg.color
@ -297,13 +291,13 @@ class _ArgparsedCommand(Command):
return tuple(), vars(self.parser.parse_args(argv))
class ArgparsedCommand(object):
class ArgparsedCommand:
"""Adds documentation and offloads parsing for a Command via argparse"""
def __init__(self, parser_or_desc, aliases=[]):
"""
:param parser_or_desc: `argparse.ArgumentParser` instance or `str`
"""
if isinstance(parser_or_desc, six.string_types):
if isinstance(parser_or_desc, str):
self.parser = argparse.ArgumentParser(description=parser_or_desc)
else:
self.parser = parser_or_desc

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import subprocess

View File

@ -1,12 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import six
import pwndbg.auxv
import pwndbg.chain
import pwndbg.commands
@ -17,4 +10,4 @@ import pwndbg.commands
def auxv():
for k, v in sorted(pwndbg.auxv.get().items()):
if v is not None:
print(k.ljust(24), v if not isinstance(v, six.integer_types) else pwndbg.chain.format(v))
print(k.ljust(24), v if not isinstance(v, int) else pwndbg.chain.format(v))

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import pwndbg.auxv
import pwndbg.commands

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import pwndbg.commands
import pwndbg.which

View File

@ -3,10 +3,6 @@
"""
Dumps all pwndbg-specific configuration points.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import ast
@ -75,7 +71,7 @@ def validate_context_sections():
config_context_sections.revert_default()
return
class StdOutput(object):
class StdOutput:
"""A context manager wrapper to give stdout"""
def __enter__(self):
return sys.stdout
@ -86,7 +82,7 @@ class StdOutput(object):
def __eq__(self, other):
return type(other) is StdOutput
class FileOutput(object):
class FileOutput:
"""A context manager wrapper to reopen files on enter"""
def __init__(self, *args):
self.args = args
@ -101,7 +97,7 @@ class FileOutput(object):
def __eq__(self, other):
return self.args == other.args
class CallOutput(object):
class CallOutput:
"""A context manager which calls a function on write"""
def __init__(self, func):
self.func = func

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import pwndbg.arch
import pwndbg.commands

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from elftools.elf.elffile import ELFFile

View File

@ -5,10 +5,6 @@ Compatibility functionality for GDBINIT users.
https://github.com/gdbinit/Gdbinit/blob/master/gdbinit
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse

View File

@ -1,16 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import ctypes
import struct
import gdb
import six
import pwndbg.color.context as C
import pwndbg.color.memory as M

View File

@ -1,14 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import gdb
import six
import pwndbg.arch
import pwndbg.commands
@ -26,14 +20,14 @@ pwndbg.config.Parameter('hexdump-bytes',
def address_or_module_name(s):
gdbval_or_str = pwndbg.commands.sloppy_gdb_parse(s)
if isinstance(gdbval_or_str, six.string_types):
if isinstance(gdbval_or_str, str):
module_name = gdbval_or_str
pages = list(filter(lambda page: module_name in page.objfile, pwndbg.vmmap.get()))
if pages:
return pages[0].vaddr
else:
raise argparse.ArgumentError('Could not find pages for module %s' % module_name)
elif isinstance(gdbval_or_str, six.integer_types + (gdb.Value,)):
elif isinstance(gdbval_or_str, (int, gdb.Value)):
addr = gdbval_or_str
return addr
else:

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import bz2

View File

@ -3,10 +3,6 @@
"""
Find a chain of leaks given some starting address.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
from queue import *

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import errno as _errno

View File

@ -1,13 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import gdb
import pwndbg.chain
import pwndbg.commands
import pwndbg.enhance

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import codecs

View File

@ -3,10 +3,6 @@
"""
Stepping until an event occurs
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import sys

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import os

View File

@ -1,13 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import argparse
import math
import os
import gdb

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import string

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import subprocess

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import imp
import os

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import re

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import subprocess

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import binascii
@ -118,10 +114,6 @@ def search(type, hex, string, executable, writable, value, mapping_name, save, n
'qword': 'Q'
}[type]
# Work around Python 2.7.6 struct.pack / unicode incompatibility
# See https://github.com/pwndbg/pwndbg/pull/336 for more information.
fmt = str(fmt)
try:
value = struct.pack(fmt, value)
except struct.error as e:

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import gdb

View File

@ -3,10 +3,6 @@
"""
Wrapper for shell commands.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os

View File

@ -1,7 +1,3 @@
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import gdb

View File

@ -4,13 +4,9 @@
Launches the target process after setting a breakpoint at a convenient
entry point.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import shlex
from shlex import quote
import gdb
@ -19,15 +15,6 @@ import pwndbg.elf
import pwndbg.events
import pwndbg.symbol
# Py 2 vs Py 3
try:
from shlex import quote
except ImportError:
from pipes import quote
break_on_first_instruction = False

View File

@ -5,10 +5,6 @@ Prints out pointer chains starting at some address in memory.
Generally used to print out the stack or register values.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import collections

View File

@ -3,10 +3,6 @@
"""
Dumps all pwndbg-specific theme configuration points.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse

View File

@ -4,10 +4,6 @@
Displays gdb, python and pwndbg versions.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import os

View File

@ -3,15 +3,9 @@
"""
Command to print the virtual memory map a la /proc/self/maps.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import gdb
import six
from elftools.elf.constants import SH_FLAGS
from elftools.elf.elffile import ELFFile
@ -20,13 +14,12 @@ import pwndbg.commands
import pwndbg.elf
import pwndbg.vmmap
integer_types = six.integer_types + (gdb.Value,)
integer_types = (int, gdb.Value)
def pages_filter(gdbval_or_str):
# returns a module filter
if isinstance(gdbval_or_str, six.string_types):
if isinstance(gdbval_or_str, str):
module_name = gdbval_or_str
return lambda page: module_name in page.objfile

View File

@ -3,10 +3,6 @@
"""
Compatibility functionality for Windbg users.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import codecs

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import subprocess

View File

@ -1,14 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import gdb
import six
import pwndbg.commands
import pwndbg.memory
@ -37,7 +31,7 @@ def xor(address, key, count):
XOR ``count`` bytes at ``address`` with the key ``key``.
'''
if not isinstance(address, six.integer_types):
if not isinstance(address, int):
try:
address = int(address, 0)
except ValueError:
@ -60,7 +54,7 @@ def memfrob(address, count):
Run the memfrob command on a region of memory
'''
if not isinstance(address, six.integer_types):
if not isinstance(address, int):
try:
address = int(address, 0)
except ValueError:

View File

@ -17,11 +17,6 @@ module, for example:
>>> int(pwndbg.config.example_value)
7
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import codecs
import collections
import re
@ -30,7 +25,6 @@ import types
from functools import total_ordering
import gdb
import six
import pwndbg.decorators
@ -42,20 +36,18 @@ TYPES[bool] = gdb.PARAM_BOOLEAN
# The value is an integer.
# This is like PARAM_INTEGER, except 0 is interpreted as itself.
for typ in six.integer_types:
TYPES[typ] = gdb.PARAM_ZINTEGER
TYPES[int] = gdb.PARAM_ZINTEGER
# The value is a string.
# When the user modifies the string, any escape sequences,
# such as \t, \f, and octal escapes, are translated into
# corresponding characters and encoded into the current host charset.
for typ in six.string_types:
TYPES[typ] = gdb.PARAM_STRING
TYPES[str] = gdb.PARAM_STRING
triggers = collections.defaultdict(lambda: [])
class Trigger(object):
class Trigger:
def __init__(self, names):
if not isinstance(names, list):
names = [names]
@ -150,11 +142,11 @@ class Parameter(gdb.Parameter):
value = self.raw_value
# For string value, convert utf8 byte string to unicode.
if isinstance(value, six.binary_type):
if isinstance(value, bytes):
value = codecs.decode(value, 'utf-8')
# Remove surrounded ' and " characters
if isinstance(value, six.string_types):
if isinstance(value, str):
# The first character must be ' or " and ends with the same character.
# See PR #404 for more information
pattern = r"^(?P<quote>[\"'])(?P<content>.*?)(?P=quote)$"

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import pwndbg.arch

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .constant import Constant

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .constant import Constant

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .constant import Constant

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .constant import Constant

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
class Constant(int):

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .constant import Constant

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .constant import Constant

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .constant import Constant

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .constant import Constant

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .constant import Constant

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import platform

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .constant import Constant

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .constant import Constant

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .constant import Constant

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .constant import Constant

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .constant import Constant

View File

@ -7,10 +7,6 @@ is declared.
We need to catch on the fly. We do this by swapping out the base classes of the
Structure type, and incurring a performance penalty for foreign-endianness targets.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import ctypes
import sys

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import functools

View File

@ -4,10 +4,6 @@
Functionality for disassmebling code at an address, or at an
address +/- a few instructions.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import collections
@ -18,7 +14,6 @@ from capstone import *
import pwndbg.arch
import pwndbg.disasm.arch
import pwndbg.ida
import pwndbg.jump
import pwndbg.memoize
import pwndbg.memory
import pwndbg.symbol

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import collections
@ -27,7 +23,7 @@ for value1, name1 in dict(access).items():
access.setdefault(value1 | value2, '%s | %s' % (name1, name2))
class DisassemblyAssistant(object):
class DisassemblyAssistant:
# Registry of all instances, {architecture: instance}
assistants = {}

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import collections

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from capstone import CS_GRP_JUMP

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import collections

View File

@ -3,10 +3,6 @@
"""
Prints structures in a manner similar to Windbg's "dt" command.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import glob
import os

View File

@ -7,10 +7,6 @@ all of the address spaces and permissions of an ELF file in memory.
This is necessary for when access to /proc is restricted, or when
working on a BSD system which simply does not have /proc.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import ctypes
import sys

View File

@ -29,16 +29,9 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import ctypes
import sys
import six
import pwndbg.arch
import pwndbg.ctypes
import pwndbg.events

View File

@ -1,8 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import pwndbg.emu.x86

Some files were not shown because too many files have changed in this diff Show More