mirror of
https://github.com/Horizontal42/netsleuth.git
synced 2026-11-11 01:02:10 +03:00
cli: treat asn target mode as own-network identity like auto mode
'--target AS<n>' still describes this machine's own egress (an asn target isn't something ip_geo can look up directly), same as auto mode, but the ipv4/ipv6 forcing added for the egress_v4 mislabel fix only checked target_kind is None. widen it to also cover 'asn' so target-mode runs get the same protocol-pinned identity lookup as auto mode instead of falling back to the unpinned shared client.
This commit is contained in:
parent
bfe9529667
commit
44b1c4a39d
1 changed files with 3 additions and 2 deletions
|
|
@ -102,7 +102,8 @@ def _dedupe(findings: list[Finding]) -> list[Finding]:
|
||||||
async def _identity(client: httpx.AsyncClient, settings: Settings, options: Options, raw: dict) -> dict:
|
async def _identity(client: httpx.AsyncClient, settings: Settings, options: Options, raw: dict) -> dict:
|
||||||
token = settings.ipinfo_token.get_secret_value() if settings.ipinfo_token else None
|
token = settings.ipinfo_token.get_secret_value() if settings.ipinfo_token else None
|
||||||
lookup = options.target_value if options.target_kind in ("ip", "domain") else None
|
lookup = options.target_value if options.target_kind in ("ip", "domain") else None
|
||||||
if options.target_kind is None:
|
own_network = options.target_kind in (None, "asn")
|
||||||
|
if own_network:
|
||||||
# The shared client has no address family pinned, so on a dual-stack host it can
|
# The shared client has no address family pinned, so on a dual-stack host it can
|
||||||
# silently connect over IPv6 (OS/happy-eyeballs preference) and hand back an IPv6
|
# silently connect over IPv6 (OS/happy-eyeballs preference) and hand back an IPv6
|
||||||
# literal mislabeled as egress_v4. Force IPv4 here the same way egress_v6 is forced
|
# literal mislabeled as egress_v4. Force IPv4 here the same way egress_v6 is forced
|
||||||
|
|
@ -125,7 +126,7 @@ async def _identity(client: httpx.AsyncClient, settings: Settings, options: Opti
|
||||||
)
|
)
|
||||||
raw.update(payloads)
|
raw.update(payloads)
|
||||||
v6 = None
|
v6 = None
|
||||||
if options.target_kind is None:
|
if own_network:
|
||||||
try:
|
try:
|
||||||
transport = httpx.AsyncHTTPTransport(local_address="::")
|
transport = httpx.AsyncHTTPTransport(local_address="::")
|
||||||
async with httpx.AsyncClient(
|
async with httpx.AsyncClient(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue