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

avail_nets fails sometimes when an HP printer network is present #20

Open
keithrbennett opened this issue Nov 2, 2018 · 2 comments
Open

Comments

@keithrbennett
Copy link
Owner

(This issue reported at https://apple.stackexchange.com/questions/341517/airport-s-x-returns-truncated-output.)

The avail_nets command calls airport -s -x to get available network information in (pseudo-)XML format. In several locations, if there is an HP printer network, the output terminates somewhere in that element, and the command fails. For example:

       <key>SSID_STR</key>
       <string>DIRECT-0E-HP OfficeJet 4650</string>
       <key>WPS_PROB_RESP_IE</key>
       <dict>
                <key>IE_KEY_WPS_AP_SETUP_LOCKED</key>
                <true/>
                <key>IE_KEY_WPS_CFG_METHODS</key>
                <integer>0</integer>
                <key>IE_KEY_WPS_DEV_NAME</key>
                <string>DIRECT-0E-HP OfficeJet 4650</string>
                <key>IE_KEY_WPS_DEV_NAME_DATA</key>
                <data>
                RElSRUNULTBFLUhQIE9mZmljZUpldCA0NjUw
                </data>
                <key>IE_KEY_WPS_MANUFACTURER</key>
                <string>HP</string>
                <key>IE_KEY_WPS_MODEL_NAME</key>
                <string>OfficeJet 4650 series

Without the -x option, the output works, but, as I say, there is the space issue that prevents me from relying on it:

                        SSID BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)
                NETGEAR25-5G a0:04:60:1a:5a:89 -67  153,-1  Y  -- WPA2(PSK/AES/AES)
 DIRECT-0E-HP OfficeJet 4650 ac:e2:d3:a9:d9:0f -90  6       Y  -- WPA2(PSK/AES/AES)
                      iPhone b2:8d:6c:9f:dd:00 -49  1       Y  US WPA2(PSK/AES/AES)
                   NETGEAR25 a0:04:60:1a:5a:87 -62  9       Y  -- WPA2(PSK/AES/AES)
                   CBCI-4F58 60:3d:26:57:4f:5c -86  6       Y  -- WPA2(PSK/AES/AES)
@keithrbennett
Copy link
Owner Author

Apparently there are others who have discovered this bug: An excerpt from https://clburlison.com/macos-wifi-scanning/:

When you run airport with the --xml flag the command would fail to output properly formatted xml data. I did not spend a bunch of time trying to find the root issue since I wanted a working solution now and knew any potential bug fixes would take 3-18 months. One idea is that HP printers are broadcasting a SSID with unsafe characters, or maybe the airport command chokes when scanning in a highly saturated area.

You can see the result of a failed run below, without proper ending tags:

<dict>
    <!-- removed for brevity-->
    <key>SSID_STR</key>
    <string>DIRECT-54-HP ENVY 4520 series</string>
    <key>WPS_PROB_RESP_IE</key>
    <dict>
        <key>IE_KEY_WPS_AP_SETUP_LOCKED</key>
        <true/>
        <key>IE_KEY_WPS_CFG_METHODS</key>
        <integer>0</integer>
        <key>IE_KEY_WPS_DEV_NAME</key>
        <string>DIRECT-54-HP ENVY 4520 series</string>
        <key>IE_KEY_WPS_DEV_NAME_DATA</key>
        <data>
        RElSRUNULTU0LUhQIEVOVlkgNDUyMCBzZXJpZXM=
        </data>
        <key>IE_KEY_WPS_MANUFACTURER</key>
        <string>HP</string>
        <key>IE_KEY_WPS_MODEL_NAME</key>
        <string>ENVY 4520 series

@gonewest818
Copy link

fwiw, this airport bug is still the case on Catalina 10.15.2.

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