ssh into Termux over usb with offline smartphone - Android Q&A, Help & Troubleshooting

I have a Oneplus 8 with kali nethunter rooted with Termux installed.
I want to connect into the device using ssh over USB but something strange happen: ssh doesn't work if the device is offline, but if I connect the device to LAN once, the sshd service start to work.
So:
I plug the device with usb-c
open termux and set the password with `passwd`
install openssh
start sshd
Then:
Bash:
adb devices
# List of devices attached
# mserialnum00 device
adb forward tcp:8022 tcp:8022
ssh.exe -p 8022 localhost
This will work only if I connect the device at least once to the LAN.

Related

native adb

Does anyone know how to connect your phone, to its own native adb. If your running 4.0 or better like the new 4.0.1 sense on evo 4g lte you have the native adb, in the terminal you can start it by typing adb start-server, but I cannot connect the phone to it.
This is nice to use to connect to other phones and use it as a debug station, but does anyone know how to connect to the phones adb server from the terminal on its own phone. When I start the server it says its listening on 5083 I have tried adb forward tcp:5555 tcp:55, tried adb tcpip 5555, but none of the forwarding ports seems to work. I have started adb on the phone and adb over wifi but still do not see the ip in adb.
Some help on this would be nice, I will keep thinking, but any help would be nice.
Some ideas might be to start a wifi server using the phones wifi tether, or hotspot to connect to itself
ip addr add 192.168.1.10/24 dev eth0
ip addr add 192.168.1.10/24 dev wlan0
maybe we can manually add and connect the devices threw wifi hotspot or tether with this. someone want to take this on and get back to me
Screen shot..
https://www.dropbox.com/sc/69v6co2l4nrd8qg/0PQqlpzI1M
I got the sdk runing natively following this..... http://fieldefect.info/w/NativeCompileAPK
he uses qemu-user-static and an i386 chroot to run the SDK, done natively on arm debian chroot.
I prefer to use multistrap over debootstrap, also I modify his run-i386 scripts to work with x86_64 chroot.
I connect adb to adbd like so,
setprop service.adb.tcp.port 5555
stop adbd
start adbd
adb connect 127.0.0.1
then try
adb shell
or
adb devices
to confirm.
My screenshot has some output from netstat which may answer your questions about ips/ports. you can see localhost
is listening on both 5038 and 5037. port 5037 belongs to adbd. adb will connect to 127.0.0.1:5037 but only gives errors.
PM me if you have questions ill gladly help.
Yea I have a chrooted ubuntu 10.04 img that I have mounted, I was going to do it that way install the sdk and use the localhost. but I was hoping to keep the chroot out of it. At least it works that way very nice. Only reason I didnt want to use a chroot is its gonna be alot of switching between terminals, was hoping for easy way to use 1 terminal. I suppose i can use 2 windows on the one terminal.
Thanks for the post.
as root
Code:
[email protected]:/ adb kill-server
[email protected]:/ adb start-server
[email protected]:/ adb connect 192.168.1.3
unable to connect to 192.168.1.3:5555
[email protected]:/ adb connect 192.168.1.3:5083
unable to connect to 192.168.1.3:5083
[email protected]:/ adb connect 127.0.0.1
unable to connect to 127.0.0.1:5555
[COLOR="Red"][email protected]:/ adb connect 127.0.0.1:5038
connected to 127.0.0.1:5038[/COLOR]
[email protected]:/ adb devices
list of attached devices
234234234234 offline
I got the adb to start and connect, but the phone still says offline. This is all native not with any chroot or anything else. any ideas?
try port 5037
email me about the other thing [email protected]
I connected using the second post like this
terminal #:
#adb kill-server
#stop adbd
#setprop service.adb.tcp.port 5555
#setprop service.adb.tcp.port 5083
#adb connect 127.0.0.1:5083
#adb devices:
127.0.0.1:5083 device

adb over wifi help, please

