Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle
context.newline
correctly in tube.interactive()
The `context.newline` or `self.newline` variable isn't obeyed when typing in interactive mode. It is used when sending and receiving lines through `tube.sendline` though, causing a mismatch. The receiving end of the `tube.interactive()` already has handling of newlines, but the sending side does not. Example: ```python from pwn import * io = process('cat') io.newline = b'\r\n' io.sendline(b'auto') io.interactive() ``` ``` $ python testinteractive.py DEBUG [x] Starting local process '/usr/bin/cat' argv=[b'cat'] [+] Starting local process '/usr/bin/cat' argv=[b'cat'] : pid 19060 [DEBUG] Sent 0x6 bytes: b'auto\r\n' [*] Switching to interactive mode [DEBUG] Received 0x6 bytes: b'auto\r\n' auto $ test [DEBUG] Sent 0x5 bytes: b'test\n' [DEBUG] Received 0x5 bytes: b'test\n' test ``` The expected outcome would be to send `b'test\r\n'. The same problem arises in non-term mode (`PWNLIB_NOTERM=1`), where stdin is read in binary mode causing the OS line seperators to come through. Correctly replacing them with the `context.newline` setting allows to use the interactive input on windows hosts as well, without constantly sending `\r\n`.
- Loading branch information