スクリプトの入力はあまり具体的ではありません。

スクリプトの入力はあまり具体的ではありません。

しばらく前に、私が使用している機能に影響を与えずにAndroid ROMから何を削除できるかを調べる方法を探していたときdeptreexda forumsこれは2012年に作成されたため、期待どおりに機能しませんでした。使用されているツール(dex2jar、、、)を更新し、スクリプトを少し変更し(例:フォルダを現在smali使用中のフォルダに変更するなど)、再実行しました。魔法の一部は、同様の3つのスクリプトで発生します。 ...Androidsystem/app-privatesystem/priv-app/*/

while [ -n "$1" ]; do
    for bin in "$1"/*; do
        [ -f "$bin" ] || continue
        case "$bin" in
            *.so)
            ;;
            *)
            [ -x "$bin" ] || continue
            ;;
        esac
        "$FILE_DIR/perls/parse_bin.pl" "$bin" dbi:SQLite:dbname="$ACTIVE_DB/test.sqlite" 2>>"$ACTIVE_DB/logs/parse_bin.log"
    done
shift
done

コーディングを全く学ばない私の超能力を活用して、私は次のようなことが起きているという結論を下しました。 (私が間違っている場合は修正してください。)

  1. 入力フォルダにアクセスすると$1
  2. すべてのbin(ary)ファイルは
  3. それが本当にファイルであることを確認しbinary、そうであれば、
    (何を意味するのかわかりません||
  4. 拡張子(.soまたはnone)を確認して
  5. 見つかったファイル(*.soおよび拡張子のないファイル)をスクリプトへの入力として使用するparse_bin.pl

入力フォルダは非常に具体的でなければなりません。このスクリプトでは、次のようになります。

$ACTIVE_DB/rom/system/lib $ACTIVE_DB/rom/system/lib/*/ $ACTIVE_DB/rom/system/usr/lib you get how this continues, super long list of folders

私が知りたいのは、これらの3つのスクリプトを入力フォルダにするためにどのように変更する必要がありますか$ACTIVE_DB/rom/system

編集:入力フォルダ内のファイルを見つけるメカニズムは、他の2つのスクリプトが検索していることを除いて、3つのスクリプトすべてで同じです*.jar*.apk

EDIT2:bashシェルはこれを実行するために使用されます。

fromnaboo私はこれがスクリプトの最初の2行で起こるべきであることを知っていて答えを試みました。ここフォルダ内のすべてのバイナリファイルをエクスポートします$ACTIVE_DB/romが、入力に渡すわけではありませんparse_bin.pl

ログを残してください:

+ PARSE_BIN DB_45763/rom/system
+ '[' -n DB_45763/rom/system ']'
+ for bin in '"$1"/*'
+ '[' -f DB_45763/rom/system/CSCVersion.txt ']'
+ case "$bin" in
+ '[' -x DB_45763/rom/system/CSCVersion.txt ']'
+ printf 'DB_45763/rom/system/CSCVersion.txt:\t'
+ echo DB_45763/rom/system/CSCVersion.txt
+ ./files/perls/parse_bin.pl DB_45763/rom/system/CSCVersion.txt dbi:SQLite:dbname=DB_45763/test.sqlite
+ for bin in '"$1"/*'
+ '[' -f DB_45763/rom/system/app ']'
+ continue
+ for bin in '"$1"/*'
+ '[' -f DB_45763/rom/system/bin ']'
+ continue
+ for bin in '"$1"/*'
+ '[' -f DB_45763/rom/system/build.prop ']'
+ case "$bin" in
+ '[' -x DB_45763/rom/system/build.prop ']'
+ printf 'DB_45763/rom/system/build.prop:\t'
+ echo DB_45763/rom/system/build.prop
+ ./files/perls/parse_bin.pl DB_45763/rom/system/build.prop dbi:SQLite:dbname=DB_45763/test.sqlite
+ for bin in '"$1"/*'
+ '[' -f DB_45763/rom/system/cameradata ']'
+ continue
+ for bin in '"$1"/*'
+ '[' -f DB_45763/rom/system/csc ']'
+ continue
+ for bin in '"$1"/*'
+ '[' -f DB_45763/rom/system/csc_contents ']'
+ continue
+ for bin in '"$1"/*'
+ '[' -f DB_45763/rom/system/etc ']'
+ continue
+ for bin in '"$1"/*'
+ '[' -f DB_45763/rom/system/fonts ']'
+ continue
+ for bin in '"$1"/*'
+ '[' -f DB_45763/rom/system/framework ']'
+ continue
+ for bin in '"$1"/*'
+ '[' -f DB_45763/rom/system/kern_sec_info ']'
+ case "$bin" in
+ '[' -x DB_45763/rom/system/kern_sec_info ']'
+ printf 'DB_45763/rom/system/kern_sec_info:\t'
+ echo DB_45763/rom/system/kern_sec_info
+ ./files/perls/parse_bin.pl DB_45763/rom/system/kern_sec_info dbi:SQLite:dbname=DB_45763/test.sqlite
+ for bin in '"$1"/*'
+ '[' -f DB_45763/rom/system/lib ']'
+ continue
+ shift
+ '[' -n '' ']'

ベストアンサー1

まず、スクリプト機能に関するあなたの仮定が正しいようです。に含まれるすべてのファイル、フォルダ、シンボリックリンクなどを見て$1、ファイルの場合はライブラリか実行ファイルかを確認するためにさらに深く掘り下げます。

シェルスクリプトでは、$1これはスクリプトに渡される最初の引数なので、その$ACTIVE_DB/rom/system場所でこのスクリプトを実行するには、$1次のようにします。

./scriptname $ACTIVE_DB/rom/system

注:コマンドプロンプトでこのコマンドを呼び出す場合は、$ACTIVE実際のパスを置き換える必要があります。

このスクリプトがターゲットディレクトリに再帰的にダウンするようにするには、スクリプトに追加してみてください。

while [ -n "$1" ]; do
    # use globbing to descend into all subdirectories
    for bin in $(find "$1" | tr '\n' ' '); do
    # change this  ^^^^   
        [ -f "$bin" ] || continue
        # leave the rest of the script as is
        # ....

おすすめ記事