欢迎来到 黑吧安全网 聚焦网络安全前沿资讯,精华内容,交流技术心得!

安卓应用程序的逆向工程

来源:本站整理 作者:佚名 时间:2017-09-20 TAG: 我要投稿
      if 'ReferenceError' in message['description']:
        print('[!] Rotate the device')
      else:
        print('[!] ' + message['description'])
    else:
      print message
      
jscode = open('punsec.js').read()
 
print('[+] Running')
 
process_name = 'com.punsec.demo'
device = frida.get_usb_device()
 
try:
    pid = device.get_process(process_name).pid
    print('[+] Process found')
except frida.ProcessNotFoundError:
    print('[+] Starting process')
    pid = device.spawn([process_name])
    device.resume(pid)
    time.sleep(1)
 
process = device.attach(pid)
 
script = process.create_script(jscode)
script.on('message', on_message)
script.load()
while True:
    time.sleep(0.2)
    if encrypted and secretKey:
      script.post({'type':'encrypted','value':decrypt(encrypted, secretKey)})
      break
sys.stdin.read()
咱们更新后的js代码:
Java.perform(function () {
    var MainActivity = Java.use('com.punsec.demo.MainActivity');
    MainActivity.onCreate.implementation = function(a) {
        this.onCreate(a);
        send({'encrypted':this.getString(2131099669)});
    };
    var base64 = Java.use('android.util.Base64');
    base64.decode.overload('java.lang.String', 'int').implementation = function(x, y) {
        var buf = new Buffer(base64.decode(x, y));
        send({'secretKey': buf.toString()});
        return base64.decode(x, y);
    }
    var Util = Java.use('com.punsec.demo.Util');
    Util.a.overload('java.lang.String', 'javax.crypto.SecretKey').implementation = function(x, y) {
        recv('encrypted', function onMessage(payload) {
            secret = payload['value'];
        });
        send('Decrypted : ' + secret)
        return this.a(secret,y);
    }
 
});
如今运转咱们的python法式:
$ python punsec.py
[+] Running
[+] Process found
[*] {u'secretKey': u'MySuperSecretL33tPassw0rd'}
[!] Rotate the device
[*] {u'encrypted': u'vXrMphqS3bWfIGT811/V2Q=='}
[*] {u'secretKey': u'MySuperSecretL33tPassw0rd'}
[*] Decrypted : knb*AS234bnm*0
用 Inspeckage 来阐发
咱们将会应用到Inspeckage, Xposed Framework 和 ApkStudio/ByteCodeViewer.
Inspeckage – Android Package Inspector

Inspeckage is a tool developed to offer dynamic analysis of Android applications. By applying hooks to functions of the Android API, Inspeckage will help you understand what an Android application is doing at runtime.
Inspeckage可以或许让你来用简略的web接口停止阐发。Inspeckage必要你装置Inspeckage Xposed module而且在 Xpose 框架中激活它。在你的android装备上启动Inspeckage App而且抉择咱们的目的应用而且在Inspeckage Webserver中阅读。

 
 

关上主动革新开关,点击在webserver上的设置按钮而且封闭一些Actvity检测就像下面这张图异样,末了点击 start App 而且革新页面。
 

一旦咱们的App在手机上运转,就在App上输入测试的数据并点击ok按钮,而后察看Inspeckage webserver上的关照(留意要开启主动革新):
 

 

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9]  下一页

【声明】:黑吧安全网(http://www.myhack58.com)登载此文出于传递更多信息之目的,并不代表本站赞同其观点和对其真实性负责,仅适于网络安全技术爱好者学习研究使用,学习中请遵循国家相关法律法规。如有问题请联系我们,联系邮箱admin@myhack58.com,我们会在最短的时间内进行处理。
  • 最新更新
    • 相关阅读
      • 本类热门
        • 最近下载