Black formatting
This commit is contained in:
@@ -14,7 +14,8 @@ GRAY = Fore.LIGHTBLACK_EX
|
||||
|
||||
def are_alive(addresses: List[str]) -> List[str]:
|
||||
hosts = multiping(addresses)
|
||||
return [ host.address for host in hosts if host.is_alive ]
|
||||
return [host.address for host in hosts if host.is_alive]
|
||||
|
||||
|
||||
def is_host_alive(host: str) -> bool:
|
||||
if ping(host, timeout=1, count=1).is_alive:
|
||||
|
||||
@@ -3,7 +3,14 @@
|
||||
# SPDX-License-Identifier: MIT
|
||||
import asyncio
|
||||
import click
|
||||
from pscanner import are_alive, async_are_alive, is_port_open, is_subnet, hosts_in_subnet, is_host_alive
|
||||
from pscanner import (
|
||||
are_alive,
|
||||
async_are_alive,
|
||||
is_port_open,
|
||||
is_subnet,
|
||||
hosts_in_subnet,
|
||||
is_host_alive,
|
||||
)
|
||||
from ..__about__ import __version__
|
||||
|
||||
|
||||
@@ -17,9 +24,9 @@ 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 = [str(_) for _ in hosts_in_subnet(host)]
|
||||
print(f"pinging {len(hosts)} hosts")
|
||||
#alive_hosts = asyncio.run(async_are_alive(hosts), debug=True)
|
||||
# alive_hosts = asyncio.run(async_are_alive(hosts), debug=True)
|
||||
alive_hosts = are_alive(hosts)
|
||||
print(f"found {len(alive_hosts)} alive")
|
||||
for ip in alive_hosts:
|
||||
|
||||
Reference in New Issue
Block a user