Mac インストール Drozer APK セキュリティ テスト フレームワークがピット記録を踏む、「openssl/opensslv.h」ファイルが見つからず、関数「xx」の暗黙の宣言

1. 環境の準備

Drozer プロジェクトの説明を確認すると、環境要件は
ここに画像の説明を挿入おおよそ次のとおりであることがわかります。

  1. jdk1.7+
  2. python2.7 と pip 2 は python3 と pip3 をサポートしていません
  3. プロトブフ 2.6 以降
  4. ピョペンスル 16.2 +
  5. ツイスト 10.2+
  6. アンドロイドSDK
  7. adbをインストールする
  8. シミュレーターには drozer エージェントもインストールする必要があります
  9. adb、java環境変数を必ず設定してください。

1.1 mac は brew を通じて python2 をインストールします

MacOS 12.4 Beta (21F5048e) 以降、次の方法でpyenvインテルおよび Apple チップに python2 をインストールできるようになりました。

たとえば、バージョン 2.7.18 の python2 を M1 にインストールします。

brew install pyenv
pyenv install 2.7.18
export PATH="$(pyenv root)/shims:${
     
     PATH}"
pyenv global 2.7.18
python --version

Python 2.7.18すべてがうまくいけば、出力を確認できるようになります。

上記のパスを環境変数に追加する必要があります。次に例を示します。

echo 'PATH=$(pyenv root)/shims:$PATH' >> ~/.zshrc

1.2. pyOpenSSL のインストール

インストールはpyOpenSSL最悪のステップです。何もありません。実行すると次のエラーpip install -v pyOpenSSL==0.14が発生します

 clang -fno-strict-aliasing -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/liam/.pyenv/versions/2.7.18/include/python2.7 -c build/temp.macosx-12.6-arm64-2.7/_openssl.c -o build/temp.macosx-12.6-arm64-2.7/build/temp.macosx-12.6-arm64-2.7/_openssl.o -Wconversion -Wno-error=sign-conversion
  build/temp.macosx-12.6-arm64-2.7/_openssl.c:575:10: fatal error: 'openssl/opensslv.h' file not found
  #include <openssl/opensslv.h>
           ^~~~~~~~~~~~~~~~~~~~
  1 error generated.
  
      =============================DEBUG ASSISTANCE=============================
      If you are seeing a compilation error please try the following steps to
      successfully install cryptography:
      1) Upgrade to the latest pip and try again. This will fix errors for most
         users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
      2) Read https://cryptography.io/en/latest/installation.html for specific
         instructions for your platform.
      3) Check our frequently asked questions for more information:
         https://cryptography.io/en/latest/faq.html
      =============================DEBUG ASSISTANCE=============================
  
  error: command 'clang' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for cryptography
Failed to build cryptography
ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly

https://github.com/WithSecureLabs/drozer/issues/155にアクセスして同様の問題を見つけてください。必要なpyOpenSSLバージョンはそれより大きいです0.15が、0.15インストールされているバージョンでも同じ問題が発生します。

ここに画像の説明を挿入

cryptography実際、ログを注意深く分析した結果、問題はおそらく暗号化および復号化モジュールのopenssl参照で発生していることがわかり、検索エンジン Dafa を通じて、無関係とは言えないがまったく同じ問題を
見つけ続けました。 。cryptography

「openssl/opensslv.h」ファイルが見つかりません。OSX 10.11.6 #3367

ここに画像の説明を挿入
最後に、この質問で見つかったcryptography公式のインストールドキュメントhttps://cryptography.io/en/latest/installation/

ここに画像の説明を挿入


1.3. openssl と Rust ツールチェーンをインストールする

渡された公式インストール ドキュメントは実際に問題のほとんどを解決できます。必要なバージョンcryptographyであることが判明しました。次のコマンドを実行してインストールしopenssl 3
opensslrust

brew install openssl@3 rust

でも、ああでも、武道の話にならないカンニングだ、さあ、ズルい!さあ、奇襲攻撃だ!私の69歳の同志は、
次のコマンドを実行し続けています。

