Shell script detect Aps and Mac Address

Asked

Viewed 55 times

0

My goal is to develop a script on Linux environment (Kali Linux) that Automatizes certain tasks such as while running, detect Access Points next showing me the intensity of the signal and the Mac Address as well as customers who are connected.

I don’t care about encryption because the goal is not trespassing, it’s anti-invasion. Once I get this information, I can decide on which Aps and clients should direct the action of disaffection.

If there is already a script like this and it is possible to leave a link or copy of the code. I am very grateful. If colleagues do not know, I also accept the help of someone experienced in the subject.

It is not college work nor for professional purposes. For exclusive use only.

Obs.: I already have a code snippet that detects my Mac address to make a comparison at a later date and to prevent myself from being disused from AP.

  • Friend, from what I’ve seen, you want the code ready.

  • I don’t think you understand... "If someone has a code ready that meets these needs, if you can share", I’ll be happy. For I see no reason to reinvent the wheel... But if this is not possible, I would be very happy if someone who knows Shell Script, could help me with some insights...

  • You need to learn linux, start by a distro like Ubuntu, learning the basics, after that you can move to Kali which is a distro with many features already installed. If you didn’t know, take some script ready, and even some error, you couldn’t solve the error. What you want is very simple, you will not do this script for you, because the idea is to learn, if you get ready you will not learn.

  • Colleague. I already use Kali Linux. I am developing a personal project based on Shell Script. I’ve even mastered many shell scripting things like storing values in variables, condition structures and repetition, but my problem is using regular expression to work with the outputs of other programs in the console.

  • If ifconfig applied on an active network card provides me with active Mac Address. I also know that iwlist applied on my active network card associated with scan me provides a list of nearby access points.

  • ok, let’s go to the tips then: vc needs to learn mainly about the command "Iw" follows the manpage --> https://linux.die.net/man/iw Regular expression vc will hardly use, only basic knowledge with "grep"," egrep","awk" and "sed" will be more than enough to get the result you seek. vc can take a look at this channel to have shell basics --> https://www.youtube.com/watch?v=EOLPUc6oo-w&list=PLucm8g_ezqNrYgXC8_CgbvHbvI7dDfhs .

  • Once I finish the script, put it to help others and already close the topic... Vlw

Show 2 more comments

1 answer

0


You can use the utility iwlist with the argument scan to list all Aps within range:

$ sudo iwlist wlan0 scan

Exit:

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 can filter only information from ESSID, of MAC Address and information on the signal (Quality, Signal level and Noise level) by means of the utility grep:

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

Exit:

  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
  • Thanks to you who guided me. With this information I can already realize this little project...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.