Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify the process in python pwntools?

Cant set the process in Python 2.7.17 pwntools.

Source code:

from pwn import *
s=process('/root/Dokumente/Scripts/example_program')

I tried from pwn import *:

root@bitpc:~# python pwn.py 
Traceback (most recent call last):
  File "pwn.py", line 1, in <module>
    from pwn import *
  File "/root/pwn.py", line 2, in <module>
    s=process('/root/Dokumente/Scripts/example_program')
NameError: name 'process' is not defined

That was not working. Then i imported process directly:

root@bitpc:~# python pwn.py 
Traceback (most recent call last):
  File "pwn.py", line 1, in <module>
    from pwn import process
  File "/root/pwn.py", line 1, in <module>
    from pwn import process
ImportError: cannot import name process

I got an import error. How to fix this?

like image 516
BitFriends Avatar asked Dec 09 '25 12:12

BitFriends


1 Answers

It seems that your exploit script's name is pwn.py. rename it to some other name such as exp.py. otherwise python will try to import things in your pwn.py instead of importing things from pwntools.

like image 63
wxk1997 Avatar answered Dec 12 '25 08:12

wxk1997



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!