env LDFLAGS="-L$(brew --prefix openssl@3)/lib" CFLAGS="-I$(brew --prefix openssl@3)/include" pip install cryptography

それは大きな防御を直接破り、暗黙的に宣言されたエラーを報告した後、直接死んだふりをし、非常に平和的に立ち去りました

build/temp.macosx-12.6-arm64-2.7/_openssl.c:18674:10: error: implicit declaration of function 'ERR_GET_FUNC' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    return ERR_GET_FUNC(x0);
           ^
  build/temp.macosx-12.6-arm64-2.7/_openssl.c:18674:10: note: did you mean 'ERR_GET_LIB'?
  /opt/homebrew/opt/openssl@3/include/openssl/err.h:241:36: note: 'ERR_GET_LIB' declared here
  static ossl_unused ossl_inline int ERR_GET_LIB(unsigned long errcode)
                                     ^
  build/temp.macosx-12.6-arm64-2.7/_openssl.c:18690:14: error: implicit declaration of function 'ERR_GET_FUNC' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    {
    
     result = ERR_GET_FUNC(x0); }
               ^
  build/temp.macosx-12.6-arm64-2.7/_openssl.c:23389:10: error: implicit declaration of function 'FIPS_mode' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    return FIPS_mode();
           ^
  build/temp.macosx-12.6-arm64-2.7/_openssl.c:23400:14: error: implicit declaration of function 'FIPS_mode' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    {
    
     result = FIPS_mode(); }
               ^
  build/temp.macosx-12.6-arm64-2.7/_openssl.c:23415:10: error: implicit declaration of function 'FIPS_mode_set' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    return FIPS_mode_set(x0);
           ^
  build/temp.macosx-12.6-arm64-2.7/_openssl.c:23431:14: error: implicit declaration of function 'FIPS_mode_set' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    {
    
     result = FIPS_mode_set(x0); }

implicit declaration of function 'ERR_GET_FUNC' is invalid in C99
C99では関数ERR_GET_FUNCの無効である理由をざっくり調べてみた

C 言語は手続き型プログラミング言語であり、プログラムの実行順序は上から下へです。関数呼び出しは、最初に宣言してから呼び出す必要があります。C99 では、デフォルトでは暗黙的な宣言が許可されません (1999 年に導入された C 言語標準)。
以前のバージョンでは、C 言語関数を呼び出す前に関数が宣言されていない場合、コンパイラは暗黙の宣言ルールに従って、関数を呼び出す C コードのアセンブリ コードを自動的に生成します。

解決:

この部分は質問の本題とは関係ありませんので、興味のない方は読み飛ばしていただいて大丈夫です

この関数は main 関数を呼び出す前に宣言してください。
(1) main関数の直前に置きます。
(2) または、.h ヘッダー ファイルに定義し、main 関数の前にヘッダー ファイルをインポートします。
(3) 古いバージョンでコンパイルします。【非推奨】

-std パラメータを使用してC 言語のバージョンを指定します。

  • Clang でコンパイルした場合:

    # 使用 C89 <-- 不报错
    $ clang test.c -std=c89
    
    # 使用 C99 <-- 提示不允许隐式声明,报错
    $ clang test.c -std=c99
    
  • gcc でコンパイルした場合:

    # 使用 C89 <-- 不报错
    $ gcc test.c -std=c89  
    
    # 使用 C99 <-- 提示不允许隐式声明,报错
    $ gcc test.c -std=c99
    

1.4. CFLAGS の変更

pip以前の解決策は、方法でインストールしたため、実際には役に立たなかったcryptographyので、検索エンジン用のプログラムを続け、同様の問題の解決策を見つけました。

CFLAGS=-Wno-error=implicit-function-declaration pip3 install scipy

ここに画像の説明を挿入

ということで、盗作できるかなと思いながらレイアウトを拡大してみると、いや、模倣だ、模造だ、改変したものは以下のCFLAGS通り

