Update hosts_in_subnet to be more predictable
This commit is contained in:
@@ -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()]
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user