mirror of https://github.com/n1nj4sec/pupy.git
*nix interactive_shell module escape character issues fix (with history and arrows)
This commit is contained in:
parent
64b55cb91a
commit
b4ff342b0a
|
@ -82,7 +82,11 @@ class InteractiveShell(PupyModule):
|
||||||
while True:
|
while True:
|
||||||
r, w, x = select.select([sys.stdin], [], [], 0)
|
r, w, x = select.select([sys.stdin], [], [], 0)
|
||||||
if sys.stdin in r:
|
if sys.stdin in r:
|
||||||
input_buf+=sys.stdin.read(1)
|
last_input=sys.stdin.read(1)
|
||||||
|
if last_input=="\x1b": # in case we read the escape character, we read stdin again because mysteriously, the select won't unlock before getting another character again
|
||||||
|
last_input+=sys.stdin.read(2)
|
||||||
|
|
||||||
|
input_buf+=last_input
|
||||||
elif input_buf:
|
elif input_buf:
|
||||||
self.ps.write(input_buf)
|
self.ps.write(input_buf)
|
||||||
input_buf=b""
|
input_buf=b""
|
||||||
|
|
Loading…
Reference in New Issue