env LDFLAGS="-L$(brew --prefix openssl@3)/lib" CFLAGS="-Wno-error=implicit-function-declaration -I$(brew --prefix openssl@3)/include" pip install cryptography

実行してpip list |grep cryptographyインストールパッケージを表示します

pip list |grep cryptography

Package            Version
------------------ -----------
cryptography       3.3.2

1. 5. ドローザーの設置

wget https://github.com/mwrlabs/drozer/releases/download/2.4.4/drozer-2.4.4-py2-none-any.whl
pip install drozer-2.4.4-py2-none-any.whl --ignore-installed pyOpenSSL

1.6. drozer インストールコマンドの暫定的な概要

コマンドのこの部分に問題がある可能性があることに注意してください。opensslバージョンの問題が発生した場合は、次の章を読んでください。[email protected]および でopenssl@3問題が発生しました。

# 安装python
brew install pyenv
pyenv install 2.7.18
export PATH="$(pyenv root)/shims:${
     
     PATH}"
pyenv global 2.7.18

#安装cryptography
brew install openssl@3 rust 
env LDFLAGS="-L$(brew --prefix openssl@3)/lib" CFLAGS="-Wno-error=implicit-function-declaration -I$(brew --prefix openssl@3)/include" pip install cryptography

#安装 protobuf Twisted和pyOpenSSL
pip install protobuf
pip install Twisted
pip install pyOpenSSL

# 安装drozer
wget https://github.com/mwrlabs/drozer/releases/download/2.4.4/drozer-2.4.4-py2-none-any.whl
pip install drozer-2.4.4-py2-none-any.whl --ignore-installed pyOpenSSL

2. APK ピットを踏むドローザーの旅を続ける

drozer公式サイトをAgent .apkシミュレータ sieve.apkドラッグしてインストールしたところ、以下のエラーが発生しました

The APK failed to install.
Error: INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113

ここに画像の説明を挿入

調べてみると、初期の Android システムは、携帯電話の CPU アーキテクチャの不一致により、ほぼ ARMv5 CPU アーキテクチャのみをサポートしていましたが、その後、
ARMv5、ARMv7 (2010 年以降)、x86 (2011 年以降) の 7 つの異なる CPU アーキテクチャをサポートするように開発されました。 )、MIPS (2012 年以降)、ARMv8、MIPS64、および x86_64 (2014 年以降) があり、それぞれが対応する ABI に関連付けられています。
アプリケーション バイナリ インターフェイス (アプリケーション バイナリ インターフェイス) は、使用される命令セット、メモリ アライメント、利用可能なシステム関数ライブラリに至るまで、バイナリ ファイル (特に .so ファイル) が対応するシステム プラットフォーム上でどのように実行されるかを定義します。Android システムでは、各 CPU アーキテクチャは ABI に対応します: armeabi、armeabi-v7a、x86、mips、arm64-v8a、mips64、x86_64。
しかし、最新の Google 公式ドキュメントでは、図に示すように mips と armv5 が削除されています。

https://img-blog.csdnimg.cn/20201218133832693.png

2.1 携帯電話の CPU コマンドラインを問い合わせる

adb shell getprop ro.product.cpu.abiクエリの実行ディスカバリーはarm64-v8aスキーマです

adb shell getprop ro.product.cpu.abi
arm64-v8a

次に、drozer を解凍しsieve.apk、サポートされている CPU アーキテクチャを確認します。案の定、Huadian が見つかりました。lib/armeabi/サポートされているアーキテクチャsieve.apkは次のとおりです。armeabi

