Can't see WiFi traffic from my mobile in Wireshark? - android

So, I'm running Ubuntu Linux on my laptop, and Android 4.0.4 on my mobile (I don't think this is relevant, but just in case). I've got my laptop unassociated from any networks, and my mobile is on my network and has been assigned (by DHCP) the IP of 192.168.0.109.
On my laptop, I did this:
ifconfig wlan0 down && airmon-ng start wlan0 && ifconfig wlan0 up .. this created my mon0 interface for promiscuous mode, if I'm not mistaken.
I fired up Wireshark, attached it to mon0 and assigned a display filter of ip.addr == 192.168.0.109, go back to my mobile, and navigate to a few websites. I get absolutely nothing.
The step listed here - unable to read packets captured from wifi network using wireshark - do not help either.
Anyone tell me what I'm doing wrong? :(
Thanks!

Set the WPA or WPA2 key by going to:
Edit ยป Preferences
Protocols
IEEE 802.11
Enable decryption
Enter the WPA or WPA2 key in Key #1 or the next field, or in more recent versions use the "Edit" button to add a key of type wpa-pwd with a value like myPassword:mySSID.
You might need monitor mode (promiscuous mode might not be sufficient). Also, make sure the device connects after you started monitoring (as Wireshark needs the handshake packets to decrypt).
See also these instructions.

The problem I was having was that the wifi card I was using wasn't giving errors when I switched modes, but it didn't support them none-the-less.
Using another card worked.
Thanks!

Related

How to Let D-Link Router Connect Android with ADB over TCP?

I'm trying to debug Flutter apps with ADB over TCP, so tried the following (Android connected with USB) according to this:
adb tcpip 5555
adb connect <Android-ip-address>:5555
But I always get unable to connect to <Android-ip-address>:5555: No route to host.
I installed the plugin Android WiFi ADB to Android Studio, but...no hope.
After that, I tried to ping my Android phone from PC with that command ping <Android-ip-address>, but again it failed with that output From <PC-ip-address> icmp_seq=1 Destination Host Unreachable.
Now I tried to do the same thing (PC & phone), however on an another router (Tenda) and it worked like a charm.
So the problem is from my router, which is a D-Link with a firmware version ME_1.03. I searched for "Port Forwarding" and stuff like that, but I don't know what I'm doing and I didn't come up with any result.
What can I do to solve it.
It's not about router type (in case it doesn't use something different from TCP/IP, Lol). You need to double check, that both devices inside one local network.
Without any additional settings on router, your IP address could be like this xxx.xxx.xxx.***. Where part with xxx should be same both both device. When this is done, follow instruction from the source. Please note, you will need to connect devices with USB, before using TCP.
The firmware can be found here below DSL > 2750U, while there are 2-3 different hardware revisions, therefore it is rather unclear which device it actually is - for some revisions there is newer firmware. Generally, the router's network bridge in between wired LAN and WiFi needs to be enabled, in order to connect. Just see the router's manual on page 33 and 45. Without that bridge, you could only connect adb from a notebook, through the same wireless network segment, as the smartphone is connected to (unless "User Isolation" is enabled on the router).
Finally I found it. It's because of a feature (as others said) called WIFI/User Isolation in routers. But in my case, it's called Relay Blocking. Anyway, you have to disable it.
In D-Link (DSL-2740U) - Firmware Version ME_1.03:
Main Page ---> Advanced ---> Advanced Wireless Settings ---> Relay Blocking.
Check disabled choice.

React Native "Could not connect to development server."

I know this already has been asked a few times, but no solution has worked for me. In fact, sometimes it does connect and my app runs on the device, but one or two attempts later, with no change, it suddenly does not. My app always runs in the emulator.
I've set my IP in AppDelegate.m and RCTWebsocketExecutor.m. I've set App Transport Security Settings to "Allow Arbitrary Loads" and even set it to allow my IP. My app is using the react-native-storage to store a user, not sure if that could cause any problems while testing.
I figured it out. It was a network problem. I used ngrok to solve my problem.
What worked for me was to trigger the developer's menu entering :
adb shell input keyevent 82
In Dev Settings > Debug server host & port for device, I entered the local IP of my machine followed by port 8081, i.e. 192.168.0.1:8081.
To get my local IP address, I used the ifconfig command, and I locate the inet field value of the Wifi interface, i.e. wlp2s0.
I hope this helps !
EDIT
To be perfectly fair, this is actually explained quite well in the documentation.

How to route all traffic coming from tethering?

