Using Wireshark in ubuntu for analyzing android requests? - android

I am using ubuntu 10.04 LTS and have a android ICS device.
I created a wifi-hotspot in my android device. I am connecting the my ubuntu via the wifi-hotspot created above. I stared capturing the packets from wireshark in my pc.
I am unable to see the traffic generated from the device, rather I can see only the traffic from the pc.
Am I missing something or wrong?

You aren't seeing the traffic from the phone because your computer is only receiving and sending packets intended for the computer.
Maybe this will help? http://www.wireshark.org/faq.html#promiscsniff
It is possible that your wireless interface device either isn't in promiscuous mode or doesn't support it.

If i were you, i would scan for all hosts alive in the subnet.Sure android device acts as a hotspot using NAT or something, i'm sure.But the catch is it's moreover a server to which only your pc or whatever might be connected, i guess it would be your lapton. But android itself uses the external ip like service bsnl or something. So it's not at all a client connected to a router or something.
Still if you run an nmap scan you would surely see the default gateway ip, which is of the hotspot.
So, it's enough said right.

Related

How do I capture Android http traffic using charles or wireshark (which is on PC) under VPN connection?

I have googled a lot about setting up fiddlers for capturing android traffic. I have tried each of the suggested options. None of them work when there is an active VPN connection.
Setup: Charles or Wireshark is available on PC. Both PC and android device are on same network and on seperate VPN connections.
Tried approaches:
Configuring Wireshark/Charles – Created a new adhoc wireless network and making the android use the same. Another way was making the laptop as a virtual router or hotspot. None of these methods work when it comes to VPN.
Using TCP/IP monitor available in eclipse – This is a great tool built in eclipse, but needs hostname and port. For the internal website I do not know the port. Since it is standard http setup, I am assuming it should be either 80 or 8080.
Using different fiddlers available on Play store – All good fiddlers like tcpdump need the phone to be rooted and that’s not an option for me.
Tethering of PC network onto mobile - This again fails when it comes to VPN (damn you, VPN)
Anyone with any insight, most welcome !
Thanks!
Have you seen this approach? Have you configured proxy on you device connection?

View android network traffic via wireshark

I'm trying to view the protocol on an app I'm using to see how it works but I can't find any traffic (except netbios traffic) coming from my Android phone (HTC Aria).
I don't have any way of getting any hardware for this and i'm using the phone on my router's wifi and the PC is directly connected to my switch.
you probably want to use something like Charles SSL...point your phone at some kind of Proxy server that captures traffic.
If you connect the phone and your computer w/ Wireshark to the same network via a router (not a switch which won't show you shared traffic), you can use Wireshark to monitor all the traffic to you phone.
I'm not sure how you are attempting to use WireShark in this scenario, but what you should do is use a packet sniffer like Shark for Root on your android phone.

Sending commands from a PC to an Android phone - via physical connection (USB, Serial, etc)

I'm working on a project to automate some tasks (such as play a song, play a video, receive bluetooth data, etc) on an Android phone from a PC.
Basically the PC will send a notifier to the phone and an app or something on the phone would then process the notifier and do 'something'. The opposite of this really:
http://code.google.com/p/android-notifier/
I've seen some examples showing how to send commands to an Android listener app or service via a network connection, but in this case, I would much rather the transmission be over a physical connection.
USB
Ideally, I'd like the connection to be via the USB port. But I've seen some posts online that suggest that the SDK does not natively support this. (Android apps, communicating with a device plugged in the USB port).
Is there some other SDK/API out there that makes this easier?
I've seen some posts on the ADB, but don't really get it... Would that work?
(http://developer.android.com/guide/developing/tools/adb.html)
Serial over USB
I've also seen some sites that show how to use a breakoutbox to perform bi-directional serial communication, but only with the G1. Is this possible with newer phones?
The Phone
I'm open to really any newish phone. I'm currently looking at the Galaxy S, because it has the video out through the headphone jack. I'm open to rooting if need be.
Implement a HTTP server in your app, then put your phone in USB Tether mode. This will create a local network between your phone and your PC. You should then be able to send HTTP request or create websockets using the phone's ip.
EDIT : I tested it, and it works, see here
What you can do is the phone acting as a server and then use adb to forward ports [1].
In this scenario the pc app would connect to localhost which would be redirected to the app on the phone via the usb cable.
But if you go this way, you might just as well simply connect directly to the phone's ip (without the adb port forwarding)...
[1] http://developer.android.com/guide/developing/tools/adb.html#forwardports

TCP connection from phone to debugging host

I'm developing client/server software for Android.
While connected to the phone via USB debugging, I'd like to access the webserver I'm running on my developement PC - using the USB connection.
Is that possible and if so, how ?
I stumbled upon the answer after a night sleep.
Enabling USB tethering on my phone (N1, 2.2.1) gives it and the host computer an IP address. The phone can communicate with my web server running on my developement machine!
(Chris, the rumors are right)
Just make sure your web server is listening on that IP address. For apache, use the line
Listen 80
or
Listen x.x.x.x:80
(x.x.x.x being address of your android tunnel)
The easiest way to do it is via wireless. If you don't have wireless, I'd say bite the bullet and get it, it's going to be a necessity for testing anyway :)
Typically the USB only supports connections from the development machine to the phone (via adb port forwards) and not the other way around. Of course once a connection is created data can move bidirectionally. One could use this to build a tunneling proxy web proxy (one connection in from the development machine to a daemon running on the phone, outbound connections from the phone then tunnel through this)
I have heard rumors though that what you want to do - often called reverse tethering - may be supported in some more recent devices.
Kevin's wifi suggestion may be the simplest with a real device.
On the other hand, unlike typical phones, the android emulator can directly access the development machine's loopback interface at an alias address given in the documentation.

Connecting to an Android emulator on another machine

I need to test my android app 24h a day and I have 3 ubuntu boxes to do it.
I would like to connect my development system (MOTODEV Studio 1.3) to a Remote Device.
The interface asks me for an IP address and port for the machine to connect to.
But it doesn't connect. I found that the adb sever on the remote machine doesn't seem to listen to external ports, only internal loopback, making machine-to-machine connections impossible.
Is this true? If so, why there is a section on Device to connect to Android Remote Device on MOTODEV Studio?
I've found an explanation and a workaround in this post (http://rxwen.blogspot.com/2009/11/adb-for-remote-connections.html) but it seems complicated and the post's links don't work, so I'm confused whether there is a solution to do that.
It seems so simple..... I can't believe there is not a way.
The Remote device feature of MOTODEV Studio is intended for TCP/IP connections to a remote phone. It requires a lot of manual intervention at this point to get things working and it's an area where we're definitely in need of better documentation.
I don't have the full workflow in front of me, but the steps you need go like this...
Connect phone to remote host.
Using adb shell on remote host, set the phone to connect over TCP/IP rather than USB. You'll need to find the IP address of the phone manually. If you're using a Motorola phone and the Motorola drivers, it's probably 192.168.16.x
Set up port forwarding from the remote host to the phone for the debug ports (probably 5554 or 5555).
From the local host, set up the address of the remote host in the IP field.
When choosing "Run as" or "Debug As" from the local host, you need to choose the remote device as your target.
We intend to make this workflow more automated in the future, but for now you have to do this manually. It's my observation that remote debugging of embedded systems is still slow and prone to problems with latency and line quality, regardless of whether we're talking about phones or reference boards.
Good luck.

Categories

Resources