A python based script for Local Network Scanning.
Table of Contents
Simple network scanner built with Scapy(Python) for Local network Scanning.
You can use the scirpt for scanning your local network. Network scanning helps to detect all the active hosts on a network and maps them to their IP addresses. Here we use ARP and TCP scan to scan for active devices and their ports.
These are the things you need to perform in order to use it.
Install :
- Python 3
- Scapy
pip install scapy
- Open terminal
- Go to your desired directory
- Clone the repo
git clone https://github.com/0xr4Gn4R/N-Scan.git
- Get into the directory
cd N-Scan
Perform either an ARP scan or TCP scan.
- An ARP scan will send ARP requests to all devices on the local network, and collect the ARP replies to discover IP address to MAC address mappings.
- A TCP scan will send TCP SYN packets to all specified ports, and collect the SYN+ACK replies to discover which ports are open.
If you are on a UNIX-based system, please run the script as root (use sudo).
usage: python3 nscan.py [-h] {ARP,TCP} ...
positional arguments:
{ARP,TCP} Command to perform.
ARP Perform a network scan using ARP requests.
TCP Perform a TCP scan using SYN packets.
optional arguments:
-h, --help show this help message and exit
Either an IP address or IP address range can be used. For example, python3 nscan.py ARP 192.168.2.1/24
scans all IP addresses in the 192.168.2.0/24 subnet.
usage: python3 nscan.py ARP [-h] IP
positional arguments:
IP An IP address (e.g. 192.168.1.1) or address range (e.g.
192.168.1.1/24) to scan.
optional arguments:
-h, --help show this help message and exit
Either specific ports or a range of ports can be used. For example, python3 nscan.py TCP 192.168.2.1 --range 0 1000
scans all ports from 0 to 1000.
usage: python3 nscan.py TCP [-h] [--range] IP ports [ports ...]
positional arguments:
IP An IP address or hostname to target.
ports Ports to scan, delimited by spaces. When --range is specified,
scan a range of ports. Otherwise, scan individual ports.
optional arguments:
-h, --help show this help message and exit
--range Specify a range of ports. When this option is specified, <ports>
should be given as <low_port> <high_port>.
If you receive AttributeError: 'L2bpfSocket' object has no attribute 'ins'
, you likely need to run the script as root (use sudo).
See https://stackoverflow.com/questions/55881295/l3packetsocket-object-has-no-attribute-ins-when-using-send-command
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make is highly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/NewFeature
) - Commit your Changes (
git commit -m 'Add some NewFeature'
) - Push to the Branch (
git push origin feature/NewFeature
) - Open a Pull Request
Your Name - Subhajit Sahana - [email protected]
Project Link: https://github.com/0xr4Gn4R/N-Scan