This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#! /usr/bin/env python3.12
|
||||
#! /usr/bin/env python3
|
||||
|
||||
import csv
|
||||
import errno
|
||||
@@ -14,7 +14,8 @@ def scan(ip):
|
||||
arp_request = scapy.ARP(pdst=ip)
|
||||
broadcast = scapy.Ether(dst="ff:ff:ff:ff:ff:ff")
|
||||
arp_request_broadcast = broadcast / arp_request
|
||||
answered_list = scapy.srp(arp_request_broadcast, timeout=1, verbose=False)[0]
|
||||
answered_list = scapy.srp(arp_request_broadcast,
|
||||
timeout=1, verbose=False)[0]
|
||||
results = []
|
||||
for element in answered_list:
|
||||
result = {
|
||||
@@ -45,7 +46,8 @@ def scan_csv(csvfile=str, colm="hostname"):
|
||||
for count, row in enumerate(csv_reader, 1):
|
||||
hostlist.append(row[colm])
|
||||
else:
|
||||
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), csvfile)
|
||||
raise FileNotFoundError(
|
||||
errno.ENOENT, os.strerror(errno.ENOENT), csvfile)
|
||||
return tuple(hostlist)
|
||||
|
||||
|
||||
@@ -70,7 +72,8 @@ if __name__ == "__main__":
|
||||
# if len(sys.argv) == 1:
|
||||
ip_list = create_ip_list()
|
||||
man_list = scan_csv(
|
||||
csvfile=os.path.dirname(os.path.realpath(__file__)) + "/hostname_manuel.csv"
|
||||
csvfile=os.path.dirname(os.path.realpath(
|
||||
__file__)) + "/hostname_manuel.csv"
|
||||
)
|
||||
output = {
|
||||
"_meta": {
|
||||
|
||||
1946
play_ansible/inv_plugin/fact/ras-dan-01.local
Normal file
1946
play_ansible/inv_plugin/fact/ras-dan-01.local
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user