Skip to content

Commit d16c083

Browse files
committed
relax fingerprinting a hair
1 parent 9fca752 commit d16c083

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

telnetlib3/server_fingerprinting.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@
108108
_ANSI_STRIP_RE = re.compile(_ZERO_WIDTH_STR_PATTERN.pattern.encode("ascii"))
109109

110110
# Match "Press [.ESC.] twice" botcheck prompts (e.g. Mystic BBS).
111-
_ESC_TWICE_RE = re.compile(rb"(?i)press\s+[\[<]?\.?esc\.?[\]>]?\s+twice")
111+
_ESC_TWICE_RE = re.compile(rb"(?i)press\s+[\[<(]?\.?esc\.?[\]>)]?\s+twice")
112112

113113
# Match single "Press [ESC]" prompts without "twice" (e.g. Herbie's BBS).
114-
_ESC_ONCE_RE = re.compile(rb"(?i)press\s+[\[<]?\.?esc\.?[\]>]?(?!\s+twice)")
114+
_ESC_ONCE_RE = re.compile(rb"(?i)press\s+[\[<(]?\.?esc\.?[\]>)]?(?!\s+twice)")
115115

116116
# Match "HIT RETURN", "PRESS RETURN", "PRESS ENTER", "HIT ENTER", etc.
117117
# Common on Worldgroup/MajorBBS and other vintage BBS systems.

telnetlib3/tests/test_server_fingerprinting.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,9 @@ async def test_probe_skipped_when_closing(tmp_path):
798798
pytest.param(
799799
b"Press <Esc> twice for the BBS ... ", b"\x1b\x1b", None, id="esc_twice_angle_brackets"
800800
),
801+
pytest.param(
802+
b"Press (ESC) twice", b"\x1b\x1b", None, id="esc_twice_parens"
803+
),
801804
pytest.param(
802805
b"\x1b[33mPress [.ESC.] twice within 10 seconds\x1b[0m",
803806
b"\x1b\x1b",
@@ -813,6 +816,7 @@ async def test_probe_skipped_when_closing(tmp_path):
813816
pytest.param(b"Please press [ESC] to continue", b"\x1b", None, id="esc_once_brackets"),
814817
pytest.param(b"Press ESC to continue", b"\x1b", None, id="esc_once_bare"),
815818
pytest.param(b"press <Esc> to continue", b"\x1b", None, id="esc_once_angle_brackets"),
819+
pytest.param(b"Press (ESC) to continue", b"\x1b", None, id="esc_once_parens"),
816820
pytest.param(
817821
b"\x1b[33mPress [ESC] to continue\x1b[0m", b"\x1b", None, id="esc_once_ansi_wrapped"
818822
),

0 commit comments

Comments
 (0)