droidlysis- Android应用的属性提取器

taibeihacker

Moderator
AVvXsEi646jVH3rnZa6bl8cqXHdlMGFwPaJrk-EQQ8F34H5PqN8ZBzvIDTkB_C4_8V8Vd5yoq-v3jVcWNFP38kswnu5V8qfTankPr6sDwx9yXtzEo3e33JcqIPVvd75VTNoyPdZCUj-I4eJdgtN15_u_IxlzVA1N2kAzsVUYNx5q4pkrEAFmAz4lM_a_9VIFiIe0=w588-h640

Droidlysis是pre-analysis tool for Android apps:它执行了我们通常在任何反向工程开始时通常要执行的重复且无聊的任务。它分解了Android样本,在目录中组织输出,并在代码中搜索可疑斑点。输出有助于反向工程师加快分析的前几个步骤。
Droidlysis可以在Android软件包(APK),Dalvik可执行文件(DEX),ZIP文件(ZIP),RAR文件(RAR)或文件目录上使用。
010-110安装所需的系统包sudo apt-get install default-jre git python3 python3-pip unzip wget libmagic-dev libxml2 dev libxsl2-dev libxslt-dev install android dissememblys工具
Apktool,
Baksmali,以及可选的Dex2Jar和Ompolete: Procyon(请注意,Procyon仅与Java 8一起使用,而不是Java 11)。 $ mkdir -p〜/softs
$ cd〜/softs
$ wget https://bitbucket.org/ibotpeaches/apktool/downloads/apktool_2.9.3.3.jar
$ wget https://bitbucket.org/jesusfreke/smali/downloads/baksmali-2.5.2.2.jar
$ wget https://github.com/pxb1988/dex2jar/releases/download/v2.4/dex-tools-v2.4.zip
$ unzip dex-tools-v2.4.zip
$ rm -f dex -tools -v2.4.zip从git存储库(首选)或从python虚拟环境(Python3 -M Venv或Pyenv虚拟环境等)中获取Droidlysis。
$ python3 -m venv venv
$ source ./venv/bin/activate
(VENV)$ pip3安装git+https://github.com/cryptax/droidlysis,您可以直接从pypi(pip3 install install droidlysis)安装droidsis。
配置conf/enstry.conf。特别是确保使用适当的目录更改/家庭/Axelle。 [工具]
apktool=/home/axelle/softs/apktool_2.9.3.3.jar
baksmali=/home/axelle/softs/baksmali-2.5.2.2.jar
dex2jar=/home/axelle/softs/dex-tools-v2.4/d2j-dex2jar.sh
procyon=/home/axelle/softs/procyon-decompiler-0.5.30.jar
keytool=/usr/bin/keytool
.运行IT: python3 ./droidlysis3.py--help

Installing DroidLysis​