I am writing a cmd script for my fire tv and am looking to see if there is a way for me to connect with the following
Code:
adb connect 192.168.1.5:5555
(the above command works)
but loop it if the device fails to connect, or wait/ retry until connect is successful... any help? sorry if explanation is not good
what my end goal is is to have a script running in the background that can start kodi when my fire tv stick starts
what I have that i can manually insert and it works to show my progress thus far, im a noob with this stuff BTW
Code:
adb kill-server
adb start-server
adb connect 192.168.1.5:5555
adb shell am force-stop org.xbmc.kodi
adb shell monkey -p org.xbmc.kodi 1
I could also use any tips on a way to check if kodi is running / or fireTV is on and pause / loop the code, any advice?

[How To] From Ubuntu to Android - Meizu 5 Pro

Hello,
I think some people asked for this, so I wrote down how I did it. I hope it helps for someone.
How to get from Ubuntu on the Meizu 5 Pro to Android.
Here is a little guide of how I installed Android (Flyme, CM and AICP) on my Meizu 5 Pro Ubuntu edition.
My desktop pc is running Ubuntu, so these commands are for the Ubuntu terminal. But should be very similar on Windows, probably.
First, install ADB and Fastboot on your pc :
Code:
sudo apt-get update
sudo apt-get install fastboot adb
Connect the Meizu phone to your pc with a usb cable. Then power up the Meizu 5 Pro with both the power button and volume down.
You’ll see a screen like this:
Type:
Code:
sudo fastboot devices
If all went well you’ll see a screen with an number/letter combination with the text fastboot behind it.
Now download TWRP_3.0_m86.img from http://xep.8800.org/pro5/.
With the next command you are going to flash TWRP custom recovery to your phone.
Code:
sudo fastboot flash recovery TWRP_3.0_m86.img
This should be done pretty fast. Power off your phone, and restart it with volume up and power button both pressed.
If all went well you’ll see a screen like this:
Now you can copy paste zip files containing Flyme OS and Cyanogenmod, through your desktop file manager while using the USB connection. Then you can use the Install button on the recovery screen to flash the zip files.
You can also copy files to your phone with adb.
Check if adb works:
Code:
sudo adb device
If correct you’ll see something like:
Code:
List of devices attached
0123456789ABCDEF device
You can download Flyme OS here: http://www.flymeos.com/firmwarelist?modelId=10&type=1
For Cyanogenmod look here: http://forum.xda-developers.com/mei...m-cyanogenmod12-1-temasek-unofficial-t3358744
I will install Flyme OS on my phone, but the procedure is just the same for Cyanogenmod. The next command copies the file to your phone:
Code:
sudo adb push -p update.zip /sdcard/
Where is update.zip is the file on your pc, and sdcard is the destination on your phone. Off course you’ll have to be in the same folder as the update.zip if you copy my command directly. If the download is in Downloads and your terminal shows:
Code:
[email protected]:~$
That means you are in your home directory. So either navigate to Downloads with cd Downloads, or change update.zip to Downloads/update.zip.
Now go back to the recovery. Press Install en browse to /sdcard/ If the operation succeeded you’ll see this:
Select update.zip and flash to confirm. Reboot. The recovery will probably ask if you want to install SuperSU, but that didn't work for me. I needed to download a different version of SuperSU and flash it to make it work.
There it is: Android on your Ubuntu Edition.
Thank you: Faust93 and all other people here on XDA for helping me learn stuff about phones and computers. I hope I can give something back by making this guide.
If you have any question, please ask. I'll try to answer them. I'm also making a back up file through TWRP, if anyone is interested, let me know.
Thank you for the guide. It would be very helpful when I get my device. If it's on stock again soon ?
Is there a way to restore Ubuntu on it? I suppose if you flash Ubuntu again using twrp it would work. No?
Sent from my GT-I9100 using XDA-Developers mobile app
Thank you!
Restoring Ubuntu is a little bit more difficult, but I have done it several times now. Going back an forth from Android to Ubuntu. I made a different guide about it, just now. Here
But it might not be easy for Windows users. So I will try to see if I can make a full backup with TWRP, so people can recover that. But I haven't tested that yet.
First of all, thanks for the tut
I have some weird problem, after flashing CM (everything went fine), I tried to reboot and it will only reboot to recovery.
No matter what I try.
I tried:
Re-flashing TWRP (I can go into fastboot mode)
Wiping everything & re-flashing cm
Wiping everything & re-flashing ubuntu (your other tut, always boots into recovery aswell)
Also tried the reboot option in TWRP, aswell as hard reboot
Tried changing/repairing filesystem of all partitions
Only method that works is if I erase recovery, then system works fine but I do not really want to have a phone without a recovery
Any other ideas?
EDIT:
I just flashed flyme recovery, used the clean option, re-flashed TWRP and now everything is working fine again
Meizu pro 5 ubuntu
I tried to install android with windows 10 but the procedure doesn't work like ubuntu.
Can please someone post a step by step method from a windows 10 pc how to from ubuntu to android?
Thank you in advance.
Thanks
got error " cannot load 'TWRP_3.0_m86.img' " what can i do ?
I'm missing something...
First, install ADB and Fastboot on your pc :
Code:
sudo apt-get update
sudo apt-get install fastboot adb
Connect the Meizu phone to your pc with a usb cable. Then power up the Meizu 5 Pro with both the power button and volume down.
You’ll see a screen like this:
Type:
:sudo fastboot devices
If all went well you’ll see a screen with an number/letter combination with the text fastboot behind it.
With the next command you are going to flash TWRP custom recovery to your phone.
Code:
sudo fastboot flash recovery TWRP_3.0_m86.img
This should be done pretty fast. Power off your phone, and restart it with volume up and power button both pressed.
I'm using Ubuntu 16.04 LTS.
Everything goes good ADB list a device. however when I tell it to :sudo fastboot flash recovery TWRP_3.0_m86.img
the terminal says:
[email protected]:~$ sudo adb fastboot flash recovery TWRP_3.0_m86.img
[sudo] password for tamashii:
Android Debug Bridge version 1.0.32
Revision debian
-a - directs adb to listen on all interfaces for a connection
-d - directs command to the only connected USB device
returns an error if more than one USB device is present.
-e - directs command to the only running emulator.
returns an error if more than one emulator is running.
-s <specific device> - directs command to the device or emulator with the given
serial number or qualifier. Overrides ANDROID_SERIAL
environment variable.
-p <product name or path> - simple product name like 'sooner', or
a relative/absolute path to a product
out directory like 'out/target/product/sooner'.
If -p is not specified, the ANDROID_PRODUCT_OUT
environment variable is used, which must
be an absolute path.
-H - Name of adb server host (default: localhost)
-P - Port of adb server (default: 5037)
devices [-l] - list all connected devices
('-l' will also list device qualifiers)
connect <host>[:<port>] - connect to a device via TCP/IP
Port 5555 is used by default if no port number is specified.
disconnect [<host>[:<port>]] - disconnect from a TCP/IP device.
Port 5555 is used by default if no port number is specified.
Using this command with no additional arguments
will disconnect from all connected TCP/IP devices.
device commands:
adb push [-p] <local> <remote>
- copy file/dir to device
('-p' to display the transfer progress)
adb pull [-p] [-a] <remote> [<local>]
- copy file/dir from device
('-p' to display the transfer progress)
('-a' means copy timestamp and mode)
adb sync [ <directory> ] - copy host->device only if changed
(-l means list but don't copy)
(see 'adb help all')
adb shell - run remote shell interactively
adb shell <command> - run remote shell command
adb emu <command> - run emulator console command
adb logcat [ <filter-spec> ] - View device log
adb forward --list - list all forward socket connections.
the format is a list of lines with the following format:
<serial> " " <local> " " <remote> "\n"
adb forward <local> <remote> - forward socket connections
forward specs are one of:
tcp:<port>
localabstract:<unix domain socket name>
localreserved:<unix domain socket name>
localfilesystem:<unix domain socket name>
dev:<character device name>
jdwp:<process pid> (remote only)
adb forward --no-rebind <local> <remote>
- same as 'adb forward <local> <remote>' but fails
if <local> is already forwarded
adb forward --remove <local> - remove a specific forward socket connection
adb forward --remove-all - remove all forward socket connections
adb reverse --list - list all reverse socket connections from device
adb reverse <remote> <local> - reverse socket connections
reverse specs are one of:
tcp:<port>
localabstract:<unix domain socket name>
localreserved:<unix domain socket name>
localfilesystem:<unix domain socket name>
adb reverse --norebind <remote> <local>
- same as 'adb reverse <remote> <local>' but fails
if <remote> is already reversed.
adb reverse --remove <remote>
- remove a specific reversed socket connection
adb reverse --remove-all - remove all reversed socket connections from device
adb jdwp - list PIDs of processes hosting a JDWP transport
adb install [-lrtsdg] <file>
- push this package file to the device and install it
(-l: forward lock application)
(-r: replace existing application)
(-t: allow test packages)
(-s: install application on sdcard)
(-d: allow version code downgrade)
(-g: grant all runtime permissions)
adb install-multiple [-lrtsdpg] <file...>
- push this package file to the device and install it
(-l: forward lock application)
(-r: replace existing application)
(-t: allow test packages)
(-s: install application on sdcard)
(-d: allow version code downgrade)
(-p: partial application install)
(-g: grant all runtime permissions)
adb uninstall [-k] <package> - remove this app package from the device
('-k' means keep the data and cache directories)
adb bugreport - return all information from the device
that should be included in a bug report.
adb backup [-f <file>] [-apk|-noapk] [-obb|-noobb] [-shared|-noshared] [-all] [-system|-nosystem] [<packages...>]
- write an archive of the device's data to <file>.
If no -f option is supplied then the data is written
to "backup.ab" in the current directory.
(-apk|-noapk enable/disable backup of the .apks themselves
in the archive; the default is noapk.)
(-obb|-noobb enable/disable backup of any installed apk expansion
(aka .obb) files associated with each application; the default
is noobb.)
(-shared|-noshared enable/disable backup of the device's
shared storage / SD card contents; the default is noshared.)
(-all means to back up all installed applications)
(-system|-nosystem toggles whether -all automatically includes
system applications; the default is to include system apps)
(<packages...> is the list of applications to be backed up. If
the -all or -shared flags are passed, then the package
list is optional. Applications explicitly given on the
command line will be included even if -nosystem would
ordinarily cause them to be omitted.)
adb restore <file> - restore device contents from the <file> backup archive
adb disable-verity - disable dm-verity checking on USERDEBUG builds
adb enable-verity - re-enable dm-verity checking on USERDEBUG builds
adb keygen <file> - generate adb public/private key. The private key is stored in <file>,
and the public key is stored in <file>.pub. Any existing files
are overwritten.
adb help - show this help message
adb version - show version num
scripting:
adb wait-for-device - block until device is online
adb start-server - ensure that there is a server running
adb kill-server - kill the server if it is running
adb get-state - prints: offline | bootloader | device
adb get-serialno - prints: <serial-number>
adb get-devpath - prints: <device-path>
adb remount - remounts the /system, /vendor (if present) and /oem (if present) partitions on the device read-write
adb reboot [bootloader|recovery]
- reboots the device, optionally into the bootloader or recovery program.
adb reboot sideload - reboots the device into the sideload mode in recovery program (adb root required).
adb reboot sideload-auto-reboot
- reboots into the sideload mode, then reboots automatically after the sideload regardless of the result.
adb reboot-bootloader - reboots the device into the bootloader
adb root - restarts the adbd daemon with root permissions
adb unroot - restarts the adbd daemon without root permissions
adb usb - restarts the adbd daemon listening on USB
adb tcpip <port> - restarts the adbd daemon listening on TCP on the specified port
networking:
adb ppp <tty> [parameters] - Run PPP over USB.
Note: you should not automatically start a PPP connection.
<tty> refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1
[parameters] - Eg. defaultroute debug dump local notty usepeerdns
adb sync notes: adb sync [ <directory> ]
<localdir> can be interpreted in several ways:
- If <directory> is not specified, /system, /vendor (if present), /oem (if present) and /data partitions will be updated.
- If it is "system", "vendor", "oem" or "data", only the corresponding partition
is updated.
environmental variables:
ADB_TRACE - Print debug information. A comma separated list of the following values
1 or all, adb, sockets, packets, rwx, usb, sync, sysdeps, transport, jdwp
ANDROID_SERIAL - The serial number to connect to. -s takes priority over this if given.
ANDROID_LOG_TAGS - When used with the logcat option, only these debug tags are printed.
Sooo what did I do wrong? Did I miss a command (file location) or (destination)??
Thanks for your awesome work on this.
TamashiiTora said:
[email protected]:~$ sudo adb fastboot flash recovery TWRP_3.0_m86.img
Click to expand...
Click to collapse
Hi Tamashii! You should type
Code:
sudo fastboot flash recovery TWRP_3.0_m86.img
.
PS: it's better not to use sudo. You can add an udev rule for your device. You can find some advices here.
abePdIta said:
Hi Tamashii! You should type
Code:
sudo fastboot flash recovery TWRP_3.0_m86.img
.
QUOTE]
You are the Man! I never thought of that... thanks! I got CM loaded up and it's running good.
Click to expand...
Click to collapse
Storage full after installation
Hi Thank you for the guide, it is very helpful.
I have installed the Flyme OS successfully. But my phone's storage is showing only 25GB and more that 24GB is occupied. Should I wipe any specific partition before installing Flyme?
low menory
I have the same problem. Any solutions?
keerthi_cit said:
Hi Thank you for the guide, it is very helpful.
I have installed the Flyme OS successfully. But my phone's storage is showing only 25GB and more that 24GB is occupied. Should I wipe any specific partition before installing Flyme?
Click to expand...
Click to collapse
Search on root of device for folder phablet
I installed the Flyme as instructed and it worked fine, but now the bootloader is (locked, unrooted) and i can't get it to unlock! fastboot oem unlock does nothing, but says ok. How do i get it unlocked again? This Flyme OS is crap.
alestonut said:
I installed the Flyme as instructed and it worked fine, but now the bootloader is (locked, unrooted) and i can't get it to unlock! fastboot oem unlock does nothing, but says ok. How do i get it unlocked again? This Flyme OS is crap.
Click to expand...
Click to collapse
I tried to get the unlocked loader in many ways, nothing happened. Maybe there are some craftsmen who can do this. I can upload files like lk lk2 and others, I do not know exactly, but I think it's the bootloader checks the preloader exactly meizu account Officially the manufacturer Do not want to give instructions on how to unlock the bootloader Help tell me how to do this?
ubuntu to android
Get to this stage and get message " cannot load 'TWRP_3.0_m86.img' " and it won't go any further . am i doing something wrong ??

