Android: how to telnet a phone?
I want to know if it's possible to telnet on a certain port of an Android phone connected via USB. I've seen that if I telnet localhost:5开发者_如何转开发556, I go to the emulator.
Could I do something similar when I connect a physical device? Which commands could be handled?
Well, adb shell
is the way to connect to the terminal. You can actually telnet
to any port you want on the device, there just needs to be an application listening to that port. I don't believe the devices provide the same functionality that the emulator does as that would allow malicious users to do a number of things. Also, the functionality provided over telnet with the emulators is designed to provide development functionality to overcome the limitation of not being on a physical device (port forwarding, etc) .I'm not sure what the goal is, but you could create an application that supports telnet and bound to a specific port on the device if you wanted to.
In your android phone,you should have a terminal.apk(app) or some other terminal application installed. You also need busybox(app), and i assume you have already rooted your android device. open it,type the commands as follows:
su
busybox telnetd -l /system/bin/sh
Now on your client machhine side type command as follows:
adb forward tcp:6000 tcp:23
telnet 127.0.0.1 6000
~~there you go
There is a free android app "Terminal IDE" available on Google Play. Install it. This app has inbuilt terminal, open the terminal and type telnetd, it will start telnet service on the android phone. Connect the phone to pc using usb. In command prompt type
- adb forward tcp:[your port number] tcp:8080
- telnet 127.0.0.1:[your port number]
Its done!!!
If you have Android Device Bridge, a simple adb shell
should give you access to a command line.
EDIT: I have not tested this, but you may check /system/bin for "telnetd". Try running this and then typing "netstat". You should receive an IP address from netstat, and may be able to telnet to that IP address.
精彩评论