LoginSignup
8
8

More than 5 years have passed since last update.

バイナリファイルに特定の文字列が含まれているか確かめる

Posted at

Android/iOS開発をしていて、特定の成果物の中に対象のメソッドが利用されているかざっくり調べたい時など便利だった。

やりかた

$ cat <something_binary> | strings | grep <search_word>

標準入力にbinaryの中身を吐き出し、stringsメソッドで文字列のみを抽出できる。それに grep をかければ、なんとなく調べられる。

例: apkに含まれているOpenSSLのバージョンチェック

$ unzip -p hoge.apk | strings | grep OpenSSL
...
AES part of OpenSSL 1.0.1h 5 Jun 2014
...

例: .a ファイルで非公開APIを使用しているかチェック

$ cat library.a | strings | grep failWithError:

stringsコマンドは、考え方次第でいろいろ応用がききそうです。

8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8