brangerbriz / wifi-data-safari

WiFi Data Safari Workshop
https://brangerbriz.github.io/wifi-data-safari
74 stars 11 forks source link

doesn't work if monitor devices isn't called mon0 #8

Closed nbriz closed 6 years ago

nbriz commented 6 years ago

was trying to run this && it wasn't working, so i tried running airodump-ng on it's own && that worked. i noticed the issue was that my mon device was called 'wlan0mon' && looking at the launch function in the server i noticed that it calls 'mon0' no matter what the mon device is actually called... then i noticed ur comments && perhaps yea, we shouldn't assume airmon-ng created a device called 'mon0'

i figured it would be easy enough to just parse the output of iwconfig to find the right name, so i added a function called getMonDevice to utils that does just that... i tested it in server.js && it worked for me, but i didn't want to change server.js ( b/c wasn't sure what state ur local version of it was in )

so if it looks good to u i'll let u implement the new function into the launch function in the server

nbriz commented 6 years ago

i updated the function to a new one called getNetInterfaces which uses ifconfig instead of iwconfig ( b/c that's not on mac ). it's synchronous && returns a list of network devices ( so we can use it to throw more informative error message that include the list of interfaces if the user doesn't specify an interface ) + could also be used to find the interface already in monitor mode like this:

let dev = getNetInterfaces().find(i=>i.indexOf('mon')>=0)
brannondorsey commented 6 years ago

@nbriz, the getNetInterface() function didn't work correctly out of the box for me. It seems like the output of my devices from ifconfig is like:

mon20     Link encap:UNSPEC  HWaddr C4-E9-84-D7-A5-D2-00-00-00-00-00-00-00-00-00-00 

where yours likely doesn't have the "Link encap" bit. I used a regex instead of the split on ":" and it should account for both of our machines, but you should test. The fact that it broke after the first test on another machine sketches me out a bit as to whether or not its safe to screen scrape ifconfig in the first place. Hopefully it is, but idk.

nbriz commented 6 years ago

@brannondorsey damn O__o

yea i had initially tried searching for an ifconfig module ( to avoid screen scraping ) but didn't find anything ( probably could have looked harder, the "config" part really throws off search results )

regex sounds like the smarter way to go ^__^