Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change all imports to absolute per PEP-328, and sort imports #832

Merged
merged 1 commit into from
Jan 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pwn/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Promote useful stuff to toplevel
from .toplevel import *
from __future__ import absolute_import

from pwn.toplevel import *

pwnlib.args.initialize()
pwnlib.log.install_default_handler()
Expand Down
4 changes: 3 additions & 1 deletion pwnlib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from __future__ import absolute_import

import importlib

from .version import __version__
from pwnlib.version import __version__

version = __version__

Expand Down
6 changes: 4 additions & 2 deletions pwnlib/abi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
from .context import LocalContext
from .context import context
from __future__ import absolute_import

from pwnlib.context import LocalContext
from pwnlib.context import context


class ABI(object):
Expand Down
6 changes: 4 additions & 2 deletions pwnlib/adb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
from .adb import *
from .protocol import Client
from __future__ import absolute_import

from pwnlib.adb.adb import *
from pwnlib.adb.protocol import Client
18 changes: 10 additions & 8 deletions pwnlib/adb/adb.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
adb.write('/data/local/tmp/foo', 'my data')

"""
from __future__ import absolute_import

import functools
import glob
import logging
Expand All @@ -57,14 +59,14 @@

import dateutil.parser

from .. import atexit
from .. import tubes
from ..context import LocalContext
from ..context import context
from ..device import Device
from ..log import getLogger
from ..util import misc
from .protocol import Client
from pwnlib import atexit
from pwnlib import tubes
from pwnlib.adb.protocol import Client
from pwnlib.context import LocalContext
from pwnlib.context import context
from pwnlib.device import Device
from pwnlib.log import getLogger
from pwnlib.util import misc

log = getLogger(__name__)

Expand Down
24 changes: 13 additions & 11 deletions pwnlib/adb/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@
Documentation is available here:
https://android.googlesource.com/platform/system/core/+/master/adb/protocol.txt
"""
from __future__ import absolute_import

import functools
import stat
import time

from ..context import context
from ..log import Logger
from ..log import getLogger
from ..tubes.listen import listen
from ..tubes.process import process
from ..tubes.remote import remote
from ..util.lists import group
from ..util.misc import size
from ..util.packing import p32
from ..util.proc import pidof
from ..util.sh_string import sh_string
from pwnlib.context import context
from pwnlib.log import Logger
from pwnlib.log import getLogger
from pwnlib.tubes.listen import listen
from pwnlib.tubes.process import process
from pwnlib.tubes.remote import remote
from pwnlib.util.lists import group
from pwnlib.util.misc import size
from pwnlib.util.packing import p32
from pwnlib.util.proc import pidof
from pwnlib.util.sh_string import sh_string

log = getLogger(__name__)

Expand Down
6 changes: 4 additions & 2 deletions pwnlib/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@
The full list of supported "magic arguments" and their effects are listed
below.
"""
from __future__ import absolute_import

import collections
import logging
import os
import string
import sys

from . import term
from .context import context
from pwnlib import term
from pwnlib.context import context

term_mode = True
args = collections.defaultdict(str)
Expand Down
12 changes: 7 additions & 5 deletions pwnlib/asm.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
' 0: b8 0b 00 00 00 mov eax,0xb'

"""
from __future__ import absolute_import

import errno
import os
import platform
Expand All @@ -53,11 +55,11 @@
from os import environ
from os import path

from . import atexit
from . import shellcraft
from .context import LocalContext
from .context import context
from .log import getLogger
from pwnlib import atexit
from pwnlib import shellcraft
from pwnlib.context import LocalContext
from pwnlib.context import context
from pwnlib.log import getLogger

log = getLogger(__name__)

Expand Down
3 changes: 2 additions & 1 deletion pwnlib/atexception.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
Analogous to atexit, this module allows the programmer to register functions to
be run if an unhandled exception occurs.
"""
from __future__ import absolute_import

import sys
import threading
import traceback

from .context import context
from pwnlib.context import context

__all__ = ['register', 'unregister']

Expand Down
3 changes: 2 additions & 1 deletion pwnlib/atexit.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
This module also fixes a the issue that exceptions raised by an exit handler is
printed twice when the standard :mod:`atexit` is used.
"""
from __future__ import absolute_import

import sys
import threading
import traceback

from .context import context
from pwnlib.context import context

__all__ = ['register', 'unregister']

Expand Down
5 changes: 3 additions & 2 deletions pwnlib/commandline/asm.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/env python2
from __future__ import absolute_import

import argparse
import sys

from pwn import *