user@local 下载 % unzip sieve.apk 
Archive:  sieve.apk
  inflating: res/layout/activity_add_entry.xml  
  inflating: res/layout/activity_file_select.xml  
  inflating: res/layout/activity_main_login.xml  
  inflating: res/layout/activity_pin.xml  
  inflating: res/layout/activity_pwlist.xml  
  inflating: res/layout/activity_settings.xml  
  inflating: res/layout/activity_short_login.xml  
  inflating: res/layout/activity_welcome.xml  
  inflating: res/layout/format_pwlist.xml  
  inflating: res/menu/activity_add_entry_add.xml  
  inflating: res/menu/activity_add_entry_edit.xml  
  inflating: res/menu/activity_file_select.xml  
  inflating: res/menu/activity_main_login.xml  
  inflating: res/menu/activity_pin.xml  
  inflating: res/menu/activity_pwlist.xml  
  inflating: res/menu/activity_settings.xml  
  inflating: res/menu/activity_short_login.xml  
  inflating: res/menu/activity_welcome.xml  
  inflating: res/xml/prefrences.xml  
  inflating: AndroidManifest.xml     
 extracting: resources.arsc          
 extracting: res/drawable-hdpi/ic_launcher.png  
 extracting: res/drawable-ldpi/ic_launcher.png  
 extracting: res/drawable-mdpi/ic_launcher.png  
 extracting: res/drawable-xhdpi/ic_launcher.png  
  inflating: classes.dex             
  inflating: lib/armeabi/gdbserver   
  inflating: lib/armeabi/libencrypt.so  
  inflating: lib/armeabi/libdecrypt.so  
  inflating: META-INF/MANIFEST.MF    
  inflating: META-INF/CERT.SF        
  inflating: META-INF/CERT.RSA    

解決策は 2 つあります。1 つは、APK を再作成して他のアーキテクチャのサポートを追加し、変更することです。build.gradle

splits {
    
    
    abi {
    
    
        enable true
        reset()
        include 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'mips', 'mips64', 'arm64-v8a'
        universalApk false
    }
}

または:

defaultConfig {
    
    
   ndk {
    
    
         abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'mips', 'mips64', 'arm64-v8a'
        }
}

しかし、公式 Web サイトの apk から自分でコンパイルすることはできず、最終的に次の Android Studio で 32 ビット エミュレータを作成して試してみることにしました。互換性があるため、イメージはこのアーキテクチャを選択する必要があることに注意してくださいarmeabi-v7aarmeabi-v7aarmeabi

  1. More Actions以下のVirtual Device Manager「シミュレータの作成」をクリックします
    ここに画像の説明を挿入
  2. Create device携帯電話をクリックして選択し、Nextここに画像の説明を挿入
  3. Other Images見つかったミラーイメージを選択しarmeabi-v7a、ダウンロードをクリックしてNext次のステップに進み、最後にクリックしてFinish作成を完了しますここに画像の説明を挿入
  4. 最後に、三角マークをクリックして開始します。
    ここに画像の説明を挿入5. drozer の sieve.apk を直接インストールすると、エラーが報告されます。
    The APK failed to install. Error:Could not parse error string.
    
    この場合、abi次のようにコマンドで直接指定します。adb install --abi armeabi sieve.apk
    user@local 下载 % adb install --abi armeabi sieve.apk 
    Performing Push Install
    sieve.apk: 1 file pushed, 0 skipped. 1490.6 MB/s (367886 bytes in 0.000s)
            pkg: /data/local/tmp/sieve.apk
    
    drozer-agent-2.3.4.apkこちらも同様の方法で取り付け可能です
    user@local 下载 % adb install --abi armeabi drozer-agent-2.3.4.apk 
    Performing Push Install
    drozer-agent-2.3.4.apk: 1 file pushed, 0 skipped. 269.4 MB/s (633111 bytes in 0.002s)
            pkg: /data/local/tmp/drozer-agent-2.3.4.apk
    Success
    

2.2 余談、x86 は ARM アーキテクチャ APP をサポートします

Windows 11 では、追加のエミュレータをインストールせずに、Microsoft ストアでの Android アプリケーションの直接ダウンロードとインストールがサポートされます。今回は Android アプリケーションと互換性があり、Microsoft は Intel と協力し、Intel と呼ばれる新しいテクノロジを採用しています。「Intel Bridge テクノロジはランタイム ポストの 1 つですBridge」 -モバイル アプリケーションを x86 ベースのデバイス上で「ネイティブ アプリケーション」として実行できるようにするコンパイラー。

