Craig's WiFI ADB connector - Android Apps and Games

To all the Android app devs/geeks if you use Android Studio on windows then you need this...
1. Enable (root) adb wifi
This takes it from listening on a usb connection to listening on a tcpip connection port 5555
2. is to click on Start ADB
this then tells windows to connect over the air to your Android
Now run apps like you have a usb cable attached but over wifi instead! (Windows client is stored on your phone, copy it to windows after running the app... it stores adb on the client with it's own copy for extreme portability )
The windows client is stored in the apk, so the entire package includung adb will get you off and running...
https://play.google.com/store/apps/details?id=controller.adb.craigs.craigswifiadb

Do you know if there is any way to get the random port of the adb wi-fi connection from the PC?

Related

[Q] remote vnc through usb connection

Search, can't find it. any direction pointing would be great.
I'm trying to remote control a phone that is connected to a host PC.
This works:
Plug in phone to USB
In command prompt run: adb forward tcp:5801 tcp 5801
Also in command prompt run: adb forward tcp:5901 tcp:5901
Make sure Droid VNC Server is started on the phone
In UltraVNC viewer, browse to "localhost:5901"
I can now remote control this from the host PC using a vnc client ( chicken of the VNC)
What I want is to do this from a remote PC connecting through the host to the phone's vnc server.
Limited knowledge on the adb part of this, so might be missing something obvious
Can this work, does adb open a normal tcp port on the host ??

[Q] How to have an Android Device access its USB host's shell?

Let's say I have a Linux server without peripherals so it can only be accessed over SSH, for example. Let's say I want to access it without wifi. I'd like to plug in my phone and then access the server's shell over USB. Is there an app for that or a way to do that with a terminal emulator?
UPDATE:
I found this: http://www.android-hilfe.de/samsung...orum/143084-how-ssh-verbindung-ueber-usb.html (german) which does the opposite of what I want to do.

samsung smart swith for ubuntu?

hello, i am usning ubuntu. is there any desktop software for managing my tablet, like samsung smart switch on windows for ubuntu?
Scrcpy, adb, vnc
d9867eb said:
hello, i am usning ubuntu. is there any desktop software for managing my tablet, like samsung smart switch on windows for ubuntu?
Click to expand...
Click to collapse
There are a lot of choices to choose from if you want to manage your tablet with Ubuntu. However, there are different methods for different programs and you get different functions out of each. I'll compile a quick list for you, but without a little more specificity, I don't know what you mean by "manage".
1) VirtualBox - You can always use VirtualBox to run Windows and use that to install Samsung Kies/Smart Manager/etc.
apt install virtualbox
2) ADB - (USB Debugging must be enabled). Android Debug Bridge is a command-line based program to control different things on your device. To start, go to Settings - About Phone. Depending on your version of android it could be in "Software" or something along those lines but find "Build Number" and tap on it until it says "Developer Settings enabled". Afterward, go back to Settings and find the Developer menu. Turn it on first (there should be a box/slider/something on the top or in the menu) and go to USB Debugging. If it is grey'ed out and you can not turn it on, try turning off and on the developer settings. Once USB Debugging is enabled plug your device into the computer. The phone will ask a question about trusting the computer, press yes. Now, launch a terminal and type "adb devices". As long as only one device is plugged into your computer, and as long as the device is listed as "device" and not "offline" "unauthorized" or something like that, you can issue it commands! For more info on ADB, just google adb commands. "adb shell" gives you direct access to the /bin/sh shell in android. From there you can run commands directly through your tablet. Last note on this: 'adb tcpip 5555' restarts the adbd program on the tablet to listen for connections over the LAN/WAN/whatever it is connected to. To connect from the computer, type "adb connect <ip>" where <ip> is the tablet's IP address.
apt install android-tools-adb
3) scrcpy: Scrcpy is a program, written in java, that will use adb to display the screen of your android device in Ubuntu/anything that runs java. You can also click/type through it, allowing you to control it remotely. A word of warning: I don't know why, but my first few times trying to install this program were a major fail. I eventually got it, and it works pretty good, but it wasn't easy.
google: scrcpy (it's a github link)
4) VNC: You can install something like a VNC (Virtual Network Client) server or RDP (Remote Desktop Procedure) server on the tablet, and connect to it with tight/tiger vnc. Note: Device may have to be rooted for this, and, from my experience, most VNC servers wont work right. However, this has worked for my Samsung tablet in the past (the screen it broken on it but the digi is okay. I cant use scrcpy because scrcpy requires Lollipop I think and it has Kit Kat). I think the app "DroidVNC Server" was what I used.
5) Check Play Store for "android remote manager"
6) nuntius/kali-rolling 0.2.0-5+b1 amd64
share notifications from Android phone or tablet via Bluetooth or LAN
NOTE: I didn't like this program, but feel free to give it a shot!
Hope this helps!