ADB on Chromebook Stable Channel, No Dev mode [Tutorial]

Okay guys I was able to connect to adb on my phone via my non-hacked Chromebook Pro =D Here is how it's done (This will only work on chromebooks with android app support):
Enable Developer settings on your Chromebook's Android instance.
Enable adb debugging/Adb over network
Download GNURoot Debian from Play Store
Open GNURoot Debian, let it install
Run the following commands:
Code:
apt-get update
apt-get install android-tools-adb
apt-get install android-tools-fastboot
on your phone go to settings-> about phone -> status
Find your ip address and make a note of it
In the GNURoot terminal on your chromebook type the following command:
Code:
adb connect ipaddress
where ipaddress is the ip from earlier
Grant access when the prompt on your phone pops up
Done!
You cant activate adb if you are not on developer mode on chrome os

adb tcpip auto

hello everone ,
i need assistance,
i was having my old laptop setup with adb TCPIP listener (meaning: once any device on my Wi-Fi network usb debugging switch on will recieve the adb prompt to allow or reject)
now i have lost my ssd and all data gone with that setup, its it was really long time ago i have done it.
now i have to use ( adb connect IP :5555) for each device instead.
all i need is to make my laptop always listening to any usb debugging switched on to target it.
i have search everywhere for that app but with no luck.
all my commands fail.
adb shell ip -f inet addr show wlan0
adb shell "ip addr show wlan0 | grep -e 'inet[^6]'"
etc .
waw ! no one have idea ?

Categories

Resources