mirror of
https://github.com/Gallopsled/pwntools.git
synced 2026-10-12 02:02:27 +00:00
sorted imports with isort
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
[settings]
|
||||
indent=' '
|
||||
not_skip = __init__.py
|
||||
force_single_line = 1
|
||||
@@ -8,5 +8,6 @@ install:
|
||||
- python -c 'from pwn import *; print pwnlib.term.term_mode' NOTERM
|
||||
- python -c 'from pwn import *; print pwnlib.term.term_mode' NOTERM
|
||||
- python -c 'from pwn import *; print pwnlib.term.term_mode' NOTERM
|
||||
- isort --recursive --check .
|
||||
|
||||
script: PWNLIB_NOTERM=1 make -C docs doctest
|
||||
|
||||
+5
-2
@@ -11,7 +11,11 @@
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
import sys, os, subprocess
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import pwnlib
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
@@ -74,7 +78,6 @@ copyright = u'2015, Zach Riggle'
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
import pwnlib
|
||||
release = pwnlib.__version__
|
||||
version = release.rsplit('.', 1)[0]
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ Example showing the interface to `pwnlib.asm.asm` and `pwnlib.shellcraft`.
|
||||
"""
|
||||
|
||||
from pwn import *
|
||||
|
||||
context(arch='i386', os='linux')
|
||||
|
||||
shellcode = shellcraft.i386_to_amd64()
|
||||
|
||||
@@ -26,4 +26,3 @@ atexit.register(r.clean_and_log)
|
||||
while True:
|
||||
line = r.recvline()
|
||||
print re.findall('^prefix (\S+)$', line)[0]
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ Script to generate README.md
|
||||
|
||||
from pwn import *
|
||||
|
||||
|
||||
out = '''# Examples
|
||||
While these examples should all work, they are not very representative of
|
||||
the binjitsu project.
|
||||
|
||||
@@ -5,8 +5,8 @@ off some proof-of-concepts.
|
||||
"""
|
||||
|
||||
from pwn import *
|
||||
from pwnlib.term.completer import LongestPrefixCompleter, \
|
||||
PathCompleter
|
||||
from pwnlib.term.completer import LongestPrefixCompleter
|
||||
from pwnlib.term.completer import PathCompleter
|
||||
|
||||
c1 = LongestPrefixCompleter([
|
||||
'foobar',
|
||||
|
||||
@@ -3,9 +3,10 @@ Simple example showing how to use the remote
|
||||
gdb debugging features available in binjitsu.
|
||||
"""
|
||||
|
||||
from pwn import *
|
||||
import getpass
|
||||
|
||||
from pwn import *
|
||||
|
||||
s = ssh(getpass.getuser(), '127.0.0.1', port = 22, keyfile = "~/.ssh/id_rsa")
|
||||
c = gdb.ssh_gdb(s, '/bin/sh', execute = '''
|
||||
p/x $pc
|
||||
|
||||
+50
-33
@@ -1,41 +1,58 @@
|
||||
# Get all the modules from pwnlib
|
||||
from pwnlib import *
|
||||
import collections
|
||||
import math
|
||||
import operator
|
||||
import os
|
||||
import re
|
||||
import string
|
||||
import struct
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import threading
|
||||
import time
|
||||
|
||||
import pwnlib
|
||||
from pwnlib import *
|
||||
from pwnlib.asm import asm
|
||||
from pwnlib.asm import cpp
|
||||
from pwnlib.asm import disasm
|
||||
from pwnlib.context import Thread
|
||||
from pwnlib.context import context
|
||||
from pwnlib.dynelf import DynELF
|
||||
from pwnlib.elf import ELF
|
||||
from pwnlib.elf import load
|
||||
from pwnlib.exception import PwnlibException
|
||||
from pwnlib.log import getLogger
|
||||
from pwnlib.memleak import MemLeak
|
||||
from pwnlib.replacements import *
|
||||
from pwnlib.rop import ROP
|
||||
from pwnlib.timeout import Timeout
|
||||
from pwnlib.tubes.listen import listen
|
||||
from pwnlib.tubes.process import process
|
||||
from pwnlib.tubes.remote import remote
|
||||
from pwnlib.tubes.serialtube import serialtube
|
||||
from pwnlib.tubes.ssh import ssh
|
||||
from pwnlib.tubes.tube import tube
|
||||
from pwnlib.ui import *
|
||||
from pwnlib.util import crc
|
||||
from pwnlib.util import iters
|
||||
from pwnlib.util import net
|
||||
from pwnlib.util import proc
|
||||
from pwnlib.util import safeeval
|
||||
from pwnlib.util.cyclic import *
|
||||
from pwnlib.util.fiddling import *
|
||||
from pwnlib.util.hashes import *
|
||||
from pwnlib.util.lists import *
|
||||
from pwnlib.util.misc import *
|
||||
from pwnlib.util.packing import *
|
||||
from pwnlib.util.proc import pidof
|
||||
from pwnlib.util.splash import *
|
||||
from pwnlib.util.web import *
|
||||
|
||||
# Promote functions from these modules to toplevel
|
||||
from pwnlib.asm import asm, disasm, cpp
|
||||
from pwnlib.context import context, Thread
|
||||
from pwnlib.dynelf import DynELF
|
||||
from pwnlib.elf import ELF, load
|
||||
from pwnlib.exception import PwnlibException
|
||||
from pwnlib.log import getLogger
|
||||
from pwnlib.memleak import MemLeak
|
||||
from pwnlib.replacements import *
|
||||
from pwnlib.rop import ROP
|
||||
from pwnlib.timeout import Timeout
|
||||
from pwnlib.tubes.listen import listen
|
||||
from pwnlib.tubes.process import process
|
||||
from pwnlib.tubes.remote import remote
|
||||
from pwnlib.tubes.serialtube import serialtube
|
||||
from pwnlib.tubes.ssh import ssh
|
||||
from pwnlib.tubes.tube import tube
|
||||
from pwnlib.ui import *
|
||||
from pwnlib.util import crc, net, proc, iters, safeeval
|
||||
from pwnlib.util.cyclic import *
|
||||
from pwnlib.util.fiddling import *
|
||||
from pwnlib.util.hashes import *
|
||||
from pwnlib.util.lists import *
|
||||
from pwnlib.util.misc import *
|
||||
from pwnlib.util.packing import *
|
||||
from pwnlib.util.proc import pidof
|
||||
from pwnlib.util.splash import *
|
||||
from pwnlib.util.web import *
|
||||
|
||||
# Promote these modules, so that "from pwn import *" will let you access them
|
||||
import \
|
||||
collections , math , operator , os , \
|
||||
pwnlib , re , string , struct , \
|
||||
subprocess , sys , threading , time , \
|
||||
tempfile
|
||||
|
||||
try:
|
||||
import cPickle as pickle
|
||||
|
||||
+3
-1
@@ -1,5 +1,7 @@
|
||||
import importlib
|
||||
|
||||
from .version import __version__
|
||||
|
||||
version = __version__
|
||||
|
||||
__all__ = [
|
||||
@@ -27,4 +29,4 @@ __all__ = [
|
||||
]
|
||||
|
||||
for module in __all__:
|
||||
importlib.import_module('.%s' % module, 'pwnlib')
|
||||
importlib.import_module('.%s' % module, 'pwnlib')
|
||||
|
||||
+10
-3
@@ -39,12 +39,19 @@ Disassembly
|
||||
' 0: b8 0b 00 00 00 mov eax,0xb'
|
||||
|
||||
"""
|
||||
import tempfile, subprocess, shutil, tempfile, errno, platform, re
|
||||
import errno
|
||||
import platform
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
from collections import defaultdict
|
||||
from os import path, environ
|
||||
from glob import glob
|
||||
from .log import getLogger
|
||||
from os import environ
|
||||
from os import path
|
||||
|
||||
from .context import context
|
||||
from .log import getLogger
|
||||
|
||||
log = getLogger(__name__)
|
||||
|
||||
|
||||
@@ -3,7 +3,10 @@ Analogous to atexit, this module allows the programmer to register functions to
|
||||
be run if an unhandled exception occurs.
|
||||
"""
|
||||
|
||||
import sys, traceback, threading
|
||||
import sys
|
||||
import threading
|
||||
import traceback
|
||||
|
||||
from .context import context
|
||||
|
||||
__all__ = ['register', 'unregister']
|
||||
|
||||
+4
-1
@@ -8,7 +8,10 @@ This module also fixes a the issue that exceptions raised by an exit handler is
|
||||
printed twice when the standard :mod:`atexit` is used.
|
||||
"""
|
||||
|
||||
import sys, traceback, threading
|
||||
import sys
|
||||
import threading
|
||||
import traceback
|
||||
|
||||
from .context import context
|
||||
|
||||
__all__ = ['register', 'unregister']
|
||||
|
||||
@@ -1 +1 @@
|
||||
# empty
|
||||
# empty
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#!/usr/bin/env python2
|
||||
import argparse, sys
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
from pwn import *
|
||||
|
||||
from . import common
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
|
||||
@@ -14,4 +14,4 @@ def context_arg(arg):
|
||||
except Exception: arg
|
||||
try: context.endian = arg
|
||||
except Exception: pass
|
||||
return arg
|
||||
return arg
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#!/usr/bin/env python2
|
||||
|
||||
import argparse, os, re
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
|
||||
from pwn import *
|
||||
|
||||
from . import common
|
||||
|
||||
p = argparse.ArgumentParser(
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env python2
|
||||
import argparse, string, sys
|
||||
import argparse
|
||||
import string
|
||||
import sys
|
||||
|
||||
from pwn import *
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#!/usr/bin/env python2
|
||||
import argparse, sys, string
|
||||
import argparse
|
||||
import string
|
||||
import sys
|
||||
|
||||
from pwn import *
|
||||
from . import common
|
||||
|
||||
from . import common
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description = 'Disassemble bytes into text format'
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#!/usr/bin/env python2
|
||||
from argparse import ArgumentParser
|
||||
from subprocess import check_output, CalledProcessError
|
||||
from subprocess import CalledProcessError
|
||||
from subprocess import check_output
|
||||
from tempfile import NamedTemporaryFile
|
||||
|
||||
|
||||
def dump(x):
|
||||
n = NamedTemporaryFile(delete=False)
|
||||
o = check_output(['objdump','-d','-x','-s',x])
|
||||
@@ -24,4 +26,4 @@ def main():
|
||||
a = p.parse_args()
|
||||
print diff(dump(a.a), dump(a.b))
|
||||
|
||||
if __name__ == '__main__': main()
|
||||
if __name__ == '__main__': main()
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python2
|
||||
import argparse, sys
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
from pwn import *
|
||||
|
||||
p = argparse.ArgumentParser()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python2
|
||||
import sys, argparse
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
parser = argparse.ArgumentParser(description='''
|
||||
Hex-encodes data provided on the command line or via stdin.
|
||||
@@ -14,4 +15,4 @@ def main():
|
||||
else:
|
||||
print ' '.join(args.data).encode('hex')
|
||||
|
||||
if __name__ == '__main__': main()
|
||||
if __name__ == '__main__': main()
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env python2
|
||||
import argparse, sys, os
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
from pwn import *
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
#!/usr/bin/env python2
|
||||
import argparse, sys, os, types
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
import types
|
||||
|
||||
from pwn import *
|
||||
|
||||
from . import common
|
||||
|
||||
r = text.red
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python2
|
||||
import sys, argparse
|
||||
import argparse
|
||||
import sys
|
||||
from string import whitespace
|
||||
|
||||
parser = argparse.ArgumentParser(description='''
|
||||
@@ -19,4 +20,4 @@ def main():
|
||||
except TypeError, e:
|
||||
sys.stderr.write(str(e) + '\n')
|
||||
|
||||
if __name__ == '__main__': main()
|
||||
if __name__ == '__main__': main()
|
||||
|
||||
@@ -32,11 +32,14 @@ Example:
|
||||
4
|
||||
|
||||
"""
|
||||
import importlib
|
||||
import sys
|
||||
from types import ModuleType
|
||||
import importlib, sys
|
||||
|
||||
from ..context import context
|
||||
from ..util import safeeval
|
||||
|
||||
|
||||
class module(ModuleType):
|
||||
def __init__(self, submodules):
|
||||
super(module, self).__init__(__name__)
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import importlib
|
||||
import sys
|
||||
from types import ModuleType
|
||||
import importlib, sys
|
||||
|
||||
from ...context import context
|
||||
|
||||
|
||||
class module(ModuleType):
|
||||
def __init__(self, submodules):
|
||||
super(module, self).__init__(__name__)
|
||||
|
||||
@@ -4,9 +4,16 @@
|
||||
Implements context management so that nested/scoped contexts and threaded
|
||||
contexts work properly and as expected.
|
||||
"""
|
||||
import threading, collections, string, logging, time, sys
|
||||
import collections
|
||||
import logging
|
||||
import string
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
|
||||
from ..timeout import Timeout
|
||||
|
||||
|
||||
class _devnull(object):
|
||||
name = None
|
||||
def write(self, *a, **kw): pass
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python2
|
||||
import sys, re
|
||||
import re
|
||||
import sys
|
||||
|
||||
from pwnlib.util import safeeval
|
||||
|
||||
python = open(sys.argv[1], "w")
|
||||
|
||||
@@ -3,8 +3,11 @@
|
||||
Script for downloading lists of user agent strings
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
import urllib
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
import re, urllib, os
|
||||
from pwn import *
|
||||
|
||||
uas = set()
|
||||
|
||||
+7
-6
@@ -47,15 +47,16 @@ Example
|
||||
|
||||
DynELF
|
||||
"""
|
||||
from . import elf
|
||||
from .elf import ELF, constants
|
||||
from .memleak import MemLeak
|
||||
from .context import context
|
||||
from .log import getLogger
|
||||
import ctypes
|
||||
|
||||
from elftools.elf.enums import ENUM_D_TAG
|
||||
|
||||
import ctypes
|
||||
from . import elf
|
||||
from .context import context
|
||||
from .elf import ELF
|
||||
from .elf import constants
|
||||
from .log import getLogger
|
||||
from .memleak import MemLeak
|
||||
|
||||
log = getLogger(__name__)
|
||||
sizeof = ctypes.sizeof
|
||||
|
||||
+13
-8
@@ -1,16 +1,21 @@
|
||||
"""Exposes functionality for manipulating ELF files
|
||||
"""
|
||||
from ..term import text
|
||||
from .datatypes import *
|
||||
from ..asm import asm, disasm
|
||||
from ..util import misc
|
||||
from ..log import getLogger
|
||||
import mmap
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
import mmap, subprocess, os
|
||||
from elftools.elf.constants import P_FLAGS
|
||||
from elftools.elf.constants import SHN_INDICES
|
||||
from elftools.elf.descriptions import describe_e_type
|
||||
from elftools.elf.elffile import ELFFile
|
||||
from elftools.elf.sections import SymbolTableSection
|
||||
from elftools.elf.descriptions import describe_e_type
|
||||
from elftools.elf.constants import P_FLAGS, SHN_INDICES
|
||||
|
||||
from ..asm import asm
|
||||
from ..asm import disasm
|
||||
from ..log import getLogger
|
||||
from ..term import text
|
||||
from ..util import misc
|
||||
from .datatypes import *
|
||||
|
||||
log = getLogger(__name__)
|
||||
|
||||
|
||||
+3
-1
@@ -1,5 +1,7 @@
|
||||
__all__ = ['PwnlibException']
|
||||
import traceback, sys
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
|
||||
class PwnlibException(Exception):
|
||||
'''Exception thrown by :func:`pwnlib.log.error`.
|
||||
|
||||
+9
-3
@@ -1,7 +1,13 @@
|
||||
import os, tempfile, re, shlex
|
||||
from .util import misc, proc
|
||||
from . import tubes, elf
|
||||
import os
|
||||
import re
|
||||
import shlex
|
||||
import tempfile
|
||||
|
||||
from . import elf
|
||||
from . import tubes
|
||||
from .log import getLogger
|
||||
from .util import misc
|
||||
from .util import proc
|
||||
|
||||
log = getLogger(__name__)
|
||||
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
import sys
|
||||
from os.path import basename
|
||||
|
||||
from docutils import nodes
|
||||
from docutils import statemachine
|
||||
from sphinx.util.compat import Directive
|
||||
|
||||
try:
|
||||
from StringIO import StringIO
|
||||
except ImportError:
|
||||
from io import StringIO
|
||||
|
||||
from sphinx.util.compat import Directive
|
||||
from docutils import nodes, statemachine
|
||||
|
||||
class ExecDirective(Directive):
|
||||
"""Execute the specified python code and insert the output into the document"""
|
||||
|
||||
+12
-4
@@ -96,11 +96,19 @@ __all__ = [
|
||||
'getLogger', 'install_default_handler', 'rootlogger'
|
||||
]
|
||||
|
||||
import logging, re, threading, sys, random, time
|
||||
from .context import context, Thread
|
||||
import logging
|
||||
import random
|
||||
import re
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
|
||||
from . import term
|
||||
from .context import Thread
|
||||
from .context import context
|
||||
from .exception import PwnlibException
|
||||
from .term import spinners, text
|
||||
from . import term
|
||||
from .term import spinners
|
||||
from .term import text
|
||||
|
||||
# list of prefixes to use for the different message types. note that the `text`
|
||||
# module won't add any escape codes if `sys.stderr.isatty()` is `False`
|
||||
|
||||
+3
-1
@@ -1,5 +1,7 @@
|
||||
from .util.packing import pack, unpack
|
||||
from .log import getLogger
|
||||
from .util.packing import pack
|
||||
from .util.packing import unpack
|
||||
|
||||
log = getLogger(__name__)
|
||||
|
||||
class MemLeak(object):
|
||||
|
||||
+2
-1
@@ -8,10 +8,11 @@
|
||||
# https://mail.python.org/pipermail/python-dev/2006-June/065918.html
|
||||
#
|
||||
import __builtin__
|
||||
|
||||
original_hex = __builtin__.hex
|
||||
|
||||
def hex(number):
|
||||
original_hex.__doc__
|
||||
return original_hex(number).rstrip('L')
|
||||
|
||||
__builtin__.hex = hex
|
||||
__builtin__.hex = hex
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
import time as __time
|
||||
|
||||
|
||||
def sleep(n):
|
||||
"""sleep(n)
|
||||
|
||||
|
||||
+8
-4
@@ -1,10 +1,14 @@
|
||||
"""Return Oriented Programming
|
||||
"""
|
||||
import hashlib, os, sys, tempfile, re
|
||||
import hashlib
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
from .elf import ELF
|
||||
from .util import packing
|
||||
from .log import getLogger
|
||||
from .elf import ELF
|
||||
from .log import getLogger
|
||||
from .util import packing
|
||||
|
||||
log = getLogger(__name__)
|
||||
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from types import ModuleType
|
||||
import sys, os, re
|
||||
|
||||
from . import internal
|
||||
from ..context import context
|
||||
|
||||
|
||||
class module(ModuleType):
|
||||
def __init__(self, name, directory):
|
||||
super(module, self).__init__(name)
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
from . import key, readline, text, termcap, keymap, term
|
||||
import sys
|
||||
|
||||
from . import key
|
||||
from . import keymap
|
||||
from . import readline
|
||||
from . import term
|
||||
from . import termcap
|
||||
from . import text
|
||||
|
||||
# Re-exports (XXX: Are these needed?)
|
||||
output = term.output
|
||||
width = term.width
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
from . import readline
|
||||
import os
|
||||
import re
|
||||
|
||||
from . import readline
|
||||
|
||||
|
||||
class Completer:
|
||||
def complete(self, _left, _right):
|
||||
raise Exception("unimplemented")
|
||||
@@ -76,7 +79,6 @@ class LongestPrefixCompleter(WordCompleter):
|
||||
else:
|
||||
return cs
|
||||
|
||||
import os
|
||||
class PathCompleter(Completer):
|
||||
def __init__(self, mask = '*', only_dirs = False):
|
||||
if mask != '*':
|
||||
|
||||
+7
-2
@@ -1,8 +1,13 @@
|
||||
__all__ = ['getch', 'getraw', 'get', 'unget']
|
||||
|
||||
import select, sys, string, os, errno
|
||||
from . import termcap
|
||||
import errno
|
||||
import os
|
||||
import select
|
||||
import string
|
||||
import sys
|
||||
|
||||
from . import keyconsts as kc
|
||||
from . import termcap
|
||||
|
||||
try: _fd = sys.stdin.fileno()
|
||||
except Exception: _fd = file('/dev/null', 'r').fileno()
|
||||
|
||||
@@ -2,6 +2,7 @@ __all__ = ['Keymap']
|
||||
|
||||
from . import key
|
||||
|
||||
|
||||
class Keymap:
|
||||
def __init__(self, bindings, on_match = None, on_nomatch = None,
|
||||
on_key = None):
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
from . import term, text
|
||||
from . import keymap as km
|
||||
from . import keyconsts as kc
|
||||
from . import keymap as km
|
||||
from . import term
|
||||
from . import text
|
||||
|
||||
cursor = text.reverse
|
||||
|
||||
buffer_left, buffer_right = u'', u''
|
||||
|
||||
+12
-1
@@ -10,8 +10,19 @@ height = 25
|
||||
# list of callbacks triggered on SIGWINCH
|
||||
on_winch = []
|
||||
|
||||
import sys, atexit, struct, fcntl, re, signal, threading, os, termios, traceback
|
||||
import atexit
|
||||
import fcntl
|
||||
import os
|
||||
import re
|
||||
import signal
|
||||
import struct
|
||||
import sys
|
||||
import termios
|
||||
import threading
|
||||
import traceback
|
||||
|
||||
from . import termcap
|
||||
|
||||
settings = None
|
||||
_graphics_mode = False
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
__all__ = ['get']
|
||||
import os, curses, sys
|
||||
import curses
|
||||
import os
|
||||
import sys
|
||||
|
||||
cache = None
|
||||
def get(cap, *args, **kwargs):
|
||||
|
||||
+5
-1
@@ -1,6 +1,10 @@
|
||||
import types, sys, functools
|
||||
import functools
|
||||
import sys
|
||||
import types
|
||||
|
||||
from . import termcap
|
||||
|
||||
|
||||
def eval_when(when):
|
||||
if isinstance(when, file) or \
|
||||
when in ('always', 'never', 'auto', sys.stderr, sys.stdout):
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
Timeout encapsulation, complete with countdowns and scope managers.
|
||||
"""
|
||||
import time
|
||||
|
||||
import pwnlib
|
||||
|
||||
|
||||
class _DummyContextClass(object):
|
||||
def __enter__(self): pass
|
||||
def __exit__(self,*a): pass
|
||||
|
||||
@@ -12,4 +12,10 @@ that specific kind of tube.
|
||||
|
||||
__all__ = ['tube', 'sock', 'remote', 'listen', 'process', 'serialtube', 'ssh']
|
||||
|
||||
from . import tube, sock, remote, listen, process, serialtube, ssh
|
||||
from . import listen
|
||||
from . import process
|
||||
from . import remote
|
||||
from . import serialtube
|
||||
from . import sock
|
||||
from . import ssh
|
||||
from . import tube
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
from .sock import sock
|
||||
from ..timeout import Timeout
|
||||
import errno
|
||||
import socket
|
||||
|
||||
from ..context import context
|
||||
from ..log import getLogger
|
||||
import socket, errno
|
||||
from ..log import getLogger
|
||||
from ..timeout import Timeout
|
||||
from .sock import sock
|
||||
|
||||
log = getLogger(__name__)
|
||||
|
||||
|
||||
+11
-4
@@ -1,9 +1,16 @@
|
||||
from .tube import tube
|
||||
from ..timeout import Timeout
|
||||
from ..util.misc import which
|
||||
import errno
|
||||
import fcntl
|
||||
import os
|
||||
import pty
|
||||
import select
|
||||
import subprocess
|
||||
import tty
|
||||
|
||||
from ..context import context
|
||||
from ..log import getLogger
|
||||
import subprocess, fcntl, os, select, pty, tty, errno
|
||||
from ..timeout import Timeout
|
||||
from ..util.misc import which
|
||||
from .tube import tube
|
||||
|
||||
log = getLogger(__name__)
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
from .sock import sock
|
||||
from ..timeout import Timeout
|
||||
from ..log import getLogger
|
||||
import socket
|
||||
import ssl as _ssl
|
||||
|
||||
from ..log import getLogger
|
||||
from ..timeout import Timeout
|
||||
from .sock import sock
|
||||
|
||||
log = getLogger(__name__)
|
||||
|
||||
class remote(sock):
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
from .. import context, term
|
||||
from ..log import getLogger
|
||||
import sys
|
||||
import time
|
||||
|
||||
import serial
|
||||
|
||||
from . import tube
|
||||
import serial, time, sys
|
||||
from .. import context
|
||||
from .. import term
|
||||
from ..log import getLogger
|
||||
|
||||
log = getLogger(__name__)
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import socket, errno, select
|
||||
from .tube import tube
|
||||
import errno
|
||||
import select
|
||||
import socket
|
||||
|
||||
from ..log import getLogger
|
||||
from .tube import tube
|
||||
|
||||
log = getLogger(__name__)
|
||||
|
||||
|
||||
+17
-5
@@ -1,12 +1,24 @@
|
||||
import os, time, tempfile, sys, shutil, re, logging, threading, logging, string, tarfile
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import string
|
||||
import sys
|
||||
import tarfile
|
||||
import tempfile
|
||||
import threading
|
||||
import time
|
||||
|
||||
from .. import term
|
||||
from ..context import context
|
||||
from ..util import hashes, misc, safeeval
|
||||
from .sock import sock
|
||||
from .process import process
|
||||
from ..log import Logger
|
||||
from ..log import getLogger
|
||||
from ..timeout import Timeout
|
||||
from ..log import getLogger, Logger
|
||||
from ..util import hashes
|
||||
from ..util import misc
|
||||
from ..util import safeeval
|
||||
from .process import process
|
||||
from .sock import sock
|
||||
|
||||
# Kill the warning line:
|
||||
# No handlers could be found for logger "paramiko.transport"
|
||||
|
||||
+15
-5
@@ -1,11 +1,21 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from .buffer import Buffer
|
||||
from ..timeout import Timeout
|
||||
import logging
|
||||
import re
|
||||
import string
|
||||
import subprocess
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
|
||||
from .. import atexit
|
||||
from .. import term
|
||||
from ..context import context
|
||||
from .. import term, atexit
|
||||
from ..util import misc, fiddling
|
||||
from ..log import Logger
|
||||
import re, threading, sys, time, subprocess, logging, string
|
||||
from ..timeout import Timeout
|
||||
from ..util import fiddling
|
||||
from ..util import misc
|
||||
from .buffer import Buffer
|
||||
|
||||
|
||||
class tube(Timeout, Logger):
|
||||
"""
|
||||
|
||||
+3
-1
@@ -1,6 +1,8 @@
|
||||
import time
|
||||
import types
|
||||
|
||||
from . import term
|
||||
from .log import getLogger
|
||||
import time, types
|
||||
|
||||
log = getLogger(__name__)
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@ Database of >22,000 user agent strings
|
||||
"""
|
||||
__all__ = ['getall', 'random']
|
||||
|
||||
import os, random as randommod
|
||||
import os
|
||||
import random as randommod
|
||||
|
||||
_cache = None
|
||||
|
||||
|
||||
+11
-2
@@ -4,6 +4,15 @@ __all__ = [
|
||||
'web'
|
||||
]
|
||||
|
||||
from . import crc, cyclic, fiddling, hashes, iters
|
||||
from . import lists, misc, net, packing, proc, safeeval
|
||||
from . import crc
|
||||
from . import cyclic
|
||||
from . import fiddling
|
||||
from . import hashes
|
||||
from . import iters
|
||||
from . import lists
|
||||
from . import misc
|
||||
from . import net
|
||||
from . import packing
|
||||
from . import proc
|
||||
from . import safeeval
|
||||
from . import web
|
||||
|
||||
@@ -12,9 +12,13 @@ the crc32-sum of ``'A'*40000``.
|
||||
An obvious optimization would be to actually generate some lookup-tables.
|
||||
"""
|
||||
|
||||
from .. import fiddling, packing
|
||||
import sys
|
||||
import types
|
||||
|
||||
from . import known
|
||||
import sys, types
|
||||
from .. import fiddling
|
||||
from .. import packing
|
||||
|
||||
|
||||
class BitPolynom(object):
|
||||
def __init__(self, n):
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import os, re
|
||||
import os
|
||||
import re
|
||||
|
||||
|
||||
def generate(self):
|
||||
"""Generates a dictionary of all the known CRC formats from:
|
||||
@@ -693,4 +695,4 @@ all_crcs = \
|
||||
'refin': False,
|
||||
'refout': False,
|
||||
'width': 16,
|
||||
'xorout': 0}}
|
||||
'xorout': 0}}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import string
|
||||
|
||||
from . import packing
|
||||
|
||||
|
||||
# Taken from https://en.wikipedia.org/wiki/De_Bruijn_sequence but changed to a generator
|
||||
def de_bruijn(alphabet = string.ascii_lowercase, n = 4):
|
||||
"""de_bruijn(alphabet = string.ascii_lowercase, n = 4) -> generator
|
||||
|
||||
+10
-4
@@ -1,9 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import re, base64, random, string
|
||||
from . import packing, lists
|
||||
from .cyclic import cyclic_find
|
||||
import base64
|
||||
import random
|
||||
import re
|
||||
import string
|
||||
|
||||
from . import lists
|
||||
from . import packing
|
||||
from ..context import context
|
||||
from ..term import text
|
||||
from ..term import text
|
||||
from .cyclic import cyclic_find
|
||||
|
||||
|
||||
def unhex(s):
|
||||
r"""unhex(s) -> str
|
||||
|
||||
@@ -52,9 +52,14 @@ __all__ = [
|
||||
'tee'
|
||||
]
|
||||
|
||||
import collections
|
||||
import copy
|
||||
import operator
|
||||
import random
|
||||
from itertools import *
|
||||
|
||||
from ..log import getLogger
|
||||
import collections, operator, random, copy
|
||||
|
||||
log = getLogger(__name__)
|
||||
|
||||
def take(n, iterable):
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import collections
|
||||
|
||||
|
||||
def partition(lst, f, save_keys = False):
|
||||
"""partition(lst, f, save_keys = False) -> list
|
||||
|
||||
@@ -207,4 +208,3 @@ def findall(haystack, needle):
|
||||
return __single_search(haystack, needle[0])
|
||||
else:
|
||||
return __kmp_search(haystack, needle)
|
||||
|
||||
|
||||
+10
-2
@@ -1,6 +1,14 @@
|
||||
import socket, re, os, stat, errno, string, base64
|
||||
import base64
|
||||
import errno
|
||||
import os
|
||||
import re
|
||||
import socket
|
||||
import stat
|
||||
import string
|
||||
|
||||
from . import lists
|
||||
from ..log import getLogger
|
||||
|
||||
log = getLogger(__name__)
|
||||
|
||||
def align(alignment, x):
|
||||
@@ -83,7 +91,7 @@ def read(path):
|
||||
|
||||
Examples:
|
||||
>>> read('pwnlib/util/misc.py').split('\\n')[0]
|
||||
'import socket, re, os, stat, errno, string, base64'
|
||||
'import base64'
|
||||
"""
|
||||
path = os.path.expanduser(os.path.expandvars(path))
|
||||
with open(path) as fd:
|
||||
|
||||
+3
-1
@@ -1,4 +1,6 @@
|
||||
import ctypes, ctypes.util, socket
|
||||
import ctypes
|
||||
import ctypes.util
|
||||
import socket
|
||||
|
||||
__all__ = ['getifaddrs', 'interfaces', 'interfaces4', 'interfaces6']
|
||||
|
||||
|
||||
@@ -30,10 +30,12 @@ Examples:
|
||||
>>> with context.local(endian='big'): print repr(p(0x1ff))
|
||||
'\xff\x01'
|
||||
"""
|
||||
from ..context import context
|
||||
import struct, sys
|
||||
import struct
|
||||
import sys
|
||||
from itertools import product
|
||||
|
||||
from ..context import context
|
||||
|
||||
mod = sys.modules[__name__]
|
||||
|
||||
def pack(number, word_size = None, endianness = None, sign = None, **kwargs):
|
||||
|
||||
+3
-1
@@ -1,4 +1,6 @@
|
||||
import time, errno
|
||||
import errno
|
||||
import time
|
||||
|
||||
from .. import tubes
|
||||
from ..log import getLogger
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
"""Silly module mostly meant as an easter-egg."""
|
||||
|
||||
import threading
|
||||
import time
|
||||
|
||||
from .. import term
|
||||
from ..term import text
|
||||
import time, threading
|
||||
|
||||
|
||||
_banner = r'''
|
||||
.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:.
|
||||
|
||||
+5
-2
@@ -1,7 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import os, tempfile
|
||||
from .misc import size
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
from ..log import getLogger
|
||||
from .misc import size
|
||||
|
||||
log = getLogger(__name__)
|
||||
|
||||
def wget(url, save=None, timeout=5, **kwargs):
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
#!/usr/bin/env python2
|
||||
from setuptools import setup, find_packages
|
||||
from distutils.util import convert_path
|
||||
import glob
|
||||
import os
|
||||
import platform
|
||||
from distutils.command.install import INSTALL_SCHEMES
|
||||
import os, glob, platform
|
||||
from distutils.util import convert_path
|
||||
|
||||
from setuptools import find_packages
|
||||
from setuptools import setup
|
||||
|
||||
# Get all template files
|
||||
templates = []
|
||||
|
||||
Reference in New Issue
Block a user