Find MAC Addresses of devices in range of Wifi router with programatically - openwrt

How can I programtically get the MAC address of WiFi router.
i want the command or the program in c which will list only the mac address of devices which are connected to the my WiFi router. it it possible to get when i know the IP address of the router?

Getting the MAC of the WiFi router on which you are connected (or try to connect) is probably possible if you have access to low level network frame.
Now it looks you are indeed willing to get the MAC of ALL the devices connected to the WiFi router, which is another thing ! Unless the router has some building functionality that gives you this list (like an HTML summary, I don't know if openWrt provide this), I don't think by running a program in C on a client, you would be able to get the MACs of other connected clients !
But in case the router as the information in an html page (eg : from a remote administration), you might try to simulate login to administration, get this page then parse the page to get the MACs... from a C prog..
Taking your problem from another side, if you have a wireless adapter you can set in monitor mode, you could sniff the wireless traffic on the channel(s) opened by your targeted WiFi router, and list the distinct client connected. Have a look to BackTrack's ssidsniff ?

Related

Can devices connected to the same Wi-Fi communicate with each other without using data for accessing the internet?

I need to enable multiple devices to communicate with each other using OSC protocol which runs over IP protocol etc.
I have two wireless routers, one of them is capable of providing internet access from SIM card.
What I want to accomplish is:
provide all devices wireless connection for communication between each other
provide all devices connection to the Internet
avoid spending data from SIM card when my devices communicate with each other
This last point is what I can't solve - in my mind it should not be a problem. If I understand it correctly, I am creating a WLAN and there is no need for passing the data to the internet provider (or asking for data from him) and the router should act like a switch and route the signal from one device to another one if the IP and port is correct.
I have router TP-Link Archer C6 ; router TP-Link Archer MR200 ; Windows laptop ; Android phone ; iPad.
What I want to accomplish is remote control of DAW Reaper (running on Windows laptop) over Web Control Surface or OSC Protocol with TouchOSC app or Open Stage Control app.
I will appreciate any help!
Thank you very much in advance,
Peter

Identifying WiFi clients connected to ESP8266

I'd like to know that a specific device (phone/tablet) has joined my WiFi network created by ESP8266 microcontroller. It shouldn't require any installed apps on that phone/tablet, if possible, to simplify the whole setup.
So I think I need to somehow identify connected clients, and MAC is not an option because it is subject to change randomly on, say, Apple devices.
Maybe it's possible to collect host names of connected clients?
I know that Windows and Ubuntu clients send their host names when getting IP from DHCP server (see here). Also, it's possible to find such information on, say, home Wi-Fi router admin web page (i.e. host names, their IPs and MACs).
I'm running DHCP server on ESP8266, but I haven't found any API that allows to get peer host name (i.e. reverse DNS). Does ESP8266 support getting such information?

Wifi repeater and captive portal

Okay, after surfing through the net, I can almost confirm that there is not a single site that tells me whether captive portal hinders the use of a wifi repeater or not. Due to my limited knowledge of how the Wifi protocol works, I can't help but ask several questions that may seem redundant to some. Anyway, here they are:
Assumption:
There is a Wifi with a captive portal that requires users to login on a webpage before connecting to the Internet
Q1:
If I simply extend that Wifi signal with a portable Wifi repeater, will the new extended Wifi signal work? Why or why not?
Q2:
After I pass the captive portal on a desktop, can I set the desktop as an access point to let other devices use the corresponding signal to connect to the Internet? Why or why not? (If yes, will other devices need to login once again?)
Q3:
Only if the answer is affirmative to question 2:
If the captive portal allows 10 hours of continuous connection after a successful log in, can I first connect to that Wifi via a computer and a router which then I close the computer but the router is on (using ap mode and connecting to the Wifi) and let other devices connect to the extended signal and connect to the Internet?
Super thanks to your help.
The answer to Q1 and Q2 is "no" with almost any captive portal software, which authorizes clients based on their IP and/or MAC address.
Reason is that the repeater/range extender/PC needs two interfaces to extend the range of the wifi cell, one interface in STA mode and the other in AP mode. Therefore routing (or bridging) is needed to carry data from clients on the repeater to the router, on which the captive portal runs.
In case of routing, most often NAT is used by the repeater to avoid having static routes on the wifi hotspot. So the captive portal just sees one IP, namely the one of the repeater.
But even if STA/AP interfaces are internally bridged together on the repeater to form one big IP network, the Ethernet frames from the repeater to the wifi hotspot carry only 3 MAC addresses: the source MAC address, the MAC address of the next hop and the destination MAC address. While the repeater sees the MAC address of the client connected to it as its source, it does not forward this MAC to the captive portal, but replaces it with its own MAC address (because when forwarding the repeater itself is the new source).
So the captive portal has no way to recognize any client behind the repeater and if an user logs in through the repeater, he/she actually logs in with the repeater's address (be it IP or MAC address), not with the address of the user's device. Result is that every device connected to the repeater appears as logged into the captive portal as soon as one user has logged in. Also, if one user logs out, all other users behind the repeater are logged out, too.
To overcome this, some routers can be configured to use WDS (wireless distribution system), but although WDS is contained in the 802.11 standard, the latter does not define any implementation requirements. So, several proprietary implementations are in use, which either use some sort of ARP NAT or a 4 address mode to transmit the origin's MAC address as 4th address in an (wireless) Ethernet frame. Since such WDS implementations require a common set up of the repeater and the captive portal by its admin - and in some cases even the same wifi chipsets on both devices -, I won't elaborate on that any further.
This is pure nonsense. An Ethernet packet has two MAC addresses - source and destination. Routers don't forward MAC addresses, only IP addresses. And a router doing NAT will replace the outgoing IP with it's own. Nobody can know how many hops if any are behind the device they are talking to. So there is no way for a captive portal to know if it is talking to a router doing NAT vs a single wireless client.
It's true that a wireless repeater won't work, because it tries to bridge a single IP network, but it should be entirely possible to build a wireless router that NAT routes between a captive portal and another wireless network, as long as it has some way to authenticate to the captive portal.

Connect iPhone to local server for testing on XCode? -- without using WiFi

So I have an ejabberd (XMPP) server setup on my MacBook. Connects fine with Simulator, only intermittently on the device. The two times it hasn't connected were at cafes that had sign-on gateways for their Wi-Fi. I know nothing when it comes to networks, but I'm guessing this is a Firewall thing?
I'm supposing I can't get around the firewall without an elaborate workaround.
I've found that turning off Wi-Fi on both devices and turning on tethering so that both devices are communicating via data works. However, I'd rather not do this as my data plan is limited and I'd like to be freely internet-connected while I work.
Is there a way to setup XCode to have the phone use the USB connection to access the server on the MacBook? Or maybe some other way I'm not imagining?
Bluetooth doesn't work.
I don't believe that the problem is with some kind of firewall on the network…
Try using the local IP address instead of the hostname, It will change from network to network. To get it, you can open the network utility
In this case it would be [xmppStream setHostName:#"172.16.1.2"];

Wi-fi signal info of devices attached to a router

Is there a way to access the signal info of the devices that are attached to a wireless router? I was thinking that maybe that information is given in the router homepage, but my netgear router only gives me the IP and MAC addresses of the attached devices. Also, in case that this isn't possible with my router (DGN2000), are you aware of another device that gives that kind of information (even if it needs custom firmware to display it).
I want to make an app that collects the attached device signal data and I am stuck.
So I found the solution. Any router that can run on dd wrt firmware can access that data by navigating to "status" and then "wireless" in the router page. Another (and expensive) solution is the Apple Airport router, that gives that data via the airport utility.

Resources