@@ -44,7 +44,11 @@ def scan_csv(csvfile=str, colm="hostname"):
|
||||
with open(csvfile) as csv_file:
|
||||
csv_reader = csv.DictReader(csv_file, delimiter=",")
|
||||
for count, row in enumerate(csv_reader, 1):
|
||||
hostlist.append(row[colm])
|
||||
hostname = row[colm]
|
||||
if port_open(address=hostname):
|
||||
hostlist.append(hostname)
|
||||
else:
|
||||
print(f"INFO: Host {hostname} not reachable.", file=sys.stderr)
|
||||
else:
|
||||
raise FileNotFoundError(
|
||||
errno.ENOENT, os.strerror(errno.ENOENT), csvfile)
|
||||
|
||||
Reference in New Issue
Block a user