配置文件为./conf/general.conf(您可以使用-config选项切换到另一个文件)。这是您配置各种外部工具(例如apktool)的位置,模式文件的名称(默认情况下./conf/smali.conf,/conf/wide.conf,/conf/arm.conf/arm.conf,/conf/kit.conf/kit.conf)和仅使用数据库文件的名称(如果您使用的名称)(
确保为拆卸工具指定正确的路径,否则droidsis找不到它们。

Configuration​

Droidlysis使用Python 3。启动它并获取Options:
droidlysis-例如,在信号的APK:上测试它
droidlysis-输入信号- website-universal-release-6.26.3.apk-unput/tmp-config/path/path/to/droidlysis/conf/conf/general.conf 3
AVvXsEi646jVH3rnZa6bl8cqXHdlMGFwPaJrk-EQQ8F34H5PqN8ZBzvIDTkB_C4_8V8Vd5yoq-v3jVcWNFP38kswnu5V8qfTankPr6sDwx9yXtzEo3e33JcqIPVvd75VTNoyPdZCUj-I4eJdgtN15_u_IxlzVA1N2kAzsVUYNx5q4pkrEAFmAz4lM_a_9VIFiIe0=w588-h640
00
Droidlysis输出:
有关控制台的摘要(请参见上图)在输出DIR的子目录中取消拉链的预处理样本。子目录使用样本的文件名和SHA256总和命名。 For example, if we analyze the Signal application and set --output /tmp, the analysis will be written to /tmp/Signalwebsiteuniversalrelease4.52.4.apk-f3c7d5e38df23925dd0b2fe1f44bfa12bac935a6bc8fe3a485a4436d4487a290.一个数据库(默认情况下,sqlite droidlysis.db),其中包含它注意到的属性。

Usage​

使用droidlysis获取使用-HERP
输入可以是文件的文件或目录,以递归查看。 DroidLysis knows how to process Android packages, DEX, ODEX and ARM executables, ZIP, RAR. droidlysis不会在其他类型的文件上失败(除非有错误.),但无法理解内容。
处理文件目录时,通常将处理的样本移至另一个位置以了解已处理的内容非常有帮助。这是通过选项来处理的-Movein。另外,如果您仅对统计信息感兴趣,则可能应清除输出目录,其中包含每个示例:的详细信息,这是选项- clearOutput。如果要将所有统计信息存储在SQL数据库中,请使用-enable-sql(请参阅此处)
procyon的dex解码很长,因此默认情况下禁用了此选项。如果您想对Java进行反复编译,请使用- Enable-Procyon。
默认情况下,Droidlysis的分析未检查已知的第三方SDK,例如,它不会报告其中的任何可疑活动。如果您希望对其进行检查,请使用选项-No-Kit-Exception。这通常为样本创建更多检测到的属性,因为SDK(例如广告)使用大量标记的API(获取GPS位置,获取IMEI,获取IMSI,http Post .)。

Options​

此目录包含(适用时):
A readable AndroidManifest.xml Readable resources in res Libraries lib, assets assets assets Disassembled Smali code: smali (and others) Package meta information: META-INF Package contents when simply unzipped in ./unzipped DEX executable classes.dex (and others), and converted to jar: classes-dex2jar.jar, and unjarred in ./unjarred以下文件由droidlysis3360生成
自动分析。MD:列出了检测到的每个模式的机器人。 report.md:与控制台上打印的内容相同,如果您不需要生成示例输出目录,请使用选项- clearOutput。

Sample output directory (--output DIR)​

$ python3 ./droidlysis3.py -import-exodus -verbose
处理文件:/droidurl.pyc .
debug:droidconfig.py:Reading配置文件:'./conf/./smali.conf'
debug:droidConfig.py:Reading Configuration file:'./conf/./wide.conf'
debug:droidConfig.py:Reading Configuration file:'./conf/./arm.conf'
debug:droidConfig.py:Reading配置文件:'/home/axelle/.cache/droidlysis/./kit.conf'
debug:droidproperties.py:Importing etip Exodus跟踪器,来自https://etip.exodus-privacy.eu.org/api/api/trackers/?format=jjson
debug:connectionpool.py:启动新的https连接(1): etip.exodus-privacy.eu.org:443
debug:connectionpool.py:3https://etip.exodus-privacy.eu.org:443'get/api/trackers/?格式=json http/1.1'200无
debug:droidproperties.py:将导入跟踪器插入到/home/axelle/.cache/droidlysis/./kit.conf trackers trom exodus的trackers trocker trocefer tocal.conf中不存在于〜/.cache/.cache/droidlysis/kit.conf中。差2个文件,然后检查要添加的跟踪器。

Import trackers from Exodus etc (--import-exodus)​

如果要处理样本目录,则可能希望存储在数据库中找到的属性droidsis,以轻松解析和查询发现。在这种情况下,请使用选项- 启用-SQL。这将自动将所有结果自动在名为droidlysis.db的数据库中转载到名为“样本”的表中。表中的每个条目都是相对于给定样本的。每列都是属性droidsis轨道。
例如,要检索数据库的所有文件名,SHA256和SMALI属性:
SQLite选择SHA256,Sanitized_basename,Smali_properties来自样品;
f3c7d5e38df23925dd0b2fe1f44bfa12bac935a6bc8fe3a485a4436d4487a290|Signalwebsiteuniversalrelease4.52.4.apk|{'send_sms': true, 'receive_sms': true, 'abort_broadcast': true, 'call': false, 'email': false, 'answer_call': false, 'end_call': true, 'phone_number': false, 'intent_chooser': true, 'get_accounts': true, 'contacts': false, 'get_imei': true, 'get_external_storage_stage': false, 'get_imsi': false, 'get_network_operator': false, 'get_active_network_info': false, 'get_line_number': true, 'get_sim_country_iso': True,
.

SQLite database{#sqlite_database}​

可以在././conf目录的文件中配置和扩展哪些Droidsis检测。
图案由:组成
tag名称:示例send_sms。这是为了命名属性。必须在.conf文件中是唯一的。 Apattern:这是要匹配的正则。 ex: - sendTextMessage |; -sendMultipartTextMessage | smsmanager; -sendDatamessage。在smali.conf文件中,此Regexp在Smali代码上匹配。 In this particular case, there are 3 different ways to send SMS messages from the code: sendTextMessage, sendMultipartTextMessage and sendDataMessage.description(可选):解释了该物业的重要性及其含义。 [send_sms]
模式=; - sendTextMessage |; -sendMultipartTextMessage | smsmanager; -sendDatamessage
description=Sending SMS messages

Property patterns​

Exodus Privacy maintains a list of various SDKs which are interesting to rule out in our analysis via conf/kit.conf. Add option --import_exodus to the droidlysis command line: this will parse existing trackers Exodus Privacy knows and which aren't yet in your kit.conf.最后,它将append所有新跟踪器〜/.cache/droidlysis/kit.conf。
之后,您可能需要对您的kit.conf file:进行排序
导入configparser
进口收集
导入操作系统
config=configparser.configparser({},collections.ordereddict)
config.read(os.path.path.expanduser('〜/.cache/droidlysis/kit.conf'))))
#按字母顺序订购所有部分
config._sections=collections.ordereddict(sorted(config._sections.items(),key=lambda t: t [0]))
用f:开放('seted.conf','w')
config.write(f)

Importing Exodus Privacy Trackers​

v3.4.6-检测清单功能,自动在安装时自动加载APK v3.4.5-创建一个可写的用户kit.conf文件v3.4.4-错误修复#14 v3.4.3-使用配置文件v3.4.2-使用配置文件v3.4.2-添加exodus privacy tracser v3.4.1 -Remaind dections v3.4.1- recoig vernedy -v。改进base64字符串v3.3.0的检测- 将数据倾倒到JSON v3.2.1- IP地址检测v3.2.0 -dex2jar是可选的v3.1.0-检测base64 strings的检测
 
返回
上方