Forum Thread: How to Scan Specific Mac and Deauth

How to Scan Specific Mac and Deauth

Hello :) I am a newbie and a Portuguese, so, sorry if i can't be clear enough.

I'm creating a script to scan all MAC addresses in my LAN (Nmap) and if a specific one exists then that MAC will be deauthenticated (aireplay).

  • allMAC=$( nmap -sP 192.168.1.0/24 | egrep 'MAC' | awk '{print $3}' )

Now, the previous code outputs only the MAC address of all devices connected.

PROBLEM:

The "allMAC" variable will output all the MAC's and i need to select each one with a command to show me the first line, then show the second, etc.

I know that adding the -c switch to grep it will output the number of lines (MAC's), and i want to make an array that will select every line until it finds the MAC i want to deauth if exists.

PS: How can i put a variable after "$" ? eg:
awk '{print $ $VAR }'

I hope that its not too confuse.

Thanks

4 Responses

Hi,

Interesting post! Some time ago i did something very similar, only that i knew exactly which MAC's i wanted to deauth and they were always connected. I have a question for you: If you know the MAC's you want to deauth, why not just launch the script on those instead of scanning the whole network? You can always discard the errors and it is lighter and faster.

What do you think?

Hi, thanks for reply and yes i know the MAC's to deauth.

Good idea im complicating things, wen it can be resolved in a faster and easier way.

  • Discarding error? Are you saying with a aireplay switch?
  • Can i deauth multiple devices without running again the script on other terminal?
  • I have noticed that i can deauth the devices without monitor mode, is it less effective or is just the same?

And i solve the problem putting a VAR after "$", check out dont know other way to do it:

# All MAC's
allMAC=$(nmap -sP 192.168.1./24 | egrep 'MAC' | awk '{print $3}')
# Number of MAC's
numMAC=$(echo $allMAC | awk '{print NF}')
num=$(echo "$"$numMAC)
echo $allMAC | awk "{print $num}"

what if we want to deauthenticate all macs except one?

Hi ROOT1216, don't know for sure but i got an idea:

BASH script that as all macs in a var (like my script above), and then making it select one mac at the time and send 1 deauth to each mac.

ex:

  • This code puts all macs to the "allMAC" variable

allMAC=$(nmap -sP 192.168.1./24 | egrep 'MAC' | awk '{print $3}')

I'm trying to make my script to work but i got some error's, if i get it to work i will share and explain all command in it

Share Your Thoughts

  • Hot
  • Active