Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Network Driver/Mac] Access Point Parsing fails #20

Closed
dtorres opened this issue Feb 11, 2013 · 2 comments
Closed

[Network Driver/Mac] Access Point Parsing fails #20

dtorres opened this issue Feb 11, 2013 · 2 comments

Comments

@dtorres
Copy link

dtorres commented Feb 11, 2013

Issue

FILE: lib/agent/providers/network/mac.js
FUNCTION: parse_access_points_list

The parsing of access points fails if the SSID contains a "-" or ":" because of the way it's currently parsed.

specifically line 87:
var start = line.split(/\s[0-9a-f]{2}[:]/); // split on MAC addr start

Cases:

SSID: dd-wrt
SCAN OUTPUT: dd-wrt 00:00:00:00:00:00 -35 11 N -- WEP

SSID: S:H:U:T T:H:E D:O:O:R
SCAN OUTPUT: S:H:U:T T:H:E D:O:O:R 00:00:00:00:00:00 -35 11 N -- WEP

Proposed Solution

Use the Plist/XML version of the command
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s --xml

Output is a parsable Plist and there is a library to handle them node-plist

@tomas
Copy link
Contributor

tomas commented Feb 12, 2013

I see the point, but the example provided does not fail. Line 87 is actually:

var start = line.split(/\s[0-9a-f]{2}[:|-]/);

Which means that the string will be cut when ver a space followed by two chars and either : or - is found. So unless the SSID contains something like " AF:" or " 12-" (with a leading space) it will work.

I do agree that using the XML output is a better approach, though. Feel free to send a pull request. ;)

@tomas
Copy link
Contributor

tomas commented Apr 19, 2013

I'm pretty sure this has already been fixed. We do need to add tests for these race conditions to make sure the parser works as expected.

@tomas tomas closed this as completed Apr 19, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants