Shell script detect APs and Mac Address

0

My goal is to develop a script in a Linux (Kali Linux) environment that automates certain tasks such as running, detect Access Points showing me the signal strength and Mac Address as well as the clients that are connected.

I do not care what kind of encryption the goal is not invasion but anti-invasion. Once I get this information, I can decide on which APs and clients should direct the deactivating action.

If there is any script like this and you can leave a link or copy of the code. I am very grateful. If colleagues do not know, I also accept the help of someone who is knowledgeable.

It's not college work or even for professional purposes. For exclusive use only.

  

Note: I already have a code snippet that detects my Mac address to make a comparison later and prevent myself from being debugged from AP .

    
asked by anonymous 27.10.2017 / 02:32

1 answer

0

You can use the iwlist utility with the argument scan to list all APs within the reach:

$ sudo iwlist wlan0 scan

Output:

wlan0     Scan completed :
          Cell 01 - Address: 00:1F:F3:02:04:81
                    ESSID:"Apple Network"
                    Mode:Master
                    Channel:1
                    Frequency:2.412 GHz (Channel 1)
                    Quality=42/100  Signal level:-84 dBm  Noise level=-127 dBm
                    Encryption key:on
                    IE: WPA Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (1) : TKIP
                        Authentication Suites (1) : PSK
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (2) : CCMP TKIP
                        Authentication Suites (1) : PSK
                    IE: Unknown: 2D1A2C0217FFFF000000000000000000000000000000000000000000
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                              9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
                              48 Mb/s; 54 Mb/s
                    Extra:tsf=0000003d7dfe8049
                    Extra: Last beacon: 1840ms ago
          Cell 02 - Address: 00:1D:7E:F8:15:F8
                    ESSID:"42"
                    Mode:Master
                    Channel:6
                    Frequency:2.437 GHz (Channel 6)
                    Quality=58/100  Signal level:-73 dBm  Noise level=-127 dBm
                    Encryption key:on
                    IE: WPA Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (2) : CCMP TKIP
                        Authentication Suites (1) : PSK
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (2) : CCMP TKIP
                        Authentication Suites (1) : PSK
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s
                              24 Mb/s; 36 Mb/s; 54 Mb/s; 6 Mb/s; 9 Mb/s
                              12 Mb/s; 48 Mb/s
                    Extra:tsf=0000007a7d5a1b80
                    Extra: Last beacon: 1616ms ago
          Cell 03 - Address: 00:1E:E5:65:C4:89
                    ESSID:"Adkins"
                    Mode:Master
                    Channel:6
                    Frequency:2.437 GHz (Channel 6)
                    Quality=84/100  Signal level:-49 dBm  Noise level=-127 dBm
                    Encryption key:on
                    IE: WPA Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (2) : CCMP TKIP
                        Authentication Suites (1) : PSK
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (2) : CCMP TKIP
                        Authentication Suites (1) : PSK
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s
                              24 Mb/s; 36 Mb/s; 54 Mb/s; 6 Mb/s; 9 Mb/s
                              12 Mb/s; 48 Mb/s
                    Extra:tsf=000001b2460c1608
                    Extra: Last beacon: 1672ms ago

And you can filter only the ESSID , MAC Address and signal information ( Quality , Signal level and Noise level ) through the grep utility:

$ sudo iwlist wlan0 scan | grep "Address\|ESSID\|Quality"

Output:

  Cell 01 - Address: 00:1F:F3:02:04:81
            ESSID:"Apple Network"
            Quality=42/100  Signal level:-84 dBm  Noise level=-127 dBm
  Cell 02 - Address: 00:1D:7E:F8:15:F8
            ESSID:"42"
            Quality=58/100  Signal level:-73 dBm  Noise level=-127 dBm
  Cell 03 - Address: 00:1E:E5:65:C4:89
            ESSID:"Adkins"
            Quality=84/100  Signal level:-49 dBm  Noise level=-127 dBm
    
01.11.2017 / 01:45