Some time ago while i was searching for a way to find out what i can delete from my Android rom without crippling functions i use, i found deptree
over at the xda forums
. Since this was written back in 2012 it wouldn't work as intended. Updating used tools (dex2jar
, smali
, ...
) plus some minor changes to the scripts (like changing folders to the ones used in Android
by now, for example system/app-private
to system/priv-app/*/
) and i got it running again.
Part of the magic happens in three scripts which are similar to this one:
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
Through using my superpowers of having never learned to code, i concluded following things to happen here (you may correct me if i got something wrong):
- while accessing the input folder
$1
, - every
bin(ary)
file gets - checked if it really is a
binary
file, if so,
( i have no idea what the||
stands for) - it checks for the extension (
.so
ornone
) and - uses the file(s) found (
*.so
and the ones without extension) as input for the scriptparse_bin.pl
The input folder has to be super specific, as for this script these are
$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
What i'd like to know, how would i have to modify these three scripts so that the input folder is $ACTIVE_DB/rom/system
?
EDIT: The mechanism of finding the file(s) in the input folder(s) is the same in all three scripts except that the other two are searching for *.jar
and *.apk
EDIT2: The bash
shell gets used to run this
I know this has to happen somewhere in the first two lines of the script, i already tried fromnaboo
s answer from over here which would spit out every binary inside the folder $ACTIVE_DB/rom
but would not pass them as input to parse_bin.pl
.
Please have a log:
+ 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 '' ']'
$bin
is a regular file, if not the|| continue
expression is saying go back to the start of the loop and begin with a new$bin
. What shell is being used to run this script?||
, thebash
shell gets used to run this. I've added this info to the question