Pulling a list of MAC addresses to use as annotations in WiFi Explorer (Tutorial)

This thread has been locked for further replies. You can start a new thread to share your ideas or ask questions.

Pulling a list of MAC addresses to use as annotations in WiFi Explorer (Tutorial)

This thread has been locked for further replies. You can start a new thread to share your ideas or ask questions.
Pulling a list of MAC addresses to use as annotations in WiFi Explorer (Tutorial)
Pulling a list of MAC addresses to use as annotations in WiFi Explorer (Tutorial)
2021-06-03 21:59:58 - last edited 2021-06-07 14:16:27
Model: EAP225  
Hardware Version: V3
Firmware Version:

If you are on a Mac, and you do anything with WiFi, the WiFi Explorer app from Intuitibits is a must have.  Period.  Any Mac users here who have not seen Adrian Granados' software needs to check it out.

 

I have lots of EAP225s, and realized that it would be really helpful to be able to pull a list of addresses so WiFi Explorer could tell me what AP was what.  WiFi Explorer has annotations, that allow you to put a label on your APs.  A CSV file can by imported to the software to make this easier, but I didn't find a way to get a CSV from the Omada web interface.  Instead I hacked together this really crazy bash one-liner to do it for me.  This is hidious, but I figured I'd share in case it at least gives someone else an idea.

 

Note: I didn't see a way to get the actual BSSIDs from the Omada db.  Here I am getting the main AP mac address from the db, and replacing the beginning of the address with a wildcard.  TP-Link seems to try to use the same ender for the BSSID as for the main mac address.  This isn't always the case, but it was close enough for me, anyway.

 

mongo --port 27217 --eval "db.getSiblingDB('omada').device.find({},{name: 1,mac: 1}).toArray()" | grep -e "name\|mac" | sed -e '/"mac"/ s/\-/\:/g' | awk -F'"' '{print $4}' | sed 'N;s/\n/,/' | awk -F':' '{print "*:" substr($0, index($0,$5))}'

 

To break it down:

 

mongo --port 27217

Start by getting getting the mongo cli.  Note the port you are running from.  On my box, this ended up being 27217.  You can use `lsof -Pni` on Linux boxes to figure out what port you are using.

 

--eval "db.getSiblingDB('omada').device.find({},{name: 1,mac: 1}).toArray()"

Tell Mongo to get the Omada database, and pull an array with the name and mac address from the device table (I really don't know anything about mongo, so this could probably be cleaner...).  Pipe that into:

 

grep -e "name\|mac"

Just get the lines with "name" or "mac" in them.  Pipe that into:

 

sed -e '/"mac"/ s/\-/\:/g'

In the lines with "mac" in them, replace the dashes with colons.  WiFi Explorer doesn't like dashed addresses.  Pipe that into:

 

awk -F'"' '{print $4}'

Split the lines on quotes and only keep the actual data (the fourth quote seperated section).  Pipe that into:

 

sed 'N;s/\n/,/'

Combine every two lines with a comma in the middle.  This should put the name and mac for each access point on the same line.  Pipe that into:

 

awk -F':' '{print "*:" substr($0, index($0,$5))}'

Trim off the beginning of the mac address and put a wildcard in.

 

I end up with a list like this:

*:12:34:56,Test AP 1
*:12:23:34,Test AP 2
*:22:33:35,Test AP 3

...

 

Put it in a CSV, and you are all set to import into WiFi Explorer!

 

Anyway, this might not help anyone, but at least it's here for me if I ever need it.  Have fun!

  0      
  0      
#1
Options

Information

Helpful: 0

Views: 411

Replies: 0

Related Articles