このBridgeは端的に言えば「Androidエミュレータ」や「仮想マシン」の役割を果たしますが、ネイティブで動作するため効率は高くなります。さらに、カメラ、ネットワーク、センサーなどはローカル ハードウェアを直接呼び出すことで、遅延や互換性の問題を回避できます。

Intel BridgeはM1チップ向けのHuaweiの「Ark Compiler」やAppleの「Rosetta 2」と性質は同じですが、x86から​​ARMアーキテクチャにコンパイルされるRosetta 2とはコンパイルの方向性が逆です。

橋は空から落ちてきたものではなく、多くの開発者がそれを見たときに非常に親しみを感じました。これは、当初 ARM アーキテクチャに基づいて開発された Android オペレーティング システムを x86 アーキテクチャに移植する際の重要なコンポーネントである Intel Houdini テクノロジを思い出させます。
さらに注目すべき点は、Houdini がインテル中国チームによって独自に開発されたことです。プロジェクトの開始、コンセプトの検証、プロトタイプから最終製品化に至るまで、上海にあるインテルの研究開発チームによって完成されます。

Houdini プロジェクトの開発を主導しているのは、Intel アーキテクチャ、グラフィックス、およびソフトウェア グループの主任エンジニアである Li Jianhui 博士であり、深層学習フレームワークの統合とワークロードの最適化を主導しています。

2.3 openssl の落とし穴

実行を続けてdrozer console connect効果を見ようと思ったら、事故はなく、また事故が起きた

