My nodemcu lua app needs to retrieve the MAC Address (BSSID) of the Access Point the nodemcu dev kit is connected to. It is able to retrieve the SSID, but the BSSID field is 'nil'.
> x=wifi.sta.getapinfo()
> y=wifi.sta.getapindex()
> print(x[y].ssid)
MySSID
>print(x[y].bssid)
nil
What needs to be done to retrieve the MAC Address? Or is it not supported?
So, the answer now is that this was added to the NodeMCU dev branch on July 8th: https://github.com/nodemcu/nodemcu-firmware/pull/2026
Should be on master in the not so distant future.
Related
My requirement is like, I want IP and MAC address of devices which are connected to my iOS device's hotspot.
How can I get a list of IP address of those devices?
Does Apple allow to get hotspot related information through code.?
Unfortunately I don't know a way to get the actual client list (or ARP table for that matter).
But you could implement a scanner. Have you thought of that? Isn't the beautiful solution you're most probably looking for, but might be something?
Here would be a scanner library as reference: https://github.com/mavris/MMLanScan
You could also get your devices IP address and network mask, calculate the possible IP range yourself and implement an ARP query per candidate device using sysctl and gethostbyaddr as described in this post
https://stackoverflow.com/a/2269903/1041122
EDIT sidenote:
Did you have a really deep read of the NetworkExtension API from Apple? I don't know it well but since it allows numerous configurations that might be possible as well.
I am developing an iOS application which require ip address of device for communication, I have MAC address of device from which I need to find IP address, there is available help for finding MAC address from IP address but not the same.
I have referred LAN-Scan library but it is pinging each devices in network and and will get list of connected devices and for each ip address I need to find MAC address and compare with available MAC address.
My question is, Is there any way that we can find directly find ip address for particular MAC address in the network using Objective C?.
This script should give you what you are looking for really quickly and requires to have nmap installed. The advantage is that if your host does not reply to ping probes, nmap would still find the host while other tools will not.
more info https://apple.stackexchange.com/questions/19783/how-do-i-know-the-ip-addresses-of-other-computers-in-my-network
I am having problems with the hostname of my ESP8266. I am using the MDNSResponder and I can successfully access my device with mydevice.local
However, my WiFi router (Netgear WGR614) list the device as ESP_FEA38A. When I use 'Angry IP Scanner' on my mac, there is no hostname listed. Both, the ip scanner and the WiFi router both recognize several raspberrys and other devices like airport express.
Does anybody know what other host naming mechanisms are being used and how I can get my ESP8266 device getting listed with hostname?
If you are using the Arduino environment in the WiFi library there is a method for setting the hostname:
WiFi.hostname(newHostName);
Once I set this to the desired name the ESP8266 showed correctly in DHCP, on the router and, when available, was pingable. From my experimenting this needs to be done before any of the other WiFi actions for it to work effectively.
You can also include the Espressif SDK functionality although looking at the Arduino ESP8266 GitHub project it appears to already be included.
The Espressif SDK sets the hostname with the following command:
wifi_station_set_hostname(myHostname);
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 ?
I checked the Phonegap API but what I would like to achieve, getting a list of available wifi networks, seems not supported.
Anyone knows if it's possible at all in the current state?
You cannot get a list of available wifi networks at the moment.
PhoneGap will support reading the currently connected network SSID via the system information api (http://www.w3.org/TR/system-info-api/#network).
If you wanted to list all the wifi networks today, you would have to write a PhoneGap plugin -- assuming those APIs are actually available on the devices in which you are interested.
Here is a PhoneGap plugin for wifi info https://github.com/HondaDai/PhoneGap-WifiInfoPlugin The code is in Java which means it's for Android. However,
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
This only gives you result for the currently connected wifi network. To get a list of all wifi networks, I believe you can change the WifiInfoPlugin class and use wifiManager.getScanResults(), then store the results in an array or similar.
I recently did some research on this and found out it's still not supported.
It might be useful to have a look at the PhoneGap roadmap from time to time.