Making a simple ADB shell script. - General Questions and Answers

So i am trying to make a simple shell script which will execute multiple ADB commands, here's what i have come up with.
#bin/sh
echo -------------------------------
echo Removing lockscreen ads...
echo -------------------------------
adb shell pm disable-user --user 0 com.amazon.kindle.kso
when i try to do, bash file.sh it just says bash is a unknown command, so what am i doing wrong?

ADB is a commandline tool to be run either on Windows OS, preferredly wrapped into a Windows CMD script, or in Android OS, preferredly wrapped into an Android shell script.
If you intend to run ADB commands in Android's terminal then a shell script would look like this
Code:
#!sbin/sh
ADB=/usr/bin/adb
"$ADB" shell "<COMMAND-HERE>"

jwoegerbauer said:
ADB is a commandline tool to be run either on Windows OS, preferredly wrapped into a Windows CMD script, or in Android OS, preferredly wrapped into an Android shell script.
If you intend to run ADB commands in Android's terminal then a shell script would look like this
Code:
#!sbin/sh
ADB=/usr/bin/adb
"$ADB" shell "<COMMAND-HERE>"
Click to expand...
Click to collapse
Okay, thank you. will try that right away
i could also use this in a windows batch file?(sorry bit of a noob about this )

ComputerTech312 said:
i could also use this in a windows batch file?(sorry bit of a noob about this )
Click to expand...
Click to collapse
If you'ld carefully read posts then you'll notice this question already get answered.

jwoegerbauer said:
If you'ld carefully read posts then you'll notice this question already get answered.
Click to expand...
Click to collapse
Apologies, i misread your post
What would the changes be to your code if it's a Windows CMD script? would changes to the path be required and such?

It really depends on what you're trying to do.
I wrote the following as a simple .bat file and ran it from my platform-tools directory on my Windows laptop:
@Echo Off
echo Checking for Devices.
adb devices
echo Is device present?
echo (Press Enter if yes, Ctrl+C or close Script if not)
pause
echo Rebooting to recovery.
adb reboot recovery
echo Waiting 30 seconds for reboot.
timeout /t 30
echo Checking for Devices.
adb devices
echo Is device present?
echo (Press Enter if yes, Ctrl+C or close Script if not)
pause
echo Decrypting Data in TWRP.
adb shell twrp decrypt ******
pause
Click to expand...
Click to collapse
And it does the following:
{
"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"
}

ComputerTech312 said:
What would the changes be to your code if it's a Windows CMD script? would changes to the path be required and such?
Click to expand...
Click to collapse
An Android shell script and a Windows bash script ( including a Powerpoint script ) are in all aspects different with regards to coding, this because Android shell scripts are coded using Linux synthax.
BTW:
To not have to dance on 2 weddings I create my scripts mainly as pure Android shell scripts, which I copy from PC to Android device, and then start executing it from PC by means of ADB using a Windows bash script.
Example Windows bash script:
Code:
@echo off
adb devices
adb push <ANDROID-SCRIPT-PATH-ON-PC-HERE> /tmp
adb shell "chmod 0755 /tmp/<ANDROID-SCRIPT-NAME-HERE>"
adb shell "cd /tmp; $(<ANDROID-SCRIPT-NAME-HERE>);"
adb shell "rm -f /tmp/<ANDROID-SCRIPT-NAME-HERE>"

Deleted member 1890170 said:
An Android shell script and a Windows bash script ( including a Powerpoint script ) are in all aspects different with regards to coding, this because Android shell scripts are coded using Linux synthax.
BTW:
To not have to dance on 2 weddings I create my scripts mainly as pure Android shell scripts, which I copy from PC to Android device, and then start executing it from PC by means of ADB using a Windows bash script.
Example Windows bash script:
Code:
@echo off
adb devices
adb push <ANDROID-SCRIPT-PATH-ON-PC-HERE> /tmp
adb shell "chmod 0755 /tmp/<ANDROID-SCRIPT-NAME-HERE>"
adb shell "cd /tmp; $(<ANDROID-SCRIPT-NAME-HERE>);"
adb shell "rm -f /tmp/<ANDROID-SCRIPT-NAME-HERE>"
Click to expand...
Click to collapse
I am doing similar adb commands but from a bash script on a PC connected only via wifi to android box.
FYI, unlike a phone these Android 11 devices are not recognized by Windows11 when connected via a USB cable.
Commands I issue are things like
$ADB_CMD shell pm uninstall org.courville.nova
Before I can use these varous ADB commands I have to
(1) manually add the box to my wifi (via a mini-keyboard attached to android box)
(2) figure out which IP it was assigned by my router
(3) update my script with the correct IP to it can issue all the $ADB_CMD = eg. "../ADB -s 192.168.123:5555"
(4) run the script
I would like to skip steps 1..3, so the idea of running a similar script on the android box is very attractive.
(1) prepare a usb thumbdrive with a script, aps, ... and plug it into the android device
(2) use the filemanager on the device to execute the script
(3) done (ie. never have to connect to wifi).
What do you suggest doing?
I assumed by the nature of it's name "bridge" that ADB is meant to be run over a connection?
Ideally I would like to install nothing on the android device but I would not mind if a script installed some apk from the thumbdrive and then de-installed it.
The device is rooted.
Can you actually get some shell prompt on Android? or does it require an app to be installed.
I saw references to /usr/bin/sh I have no idea how to start one
Thank you for helping out.

Short answer: use
SH Script Runner for Android - APK Download
Download SH Script Runner apk 1.10 for Android. Bash script runner and shell command executor with superuser functionality.
apkpure.com
app to run scripts on Android device without the need of ADB

.

xXx yYy said:
.
xXx yYy said:
Short answer: use
SH Script Runner for Android - APK Download
Download SH Script Runner apk 1.10 for Android. Bash script runner and shell command executor with superuser functionality.
apkpure.com
app to run scripts on Android device without the need of ADB
Click to expand...
Click to collapse
Click to expand...
Click to collapse
So I downloaded SH Script Runner_v1.10_apkpure.com.apk onto a thumbdrive
I insert it into the android device I have to install it manually?
can you provide a sample script.sh that would run the equivalent of I can take it from there
$ADB_CMD shell pm uninstall org.courville.nova
...
I went ahead and installed the SH Script Runner it looks like it's designed to create/manage several scripts. I am not sure I understand yet it's flow.
When accessing the upper-right menu ... "open local script" It does not appear to let me browse other than internal /sdcard IOW, it does not seem to list my connected thumbdrive like this simple FileManager or X-plore would.
Once I understand the syntax of this script.sh I will convert my current make.sh and take it over the android device.
I do all my script editing on a PC with VScode editor.
Thank you for your guidance.

SH Script Runner is both a script editor and script executor, means write your code into this editor and run the script.
Example:
Code:
pm uninstall org.courville.nova

Related

[APP][2.2+] Remote ADB Shell

Overview
Remote ADB Shell is a simple terminal app that allows you to connect to the ADB shell service of another Android device over the network. This works in the exact same way that the "adb shell" command works on a computer. Because this app uses a native implementation of the ADB protocol in Java, it does not require root on either device or any 3rd party apps on the target device. The devices simply speak the same protocol to each other that they would to a computer running the ADB client from the Android SDK.
Features
Command history (accessible by long pressing the command box)
Send Ctrl+C (accessible by long pressing the terminal view)
Auto-scroll (with toggle accessible by long pressing the terminal view)
Screenshots
{
"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"
}
Instructions
IMPORTANT: Android 4.2.2+ devices use RSA keys to authenticate the ADB connection. These devices will need to be plugged in to a computer the first time you connect to them (from each device with this app installed). This allows them to display the public key acceptance dialog, which you must accept (and check "Always allow from this computer").
To configure a stock un-rooted target, plug the target device into a computer and run "adb tcpip 5555". This will start ADB listening on port 5555 on the target device. The device can then be unplugged and will remain configured properly until reboot.
For devices that are rooted (although it's not required), you can install one of the several "ADB WiFi" apps to enable the ADB server to listen over the network. Devices with a custom ROM may have an option to enable ADB over the network in the Developer Options pane of Settings. Using either of these methods will properly configure ADB for network access with this app. The extra step for 4.2.2+ is still required for the initial connection.
To connect to your remote Android device, type in the IP address of the device and the port number (5555 from the example above) in Remote ADB Shell. Tap Connect and it will attempt to connect to the device and start up the terminal.
Notes
This app is unique because it runs a custom ADB implementation that I wrote from scratch in Java. I plan to open-source my ADB implementation on GitHub or Google Code once I give it a bit of cleanup and documentation. Using this custom ADB implementation means that I don't require an ADB binary or root on the device running the app. Because it speaks standard ADB, it doesn't require anything special on the target either.
Please post feature requests or suggestions here and I'll do my best to work on them.
Download
The app is available on Google Play for free. https://play.google.com/store/apps/details?id=com.cgutman.androidremotedebugger
Hi, cgutman - I actually have a feature request.
But first, let me say thank you for providing this featureset in an app I already have gotten a fair amount of use out of it.
Backstory:
I use adb shell commands to automate repetitive processes on a Fire TV (Android Settop Box, connected to a TV, runs apps), like launching certain apps, performing certain actions - and so on.
I actually have about 20 actions across multiple Applescript apps on the Mac that allow me to remote controll apps like Spotify or Pandora - and your app allows me to do that from an Android device (smartphone) as well.
That said - I run into two major speedbumps.
Without a "Bookmarks" feature (store a certain shell script, give it a name, be able to edit it, execute it on click), so far I can only effectively cycle through two scripts (using the "recent history" feature in your app) - and I'd like to be able to use 20+ scripts eventually. A bookmark list (sorted by name) would be great for my purpose.
Second - to really be able to speed up the use of those items a launcher shortcut feature would be great. It could look up and reference the bookmark entries from the suggestion above - or let you set an IP and enter a command in the shortcut dialogue (Terminal Emulator does it that way). Maybe even with an auto exit option (although "&& exit" works just as well right now (*yay*) - but people would have to know to use it). Also it should allow you to name the shortcut, before creating it.
The reason why this would be great is to reduce steps. Right now I have to open the app, connect to the remote Android device, longpress on the command line entry field, select a history item, press enter - press OK once the app has finished the script, then exit the app.
It would be great to be able to automate all of this down to one launcher shortcut click.
To give you an Idea - what I am using the app for currently - here is one of the scripts I wrote today:
Code:
monkey -p com.netease.cloudmusic 1 && sleep 5 && input tap 960 978 && sleep 0.8 && input keyevent 19 && input keyevent 19 && input keyevent 19 && sleep 0.3 && input keyevent 20 && input keyevent 20 && input keyevent 20 && sleep 0.3 && input tap 50 960 && sleep 0.8 && exit
This opens the netease app and starts the "daily recommended" playlist.
Code:
input tap 60 100 && sleep 0.8 && input tap 60 100 && sleep 0.8 && input tap 60 100 && sleep 0.8 && input tap 1444 1030 && sleep 0.8 && exit
This exits the app cleanly - and so on...
Again - I've set up dozens of scripts like that on my Mac to be able to navigate Pandora, and spotify - to pull files, make screenshots, and so on and so forth. If you could implement said features (again - Terminal Emulator has them.. ) - your app would allow me to realize the same functionality on my smartphone.
Thank you for reading through my posting and contemplating the idea -
so long
h.
edit: Also thank you for already exiting the session cleanly (adb disconnect) once you type in exit. The Fire TV only allows one adb session at a time, so this is great.
Found a way to make the app a little more usable "as is" for my purposes in the meantime. Part of my problem was, that the shell scripts turned out quite complex - so I couldnt run several of them - because they weren't instantly recognizable on the run history level.
The temporary workaround for me was to move the commands as shell scripts to a folder (I named "shell") in /system on the target device and make them executable. That way the history in Remote ADB Shell stays cleaner and is better parseable by humans.
This is what it looks like now:
http://i.imgur.com/AuGFZ0a.png
Just right. Thank you.
Love this app! However I would like to ask if it were possible to send adb commands from outside the app using apps like Tasker. This could already simply be done by sending your app and intent with the ip, port and command.
I just created a Tasker Plugin myself using the AdbLib library! Have a look if you like https://play.google.com/store/apps/details?id=com.ADBPlugin
Trying to connect to my phone but I am not getting device authorization messages.
Great application, thank you.
My task:
- - the device has no Root
- in the directory / tmp there is a binary file su and SuperSU.apк for this device
- How to launch an "adb root shell tcpip:5555" using your application on the this device?
may be:?
1) adb tcpip:5555
2) adb root
3) adb tcpip:5555
4) adb remount
5) "adb shell"
6) or without "adb shell" -> adb pull ... adb pushh... adb reboot...
This is possible?
Or is this impossible in principle?
I'm having trouble installing apk's with this. The normal command that I use on Windows doesn't seem to work...
Could it be having trouble finding the file on my phone while trying to send it to my fire stick?
Kranium31 said:
I'm having trouble installing apk's with this. The normal command that I use on Windows doesn't seem to work...
Could it be having trouble finding the file on my phone while trying to send it to my fire stick?
Click to expand...
Click to collapse
You can't, it's just "adb shell" commands (where you leave out the adb shell part), not "adb install" for instance.
---------- Post added at 12:23 AM ---------- Previous post was at 12:20 AM ----------
AS2107 said:
Great application, thank you.
My task:
- - the device has no Root
- in the directory / tmp there is a binary file su and SuperSU.apк for this device
- How to launch an "adb root shell tcpip:5555" using your application on the this device?
may be:?
1) adb tcpip:5555
2) adb root
3) adb tcpip:5555
4) adb remount
5) "adb shell"
6) or without "adb shell" -> adb pull ... adb pushh... adb reboot...
This is possible?
Or is this impossible in principle?
Click to expand...
Click to collapse
The app only connects via "adb shell", so only those commands are possible, so no "adb install", "adb tcpip" or whatever. It's like typing "adb shell" on a PC and then you're able to give direct commands to the phone like moving a file with "mv /sdcard/Download/file /sdcard"
Hello I am having an issue
I want to use the adb on my own device (meaning only one device is being used)
I am able to connect the adb shell but whenever I try to type the following command it gives the error adb not found
adb shell sh /sdcard/.chaozhuo.gameassistan2/inject.sh
If anyone knows what the issue is Plz help
Thanks in advance
I just bought a 2019 Nvidia Pro. I installed your Wolf Launch and was attempting to install a widget. A prompt appears and states my device doesn't support a widget and have to run an ADB shell. Troypoint has an app for a remote adb shell as so do others, but I cannot find one for a nvidia.
In the widget binding failure the code it is telling me to type is, appwidget grantbind --package com.wolf.firelauncher --user 0
I was all set to do this but the firelauncher gave me pause. The device I am attempting this on isa 2019 Nvidia Pro v.9.0.1 + hotfix 1
need confirmation this is the correct code for my device.
Thanks,

