======Android====== ====Android Studio Ignored Files===== * build (and build directory if there are multiple modules in a project) * .idea * *.iml * local.properties * .DS_Store * .gradle * .cxx ====Pull APK from device==== Get the list of installed packages to determine what to pull: > adb shell pm list packages | grep tom package:com.customermobile.preload.vzw package:com.fanqies.tomatofn With the package name, we can get the actual file name and location of the APK using: > adb shell pm path com.fanqies.tomatofn package:/data/app/com.fanqies.tomatofn-g0zd0oekwgIETU7mS62UEQ==/base.apk Then pull it: adb pull /data/app/com.fanqies.tomatofn-g0zd0oekwgIETU7mS62UEQ==/base.apk This will result in an APK file "base.apk" downloaded onto your computer. Rename it appropriately: mv base.apk tomato.apk ====Decompile app to android Studio==== Follow directions at https://malacupa.com/2018/11/11/debug-decompiled-smali-code-in-android-studio-3.2.html ====Sign an APK==== rm -rf $1_pre.apk rm -rf $1_signed.apk rm -rf %1_aligned.apk apktool b -o $1_pre.apk $1 ~/Library/Android/sdk/build-tools/28.0.3/zipalign -f 4 $1_pre.apk $1_aligned.apk echo "android" | ~/Library/Android/sdk/build-tools/27.0.3/apksigner sign --ks ~/.android/debug.keystore --out $1_signed.apk $1_aligned.apk rm -rf $1_pre.apk rm -rf $1_aligned.apk echo "" echo -n "Signed APK: " echo $1_signed.apk echo "" Then uninstall the app on the phone. Then install it from your computer: adb install tomato_project_signed.apk ====Debug over wifi==== Follow directions at: https://futurestud.io/tutorials/how-to-debug-your-android-app-over-wifi-without-root Basically: - Connect the phone to USB - Make sure the device is present: "adb devices" - adb tcpip 5555 - Unplug the phone from USB - Go to the Settings -> About phone -> Status to view the IP address of your phone. - adb connect :5555 Note: The TCP connection may stop occasionally and need to be restarted. Run this to continually try to restart the connection every second: watch -n 1 adb connect :5555 ====Get BtSnoop logfile==== DATE=`date +%d%m%y_%H%M%S` #echo $DATE FILENAME=btsnoop_hci.$DATE.log JSON_FILENAME=btsnoop_hci.$DATE.json #echo $FILENAME mkdir -p logs cd logs mkdir -p temp cd temp adb bugreport > BUG_REPORT.txt >/dev/null 2>/dev/null unzip *.zip >/dev/null 2>/dev/null cp FS/data/misc/bluetooth/logs/btsnoop_hci.log ../$FILENAME >/dev/null 2>/dev/null cd .. rm -rf temp echo "The btsnoop logfile is logs/$FILENAME" tshark -T json -r $FILENAME >$JSON_FILENAME echo "The btsnoop JSON logfile is logs/$JSON_FILENAME" ====Galaxy S8/9/10 Get SNOOP file==== This is tested and verified working for S8, S9, S10+ Android 8.0 through to 9.1: Input "*#9900#" (there is an asteriks in there) in the dial pad. An engineer mode menu will pop up. Click "Run DUMPSTATE/LOGCAT/". Wait. It may take several minutes for this to generate logs. Click "Copy To sdcard..." or "Copy to ext sdcard" /sdcard/logs will contain an extensive dump of system logs /sdcard/logs/bluetooth/ will contain your timestamped btsnoop_hci_ log files