General Extend WSA by 428 Linux commands - Windows 11

To my knowledge Windows Subsystem for Android ( WSA ) is not created to run apps from the Amazon store only, but is configured for testing via ADB, will say run Linux commands in an Android shell, too.
WSA ( what at time of this writing is running Android 12 ) has merged Landley's Toybox v0.8.4, a bag of over 200 Linux command line applets - I have not really counted them.
A typical Linux distribution provides 428 command line applets - the SU incorporated. I have uploaded .ZIP ( 263 MB ) what contains them all here to:
428-cmds
MediaFire is a simple to use free service that lets you put all your photos, documents, music, and video in a single place so you can access them anywhere and share them everywhere.
www.mediafire.com
If you are interested in this project, too, then it's on you to download and extract the .ZIP and push the 428 files onto Android, preferredly to /storage/emulated/0/428-cmds, and make them executable.
Example .BAT-file - assumed .ZIP got extracted into D:\428-cmds folder & ADB is installed on PC
Code:
adb connect 127.0.0.1:58526
adb devices
adb shell "cd /sdcard & mkdir -p -m06755 428-cmds 2>/dev/null"
adb push "D:\428-cmds" "/sdcard/428-cmds/"
adb shell "SM='getenforce';setenforce 0;cd /sdcard/428-cmds;CMDS='$(find .-name "*" -maxdepth 1 -type f 2>&1 | grep -i -v denied)';while read x;do chmod 06755 "$x" & chown root:shell "$x";done; << "$CMDS";chcon "$x" u:object_r:su_exec:s0;setenforce "$SM";"
{
"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"
}
Note:
The 428 commands provided all are ELF32 binaries, so 32-bit:
That doesn't have to stop you from using them on a x86_64 PC because a 64-bit CPU can handle 32-bit commands.

Hmm... Great Work

I am getting an error on the last command.
/system/bin/sh: here document '$CMDS' unclosed
I tried the method in your toybox thread but it doesn't connect to wsa.
I think it is looking on the wrong port from the looks of the script. I am just trying to get root. I updated my rooted build of wsa and it no longer would load. i have tried different ones making sure to remove the one from the microsoft store first. Installing the one from the microsoft store by installing the amazon store gets wsa working again but without root and without my userdata.vhdx that I backed up. Any help would be appreciated. Thanks

Related

Netcat through Terminal

Installing NMAP to run via Terminal
Let me start now by saying, if you dont know what Netcat is, you shouldn't bother going any further. If you do, then I hold no liability on how you use the following information.
Netcat has been said to be the "Swiss Army Knife" of networking tools. Ergo, as a network/tech, I have used this Program for a long time.
You can read up on Netcat and research this tool before use at its home page @
http://netcat.sourceforge.net/
If you need to root your device, please visit http://nookdevs.com/NookColor_Rooting for the walk through process.
Following that you will want to install Superuser and su by following the steps found at http://nookdevs.com/NookColor_Instal..._Superuser_app
You can download the file as well on your own from
http://sourceforge.net/projects/netcat/files/netcat/0.7.1/netcat-0.7.1.tar.gz/download
However, I have taken the time to unpackage the Tarbal and GZ to make it easier for this process.
Netcat files: http://www.megaupload.com/?d=S4K9QC60
First thing is of course unzip the folder. This install, compared to my last post regarding NMAP, will be slightly different. Once unzipped, there will be the primary folder holding all the files. Open your CMD/term, and run the ADB push command. For example, if the file is on my desktop, i will run
Code:
adb shell
mount -o remount,rw /dev/block/mmcblk0p5 /system
exit
adb push C:\Users\User\Desktop\netcat\netcat /system/bin
This will copy all the files within the netcat folder.
Old netcat users who used it when the syntax started with the command "netcat" will notice a difference in this revision. Now to run the commands, you simply use "nc".
To access the man page, type in nc -h and hit enter. If you installed the files correctly, you will get the following results.
{
"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"
}
~Exile~
"When All Else Fails, Try Linux"
Hi, can you please specify the steps you followed to compile it?
Thanks
Venator85 said:
Hi, can you please specify the steps you followed to compile it?
Thanks
Click to expand...
Click to collapse
I still don't see the point of netcat on a tablet... I guess people use netcat for random weird things.
question
Hey I have been missing with around with terminal and all that on my ipod. I installed netcat and I looked around and saw that it could be used like a chat, but whenever I tried the code that they used it did not work for me. Can you help me? What am i suppose to use for the code?
NetCat for app invertor
Hello
I just saw this tread and was thinking that the app inventor community ( including me ) has been looking for a TCP/UDP API ti send and receive data via tcp and udp is there a way to interface Netcat via appinventor so we can communicate with Ethernet enabled devices using this tool.
Thanks in advance
Hello...the download link is not working ..I love your project and I need that urgent....please upload the file or send it to my email: [email protected] if u have ndk stand alone tool plz can u give me...I don't have much money and data in my area to download ndk...plz

