Skip to content

Instantly share code, notes, and snippets.

@jjsahalf
Last active April 25, 2017 00:17
Show Gist options
  • Save jjsahalf/f2024fcbd3e7cb60436d9776c02d7770 to your computer and use it in GitHub Desktop.
Save jjsahalf/f2024fcbd3e7cb60436d9776c02d7770 to your computer and use it in GitHub Desktop.
handy shell 2
#!/bin/bash
cd ../runnableJar/target/sootOutput/
v=$(find . -name "*apk")
cd ../../../Done/
for line in $v
do
echo $(pwd)
echo $line
cp -v $line /data/RedDroid/evaluation/original/
done
#!/bin/bash
find . -name "*apk" | while read line
do
apktool d $line
rm $line
dirname=$(echo $line | sed 's/\.apk//g')
echo $dirname
cd $dirname
find . -name "android_wear_micro_apk*" | while read innerline
do
echo $innerline
rm $innerline
done
grep -r "android_wear_micro_apk" . | sed 's/:.*//g' | while read innerline2
do
sed --in-place '/android_wear_micro_apk/d' $innerline2
done
cd ..
apktool b $dirname -o "${dirname}.apk"
done
#!/bin/bash
find . -name "*apk" | while read line
do
printf "\n"
echo "processing ${line} ..."
dirname=$(echo $line | sed 's/\.apk//g')
echo $dirname
unzip $line -d $dirname
cd $dirname
if [ -d "lib" ]; then
cd "lib"
dirNum=$(find . -mindepth 1 -type d | wc -l)
echo "there are ${dirNum} directories in lib"
if [ $dirNum -gt 1 ]; then
if [ -d "arm64-v8a" ]; then
rm -r "arm64-v8a"
echo "arm64-v8a has been removed"
fi
if [ -d "x86" ]; then
rm -r "x86"
echo "x86 has been removed"
fi
if [ -d "x86_64" ]; then
rm -r "x86_64"
echo "x86_64 has been removed"
fi
if [ -d "mips" ]; then
rm -r "mips"
echo "mips has been removed"
fi
if [ -d "mips64" ]; then
rm -r "mips64"
echo "mips64 has been removed"
fi
if [ -d "armeabi" ] && [ -d "armeabi-v7a" ]; then
rm -r "armeabi"
echo "armeabi has been removed"
fi
fi
cd ..
fi
cd ..
cleanDirName=$( echo "${dirname}" | sed 's/\.\///g')
echo ${cleanDirName}
if [ $dirNum -gt 1 ]; then
echo "move ${dirname} ..."
mv "$dirname" "./modified"
unzip $line -d $dirname
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment