Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions telnetlib3/fingerprinting.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class ProbeResult(TypedDict, total=False):
ENVIRON_EXTENDED: list[str] = [
"HOME",
"SHELL",
"IPADDRESS",
"SSH_CLIENT",
"SSH_TTY",
"HOSTNAME",
Expand Down Expand Up @@ -625,7 +626,7 @@ def _create_protocol_fingerprint(
protocol = _get_protocol(writer)
extra_dict = getattr(protocol, "_extra", {}) if protocol else {}

for key in ("HOME", "USER", "SHELL"):
for key in ("HOME", "USER", "SHELL", "IPADDRESS"):
if key in extra_dict:
fingerprint[key] = "True" if extra_dict[key] else "None"

Expand Down Expand Up @@ -796,7 +797,7 @@ def _create_session_fingerprint(writer: Union[TelnetWriter, TelnetWriterUnicode]
if term := (writer.get_extra_info("TERM") or writer.get_extra_info("term")):
identity["TERM"] = term

for key in ("USER", "HOME", "SHELL", "LANG", "charset"):
for key in ("USER", "HOME", "SHELL", "LANG", "IPADDRESS", "charset"):
if (value := writer.get_extra_info(key)) is not None and value:
identity[key] = value

Expand Down
2 changes: 1 addition & 1 deletion telnetlib3/fingerprinting_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def _build_telnet_rows(term: "blessed.Terminal", data: Dict[str, Any]) -> List[T
pairs.append(("SLC", ", ".join(parts)))

env_vars = []
for key in ("USER", "HOME", "SHELL"):
for key in ("USER", "HOME", "SHELL", "IPADDRESS"):
if proto_data.get(key) == "True":
env_vars.append(key)
if env_vars:
Expand Down
1 change: 1 addition & 0 deletions telnetlib3/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ def on_request_environ(self) -> List[Union[str, bytes]]:
"LINES",
"COLORTERM",
"EDITOR",
"IPADDRESS",
# Request any other VAR/USERVAR the client wants to send
VAR,
USERVAR,
Expand Down
1 change: 1 addition & 0 deletions telnetlib3/tests/test_fingerprinting.py
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,7 @@ def test_fingerprinting_server_on_request_environ():
assert "HOME" in env
assert "SHELL" in env
assert "USER" in env
assert "IPADDRESS" in env


def test_fingerprint_server_shell_has_no_protocol_factory():
Expand Down
Loading