fix bug scan ip (win)
This commit is contained in:
@@ -12,10 +12,10 @@ def _ping_one(ip, is_win):
|
|||||||
try:
|
try:
|
||||||
if is_win:
|
if is_win:
|
||||||
r = subprocess.run(
|
r = subprocess.run(
|
||||||
["ping", "-n", "1", "-w", "300", str(ip)],
|
["ping", "-n", "1", "-w", "500", str(ip)],
|
||||||
stdout=subprocess.DEVNULL,
|
stdout=subprocess.DEVNULL,
|
||||||
stderr=subprocess.DEVNULL,
|
stderr=subprocess.DEVNULL,
|
||||||
timeout=2,
|
timeout=3,
|
||||||
creationflags=_NO_WINDOW
|
creationflags=_NO_WINDOW
|
||||||
)
|
)
|
||||||
elif sys.platform == "darwin":
|
elif sys.platform == "darwin":
|
||||||
@@ -59,7 +59,7 @@ def _ping_sweep(network, progress_cb=None):
|
|||||||
progress_cb(done_count[0], total)
|
progress_cb(done_count[0], total)
|
||||||
return (str(ip), ok)
|
return (str(ip), ok)
|
||||||
|
|
||||||
with ThreadPoolExecutor(max_workers=len(hosts)) as executor:
|
with ThreadPoolExecutor(max_workers=min(64, len(hosts))) as executor:
|
||||||
futures = [executor.submit(_ping_and_track, ip) for ip in hosts]
|
futures = [executor.submit(_ping_and_track, ip) for ip in hosts]
|
||||||
for f in as_completed(futures):
|
for f in as_completed(futures):
|
||||||
ip_str, ok = f.result()
|
ip_str, ok = f.result()
|
||||||
|
|||||||
Reference in New Issue
Block a user