Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Writing an ADB Lib

Ricky Wilson Ricky-Wilson

💭
Writing an ADB Lib
View GitHub Profile
@Ricky-Wilson
Ricky-Wilson / adb-sendkey
Created Mar 24, 2020 — forked from for2ando/adb-sendkey
Automate key input to Android applications and system utilities using input command on any Android device via adb
View adb-sendkey
#!/bin/bash
pnam=$(basename "$0")
usage="$pnam [-b] [-n] [-v] KeySequence
$pnam {-h|--help}
"
adb_shell_input_keyevent() {
$verbose && echo "adb shell input keyevent $1"
$dryrun || adb shell -n input keyevent $1
}
@Ricky-Wilson
Ricky-Wilson / poweroff.sh
Created Mar 24, 2020
ADB helper to turn off a device
View poweroff.sh
#!/bin/bash
adb shell svc power shutdown
@Ricky-Wilson
Ricky-Wilson / adbwifi.sh
Created Mar 24, 2020
Android ADB Helpers
View adbwifi.sh
#!/bin/sh
ip=$( adb shell ifconfig wlan0 | cut -f 3 -d ' ' )
port=5555
adb tcpip $port
adb connect $ip:$port
@Ricky-Wilson
Ricky-Wilson / AdbCommands
Created Mar 22, 2020 — forked from Pulimet/AdbCommands
Adb useful commands list
View AdbCommands
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
@Ricky-Wilson
Ricky-Wilson / backup.sh
Last active Mar 20, 2020
Create a full backup of an android device using ADB
View backup.sh
#!/bin/bash
adb backup -apk -shared -all -f $1
@Ricky-Wilson
Ricky-Wilson / random-mac.sh
Created Mar 20, 2020
Generate a random MAC address
View random-mac.sh
#!/bin/bash
MAC=`(date; cat /proc/interrupts) | \
md5sum | sed -r 's/^(.{10}).*$/\1/; s/([0-9a-f]{2})/\1:/g; s/:$//;'`
echo "$MAC"
View mirror.sh
#!/bin/bash
wget \
--mirror \
--convert-links \
--adjust-extension \
--page-requisites \
-e robots=off \
--html-extension \
-U Mozilla \
@Ricky-Wilson
Ricky-Wilson / fix-names.sh
Created Mar 20, 2020
Replace white space in file names
View fix-names.sh
#!/bin/bash
find $1 -name "*.apk" -type f -print0 | \
while read -d $'\0' f
do mv -v "$f" "${f// /-}"
done
View .bash_aliases
alias x="chmod +x"
alias install="sudo apt-get update; sudo apt install -y "
alias update="sudo apt-get update"
alias search="apt search"
alias rm="rm -rf"
alias nano="nano -m"
alias wc="wc -l"
alias lll="ls -R **"
alias du="du -sh"
@Ricky-Wilson
Ricky-Wilson / cpfind.sh
Created Mar 20, 2020
Find files that match a pattern and copy them
View cpfind.sh
#!/bin/bash
while getopts "r:p:o:" flag; do
case "$flag" in
# Where to stert searching.
r) ROOT=$OPTARG;;
# The pattern.
p) NAME=$OPTARG;;
# where to store the findings.