I'm working on some test project, basically I want to route all traffic when I'm in hotspot mode into a fixed address. I have the IP range for example 192.168.0.0/24 I don't know if I can use iptables without root or JNI functions (can't find any that match what I want)
Thinking out of the box is very welcomed (DNS, low level packet broadcast on client connect etc...)
Any Idea?
EDIT: How Android and iOS detect a Network Portal?
source : https://sudoroom.org/wiki/Mesh/Firmware/Splash_page
They try to HTTP GET on
iOS: http://www.apple.com/library/test/success.html and expect a 200 if not behind portal
Android: http://clients3.google.com/generate_204 and expect a 204 status when not behind portal, any other status is a portal
So, how can I respond correctly to those detections?
The easiest approach is to enable a socks proxy when configuring the wifi AP you are connecting to. This varies depending on the version of android, but it is typically something like:
Touch and hold the wifi network you want to connect to.
A dialogue box should pop-up. In that dialogue box, select advanced.
Find the proxy option and enter in the IP and port of the server you want to forward traffic to.
Android speaks SOCKS and so long as your proxy speaks SOCKS as well, you are good to go. If you root the device you can (depending on your version of Android), configure this proxy automatically. See, for instance, AdBlock Plus for Android which does exactly that.
If you don't want to go the proxy route you may be able to manually set ebtables rules if your device is rooted. This is significantly more work as you have to be careful not to mess up the NAT'ing that your device is already doing.

How to read the data of a dhcp server?

I want to know about all the device that are connected to the dhcp server.
I have the IP of the device it may be a android phone or printer but I think dhcp is having the information of this devices.
I got something like the "vendor information " in the dhcp protocol stack.
My doubt is I have to identify at least a android phone is on the network ,
Is it possible by this.or how to Identify a android phone is one the network.I have the IP of the android also but I am not getting any information from any way.
I got something like nmap but this tool is not giving a perticular details of the phone.The information provided by the nmap is confusing I am not able to identify whether it is a phone or a linux system as both the system having linux as the os.
Then i got this dhcp -vendor information : but I don't have any idea about how to read these data..
kindly give any suggestion.....Needed for my project.
Thanks
The problem you will have is that modern day switches will stop you sniffing traffic destined for specific MAC addresses so if its hard-wired then you are going to run into trouble. If on the other-hand its a unsecured WiFi connection, or a network with hubs (rare now!) rather than switches then you may have a chance.
You'd need to switch the ethernet controller into promiscuous mode and listen for the DHCP REQUEST and DHCP OFFER commands, inspect the contents and see whats going on.
Another method would be to listen for ARP and RARP requests on the network and use a hardware lookup table for the MAC id to determine who makes the chip-sets, its not going to give you awesome accuracy since a lot of chips are re-used on different devices but it may give you a little bit more info.
In terms of the DHCPd server, unless you have access to that physical machine I'm afraid your probably out of luck, DHCP is a designed as a offering protocol, not a querying protocol.

Enable simultaneously wifi and 3G interface on Android

Is it possible to have both 3G and Wifi connections up and running? I want to transmit at the same time through both interfaces.
However, I've noticed that when Wifi is up, 3G is going down. Actually, it seems that the routing table is updated on on/off of the interfaces.
Route table UMTS on / Wifi on
a.b.c.1 dev rmnet0
a.b.c.0/24 dev rmnet0 src a.b.c.2
default via a.b.c.1 dev rmnet0
Route table Wifi on / UMTS on
192.168.1.0/24 dev eth0 src 192.168.1.147
default via 192.168.1.1 dev eth0
With wifi on I have run:
ip link set rmnet0 up
ip route
192.168.1.0/24 dev eth0 src 192.168.1.147
a.b.c.0/24 dev rmnet0 src a.b.c.2
default via 192.168.1.1 dev eth0
When I saw that I thought that I have managed to put both devices up and running. However, this is not the case. When I ping a public internet address (a.b.c.3), in case 1) and 2) everything goes well. In case 3) I get no answer.
Where on earth does Android set that only one device can be available at a time? How can I make both interfaces to be up and available, like on an ordinary Linux box?
P.S.: I have tried the solution in [1] to enable the data connection when wifi is on, and no way.
[1] How to enable data connection on Android 2.3
[2] How to block calls in android --> using ITelephony to get the telephonyService.enableDataConnectivity(); but I get an exception.
This is not going to be possible... unless you are will to go to great lengths to make it work. You are essentially asking for you device to become a router.
To do this you will need to find a program (sorry can't remember any names at the moment) that will accomplish this on a normal linux distro. Then recompile it to fit the Android OS and install is into the native system.
This explanation may make a little more sense to you. If you go to your ADB shell and run netcfg (or ifconfig to verbose this) you will see the devices networking options. You can run an ifconfig command to set the device or change its state - but you cannot have multiple devices route data to and from the phone at the same time I wouldn't think.
This would be my best guess...

Categories

Resources