Giter Site home page Giter Site logo

arthaud / python3-pwntools Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gallopsled/pwntools

277.0 277.0 43.0 19.92 MB

CTF framework and exploit development library in python3 (pwntools and binjitsu fork)

License: Other

Shell 0.12% Python 57.78% Assembly 42.03% Dockerfile 0.07%

python3-pwntools's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python3-pwntools's Issues

SyntaxError: invalid syntax: "def goto((r, c)):"

issue:

invalid syntax in python 3.6

steps to reproduce:

$ python3.6

python
Python 3.6.0 (default, Dec 24 2016, 08:03:08)
[GCC 6.2.1 20160830] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pwn
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.6/site-packages/pwn/__init__.py", line 2, in <module>
    from .toplevel import *
  File "/usr/lib/python3.6/site-packages/pwn/toplevel.py", line 20, in <module>
    import pwnlib
  File "/usr/lib/python3.6/site-packages/pwnlib/__init__.py", line 40, in <module>
    importlib.import_module('.%s' % module, 'pwnlib')
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/usr/lib/python3.6/site-packages/pwnlib/args.py", line 48, in <module>
    from . import term
  File "/usr/lib/python3.6/site-packages/pwnlib/term/__init__.py", line 3, in <module>
    from . import completer
  File "/usr/lib/python3.6/site-packages/pwnlib/term/completer.py", line 4, in <module>
    from . import readline
  File "/usr/lib/python3.6/site-packages/pwnlib/term/readline.py", line 3, in <module>
    from . import term
  File "/usr/lib/python3.6/site-packages/pwnlib/term/term.py", line 157
    def goto((r, c)):
             ^
SyntaxError: invalid syntax

Can't Run "from pwn import *" from Python IDLE

When I run

from pwn import *

from Python 3.5 IDLE, it gives me error message like:

Traceback (most recent call last):
File "<pyshell#0>", line 1, in
from pwn import *
File "/home/dejanosky/Downloads/python3-pwntools/pwn/init.py", line 2, in
from .toplevel import *
File "/home/dejanosky/Downloads/python3-pwntools/pwn/toplevel.py", line 19, in
import pwnlib
File "/home/dejanosky/Downloads/python3-pwntools/pwnlib/init.py", line 37, in
importlib.import_module('.%s' % module, 'pwnlib')
File "/usr/lib/python3.5/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/dejanosky/Downloads/python3-pwntools/pwnlib/args.py", line 7, in
from . import term
File "/home/dejanosky/Downloads/python3-pwntools/pwnlib/term/init.py", line 5, in
from . import readline
File "/home/dejanosky/Downloads/python3-pwntools/pwnlib/term/readline.py", line 3, in
from . import term
File "/home/dejanosky/Downloads/python3-pwntools/pwnlib/term/term.py", line 30, in
fd = sys.stdout.buffer
AttributeError: 'PseudoOutputFile' object has no attribute 'buffer'

(dejanosky is my username).
What should I do? Thx.

Loading ELF files fail

Loading elf files fail because the symbol names are stored as strings instead of byte strings.

For example the following code throws an exception:

from pwn import *
e = ELF('/bin/ls')

Please apply the following patch to correct the issue:

diff --git a/pwnlib/elf/elf.py b/pwnlib/elf/elf.py
index 134f8c1..e0eff4a 100644
--- a/pwnlib/elf/elf.py
+++ b/pwnlib/elf/elf.py
@@ -376,7 +376,7 @@ class ELF(ELFFile):
                 if not symbol.entry.st_value:
                     continue

-                self.symbols[symbol.name] = symbol.entry.st_value
+                self.symbols[bytes(symbol.name, 'ascii')] = symbol.entry.st_value

         # Add 'plt.foo' and 'got.foo' to the symbols for entries,
         # iff there is no symbol for that address

Is this Project still alive?

I was just wondering if this project is still maintained, because the last changes from the main project (somewhen 2017) have not been merged.

Kind regards,
TheClown

FileNotFoundError

Trying to run 32bit elf on 64bit ubuntu, gives you the following erroe:

[x] Starting program './program'
[-] Starting program './program': Failed
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/home/naweiss2/.local/lib/python3.5/site-packages/pwnlib/tubes/process.py", line 284, in __init__
    preexec_fn=self._preexec_fn)
  File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: './program'

Used multiple ways, for example:

from pwn import *
context.update(arch='i386',bits='32')
p = process('./program')
p.interactive()

Note: using qemu-i386 ./program manualy works fine

Gnome Terminal needs nasty hack

Gnome Terminal recently deprecated the -c option, opting instead for syntax of the style:

gnome-terminal -- /usr/bin/gdb ./target_binary 

to get around this, I had to make the following hack in utils/misc.py:

First, right below "if not terminal: ..." add:

if("gnome-terminal" in terminal):
    command = command.split(' ')

Then, change

argv = [terminal_path] + args + [command]

to

if("gnome-terminal" in terminal):
    argv = [terminal_path] + args + command
else:
    argv = [terminal_path] + args + [command]

Works, and should still support any other terminals. I am unsure if there are other terminals that might use the "-- [passed command line]" but I have a feeling there are, and it would be potentially worth it to add support.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.