from . import common
from pwnlib.commandline import common

parser = common.parser_commands.add_parser(
'asm',
Expand Down
5 changes: 3 additions & 2 deletions pwnlib/commandline/checksec.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/env python2
from __future__ import absolute_import

import argparse
import sys

from pwn import *

from . import common
from pwnlib.commandline import common

parser = common.parser_commands.add_parser(
'checksec',
Expand Down
4 changes: 2 additions & 2 deletions pwnlib/commandline/constgrep.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env python2
from __future__ import absolute_import

import argparse
import os
import re

from pwn import *

from . import common
from pwnlib.commandline import common

p = common.parser_commands.add_parser(
'constgrep',
Expand Down
5 changes: 3 additions & 2 deletions pwnlib/commandline/cyclic.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/usr/bin/env python2
from __future__ import absolute_import

import argparse
import string
import sys

from pwn import *

from . import common
from pwnlib.commandline import common

parser = common.parser_commands.add_parser(
'cyclic',
Expand Down
5 changes: 3 additions & 2 deletions pwnlib/commandline/disasm.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/usr/bin/env python2
from __future__ import absolute_import

import argparse
import string
import sys

from pwn import *

from . import common
from pwnlib.commandline import common

parser = common.parser_commands.add_parser(
'disasm',
Expand Down
5 changes: 3 additions & 2 deletions pwnlib/commandline/elfdiff.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/usr/bin/env python2
from __future__ import absolute_import

import shutil
from argparse import ArgumentParser
from subprocess import CalledProcessError
from subprocess import check_output
from tempfile import NamedTemporaryFile

from pwn import *

from . import common
from pwnlib.commandline import common


def dump(objdump, path):
Expand Down
5 changes: 3 additions & 2 deletions pwnlib/commandline/elfpatch.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/env python2
from __future__ import absolute_import

import argparse
import sys

from pwn import *

from . import common
from pwnlib.commandline import common

p = common.parser_commands.add_parser(
'elfpatch',
Expand Down
4 changes: 3 additions & 1 deletion pwnlib/commandline/errno.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from __future__ import absolute_import

import argparse
import os

from . import common
from pwnlib.commandline import common

parser = common.parser_commands.add_parser(
'errno',
Expand Down
4 changes: 3 additions & 1 deletion pwnlib/commandline/hex.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/usr/bin/env python2
from __future__ import absolute_import

import argparse
import sys

from . import common
from pwnlib.commandline import common

parser = common.parser_commands.add_parser(
'hex',
Expand Down
38 changes: 20 additions & 18 deletions pwnlib/commandline/main.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
from __future__ import absolute_import

import sys

from . import asm
from . import checksec
from . import common
from . import constgrep
from . import cyclic
from . import disasm
from . import elfdiff
from . import elfpatch
from . import errno
from . import hex
from . import phd
from . import pwnstrip
from . import scramble
from . import shellcraft
from . import unhex
from . import update
from ..context import context
from .common import parser
from pwnlib.commandline import asm
from pwnlib.commandline import checksec
from pwnlib.commandline import common
from pwnlib.commandline import constgrep
from pwnlib.commandline import cyclic
from pwnlib.commandline import disasm
from pwnlib.commandline import elfdiff
from pwnlib.commandline import elfpatch
from pwnlib.commandline import errno
from pwnlib.commandline import hex
from pwnlib.commandline import phd
from pwnlib.commandline import pwnstrip
from pwnlib.commandline import scramble
from pwnlib.commandline import shellcraft
from pwnlib.commandline import unhex
from pwnlib.commandline import update
from pwnlib.commandline.common import parser
from pwnlib.context import context

commands = {
'asm': asm.main,
Expand Down
5 changes: 3 additions & 2 deletions pwnlib/commandline/phd.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/usr/bin/env python2
from __future__ import absolute_import

import argparse
import os
import sys

from pwn import *

from . import common
from pwnlib.commandline import common

parser = common.parser_commands.add_parser(
'phd',
Expand Down
5 changes: 3 additions & 2 deletions pwnlib/commandline/pwnstrip.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import absolute_import

import argparse

from pwn import *

from . import common
from pwnlib.commandline import common

p = common.parser_commands.add_parser(
'pwnstrip',
Expand Down
5 changes: 3 additions & 2 deletions pwnlib/commandline/scramble.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from __future__ import absolute_import

import argparse
import sys

from pwn import *

from . import common
from pwnlib.commandline import common

parser = common.parser_commands.add_parser(
'scramble',
Expand Down
Loading