Skip to content
Permalink
Browse files

[dev3] Minor changes for python3 support (#1310)

* Removed old dependency for intervaltree and sortedcontainers

Also make the pwn command show usage if no arguments supplied

* Fix errno subcommand

The errno library moved out of os and into its own library

* Change template script to use system env python instead of only py2

* Require updated intervaltree in setup.py

* Update .travis.yml

* Update .travis.yml
  • Loading branch information...
mcd1992 authored and Arusekk committed Jun 22, 2019
1 parent b2130e3 commit 6f127e730514ae4d3d039ea954037515bfe0506a
Showing with 15 additions and 8 deletions.
  1. +2 −0 .gitignore
  2. +1 −0 .travis.yml
  3. +5 −4 pwnlib/commandline/errno.py
  4. +3 −0 pwnlib/commandline/main.py
  5. +1 −1 pwnlib/data/templates/pwnup.mako
  6. +1 −1 pwnlib/elf/elf.py
  7. +2 −2 setup.py
@@ -11,6 +11,8 @@ docs/build
build
MANIFEST
dist
venv
.vscode
*.egg-info
*.core
.coverage
@@ -38,6 +38,7 @@ before_install:
install:
- pip install --upgrade pip
- pip install --upgrade appdirs # https://github.com/ActiveState/appdirs/issues/89#issuecomment-282326570
- python setup.py egg_info
- pip install --upgrade --editable .
- pip install --upgrade --requirement docs/requirements.txt
before_script:
@@ -2,6 +2,7 @@

import argparse
import os
import errno

from pwnlib.commandline import common

@@ -24,20 +25,20 @@ def main(args):
if 0x100000000 - value < 0x200:
value = 0x100000000 - value

if value not in os.errno.errorcode:
if value not in errno.errorcode:
print("No errno for %s" % value)
return

name = os.errno.errorcode[value]
name = errno.errorcode[value]

except ValueError:
name = args.error.upper()

if not hasattr(os.errno, name):
if not hasattr(errno, name):
print("No errno for %s" % name)
return

value = getattr(os.errno, name)
value = getattr(errno, name)


print('#define', name, value)
@@ -46,6 +46,9 @@
}

def main():
if len(sys.argv) < 2:
parser.print_usage()
sys.exit()
args = parser.parse_args()
with context.local(log_console = sys.stderr):
commands[args.command](args)
@@ -32,7 +32,7 @@ remote_path = remote_path or exe
password = password or 'secret1234'
binary_repr = repr(binary)
%>\
#!/usr/bin/env python2
#!/usr/bin/env python
# -*- coding: utf-8 -*-
%if not quiet:
# This exploit template was generated via:
@@ -1125,7 +1125,7 @@ def read(self, address, count):
start = address
stop = address + count

overlap = self.memory.search(start, stop)
overlap = self.memory.overlap(start, stop)

# Create a new view of memory, for just what we need
memory = intervaltree.IntervalTree(overlap)
@@ -59,8 +59,8 @@
'python-dateutil',
'packaging',
'psutil>=3.3.0',
'intervaltree<3.0', # See Gallopsled/pwntools#1238
'sortedcontainers<2.0', # See Gallopsled/pwntools#1154
'intervaltree>=3.0',
'sortedcontainers',
'unicorn']

# Check that the user has installed the Python development headers

0 comments on commit 6f127e7

Please sign in to comment.
You can’t perform that action at this time.