arp-scan debug #261 work
This commit is contained in:
@@ -2,6 +2,8 @@ import re
|
|||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from logger import mylog
|
from logger import mylog
|
||||||
|
from helper import write_file
|
||||||
|
from const import logPath
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
def execute_arpscan (userSubnets):
|
def execute_arpscan (userSubnets):
|
||||||
@@ -10,9 +12,13 @@ def execute_arpscan (userSubnets):
|
|||||||
arpscan_output = ""
|
arpscan_output = ""
|
||||||
|
|
||||||
# scan each interface
|
# scan each interface
|
||||||
|
index = 0
|
||||||
for interface in userSubnets :
|
for interface in userSubnets :
|
||||||
|
write_file (logPath + '/arp_scan_output_', index ,'.txt', arpscan_output)
|
||||||
|
index += 1
|
||||||
arpscan_output += execute_arpscan_on_interface (interface)
|
arpscan_output += execute_arpscan_on_interface (interface)
|
||||||
|
|
||||||
|
|
||||||
# Search IP + MAC + Vendor as regular expresion
|
# 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_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}))'
|
re_mac = r'(?P<mac>([0-9a-fA-F]{2}[:-]){5}([0-9a-fA-F]{2}))'
|
||||||
@@ -23,6 +29,8 @@ def execute_arpscan (userSubnets):
|
|||||||
devices_list = [device.groupdict()
|
devices_list = [device.groupdict()
|
||||||
for device in re.finditer (re_pattern, arpscan_output)]
|
for device in re.finditer (re_pattern, arpscan_output)]
|
||||||
|
|
||||||
|
mylog('debug', ['[ARP Scan] Found: Devices including duplicates ', len(devices_list) ])
|
||||||
|
|
||||||
# Delete duplicate MAC
|
# Delete duplicate MAC
|
||||||
unique_mac = []
|
unique_mac = []
|
||||||
unique_devices = []
|
unique_devices = []
|
||||||
@@ -33,7 +41,8 @@ def execute_arpscan (userSubnets):
|
|||||||
unique_devices.append(device)
|
unique_devices.append(device)
|
||||||
|
|
||||||
# return list
|
# 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
|
return unique_devices
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user