This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
old_regex = re.compile(r'(\x1b\[\?1h\x1b=)') | |
new_regex = re.compile(r'((?:\x9b|\x1b\x5b)[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e])') | |
raw = '\x1b[1;23r\x1b[1;1H\x1b[?6l\x1b[1;24r\x1b[?7h\x1b[2J\x1b[1;1H\x1b[1920;1920H\x1b[6n\x1b[1;1HYour previous successful login (as manager) was on 2018-12-04 08:47:32 \r\n from 10.5.37.17\r\n\x1b[1;24r\x1b[24;1H\x1b[24;1H\x1b[2K\x1b[24;1H\x1b[?25h\x1b[24;1H\x1b[24;1Haruba-host# \x1b[24;1H\x1b[24;21H\x1b[24;1H\x1b[?25h\x1b[24;21H\x1b[24;21Hshow versi\x1b[24;21H\x1b[?25h\x1b[24;31H\x1b[24;31Hon\x1b[24;31H\x1b[?25h\x1b[24;33H\x1b[1;0H\x1b[1M\x1b[24;1H\x1b[1L\x1b[24;33H\x1b[24;1H\x1b[2K\x1b[24;1H\x1b[?25h\x1b[24;1H\x1b[1;24r\x1b[24;1H\x1b[1;24r\x1b[24;1H\x1b[24;1H\x1b[?25h\x1b[24;1H\x1b[24;1H\r\r\n\x1b[?25h\x1b[24;1H\x1b[?25h\x1b[24;1H\r\nImage stamp: \r\n /ws/swbuildm/rel_ukiah_qaoff/code/build/bom(swbuildm_rel_ukiah_qaoff_rel_ukiah)\r\n Oct 12 2017 22:17:31\r\n KB.16.04.0009\r\n 145\r\nBoot Image: Primary\r\n\r\nBoot |