pwnlib.term.readline — Terminal nice readline

pwnlib.term.readline.eval_input(prompt='', float=True)[source]

Replacement for the built-in python 2 - style input using pwnlib readline implementation, and pwnlib.util.safeeval.expr instead of eval (!).

Parameters:
  • prompt (str) – The prompt to show to the user.
  • float (bool) – If set to True, prompt and input will float to the bottom of the screen when term.term_mode is enabled.

Example

>>> try:
...     saved = sys.stdin, pwnlib.term.term_mode
...     pwnlib.term.term_mode = False
...     sys.stdin = io.TextIOWrapper(io.BytesIO(b"{'a': 20}"))
...     eval_input("Favorite object? ")['a']
... finally:
...     sys.stdin, pwnlib.term.term_mode = saved
Favorite object? 20
pwnlib.term.readline.raw_input(prompt='', float=True)[source]

Replacement for the built-in raw_input using pwnlib readline implementation.

Parameters:
  • prompt (str) – The prompt to show to the user.
  • float (bool) – If set to True, prompt and input will float to the bottom of the screen when term.term_mode is enabled.
pwnlib.term.readline.str_input(prompt='', float=True)[source]

Replacement for the built-in input in python3 using pwnlib readline implementation.

Parameters:
  • prompt (str) – The prompt to show to the user.
  • float (bool) – If set to True, prompt and input will float to the bottom of the screen when term.term_mode is enabled.