ADB install problem on SGS3/JB

I'm on SGS 3 (I9300) with freshly installed I9300XXDLIH_I9300VFGDLJ1_VIP and rooted afterwards.
Since I upgraded my phone to Jelly Bean, I can't test/debug any development project on the phone.
The Eclipse APK build passes OK and this is what I get in the step afterwards -- when the APK is tried to be deployed on the phone:
Code:
Installation failed due to invalid APK file!
Please check logcat output for more details.
Launch canceled!
This is what I get when I try installing directly with ADB:
Code:
>adb install -r test.apk
3484 KB/s (1616779 bytes in 0.453s)
pkg: /data/local/tmp/test.apk
Failure [INSTALL_FAILED_INVALID_APK]
I've found some hints that the tmp folder may have invalid permissions, so I have done this:
Code:
chmod 777 /data /data/local /data/local/tmp
With the result:
Code:
[email protected]:/ # ls -ld data data/local data/local/tmp
ls -ld data data/local data/local/tmp
drwxrwxrwx system system 2012-10-23 15:40 data
drwxrwxrwx root root 2012-08-25 10:40 local
drwxrwxrwx shell shell 2012-10-23 16:36 tmp
Eclipse or ADB still refuse to install (any) APK.
If I copy the Eclipse-generated APK to the phone and initiate the install from there, it works OK.
What can I do to fix this? Please help.
FYI, I'm using 20.0.3 Android SDK (and Eclipse 4.2.1).
My system properties:
{
"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"
}
Update:
Installed SiyahKernel S3-v1.6.8 and w/o any tampering with the settings (e.g. through ExTweak) the problem is solved.
Root cause seems to be UMASK.
- on stock kernel I had 0077
- now on SiyahKernel I have 0000
Still, as can be seen from numerous other threads on the same issue out there, it's very wrong for the stock kernel to cause that problem.
Moved to Android Q&A.

[TUTORIAL LINUX]flash TWRP onto Mediapad 7 Lite

Introduction
Try at own risk
I am a Linux user. Commands are Debian or Ubuntu so you may need to check your package manager for
Linux software for adb if different distro.
If you do not have sudo enabled, then use su - please
On tablet, I use "reboot" by Petrus, as recommended by pogs24ever
I have also installed app= adbd insecure........YMMV
Know that when TWRP is used on removeable sdcard = /sdcard2, you will have a folder
called TWRP so I prefer to rename my image as twrp.img
Credits
Vampirefo for his wonderful help with adb and root id test
pogs24ever for his XDA post for TWRP
AbduL_PT for TWRP for Rockchip
Method
SPOILERS= Click to show content ..... hides images only
Ensure your device is rooted.
{
"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"
}
If your method to root is failing try my method here.
http://forum.xda-developers.com/hua...t-huawei-mediapad-7-lite-alternative-t2996675
On tablet go to system settings and enable USB debugging.
Don't worry about setting media transfer, camera or Hisuite
Download and unpack the TWRP* zip to PC and copy TWRP.img to your home folder.
See Original post for latest download
http://forum.xda-developers.com/showthread.php?t=2693100
Latest download is found at
"Dowload the zip file to this"
Install latest adb to Linux PC
Code:
sudo su
apt-get update
apt-get install android-tools-adb
Do NOT close terminal please
Create udev rule if you don't yet have Huawei mentioned in your rules
Code:
echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="666", GROUP="plugdev" ' > /etc/udev/rules.d/55-huawei.rules
Refresh udev for distros running "service" such as distros like Ubuntu with next command or
bottom line for distros not running service like Debian.
Code:
service udev restart
udevadm control --reload-rules
Now open terminal as local user please.
I prefer to kill the server and restart it with
Code:
adb kill-server
adb devices
If you do not get a device showing a serial number, you can NOT continue.
Recheck you have enabled USB debugging, kill the server and retry adb devices command.
If you are not sure what device your recovery is on, recheck it please with
Code:
adb shell cat /proc/mtd | grep recovery
Now we need to translate that into a device which is /dev/mtd/mtd3
Now we can flash with
Code:
adb push TWRP.img /sdcard2/twrp.img
# above line copies TWRP to removeable sdcard, change sdcard2 if you
don't use one please.
adb shell su -c "dd if=/sdcard2/twrp.img of=/dev/mtd/mtd3"
adb kill-server
Second last command may fail if you don't yet have a rooted device
also if size of bytes of TWRP image is wrong, recheck it please.
6717440 bytes = 6560 Kb = 6.41 Mb which is far less than max size of recovery image.
Before you test, ensure you have a backup of current recovery on removeable sdcard please.
Now use app to reboot into recovery to test.
Nice.. Hope you can find time to port some Cm rom for this.. I stop digging for this device for sometime now.. We have manage to boot on cm9 but it goes bootloop due to kernel compatibility ..
pogs24ever
I have not attempted to port anything yet. Feel free to pm or post here any links you would like me to look at please.
nor have I attempted to cross compile a kernel for this device but I can see Huawei appear to have source here
http://consumer.huawei.com/en/support/downloads/detail/index.htm?id=18334
cheers
just to make it clear in case others drop by via google
this is the mediapad with model showing as S7-931W
and
ro.product.device=hws7930w
2) you can use huawei and 7930 to see one entrant here
https://www.otaupdatecenter.pro/device-lookup
good luck