/Users/user/.pyenv/versions/2.7.18/lib/python2.7/site-packages/OpenSSL/crypto.py:14: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  from cryptography import utils, x509
Traceback (most recent call last):
  File "/Users/user/.pyenv/versions/2.7.18/bin/drozer", line 30, in <module>
    __import__("drozer.cli.%s" % (sys.argv[1]))
  File "/Users/user/.pyenv/versions/2.7.18/lib/python2.7/site-packages/drozer/cli/console.py", line 8, in <module>
    from drozer.console import Console
  File "/Users/user/.pyenv/versions/2.7.18/lib/python2.7/site-packages/drozer/console/__init__.py", line 4, in <module>
    from drozer.console.console import Console
  File "/Users/user/.pyenv/versions/2.7.18/lib/python2.7/site-packages/drozer/console/console.py", line 6, in <module>
    from pydiesel.api.transport.exceptions import ConnectionError
  File "/Users/user/.pyenv/versions/2.7.18/lib/python2.7/site-packages/pydiesel/api/transport/__init__.py", line 5, in <module>
    from socket_transport import SocketTransport
  File "/Users/user/.pyenv/versions/2.7.18/lib/python2.7/site-packages/pydiesel/api/transport/socket_transport.py", line 8, in <module>
    from drozer.ssl.provider import Provider # TODO: eugh
  File "/Users/user/.pyenv/versions/2.7.18/lib/python2.7/site-packages/drozer/ssl/__init__.py", line 1, in <module>
    from drozer.ssl.ssl_manager import SSLManager
  File "/Users/user/.pyenv/versions/2.7.18/lib/python2.7/site-packages/drozer/ssl/ssl_manager.py", line 6, in <module>
    from drozer.ssl.provider import Provider
  File "/Users/user/.pyenv/versions/2.7.18/lib/python2.7/site-packages/drozer/ssl/provider.py", line 2, in <module>
    import OpenSSL
  File "/Users/user/.pyenv/versions/2.7.18/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/Users/user/.pyenv/versions/2.7.18/lib/python2.7/site-packages/OpenSSL/crypto.py", line 17, in <module>
    from OpenSSL._util import (
  File "/Users/user/.pyenv/versions/2.7.18/lib/python2.7/site-packages/OpenSSL/_util.py", line 6, in <module>
    from cryptography.hazmat.bindings.openssl.binding import Binding
  File "/Users/user/.pyenv/versions/2.7.18/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 14, in <module>
    from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: dlopen(/Users/user/.pyenv/versions/2.7.18/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so, 0x0002): symbol not found in flat namespace (_ERR_GET_FUNC)

実はこれも大体openssl同じ問題で、上司に相談したところ、コンパイル時は使っているけどOpenSSL 1.1.1リンク時は使っていると返答しましたが、バージョンとエラーメッセージOpenSSL 3.0を読むとopenssl、基本的にはバージョンの問題と判断できます。に再リンクしOpenSSL 1.1.1、再インストールしpyenv解決できます。cryptography

user@user ~ % brew list |grep openssl
[email protected]
openssl@3

解決策は次のとおりです。

#卸载pyenv
user@user ~ % pyenv uninstall 2.7.18
pyenv: remove /Users/user/.pyenv/versions/2.7.18? [y|N] y

#卸载openssl@3
user@user ~ % brew  uninstall openssl@3
Uninstalling /opt/homebrew/Cellar/openssl@3/3.0.5... (6,444 files, 27.9MB)

#强制链接到[email protected]
user@user ~ % brew link openssl --force [email protected]
Warning: Already linked: /opt/homebrew/Cellar/openssl@3/3.0.5
To relink, run:
  brew unlink openssl@3 && brew link --force openssl@3
Unlinking /opt/homebrew/Cellar/openssl@3/3.0.5... 5508 symlinks removed.
Linking /opt/homebrew/Cellar/[email protected]/1.1.1q... 3997 symlinks created.

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"' >> ~/.zshrc

#修改环境变量
user@user bin % echo 'export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
user@user bin % source  ~/.zshrc
user@user ~ % openssl version
OpenSSL 1.1.1q  5 Jul 2022

#重新安装pyenv
user@user ~ % pyenv install 2.7.18
python-build: use [email protected] from homebrew
python-build: use readline from homebrew
Downloading Python-2.7.18.tar.xz...

#安装cryptography
user@user ~ % env LDFLAGS="-L$(brew --prefix [email protected])/lib" CFLAGS="-I$(brew --prefix [email protected])/include" PKG_CONFIG_PATH="$(brew --prefix [email protected])/lib/pkgconfig" pip install cryptography

#验证cryptography
user@user ~ % python
Python 2.7.18 (default, Nov  7 2022, 09:51:47) 
[GCC Apple LLVM 14.0.0 (clang-1400.0.29.102)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from cryptography.hazmat.bindings._openssl import ffi
__main__:1: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.     

2.4 drozer インストールコマンドの完全版の概要

pipバージョンアップしないとバージョンアップ後に該当パスpipなる場合がありますのでご注意ください。pip3pip --version

#安装rust工具链和openssl
brew install [email protected] rust 

#强制链接到[email protected]
brew link openssl --force [email protected]

#写入环境变量
echo 'export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
source  ~/.zshrc

# 安装python
brew install pyenv
pyenv install 2.7.18
export PATH="$(pyenv root)/shims:${
     
     PATH}"
pyenv global 2.7.18

#安装cryptography
env LDFLAGS="-L$(brew --prefix [email protected])/lib" CFLAGS="-I$(brew --prefix [email protected])/include" PKG_CONFIG_PATH="$(brew --prefix [email protected])/lib/pkgconfig" pip install drozer-2.4.4-py2-none-any.whl --ignore-installed pyOpenSSL

#安装 protobuf Twisted和pyOpenSSL
pip install protobuf
pip install Twisted
pip install pyOpenSSL

# 安装drozer
wget https://github.com/mwrlabs/drozer/releases/download/2.4.4/drozer-2.4.4-py2-none-any.whl
pip install drozer-2.4.4-py2-none-any.whl --ignore-installed pyOpenSSL

3. ドローザーの使用

3.1 エミュレータにagent.apkとsieve.apkをインストールする

公式 Web サイトhttps://labs.withsecure.com/tools/drozerにアクセスしてダウンロードAgent .apkし、sieve.apk

コンピューター上で次のコマンドを実行して、APK をインストールし、--abi armeabiCPU アーキテクチャを指定します

adb install --abi armeabi sieve.apk
adb install --abi armeabi drozer-agent-2.3.4.apk 

3.2 コンピュータで転送をオンにする

adb forward tcp:31415 tcp:31415

3.3 携帯電話で組み込みサーバーを起動する

アプリがシミュレーター内でクリックされ、ボタンをクリックして開きますdrozer agentOFFEmbedded Server
ここに画像の説明を挿入ここに画像の説明を挿入

3.4 ドローザーコンソールを起動する

drozer console connectドローザーコンソールの起動を実行する

user@user tmp %  drozer console connect
/Users/user/.pyenv/versions/2.7.18/lib/python2.7/site-packages/OpenSSL/crypto.py:14: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  from cryptography import utils, x509
Selecting 6fc8ab31aaf41650 (unknown sdk_phone_armv7 6.0)

            ..                    ..:.
           ..o..                  .r..
            ..a..  . ....... .  ..nd
              ro..idsnemesisand..pr
              .otectorandroidsneme.
           .,sisandprotectorandroids+.
         ..nemesisandprotectorandroidsn:.
        .emesisandprotectorandroidsnemes..
      ..isandp,..,rotectorandro,..,idsnem.
      .isisandp..rotectorandroid..snemisis.
      ,andprotectorandroidsnemisisandprotec.
     .torandroidsnemesisandprotectorandroid.
     .snemisisandprotectorandroidsnemesisan:
     .dprotectorandroidsnemesisandprotector.

drozer Console (v2.4.4)
dz>

3.5 drozer は、必要な拡張ライブラリを見つけられないか、コンパイルできませんでした。

実行するとデバッグ情報が表示されるdrozer console connect --debugため、実際のパスに変更する
ここに画像の説明を挿入
必要がありますclass_loader.pyapk_pathZipUtil.apk

例えば:

    def __get_source(self, source_or_relative_path, relative_to=None):
        """
        Get source, either from an apk file or passed directly.
        """
        
        source = None

        if source_or_relative_path.endswith(".apk"):
           ...
            #apk_path = os.path.join(relative_to, *source_or_relative_path.split("/"))
            apk_path = "/Users/user/.pyenv/versions/2.7.18/lib/python2.7/site-packages/drozer-2.4.2-py2.7.egg/drozer/modules/common/ZipUtil.apk"
            java_path = apk_path.replace(".apk", ".java")
            
        ....
        return source

参考

  1. https://github.com/WithSecureLabs/drozer
  2. Python2を醸造インストール
  3. https://github.com/WithSecureLabs/drozer/issues/155
  4. 「openssl/opensslv.h」ファイルが見つかりません。OSX 10.11.6 #3367
  5. https://cryptography.io/en/latest/installation/
  6. C コンパイラ エラー: 関数 xxx の暗黙的な宣言は C99 では無効です [-Wimplicit-function-declaration]
  7. https://github.com/scipy/scipy/issues/12935
  8. Android スマートフォンの CPU タイプが armeabi、armeabi-v7a、または arm64-v8a であるかどうかを確認する方法
  9. [INSTALL_FAILED_NO_MATCHING_ABIS: ネイティブ ライブラリの抽出に失敗しました。res=-113]
  10. あなたのコンピュータに Android をインストールしてくれた中国人エンジニアに感謝しなければなりません
  11. カスタム Android x86 リグに liboudini をインストールする方法
  12. x86 エミュレータは Houdini を統合します
  13. Genymotion_ARM_Translation
  14. Android ABI
  15. pip3 でパッケージをインストールすると「Python の ssl モジュールは利用できません」というメッセージが表示される
  16. drozer は必要な拡張ライブラリを見つけられないか、コンパイルできませんでした。

おすすめ

転載: blog.csdn.net/qq_26545503/article/details/127650478
おすすめ