[PYTHON SCRIPT][WINDOWS]Start scrcpy over Wi-Fi

This script is for non rooted phones, as on rooted ones TCP listening for adb can be configured on the device and it doesn't need to be plugged to the USB beforehand, meanwhile on un-rooted ones it should be apparently done after every phone reset. I've made this script so I don't have to manually enter commands every time eye wish to start scrcpy after a phone reset. The script also minimizes which also hides the scrcpy command line afterwards, but can also be hidden.
What it does:
- Minimizes the window
- Issues "ifconfig" to the device to get its IP.
- Enables port listening and connects to the device over WiFi
- Waits a bit
- Starts scrcpy.
Usage:
- Connect the phone
- Allow the dialog on the phone //if asked
- Open the script
- Allow the dialog on the phone //if asked
- You can disconnect the device
- Should be all.
The script has to be placed in the scrcpy's directory to work, and should only work correctly with one device connected.
To hide the window you can change the following line:
Code:
ctypes.WinDLL('user32').ShowWindow(ctypes.WinDLL('kernel32').GetConsoleWindow(),6)
to :
ctypes.WinDLL('user32').ShowWindow(ctypes.WinDLL('kernel32').GetConsoleWindow(),0)
and if you wish to run scrpy with some arguments you can do so by editing the following line:
Code:
os.system("scrcpy -s "+AyyyP+":4774")
where you can either add other arguments befor the "-s" part or after the ":4774" like so:
os.system("scrcpy -m 720 -s "+AyyyP+":4774")
or so:
os.system("scrcpy -s "+AyyyP+":4774 -m 720")
the changes should be doable in almost any text editor. Scrcpy attributes can be currently found here.
Also python 3.x has to be installed on the PC which should be obtainable here.
Sidenote: File is located in a .zip so I was able to upload it, just extract it beforehand.
If you have any questions feel free to ask .
Reserved.
Thank you for this python scrcpy script on behalf of everyone who loves scrcpy/sndcpy mirroring onto the PC as I do, where I'd like to take the developer up on his offer of:
If you have any questions feel free to ask
Click to expand...
Click to collapse
As most people know, Android 10 and below allowed wireless adb connections AFTER a USB connection was first established (adb tcpip 5555 && adb connect [IP]:5555), but that changed (for the better) in Android 11 and above with the new new Developer options Wireless debugging random port assignments (adb connect [IP]:[PORT] or adb pair [IP]:[PORT] [PIN]) such that the adb wireless connection never needs USB cable ever again.
Given Android 11 allows Developer options Wireless debugging via a random port, and Android 12 new Developer options Wireless debugging allows that to be accessed even easier with a new Developer options Wireless debugging tile, the only thing missing is a way to get, after the fact, the random port assignment that Android uses for the adb wireless connection to your PC.
[adb,scrcpy,vysor] What ports does Android 12 randomly set when Wi-Fi connecting via Wireless debugging adb "pair" or "connect" commands?
Does anyone know how to obtain that random Android port address from the PC?
I am asking for detailed instructions on how to install it on the galaxy s22U? I can't handle it on my own.

[adb,scrcpy,vysor] What ports does Android 12 randomly set when Wi-Fi connecting via Wireless debugging adb "pair" or "connect" commands?