Creating a android dump file using ADB

Hello,
I am trying create a disk image on my windows PC of the data on my phone to see if I can recover some lost files.
On my PC, can I just use:
~# adb shell dd if=/dev/block/datapartition > data.img
or just
~# adb pull /dev/block/datapartition data.img
or do I need to use netcat and busybox to send and receive the files?
Do all these methods work exactly the same?
Thanks
just type the following on ADB
Code:
adb devices
Code:
adb shell
Code:
ls -la /dev/block/bootdevice/by-name
^ this would list all partion of your devices it should look like this
{
"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"
}
based on the screenshot above we know boot.img is mmcblk0p59
now we just do dd command
Code:
dd if=/dev/block/mmcblk0p59 of=/sdcard/boot.img
Congratulation you now have boot.img backup of your device :fingers-crossed::fingers-crossed:
Thanks, but will that output to the phones sd card? I would like to output the img to my pc
kaotik123 said:
Thanks, but will that output to the phones sd card? I would like to output the img to my pc
Click to expand...
Click to collapse
you are most likely do the dd command from your pc just copy the img file from your device to your pc
also on my device even it say " of=/sdcard/ " files are being drop on Internal Memory ...
ineedroot69 said:
you are most likely do the dd command from your pc just copy the img file from your device to your pc
also on my device even it say " of=/sdcard/ " files are being drop on Internal Memory ...
Click to expand...
Click to collapse
Yeah I wanted to avoid writing to the phone's memory becuase I was trying to recover lost files from it. Plus the image would be too big to fit on the remaining memory anyway. Thanks for your help but I used netcat and busybox and successfully copied the image directly to my PC. Followed the tutorial here for anyone else reading this and was quite easy: https://dfir.science/2017/04/Imaging-Android-with-root-netcat-and-dd.html (second video for windows pc).

adb pull gives error "access denied" - How to fix?

All I want to achieve is to pull subfolders ( DCIM etc.pp ) of Android's /data/media folder what successfully got mounted as RW
To access /data partition you need root permission which is adb root
But most devices would refuse to run this command, in which case you need to install adb insecure mode. You can get that from here.
After installing the app switch to insecure mode. Then pull command should work.
Alternatively you can use adb shell to work around it:
Code:
adb shell
su
mkdir /sdcard/media
cp -R /data/media/* /sdcard/media
exit
exit
adb pull /sdcard/media
Notes:
The "*" in "/data/media/*" stands for all, which copies all files in current directory. If you want specific file just replace it with "filename.extension"
The option "-R" in "cp" command stands for recursive which copies directories, and will copy all files in respective directories as well.
Thanks for trying to help: Unfortunately your solutions don't work at all.
FYI:
I use /data/local/tmp for intermediate storage ( permissions: rwxrwxrwx )
I can successfully copy /data/media/<SUBFOLDER> to /data/local/tmp/<SUBFOLDER> ( permissions rw-rw-rw- )
All copied files have permission rw-rw-rw-
When applying ADB PULL on /data/local/tmp/<SUBFOLDER> I still get error "Access denied" even if having additionally set owner of all
files in /data/local/tmp/<SUBFOLDER> to shell.shell and/or root.shell and/or shell.root and/or root.root
It's working fine with me, but I used /sdcard as the copy folder.
Like I said you can only access /data partition with root. You can try the first method mentioned above.
As mentioned none of your suggestions solved the problem.
1, ADB Insecure obviously doesn't work on Android 8+ devices, hence useless
{
"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"
}
2. Temporarily copying to /sdcard in my case is useless too, because /sdcard is merely a symlink to /data
So you can't even use pull command on /sdcard partition?
I only found this answer, that may be similar https://android.stackexchange.com/a/213172

Categories

Resources