Gallopsled / pwntools

CTF framework and exploit development library
http://pwntools.com
Other
11.99k stars 1.7k forks source link

Backport: Fix typo for fallback to default number of console colors on windows #2467

Closed peace-maker closed 1 week ago

peace-maker commented 1 week ago

Fix importing of pwntools on Windows in stable. This patch is already in 4.14.0beta0 but wasn't backported to 4.13.1 yet.

>>> from pwn import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\student\AppData\Local\Temp\venv\lib\site-packages\pwn\__init__.py", line 4, in <module>
    from pwn.toplevel import *
  File "C:\Users\student\AppData\Local\Temp\venv\lib\site-packages\pwn\toplevel.py", line 21, in <module>
    import pwnlib
  File "C:\Users\student\AppData\Local\Temp\venv\lib\site-packages\pwnlib\__init__.py", line 41, in <module>
    from . import args
  File "C:\Users\student\AppData\Local\Temp\venv\lib\site-packages\pwnlib\args.py", line 60, in <module>
    from pwnlib import term
  File "C:\Users\student\AppData\Local\Temp\venv\lib\site-packages\pwnlib\term\__init__.py", line 6, in <module>
    from pwnlib.term import completer
  File "C:\Users\student\AppData\Local\Temp\venv\lib\site-packages\pwnlib\term\completer.py", line 7, in <module>
    from pwnlib.term import readline
  File "C:\Users\student\AppData\Local\Temp\venv\lib\site-packages\pwnlib\term\readline.py", line 14, in <module>
    from pwnlib.term import text
  File "C:\Users\student\AppData\Local\Temp\venv\lib\site-packages\pwnlib\term\text.py", line 136, in <module>
    sys.modules[__name__] = Module()
  File "C:\Users\student\AppData\Local\Temp\venv\lib\site-packages\pwnlib\term\text.py", line 30, in __init__
    self.num_colors = termcap.get('colors', 8) if sys.platform == 'win32' else 8
  File "C:\Users\student\AppData\Local\Temp\venv\lib\site-packages\pwnlib\term\windows_termcap.py", line 26, in get
    return s(*args)
TypeError: 'int' object is not callable

Fixes #2456