Python WiFi scanner in kali Linux python script

Sharing is caring!

How to create a simple python script that discovers all hosts in the local subnet so it’ll discover all devices on the local wi-fi network or all devices connected to your physical ethernet network now to do this I’m going to leverage the power of escapee which supports packet crafting for python 2 and python 3. this is really powerful software i’m going to show you a simple use case using the software right now in other words using op to discover devices in the local subnet but i’ll show you more powerful examples using scapy in later videos the script that we’re going to use simply imports escapee imports regular expressions and then asks the user to enter the range of devices to scan and using this simple command op result escapee rping ip address range entered i can get my python script to send op messages out into a network and discover all the devices on the network.

So in kali linux ls i’ve created this file called nano is a text editor so nanolandscan py i’ve simply copied the script into this file so this script is the script that i’ve just demonstrated now i’ve put a lot of comments in the script so it explains every line of the code so i won’t bore you with it but essentially all we’re doing is importing scapy and regular expressions this can be removed if you don’t want it we are then making sure that the user enters a correct ip address range by using this regular expression and then we scan for devices in the network a very simple script most of the script is just comments you need pseudo privileges on kali to run this i’m going to use python 3 in this example escapee does support python 2 but it’s recommended today that you use python3 so that’s what we’re going to use here and i’m going to run my script okay so we prompted to enter the subnet that we’re going to scan i’ll open up another terminal and i’ll show you that the ip address for this linux device is that’s the subnet that we want to scan now i’m actually doing everything on this windows laptop it’s connected to the wi-fi network but in this example i’m running cali within a virtual machine so we don’t see a wi-fi network we see an ethernet network but this is essentially the wi-fi network that connects my kali virtual machine to the physical network around me so i’ll put in my subnet that’s the subnet that i want to scan and notice we prompted to enter the right format and then escapee sends out up messages into the network to discover devices these are devices in my local network so as an example it’s picked up some apple computers it’s picked up synology nasa’s it’s picked up cisco devices it’s picked up a net gear router and various other devices in the network it’s as simple as that so if i run that again notice i can put in the network now you could change the script to automatically select a network rather than asking the user to put it in but in this example i’m allowing the user to put in a specific network and once again it’s discovered devices here is a printer as an example at the moment we’re not storing this information in a text file or in a database.

I will show you that in later videos we’re going to be iterating and improving our scripts and making them more and more powerful but here’s a very simple script showing you why it’s a good idea to learn python python is one of those scripting languages that can help you in many many places it can help you with ethical hacking it can help you with network automation it can help you with just automating stuff on your computer help you with data science there are many many use cases it’s well worth your time learning how to use python today now you can use the software on windows you can use this on your apple mac but i prefer running everything within linux so that’s what i’ve done here i’ve demonstrated how to use this on kali kali linux contains a whole bunch of tools but in this example we are hopefully going to be learning python and having some fun at the same time with that being said if you like this video please consider share my article.

Sharing is caring!

Leave a Comment