What ports does Android 12 randomly set when connecting wirelessly to adb via either the Wireless debugging "pair" or the "connect" adb PC commands?
Brief history:
While Android has forever been able to initially connect over TCP Port 5555 over USB first, and then the USB cable could have been disconnected to mirror Android over to the PC wirelessly on your LAN...
... As of Android 12, there are fantastic new "Developer options" for "Wireless debugging" which allow us to mirror Android over to any PC (Mac/Windows/Linux) without ever needing a USB cable ever again!
Brief background:
1. The wonderful screen mirroring tools (Vysor, Scrcpy, Sndcpy,etc.) connect using adb
2. We write scripts on the PC to mirror multiple devices onto the PC sans consoles
3. Each Android device has a random port assignment for adb "pair" & "connect" commands
C:\> adb connect 192.168.0.2:[RANDOM-PORT]​C:\> adb pair 192.168.0.2:[RANDOM-PORT] [RANDOM-PIN]​
We need a tool to TEST which random port Android 12 sets Developer options Wireless debugging to.
We have a variety of tools as described in this recent thread today:
(PSA) Using the new Android 12 TILE for 'Developer options' 'Wireless debugging' to establish adb connection over Wi-Fi without USB​
But those port-scanning tools take FOREVER to run on all possible ports.
Hence it behooves us to limit the port scan to just the ports Android 12 uses for Wireless debugging.
C:\> portqry -n 192.168.0.2 -r 30000:40000​C:\> netstat -ano -p tcp | findstr "92.168.0.2"​C:\> adb shell "ifconfig|grep -A 1 wlan0|tail -n 1|cut -f2 -d:|cut -f1 -d' '"​C:\> adb mdns services​C:\> nmap 92.168.0.2​etc.​
That is the reason I ask this very specific question:
What ports does Android 12 use for Developer options Wireless debugging?
I just came home and connected to scrcpy via adb over port 41703
C:\> adb connect 192.168.0.2:41703 && scrcpy
Click to expand...
Click to collapse
And then I ran the Microsoft port query command (which is slow as a lazy dog), but at least portqry.exe listed that port as "listening"...
c:\app\network\portqry\portqry -nr 192.168.0.2 -e 41703
Querying target system called:
192.168.0.2
Attempting to resolve IP address to a name...
Failed to resolve IP address to name
querying...
TCP port 41703 (unknown service): LISTENING
Click to expand...
Click to collapse
Of course, I already knew the port was 41703 by looking at the phone by longpressing on the new Android 12 "Developer options Wireless debugging tile" (which saves a bunch of steps digging into Android Settings and then Developer options).
But assuming I didn't know the port, but only knew the range, this would work (but it's horribly slow).
c:\app\network\portqry\portqry -n 192.168.0.2 -r 41700:41705
TCP port 41700 (unknown service): NOT LISTENING
TCP port 41701 (unknown service): NOT LISTENING
TCP port 41702 (unknown service): NOT LISTENING
TCP port 41703 (unknown service): LISTENING
TCP port 41704 (unknown service): NOT LISTENING
TCP port 41705 (unknown service): NOT LISTENING
Click to expand...
Click to collapse
Of course, once you know the IP address & port Android randomly set the new Android 12 Developer options Wireless debugging to, many basic network commands will tell you that port is being used by adb on that IP address, for example...
C:\> adb shell "ifconfig|grep -A 1 wlan0|tail -n 1|cut -f2 -d:|cut -f1 -d' '"
192.168.0.2
Click to expand...
Click to collapse
Where once you know the IP address, you can query the port.
C:\> netstat -ano -p tcp | findstr "192.168.0.2"
TCP 192.168.0.2:2392 192.168.0.2:41703 ESTABLISHED 1928
Click to expand...
Click to collapse
But... I knew the port ahead of time by looking on the phone to see what the random port the new Android 12 Developer options Wireless debugging had set the phone to.
What we need, of course, is a way to narrow down the range of ports that adb will use, which, to that end, I opened this thread.
BTW a search shows EVERYONE has the same adb wi-fi needs!
ADB Wifi, how to specify port and have it fix
[Q] Is it possible to adb connect via wifi without configuring port on android?
Connect Android phone over Wi-Fi using ADB
adb over wi-fi
[TUT] ADB over WI-FI
How to add WiFi network over ADB without root?
[GUIDE] How to connect adb over wifi
ADB Via WiFi
Adb over wifi
ADB-Over-WiFi
[APP] ADB WiFi
[APP] [4.1+] [OPEN SOURCE] WiFi ADB (Kotlin)
ADB over WiFi missing from developer option
ADB Via WiFi doesn't work.
adb over wifi without root?
[TUTORIAL] ADB over WiFi / TCP
[Q] adb over wifi?? without root
[APP] ADB WiFi
Adb over wifi
how can i enable adb over wifi
ADB over wifi
[Q] ADB only over wIFI no USB
Adb over wifi
[Q] ADB over wifi, no USB to accept RSA key
[Q] Is it possible to adb connect via wifi without configuring port on android?
[PYTHON SCRIPT][WINDOWS]Start scrcpy over Wi-Fi
[APP][8.0.0+][ROOT] Start ADB Over Wi-Fi [Root]
UPDATE:
It's IMPORTANT to be able to know what the random port is from the PC (without needing to touch the Android phone at all).
Making use of a 2012 thread today...
How to make adb listen to tcpip 5555 after reboot​
@AlainCh2 came up with a third option:
1. The first option is to try to keep the random port static
2. The second option is to figure out what it is from the PC alone
However... In that ancient thread, a third option was described...
3. Try to SET the port over Wi-Fi (without USB!) from the PC
Which @AlainCh2 experimented with over here today in post #10.
This is the best I can do (but it's cheating)
a. Non-rooted Android 12 has Wi-Fi turned on
c. Android has the Wi-Fi connected to an access point
d. Android has Developer options Wireless debugging = on
e. Which reports a static IP & random port of 192.168.0.2:41269
Once I already know the random port assignment, these commands ALWAYS work (but I had to cheat!)...
1. Win+R > cmd
2. adb kill-server
3. adb connect 192.168.0.2:41269
4. scrcpy --tcpip=192.168.0.2:41269
5. up pops the mirror of Android in the scrcpy GUI
View attachment 5677027
While that works perfectly, the problem is that I have to KNOW the port before any of that works.
My setup for scrcpy, 1 device:
1. Connect phone and PC to the same network.
2. Connect the phone to the PC via cable, execute command "scrcpy -d --tcpip" then scrcpy will setup the rest
scrcpy will set the port automatically to 5555 and try to establish a connection. No need to look for ports somewhere.
You may then disconnect the cable from PC. Just make sure you have a static IP for convenience. You don't need to enable wireless debugging for the port or anything. You just need to execute the steps above once every reboot. You may connect multiple devices. When executing the steps above, just make sure only one device is connected via cable at a time. You may then execute "scrcpy -s (ip)" or "scrcpy --tcpip=(ip)" to connect to one of the devices. If only one is connected wirelessly, "scrcpy -e" will do.
wildcatacu said:
My setup for scrcpy, 1 device:
1. Connect phone and PC to the same network.
2. Connect the phone to the PC via cable, execute command "scrcpy -d --tcpip" then scrcpy will setup the rest
scrcpy will set the port automatically to 5555 and try to establish a connection. No need to look for ports somewhere.
You may then disconnect the cable from PC. Just make sure you have a static IP for convenience. You don't need to enable wireless debugging for the port or anything. You just need to execute the steps above once every reboot. You may connect multiple devices. When executing the steps above, just make sure only one device is connected via cable at a time. You may then execute "scrcpy -s (ip)" or "scrcpy --tcpip=(ip)" to connect to one of the devices. If only one is connected wirelessly, "scrcpy -e" will do.
Click to expand...
Click to collapse
Nice, I can say it works
But I have to run scrcpy -d --tcpip only if I reboot tablet (in my case) or also if I restart pc?
If only the PC is restarted, there's no need to reconnect the android device via USB. To reconnect, you just need to run this command replacing the IP address (preferably set to static for convenience): scrcpy --tcpip=(Local IP Address). If you set your device's static IP to 192.168.1.24 for example, run the command: scrcpy --tcpip=192.168.1.24
As long as the Android device doesn't shut down or restart, you may reconnect to it anytime. PC can be shut down or restarted. The initial wired setup is only required on the Android device's first boot.

Categories

Resources