Update hosts_in_subnet to be more predictable

This commit is contained in:
Heath Brown
2022-11-01 17:37:24 -05:00
parent 939ab1ada3
commit cf5455fd8e
2 changed files with 3 additions and 3 deletions

View File

@@ -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()]

View File

@@ -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")