From cf5455fd8e683acd10f16a0bcbfd90c94ef6a497 Mon Sep 17 00:00:00 2001 From: Heath Brown Date: Tue, 1 Nov 2022 17:37:24 -0500 Subject: [PATCH] Update hosts_in_subnet to be more predictable --- pscanner/__init__.py | 4 ++-- pscanner/cli/__init__.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pscanner/__init__.py b/pscanner/__init__.py index f9d6498..28e4a1a 100644 --- a/pscanner/__init__.py +++ b/pscanner/__init__.py @@ -46,8 +46,8 @@ def is_subnet(ip: str) -> bool: return False -def hosts_in_subnet(network: str) -> List: +def hosts_in_subnet(network: str) -> List[str]: if not is_subnet: print(f"{network} is not a network") - return list(ipaddress.ip_network(network).hosts()) + return [str(_) for _ in ipaddress.ip_network(network).hosts()] diff --git a/pscanner/cli/__init__.py b/pscanner/cli/__init__.py index 9de2750..df90aba 100644 --- a/pscanner/cli/__init__.py +++ b/pscanner/cli/__init__.py @@ -23,7 +23,7 @@ from ..__about__ import __version__ @click.pass_context def pscanner(ctx: click.Context, host, port): if is_subnet(host): - hosts = [str(_) for _ in hosts_in_subnet(host)] + hosts = hosts_in_subnet(host) print(f"pinging {len(hosts)} hosts") alive_hosts = are_alive(hosts) print(f"found {len(alive_hosts)} alive")