[TOOL] [LINUX/MAC/WINDOWS] Nexus Tools 5 (Featured by XDA)

Nexus Tools
Nexus Tools is a simple installer for the Android SDK Platform Tools package, which includes ADB, Fastboot, Systrace, and other applications. Nexus Tools is written in Dart, and can run on Linux, macOS, Windows, Windows Subsystem for Linux, and Chrome OS.
Nexus Tools downloads the latest Platform tools package directly from Google's servers (so you're always getting the latest version), saves them to ~/.nexustools, and adds the directory to your system's path. On Windows, Nexus Tools can optionally install Koush's Universal ADB Driver.
Once Nexus Tools is finished, you can run adb, fastboot, and other commands with no problems. You need to open a new terminal/command line window after installation for changes to take effect. The SDK Platform Tools can be updated by running nexustools -i, or you can uninstall everything by running nexustools -r.
{
"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"
}
How to use on Linux, macOS, and Chrome OS
Paste this command into the Terminal app:
Code:
bash <(curl -s https://raw.githubusercontent.com/corbindavenport/nexus-tools/main/install.sh)
You can also download the Mac and Linux versions from the latest release page, un-zip the file, and run it from the Terminal.
Once Nexus Tools is finished, you can run adb, fastboot, and other commands straight from the terminal. You may need to open a new terminal window for changes to take effect. To update, just run the installer again.
How to use on Windows
Open Windows PowerShell from the Start Menu and paste this command:
Code:
iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/corbindavenport/nexus-tools/main/install.ps1'))
You can also download the Windows version from the latest release page, un-zip the file, and run it from Windows PowerShell or the Command Prompt.
New in Nexus Tools 3.0:
Cleaned up script code
Fixed udev list being installed on Mac OS X, even though OS X doesn't need it
Less output spam during installation
New logo
corbin052198 said:
New in Nexus Tools 3.0:
Cleaned up script code
Fixed udev list being installed on Mac OS X, even though OS X doesn't need it
Less output spam during installation
New logo
Click to expand...
Click to collapse
Hey, I appreciate your work mate. Nexus Tools has worked well on my Mac. Thanks for creating this tool set. Keep it up!
syintiphic said:
Hey, I appreciate your work mate. Nexus Tools has worked well on my Mac. Thanks for creating this tool set. Keep it up!
Click to expand...
Click to collapse
Glad it worked for you!
New in Nexus Tools 3.1:
Added smart remove (on Ubuntu and Debian linux, Nexus Tools will automatically check if the distro's ADB/Fastboot packages are present and allow you to uninstall them)
Changed udev rules list to automatically overwrite existing list
No longer installs udev list on Mac OS X (because it doesn't use it)
sorry to bother, but will this very useful tool be updated to the latest adb and fastboot versions ? afaik the last adb version is 1.0.35 and the current installed is 1.0.32.
thanks a lot in advance !
I've installed it but the terminal still says -bash: adb: command not found
where can i find 1.0.32? The adb version i have now is 1.0.31...
Any chance you can update the script to install ADB 1.0.36?
UPDATED: I downloaded the latest SDK Tools and moved the adb and fastboot binaries into the .nexustools folder and made the binaries executable using chmod +x on both binaries so now I have adb 1.0.36 and the latest fastboot
1619415 said:
Any chance you can update the script to install ADB 1.0.36?
UPDATED: I downloaded the latest SDK Tools and moved the adb and fastboot binaries into the .nexustools folder and made the binaries executable using chmod +x on both binaries so now I have adb 1.0.36 and the latest fastboot
Click to expand...
Click to collapse
Hey, would you be able to send me the adb and fastboot files? I don't have Android Studio installed on my Mac and so I can't use sdk tools to update my adb to 1.0.36. Thanks.
corbin052198 said:
Nexus Tools is an installer for the Android debug/development command-line tools ADB (Android Device Bridge) and Fastboot for Mac OS X and Linux. The script does not need to be downloaded, simply copy and paste this command into the terminal and run it to install ADB/Fastboot:
Code:
bash <(curl -s https://raw.githubusercontent.com/corbindavenport/nexus-tools/master/install.sh)
and this command to un-install Nexus Tools:
Code:
bash <(curl -s https://raw.githubusercontent.com/corbindavenport/nexus-tools/master/uninstall.sh)
Nexus Tools requires sudo privileges to install/uninstall the adb and fastboot tools to /usr/local/bin, so they can be run without typing the full directory. Nexus Tools is licensed under the GPLv3 license, and the source code is at the GitHub project below.
If you have a problem with Nexus Tools, leave a reply below or as an issue on the GitHub project!
GitHub Project
XDA News Article
Click to expand...
Click to collapse
Thank You so much. You are a life saver. This is amazing. Looked all over for this. It was hard to find.
Thank You.
1619415 said:
Any chance you can update the script to install ADB 1.0.36?
UPDATED: I downloaded the latest SDK Tools and moved the adb and fastboot binaries into the .nexustools folder and made the binaries executable using chmod +x on both binaries so now I have adb 1.0.36 and the latest fastboot
Click to expand...
Click to collapse
Also anyone that's on Linux another way to make adb/fastboot or any binary for that matter executable is to just put a " dot followed by a forward slash in front of your adb or fastboot command " like so...
./adb devices
./fastboot devices
Work like charm on el capitan, thanks for this quick an amazing script
1619415 said:
Any chance you can update the script to install ADB 1.0.36?
UPDATED: I downloaded the latest SDK Tools and moved the adb and fastboot binaries into the .nexustools folder and made the binaries executable using chmod +x on both binaries so now I have adb 1.0.36 and the latest fastboot
Click to expand...
Click to collapse
I ran your script today and ADB is showing 1.0.32 for me. Any way I can get it to 1.0.36?
Google Releases Separate ADB and Fastboot Binary Downloads
could some one tell me where to place the files i want to flash.. i'm not a pro thanks in advance
hjjiang said:
Google Releases Separate ADB and Fastboot Binary Downloads
Click to expand...
Click to collapse
thanks a ton you saved me a lot of time. thanks a lot
I just updated Nexus Tools to version 3.3, which updates the ADB/Fastboot binaries to the latest versions. Enjoy!
i try this but got a message
"Illegal instruction"
i also try
"PATH=~/.nexustools:$PATH"
but there is nothing happen
my computer is mac osx 10.6
how could i fix it
thank you
I can install and working well without any doubt till today.. using the copy of script directed to my terminal.. thanks alot

[WIP][GUIDE] Adb beginner to Pro[In-Depth]

A thanks here would be highly appreciated :good::good::good:
Any developing you take with Android you need ADB its the acronym fo Android Debugging Bridge
Today I am going to show you how to use Adb , how to build it , how to play with its source
Beginner ​Lets introduce to you adb
Think adb as your messenger ,
You type a message / command
Then that message is taken by adb and delivered to the phone
the phone client would execute or perform any necessary tasks
Installing Adb
HOW TO INSTALL ADB [Linux]
On Ubunutu
Code:
sudo apt-get install android-tools-adb android-tools-fastboot
{I Need more distro's command if you know please contact me}
HOW TO INSTALL ADB ON WINDOWS
http://forum.xda-developers.com/showthread.php?p=48915118
Lets Now play with basic adb commands
================================================================================================
adb devices : This allows you to confirm that your pc and device are communicating
syntax
Code:
adb devices
adb pull : This allows you to pull specific files from the device
syntax
Code:
adb pull /sdcard/you_know_what.jpg
adb push : This allows you to send specific files to the device
syntax
Code:
adb push file.txt /sdcard/0/
================================================================================================
adb reboot : You can guess the command's function by looking at it and you were probably right it just "reboot" your phone
syntax
Code:
adb reboot
adb reboot-bootloader : This is same as its parent (adb reboot) but instead of rebooting to Android OS it boots to the bootloader
adb reboot-recovery : This is same as its parent (adb reboot) but instead of rebooting to Android OS it boots to the recovery
================================================================================================
adb shell : This executes a command on the device
Info : You can just pass a single command to the device to execute or you can also open an interactive shell
syntax ( single command ) :
Code:
adb shell [I]command[/I]
synatx ( interactive shell ) :
Code:
adb shell [ENTER]
command"s"
adb sideload : ADB sideload is a different ADB mode that you can use to push and install a zip using one command from your computer
Info : This was introduced in Jelly Bean Aosp
syntax :
Code:
adb sideload /sdcard/0/rom.zip
================================================================================================
adb install : This allows you to install any apps on the device using adb
syntax :
Code:
adb install TheApp.apk
info : running adb install with -r flag makes it install the app on the sdcard of the device (if the rom supports it)
adb uninstall : This allows you to uninstall an app on the device
syntax :
Code:
adb uninstall com.company.appname
info : using -k option uninstalls the application while retaining the data/cache.
At the moment, there is no way to remove the remaining data.
You will have to reinstall the application with the same signature, and fully uninstall it.
adb logcat : This allows you to access the logs / events of the system/apps
syntax :
Code:
adb logcat
{I would do a more in-depth synopsis of these command in my next post}
================================================================================================
Great post! This will be an excellent tool for anyone wanting to learn adb.
================================================================================================
After you have played with adb now lets gets the level
Amateur​Now after playing with commands your curiosity has risen and you want to know How does adb work ?
let me break the confusion
Adb has 3 major components
Adb client
adb server
adb daemon (adbd)
Lets see what each of them does
================================================================================================
adb server : You can consider this as a daemon running on the PC . It manages the communication between the adb client and adbd daemon. Its purpose if to sense the USB ports to know when devices are attached/removed, as well as when emulator instances start/stop.It thus maintains a list of "connected devices" and assigns a 'state' to each one of them: OFFLINE, BOOTLOADER, RECOVERY or ONLINE
================================================================================================
adb client: This is the clients that communicates with the server to give commands. It first tries to locate the ADB server on the host machine, and will start one automatically if none is found.
================================================================================================
Info: At this moment a single 'adb' binary is used for both the server and client
================================================================================================
adbd : The daemon runs on the device side and listens for for the commands on the usb or tcp. The adb server tries to communicate with the adbd daemon, if the connection is made then it labels the device as online else if , the connection to the device is made but the server cant communicate with the adbd then the device is labelled as offline.
In Android adbd is started when the data partition is mounted it is started by init.usb.{ro.hardware}.rc you can mod it to run earlier on your rom builds
================================================================================================
================================================================================================
Now lets move on to the next level
PROFESSIONAL​Before Moving in here please see familiarize your self with Android Building
After you have followed the guide , Now lets start building the adb
Prepare the environment
Code:
source ./build/envsetup.sh
lunch lineage_devicecodename-eng
mka adb fastboot
Now you can check $OUT directory for the executable
Code:
which adb
which fastboot
================================================================================================
Lets first see how the communication between the client and the adb server works
The adb server listens on tcp::localhost:5037
A diagram representing the structure
A Graphic by forum.xda-developers.com wiki
{
"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"
}
so the client connects to tcp:localhost:5037 and sends a request in the following way
A 4-byte hexadecimal string giving the length of the command
And then followed by the command itself
so a million dollar question how does the adb server responds to the client ?
Server would respond in 2 ways :
For success, the 4-byte "OKAY" string
For failure, the 4-byte "FAIL" string, followed by a 4-byte hex length, followed by a string giving the reason for failure.
Note : In a special case of adb's version the a 4-byte hex string corresponding to the server's internal version number would be returned
Note : For different commands the behavior is different so I would make a separate post About it
================================================================================================
Now for building the adb as you have already see you use mka adb fastboot
The main thing over here is Android.mk of the adb and the folder structure
Lets start by counting the number of modules built by the Android.mk
LOCAL_MODULE := libadbd
LOCAL_MODULE := libadb
LOCAL_MODULE := adbd_test
LOCAL_MODULE := libdiagnose_usb
LOCAL_MODULE := adb_test
LOCAL_MODULE := adb
LOCAL_MODULE := adbd
So these were the 7 module built by it
================================================================================================
Now I would leave you on your own to figure the source code ( i made it quite easy , didnt i ? )
I would continue writing in my next post how do the commands execution work
So this was the end of the professional I hope you learnt something If you need more stuff here please contact me
[WIP][If anyone can do the diagrams it would be a huge help i would give you the whole credit for images]

[TOOL][GUIDE] BareNox - Modded Nox Android Emulator

Hello Friends~!
Today I bring to you the Latest version of Nox, made portable, with a Cleaner Script to remove all the junk on your Main Machine as well as for Clones
DOWNLOAD BARENOX:
BareNox.zip (200M)
If you would rather build your own, I will now provide a written guide for how BareNox was built.
"BareNox" went through a lot of testing and a script was made to automate much of what is written below
Spoiler: WRITTEN GUIDE
Made using the latest version of Nox, which can be downloaded off the right side of this page:
System Requirements of Nox App Player – NoxPlayer
Open Nox's Multi Drive Manager and select "Add Emulator" and "Android 9" or whatever you prefer
{
"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"
}
When it is done building the machine you need to click on settings and enable root.
Spoiler: HOW TO CLEAN THE PREINSTALLED MACHINE WITH AN APP (NOT RECOMMENDED)
This method is advised against, due to the amount of time it takes to physically remove each directory within the gui, when we could remove all of these directories with a simple script. The knowledge will still be provided to show what the adb method is doing for us.
Open Nox and install a launcher app like nova, and a root explorer by selecting the apk button on the right side panel.
Spoiler: PIC
If you need the apps:
Nova
nova.apk
drive.google.com
Root Explorer
RootExplorer.apk
drive.google.com
Now open Nox's settings by clicking on the gear icon at the top right.
We need to go into General, and then put a check on root.
Spoiler: PIC
Next click on the Gaming tab and enable high fps and rendering cache. This is to allow you to be able to play higher end mobile games
Spoiler: PIC
Save settings and restart the machine
Select Nova as the Launcher app always
Spoiler: PIC
Open root explorer. Grant Superuser access forever
Delete all the items highlighted in the pictures below and close the machine.
Spoiler: PIC
Spoiler: HOW TO CLEAN THE PREINSTALLED MACHINE WITH ADB (RECOMMENDED)
This comment explains it
Spoiler: HOW TO USE THE SCRIPT AND NOVA ON ANY VERSION OF NOX
Make a new machine and enable root in settings
Make a text file and call it run.bat
Paste in this code.
Code:
adb root
adb shell rm -r /system/app/AmazeFileManager
adb shell rm -r /system/app/AppStore
adb shell rm -r /system/app/BuiltInPrintService
adb shell rm -r /system/app/CarrierDefaultApp
adb shell rm -r /system/app/CompanionDeviceManager
adb shell rm -r /system/app/CtsShimPrebuilt
adb shell rm -r /system/app/EasterEgg
adb shell rm -r /system/app/Facebook
adb shell rm -r /system/app/Helper
adb shell rm -r /system/app/LiveWallpapersPicker
adb shell rm -r /system/app/PrintRecommendationService
adb shell rm -r /system/app/PrintSpooler
adb shell rm -r /system/app/Traceur
adb shell rm -r /system/app/WallpaperBackup
adb shell rm -r /system/app/newAppNameEn
adb install nova.apk
adb reboot
Paste run.bat into the bin folder of Nox
Paste nova.apk (10M) into the bin folder of Nox
Now Run run.bat
Spoiler: VERIFIED WORKING GAMES
If there is a game you want me to test, leave a comment below.
Spoiler: BEAT PARTY
at the end of the video
Spoiler: DIABLO IMMORTAL
at the end of the video. guide is outdated
Spoiler: EPISODE STORY APP
Spoiler: MKX ONLINE
There's more that can be finessed here, have fun!
VT-Error fix
For rooted WSA (Android 12 or 13) see this guide
How To Build and Root Your Desired Flavor of WSA and install the Playstore Using LSPosed & Magisk. Plus a Premade
Hello Friends, Today I wanted to write a guide about how to use the LSPosed Github Repo on a linux machine to build your desired flavor of WSA with GAPPS and Root. If you do not already have a Linux machine or WSL, I have a fully built and...
forum.xda-developers.com
Works pretty well for me, except for trying open the multiple instances. I've wiped things clean a couple times and even tried on my other pc. Luckily the app I was trying to install had an x86 version so it'll do for now. I'll have to look into it when I have a bit more time.
Thanks for the post!
Twistt said:
Works pretty well for me, except for trying open the multiple instances. I've wiped things clean a couple times and even tried on my other pc. Luckily the app I was trying to install had an x86 version so it'll do for now. I'll have to look into it when I have a bit more time.
Thanks for the post!
Click to expand...
Click to collapse
Thank you for testing it!
Note that this issue has now been corrected
-
--
--
NotNox has had a Proper Update and is now at V2 "BareNox"
Includes the cleaning script commented on earlier.
Spoiler: HOW TO USE BARENOX
UPDATED 08/04/2022
BareNox.zip
drive.google.com
(196.2 MB ZIPPED)
Open BareNox and then bin, run MultiplayerManager.exe and add new emulator of choice
The first time you make a machine, nox will have to dl the "base" of the android version you selected from nox's servers. You only have to do this the first time you try to create an android 9 or 7 machine. You will then be able to create clones quickly as the BareNox folder will now contain the base disk and data folder.
Make sure to click on the gear icon and enable Root in system settings before running the machine
Run the remove.bat script when this lady appears on your new machine (this is when you have full read write access)
This will go through and remove the crap apps and install nova launcher for us
Spoiler: HOW TO CLEAN THE PREINSTALLED MACHINE (OR CLONES) WITH ADB
Spoiler: WRITTEN GUIDE
Go into the Binary folder of Nox or Not Nox and add a new text file called remove, paste NOVA.APK into this folder as well
Paste the contents of the script into the remove file
change the file extension from txt to .bat by renaming the file
add a new emulator and wait for it to make it to this screen, you need to hit Login later in order to get full Root, otherwise our batch will fail.
Run the remove.bat file after hitting Login Later and waiting for the garena lady to appear
this is what will be shown as the batch runs, don't do anything the machine will reset itself
select nova always and you're all set!
Spoiler: THE SCRIPT AND NOVA DL LINK
Spoiler: FILE EXPLORER OPTIONS PREREQ
View attachment 5669749
You need to have hide extensions for known file types unchecked, in order to be able to change a file from text to batch
nova.apk
drive.google.com
adb shell rm -r /system/app/AmazeFileManager
adb shell rm -r /system/app/AppStore
adb shell rm -r /system/app/BuiltInPrintService
adb shell rm -r /system/app/CarrierDefaultApp
adb shell rm -r /system/app/CompanionDeviceManager
adb shell rm -r /system/app/CtsShimPrebuilt
adb shell rm -r /system/app/EasterEgg
adb shell rm -r /system/app/Facebook
adb shell rm -r /system/app/Helper
adb shell rm -r /system/app/LiveWallpapersPicker
adb shell rm -r /system/app/PrintRecommendationService
adb shell rm -r /system/app/PrintSpooler
adb shell rm -r /system/app/Traceur
adb shell rm -r /system/app/WallpaperBackup
adb shell rm -r /system/app/newAppNameEn
adb install nova.apk
adb reboot
Spoiler: HOW THE NOX ADB SCRIPT WAS MADE
Hello Friends! I have created a guide on how to make your own Script to clean up your Nox machines (pre-installed and clones)~! Please note there is much much more that you can do here, this is just to teach you the basics to help you come up with interesting ideas!!
This video is Nerd Knowledge, and unneeded for folks that just want to quickly clean up their clones. Check out the next comment for the quick cleaning method
"BareNox" has this batch file pre-installed for your convenience
jenneh said:
NotNox has had a Proper Update and is now at V2 "BareNox"
BareNox.zip
drive.google.com
100 mb zipped!
Includes the cleaning script commented on earlier. Watch the video to see how to use it.
Note that:
THIS IS NOT A PREINSTALLED MACHINE, like "NotNox".
You will have to use multiplayermanager and add a new emulator with your choice of android version.
The first time you make a machine, nox will have to dl the "base" of the android version you selected from nox's servers. You only have to do this the first time you try to create an android 9 or 7 machine. You will then be able to create clones quickly as the BareNox folder will now contain the base disk and data folder.
Run the remove.bat script when this lady appears on your new machine (this is when you have full read write access)
This will go through and remove the crap apps and install nova launcher for us
View attachment 5669963
Click to expand...
Click to collapse
i got this error
HoangNK said:
i got this error
Click to expand...
Click to collapse
edit I am working on a fix
This issue has now been fixed
@HoangNK I apologize, I didn't mean to dismiss your VT error, I sincerely thought it was due to that mode not being enabled on the user end.
I now realize, after reinstalling windows on my laptop which has vt enabled, that I did indeed create this error. I didn't realize it at the time due to sharding, as I had nox installed in the main directory as well as the portable, so I didn't notice the problem.
I have rebuilt and verified BareNox, here's the new dl link:
BareNox.zip
drive.google.com
(196.2 mb ZIPPED)
For anyone Still experiencing the "VT Error" check your Windows Features settings. I unintentionally caused this error to myself while playing with WSL. Open up windows Features and uncheck these options, then reset
Spoiler: show
Something to consider about Emulators, they can be used to program virtual machines that have windows preinstalled faster usually than on your android device. Then you could pull your machine from the emulator and port over to any android device. I'm working on a detailed guide but it will take some time as I work to make the virtual machine's parameters more feasable for work use, i.e. a 10gb max hdd is not gonna suffice~!
To Do List: get win 10 working
Proof of Windows 7 Working in Nox:
How To Guide:
How To Install Windows Or Linux ISOs on your Android Devices - Windows 10 Nox Lab + Working Arm Distros for your phone using Termux
Update: A new thread is created to house "premade" linux distros. The first premade environment is an Ubuntu distro, installed using proot-distro in termux, Takes only a few minutes to restore the backup, else instructions are provided to build...
forum.xda-developers.com
A note to anyone checking this out from this date forward, Nox has had an update since I wrote the script. So when barenox downloads the android image from nox's server, they are different than before. Meaning that Even though one selects ROOT on startup, the ADB will not recognize the READ WRITE status thus rendering the .REMOVE.bat script useless for the time being. The adb root command does not help, I didn't bother to su into the shell bc the time factor, I could just delete in root explorer
A TLDR use the manual removal method with root explorer and manually install nova as the original thread shows how to do if you want to remove the crapware.
I'm not going to update the script, instead I am going to stop being lazy and just make my own emulators in android studio and share some builds in another thread. I'll leave a comment below whenever that happens.
Listen Linda.
I found an Amazing OS that I am trying to work out a few kinks for. It runs in vmware, has root, can play the games, has a traditional desktop feel, can run multiple apps in separate windows.
It's called prime os! I am not a creator. Just a testing a producto~!
I will make a new thread with prebuilt images of this and like 5 other prebuilt android x86_64/ chrome os forked os's that I played with this week. Putting out the word about prime in case anyone has any ideas how to get openvmtools or vmware tools to work on here. I am trying to build a stack in termux to accomplish this myself, key word trying. Maybe someone knows how.
other os's tested and built -- may add more if I find them
google chrome os - cloudready version
bliss os
android x86_64 9.0
flint os
fyde os
Spoiler: notes
as an Edit ---I am well aware that the tools are not "officially supported" so lets make them work anyway ok
This is 12 years old but still relevant
'As an update, I was able to locate the vmware tools iso for pre glibc linux distros (like our android vms) It comes with vmware workstation 17
had to pkg install tsu then run this command and am a step closer
I went through and pointed the script to the requested binary's location /system/bin/more and the others all for the most part in bin with depmod being in xbin. the program seemed to have an error at the end. going to take all the requested binaries out from system now and add them to the vmtools folder
using root explorer can copy the binaries from bin into the vmtools folder
So here's my notes on getting vmware tools to work in the android emulator.
In vmware tools on your windows pc there are isos that contain the tools.
Inside the iso is a file like this. extract it and extract the file it makes
So here is what I did, You can see the tools have an etc folder and a bin folder. and in pictures in the notes comment above, we know that the tools need certain binaries to run, or access to.
It is not just enough to point the tools to the /system/bin/binaryname because the stock binaries aren't executable.
So I obtained all the binaries the code calls for and put them into the bin folder of the tools.
I also built the missing directories such as /var/log
i changed the name of install-vmwaretools.pl to run.pl and added mkdir codes for the needed folders
Now running perl run.pl gives this interesting error
Anyone have any ideas?
It also really Did create that many folders, haha
hey there.. is there still possible to use your script to use older version of noxplayer and make that work? i get it that no more noxplayer updates will be compatible. but, that is just perfect for me.
i used noxplayer every day since 2016 and run 12 instances. it was and still is Ver. 3.8.3.1
but google as of last month has now removed games that is no longer supported by the google play.. so no more game updates for me. so i have no other choice to upgrade too.. i had off course followed guides and hacked it.. so no adds what so ever.. so hoping that you can still your very useful software to get rid of ads and malwares that they usually bring to free version.
thank you
@noxlar2 anything is possible, however i would need a copy of the version you want to fix to be able to advise better. as far as the current version i will for sure look at fixing the script for it tomorrow. kinda got super carried away on other projects and should take the time
@jenneh
wow.. fast reply back. well, just buildt me a new pc.. so, it will be with a fresh win11 and fresh noxplayer.. so i have no idea what version i must choose.. i will have my old pc system untouched in case of fall back on nox.p.. reason i always used the version i did was because of superior stability vs recent (back then + few years forwards)
also i did test latest free version on my minipc.. and it worked great as well. but, i have not done extensive testing so i don't know.
@noxlar2 Hey Congratulations on your new PC! That's always an amazing feeling. Thank you for clarifying which version. I was able to successfully get the script working again on the Latest nox and Lol it was silly, all the script needed was "adb root" added to the top.
i had to do the VT-Error fix bc of playing with WSA
got the original barenox updated -- link in the op and HERE Just remember to select root in settings before running the machine or the script wont work

Question Resolve "adbd cannot run as root in production builds"

Hi!
I'm running Android 13. I've used Magisk to root the device but the command
Code:
adb root
results in
Code:
adbd cannot run as root in production builds
I already tried "adbd Insecure v2.00.apk" but it fails with the message
Code:
Could not patch adbd !
Is there a way to fix this?
you can overlay /system/bin/adbd with magisk module. create new directory in /data/adb/modules and place your files
Code:
/data/adb/modules/my_module/system/bin/adbd
/data/adb/modules/my_module/module.prop
https://topjohnwu.github.io/Magisk/guides.html#magisk-modules
or escalate to privileged shell and stream file content over stdin/stdout (linux only)
Code:
adb shell "su -c 'dd bs=1m if=/dev/block/bootdevice/by-name/boot 2> /dev/null'" > boot.img
adb shell "su -c 'dd bs=1m of=/dev/block/bootdevice/by-name/boot'" < path/to/boot.img
alecxs said:
you can overlay /system/bin/adbd with magisk module. create new directory in /data/adb/modules and place your files
Code:
/data/adb/modules/my_module/system/bin/adbd
/data/adb/modules/my_module/module.prop
https://topjohnwu.github.io/Magisk/guides.html#magisk-modules
or escalate to privileged shell and stream file content over stdin/stdout (linux only)
Code:
adb shell "su -c 'dd bs=1m if=/dev/block/bootdevice/by-name/boot 2> /dev/null'" > boot.img
adb shell "su -c 'dd bs=1m of=/dev/block/bootdevice/by-name/boot'" < path/to/boot.img
Click to expand...
Click to collapse
Thank you very much for your reply.
How would method 1 work? I find a different binary of adbd that has the root feature enabled and overlay the original with it through a Magisk module?
mattdeox said:
I already tried "adbd Insecure v2.00.apk" but it fails with the message
Click to expand...
Click to collapse
you found already, just unzip the assets/adbd.21.png from apk
alecxs said:
you found already, just unzip the assets/adbd.21.png from apk
Click to expand...
Click to collapse
I checked the file you mentioned and it has those contents:
{
"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"
}
What should I do with them?
mattdeox said:
. I've used Magisk to root the device but the command
Code:
adb root
results in
Code:
adbd cannot run as root in production builds
Click to expand...
Click to collapse
Why do you need this?
WoKoschekk said:
Why do you need this?
Click to expand...
Click to collapse
I would like to do some automated testing on my device using Appium to check if my website works correctly.
As I understood, adb root is needed to do it properly.
just rename the file > adbd
/data/data/eu.chainfire.adbd/files/adbd.21.png: ELF executable, 32-bit LSB arm, static, stripped
mattdeox said:
I would like to do some automated testing on my device using Appium to check if my website works correctly.
As I understood, adb root is needed to do it properly.
Click to expand...
Click to collapse
Basically: ADB is a commandline tool which acts as a client-server programm. You send ADB commands (usually from a desktop PC, but also possible from a rooted mobile) as a client to the adbd (daemon) on another device. The adbd executes those commands on the other device as user:shell. If you want the adbd acts as user:root then you have to execute adb root. BUT it's not possible to grant the adbd root permissions on a stock ROM (production builds). Even if the other device is rooted with Magisk it's still a production build!
The only way to execute commands as root via ADB on another device is
Code:
adb shell
su
alecxs said:
just rename the file > adbd
/data/data/eu.chainfire.adbd/files/adbd.21.png: ELF executable, 32-bit LSB arm, static, stripped
Click to expand...
Click to collapse
I created the structure you recommended
Code:
/data/adb/modules/adbRoot/module.prop
/data/adb/modules/adbRoot/system/bin/adbd
I opened Magisk and could see the module enabled.
Then restarted adbd
Code:
setprop ctl.restart adbd
But there was still the error
adbd cannot run as root in production builds
Click to expand...
Click to collapse
Then I found out on this page https://source.android.com/docs/core/ota/modular-system/adbd
that adbd moved on Android 13, supposedly to this location:
Code:
/apex/com.android.adbd/bin/adbd
Then I also created this file for the Magisk module
Code:
/data/adb/modules/adbRoot/system/apex/com.android.adbd/bin/adbd
Again, I restarted adb
Code:
setprop ctl.restart adbd
But the result still is the same
adbd cannot run as root in production builds
Click to expand...
Click to collapse
Anything else I could do/something that is wrong?
WoKoschekk said:
Basically: ADB is a commandline tool which acts as a client-server programm. You send ADB commands (usually from a desktop PC, but also possible from a rooted mobile) as a client to the adbd (daemon) on another device. The adbd executes those commands on the other device as user:shell. If you want the adbd acts as user:root then you have to execute adb root. BUT it's not possible to grant the adbd root permissions on a stock ROM (production builds). Even if the other device is rooted with Magisk it's still a production build!
The only way to execute commands as root via ADB on another device is
Code:
adb shell
su
Click to expand...
Click to collapse
Thank you very much for your input.
Are you saying there is nothing that can be done by replacing the adbd file or the config?
Do you think the solution by alecxs to replace the binary is not working?
mattdeox said:
Thank you very much for your input.
Are you saying there is nothing that can be done by replacing the adbd file or the config?
Do you think the solution by alecxs to replace the binary is not working?
Click to expand...
Click to collapse
Still do not understand the reason. Assume the command adb root is successful. how to proceed then?
Here's what you need for adb root:
daemon/main.cpp - platform/system/adb - Git at Google
These criterias have to be met to execute adb root.
In case the adbd gets root permissions, then you keep the privileges to run:
Code:
adb disable-verity
enable-verity
sideload OTAPACKAGE
remount [-R]
unroot
(For further information see 'adb help')
All the other ADB commands don't require the adbd to be rooted.
the insecure adbd by @Chainfire according to this logcat requires some additional sepolicy rules and probably therefore does not work with magisk out of the box.
found some magisk modules, maybe one of these binaries work for android 13 if you place it system/apex
[MODULE] Insecure adbd for Pixel devices
Hi everyone, I made a simple module for my own needs and I figured I'd share it here as well. This module enables "insecure adbd" on Pixel devices, which allows you to restart adbd in root mode via "adb root" and push/pull to/from the /data...
forum.xda-developers.com
[MODULE] Debugging modules: ADB Root, SELinux Permissive, Enable Eng
These modules are not meant for everyday use. They are intended for debugging and modification of a firmware. They significantly lower security of your device while active and even could softbrick it. You've been warned. ADB Root Magisk Module...
forum.xda-developers.com
Do I understand correctly:
To use/install the patched adbd I need a device with root permissions. Otherwise it wouldn't be possible to copy the adbd to /system/bin and make it executable. Having that patched adbd in /system/bin, I'm able to use the command adb root which let's me execute ADB commands with root permissions.
Why not using
Code:
adb shell
su
? Why I need a adbd with root permissions on a rooted device?
@WoKoschekk most likely he don't need it. we don't know. but there are cases where it can be useful, for example
Code:
adb pull /dev/block/bootdevice/by-name/userdata
alecxs said:
@WoKoschekk most likely he don't need it. we don't know. but there are cases where it can be useful, for example
Code:
adb pull /dev/block/bootdevice/by-name/userdata
Click to expand...
Click to collapse
Apart from the fact that it's not possible to restore such an image (e.g. corrupted encryption) you have to copy 128GB (minus the system) or more via USB. There is a reason why TWRP saves the data as a TAR archive and splits it into 1GB chunks.
I know there are more examples for a rooted adbd. But it could all be done in a root shell, too.
TWRP is useful for backup only if encryption is supported, which is not the case for Samsung encryption. But for forensic and recovery of deleted files full partition image is required. on FBE that /dev/block/bootdevice/by-name/userdata is already decrypted during runtime. for FDE one must adb pull /dev/block/dm-0 or whatever is mounted /data of course. Restoring works fine btw. just some encryption related files (like locksettings.db) must deleted.
I have posted workaround for streaming partitions with su (refer to 2. method in post #2) but it does not work on windows (not even with dos2unix)
TWRP was only an example for how /data could be backed up. In the most cases you restore /data after a wipe or when /data gets formatted. Then you will have a conflict with the already established encryption. After /data gets formatted the system generates a new master key during the next boot. You can't decrypt an old encryption with that master key.
The partition mirrors ~/dm-0 and so on are based on AVB and the device-mapper layer.
alecxs said:
I have posted workaround for streaming partitions with su
Click to expand...
Click to collapse
Yes, I know the 'netcat' method. Of course it's better to have a desktop PC and its storage for large images like /data. Better than an external sd. But you could also use the device's shell to create tar files.
WoKoschekk said:
Then you will have a conflict with the already established encryption.
Click to expand...
Click to collapse
Nope. works fine, as the partition image does not contain any encryption at all. consider it's already decrypted in AFU state.
WoKoschekk said:
After /data gets formatted the system generates a new master key during the next boot. You can't decrypt an old encryption with that master key.
Click to expand...
Click to collapse
Yes. only for FBE, for FDE it's static key. But encryption type doesn't matter, it contains plain files - same as TWRP backup.

Categories

Resources