arthaud / python3-pwntools Goto Github PK
View Code? Open in Web Editor NEWThis project forked from gallopsled/pwntools
CTF framework and exploit development library in python3 (pwntools and binjitsu fork)
License: Other
This project forked from gallopsled/pwntools
CTF framework and exploit development library in python3 (pwntools and binjitsu fork)
License: Other
invalid syntax in python 3.6
$ 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
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 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
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
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 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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.