Skip to content

Instantly share code, notes, and snippets.

@tchn
Last active August 29, 2015 14:04
Show Gist options
  • Save tchn/f6c161cfdb4dd59c2e2c to your computer and use it in GitHub Desktop.
Save tchn/f6c161cfdb4dd59c2e2c to your computer and use it in GitHub Desktop.
Androguard で APK静的解析する際の iptyhon profile 用
# $ ipython profile create androguard
# $ cd ~/.ipython/profile_androguard/startup/00-androguard.py
# $ ipython --profile=androguard
# In [1]: a, d, dk, dx, gx = set_target_apk(apk)
import sys
import os
def set_target_apk(apk):
"""
a, d, dk, dx, gx = set_target_apk(apk)
"""
a, d, dk = anz.AnalyzeAPK(apk, decompiler='dex2jar')
dx = anz.VMAnalysis(d)
gx = anz.GVMAnalysis(dx, None)
d.set_vmanalysis(dx)
d.set_gvmanalysis(gx)
return a, d, dk, dx, gx
# Ajdust PYTHONPATH
sys.path.append('/opt/lib/androguard')
# Include Android-SDK to PATH
old_path = os.environ['PATH']
sdk_path = [
'/opt/lib/android-sdk-linux/tools',
'/opt/lib/android-sdk-linux/platform-tools',
'/opt/lib/android-sdk-linux/build-tools/17.0.0'
]
new_path = old_path + ':' + ':'.join(sdk_path)
os.environ['PATH'] = new_path
import androlyze as anz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment