Les informations peuvent être obtenues avec une commande appelée aéroport, qui est en quelque sorte profonde.
$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I
     agrCtlRSSI: xxx
     agrExtRSSI: xxx
    agrCtlNoise: xxx
    agrExtNoise: xxx
          state: xxx
        op mode: xxx
     lastTxRate: xxx
        maxRate: xxx
lastAssocStatus: xxx
    802.11 auth: xxx
      link auth: xxx
          BSSID: xxx
           SSID: HERE!!!
            MCS: xxx
        channel: xxx
Tirez seulement où vous le voulez
Shell est comme ça
$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep " SSID" | tr -d " " | cut -c6-
HERE!!!
Avec Python comme ça
import commands
airport = "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I"
print [line for line in commands.getoutput(airport).split('\n') if " SSID" in line][0].split(':')[1].strip()
# HERE!!!
Par exemple, j'ai créé un outil de ligne de commande qui peut être utilisé à la maison ou au travail, mais au travail, je dois configurer un proxy.
Recommended Posts