def networkScan(self):

        print('Enter the IP address to start scanning...')
        ip = str(input()).strip()
        if self.validateIP(ip):
            try:
                colors.info('Initiating ARP Scan')

                from lib.scanner.ip_scanner import arp_scanner

                arpScanObj = arp_scanner.ARPScan(ip=ip,
                                                 start_ip=None,
                                                 end_ip=None,
                                                 threads=100)
                total_index, result_dict = arpScanObj.threadingScan()

                index = int(input('>> Enter the index of the target IP : '))
                if index < total_index and index > 0:
                    self.target_ip = result_dict[index][0]
                    self.target_mac = result_dict[index][1]

                    colors.success('Target IP set to : {}'.format(self.target_ip))
                    colors.success('Target MAC set to : {}'.format(self.target_mac))

            except ImportError:
                colors.error('Could not import the required module.')
            except Exception as e:
                print(e)
        else:
            colors.error('Please enter a valid IP address...')
            self.networkScan()
Exemple #2
0
def arp_scan(args):
    if not args.ip:
        colors.error('Please enter an IP address for scanning')
        sys.exit(1)
    else:
        try:
            colors.info('Initiating ARP Scan')

            from lib.scanner.ip_scanner import arp_scanner

            arpScanObj = arp_scanner.ARPScan(ip=args.ip,
                                             start_ip=args.ip_start_range,
                                             end_ip=args.ip_end_range,
                                             threads=args.threads)
            arpScanObj.threadingScan()
        except ImportError:
            colors.error('Could not import the required module.')
        except Exception as e:
            print(e)