arp-scan debug #261 work

This commit is contained in:
Jokob-sk
2023-07-05 08:00:58 +10:00
parent cd9e244efd
commit 0c35577a68

View File

@@ -2,6 +2,8 @@ import re
import subprocess
from logger import mylog
from helper import write_file
from const import logPath
#-------------------------------------------------------------------------------
def execute_arpscan (userSubnets):
@@ -10,9 +12,13 @@ def execute_arpscan (userSubnets):
arpscan_output = ""
# scan each interface
for interface in userSubnets :
index = 0
for interface in userSubnets :
write_file (logPath + '/arp_scan_output_', index ,'.txt', arpscan_output)
index += 1
arpscan_output += execute_arpscan_on_interface (interface)
# Search IP + MAC + Vendor as regular expresion
re_ip = r'(?P<ip>((2[0-5]|1[0-9]|[0-9])?[0-9]\.){3}((2[0-5]|1[0-9]|[0-9])?[0-9]))'
re_mac = r'(?P<mac>([0-9a-fA-F]{2}[:-]){5}([0-9a-fA-F]{2}))'
@@ -22,6 +28,8 @@ def execute_arpscan (userSubnets):
# Create Userdict of devices
devices_list = [device.groupdict()
for device in re.finditer (re_pattern, arpscan_output)]
mylog('debug', ['[ARP Scan] Found: Devices including duplicates ', len(devices_list) ])
# Delete duplicate MAC
unique_mac = []
@@ -33,7 +41,8 @@ def execute_arpscan (userSubnets):
unique_devices.append(device)
# return list
mylog('debug', ['[ARP Scan] Completed found ', len(unique_devices) ,' devices ' ])
mylog('debug', ['[ARP Scan] Found: Devices without duplicates ', len(unique_devices) ])
return unique_devices
#-------------------------------------------------------------------------------