Skip to content

Commit de67c86

Browse files
committed
Fix tty_escape on Python 2
1 parent 101f9bc commit de67c86

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pwnlib/util/fiddling.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,12 +1114,12 @@ def tty_escape(s, lnext=b'\x16', dangerous=bytes(bytearray(range(0x20)))):
11141114
Returns:
11151115
The escaped data.
11161116
1117-
>>> tty_escape(b'abc\x04d\x18e')
1118-
b'abc\x16\x04d\x16\x18e'
1117+
>>> tty_escape(b'abc\x04d\x18e\x16f')
1118+
b'abc\x16\x04d\x16\x18e\x16\x16f'
11191119
"""
11201120
s = s.replace(lnext, lnext * 2)
11211121
for b in bytearray(dangerous):
1122+
b = bytes(bytearray([b]))
11221123
if b in lnext: continue
1123-
b = bytearray([b])
11241124
s = s.replace(b, lnext + b)
11251125
return s

0 commit comments

Comments
 (0)