Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in Kali linux #818

Closed
dxxzero opened this issue Dec 16, 2016 · 2 comments
Closed

Bug in Kali linux #818

dxxzero opened this issue Dec 16, 2016 · 2 comments
Assignees
Labels

Comments

@dxxzero
Copy link

dxxzero commented Dec 16, 2016

If I install pwntools through pip install and want to run

from pwn import *

r = remote('aaa', 11)

I receive following error:

File "/root/Downloads/qwe.py", line 2, in <module>
    from pwn import *
  File "/usr/local/lib/python2.7/dist-packages/pwn/__init__.py", line 2, in <module>
    from .toplevel import *
  File "/usr/local/lib/python2.7/dist-packages/pwn/toplevel.py", line 20, in <module>
    import pwnlib
  File "/usr/local/lib/python2.7/dist-packages/pwnlib/__init__.py", line 40, in <module>
    importlib.import_module('.%s' % module, 'pwnlib')
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/usr/local/lib/python2.7/dist-packages/pwnlib/args.py", line 10, in <module>
    from . import term
  File "/usr/local/lib/python2.7/dist-packages/pwnlib/term/__init__.py", line 3, in <module>
    from . import completer
  File "/usr/local/lib/python2.7/dist-packages/pwnlib/term/completer.py", line 4, in <module>
    from . import readline
  File "/usr/local/lib/python2.7/dist-packages/pwnlib/term/readline.py", line 4, in <module>
    from . import text
  File "/usr/local/lib/python2.7/dist-packages/pwnlib/term/text.py", line 115, in <module>
    sys.modules[__name__] = Module()
  File "/usr/local/lib/python2.7/dist-packages/pwnlib/term/text.py", line 26, in __init__
    self.num_colors = termcap.get('colors', default = 8)
  File "/usr/local/lib/python2.7/dist-packages/pwnlib/term/termcap.py", line 25, in get
    s = curses.tigetstr(cap)
_curses.error: must call (at least) setupterm() first

How can I fix this?
I am running kali linux 2.2016

@zachriggle
Copy link
Member

zachriggle commented Dec 16, 2016

Works fine for me, I can't reproduce this. I expect it's an issue on your side.

$ docker run -t -i kalilinux/kali-linux-docker /bin/dash
# apt-get update

# apt-get install python2.7 python-pip python-dev git libssl-dev lsb-release

# lsb_release -a
No LSB modules are available.
Distributor ID:	Kali
Description:	Kali GNU/Linux Rolling
Release:	kali-rolling
Codename:	kali-rolling

# uname -a
Linux 405faad8b244 4.4.20-moby #1 SMP Thu Sep 15 12:10:20 UTC 2016 x86_64 GNU/Linux

# pip install --upgrade pwntools

# cat >test.py <<EOF
from pwn import *
r = remote('google.com', 80)
EOF

# python test.py
[+] Opening connection to google.com on port 80: Done
[*] Closed connection to google.com port 80

# python test.py NOTERM
[x] Opening connection to google.com on port 80
[x] Opening connection to google.com on port 80: Trying 216.58.192.238
[+] Opening connection to google.com on port 80: Done
[*] Closed connection to google.com port 80

@zachriggle zachriggle self-assigned this Dec 16, 2016
@alicio-ctf
Copy link

Same error with pycharm on kali-linux. Workaroud is to define environment variables for run configuration:

TERM=linux
TERMINFO=/etc/terminfo

See http://stackoverflow.com/questions/9485699/setupterm-could-not-find-terminal-in-python-program-using-curses/21571407#21571407

Kyle-Kyle pushed a commit to Kyle-Kyle/pwntools that referenced this issue Apr 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants