0

Suppose, I have two android devices A and B. They are on the same wifi network. Device A does not have any password or pattern lock and It is rooted.

How can I access to device A from device B and view it's files?

I know that using reverse_tcp or installing some kind of .apk in the target device which will create a backdoor connection to my device will somehow allow me to access in the target device. But, I don't want to do it in that way.

I want to know a way to access device A from device B remotely where I don't need to do anything with device A and still gain access to it's system.Is it possible? Can adb shell commands help me to do it? Assume both are my devices and I have full access control on both devices. I just want to control one using the other.

Thank you.

Amit Vaghela
  • 22,772
  • 22
  • 86
  • 142
Tahseen Adit
  • 184
  • 2
  • 7
  • 22

1 Answers1

0

You can use ADB to connect to A over network the same way you do via USB. All you have to do is switch adbd on A to tcpip mode. See: How can I connect to Android with ADB over TCP?

If you want to do this over WiFi, first connect A to a PC via USB, then fetch the current IP address of A:

adb shell ip -f inet addr show wlan0
192.168.1.111  # example

Next tell A's adbd to switch to tcpip mode and listen for connections on some port, for instance 5555.

adb tcpip 5555

Then from any device (whether PC or your device B) on the same network you can establish an ADB session with A by running:

adb connect 192.168.1.111:5555

Neither A nor B need to be rooted for this to work. You do need USB debugging access to A to enable ADB over TCP. Furthermore, the two devices do need to be on the same network. If A is NAT/firewalled and B isn't, then you'll need to open ports, etc.

Community
  • 1
  • 1
szym
  • 5,606
  • 28
  • 34
  • Result shows 'restarting in tcp mode' and then nothing happens, the cursor keeps blinking. What am I doing wrong? My device is rooted, USB Debugging is enabled. – Tahseen Adit Aug 02 '16 at 04:45
  • Nothing more is supposed to happen. You should proceed to the next step: `adb connect`. – szym Aug 02 '16 at 20:48
  • No, I mean I can not give any command, The cursor keeps blinking, it does not take any command. Whatever I write nothing appears in the command window. I have tried port forwarding. Then it says that I have more than one device or emulator connected. – Tahseen Adit Aug 03 '16 at 03:28
  • My daemon started in port 5037. Should I try to connect in this port instead of port 5555 ? – Tahseen Adit Aug 03 '16 at 05:50
  • I have disabled my Local Area Network of my PC and then tried to connect. This time adb is restarting in TCP mode successfully but when I try to connect, it shows 'unable to connect to 10.0.0.7:5555: cannot connect to 10.0.0.7:5555: A socket operation was attempted to an unreachable network. (10051)'. My android device is connected to wifi network. – Tahseen Adit Aug 03 '16 at 06:53