Nanitor Network Scanner
A comprehensive network scanner for security assessments and discovery. A standalone scanner written in Python that produces a text file in json format. Optionally import into your Nanitor instance. Recommend running this on a Linux or macOS machine.
Features
- Network discovery using ping sweep
- TCP and UDP port scanning
- MAC address and vendor resolution
- Web server detection and fingerprinting
- SSL/TLS certificate analysis
- SNMP information gathering
- Colorized terminal output
- JSON results for further analysis
- Nanitor import: Importing scan results into Nanitor
System Requirements
-
Python 3.11
-
Nmap is installed on your system
- macOS:
brew install nmap - Linux:
sudo apt-get install nmap(Ubuntu/Debian) orsudo yum install nmap(RHEL/CentOS) -
Others: Download from Nmap's official website
-
httpx installed on your system
-
Releases can be downloaded from httpx's GitHub releases
-
gobuster is installed on your system
- Releases can be downloaded from gobuster's GitHub releases
Installation
-
Clone the repository:
git clone https://github.com/nanitor/nanitor-scanner.git cd nanitor-scanner -
Create a virtual environment:
python -m venv venv source venv/bin/activate -
Install dependencies:
pip install -r requirements.txt -
Install the needed dependencies (nmap, gobuster, httpx).
-
Run the scanner:
sudo -E python nanscan.py
Usage
Scan the local network:
sudo -E python nanscan.py
Scan a specific network with verbose output:
sudo -E python nanscan.py -n 192.168.1.0/24 -v
Import the results into Nanitor through the API. Make sure to set the environment variables and specify the correct organization ID. The data will be imported into the organization specified.
export NANITOR_API_URL=https://my.nanitor.net/system_api
export NANITOR_API_KEY=MySecretAPIKeywithWritePermissionHere
python api.py import scan_results/nanitor_import.json -org-id 123
Dependencies and External Tools
Python environment
The Nanitor scanner is built in Python. The required Python configuration is specified in pyproject.toml. It has several dependencies, as specified in requirements.txt. For a complete list of the packages and their licensing, see the DEPENDENCIES.md file.
External tools
The Nanitor scanner depends on some external tools to enhance scanning capabilities. These tools need to be installed and ready to run in the environment. Each tool serves a specific purpose and is referenced directly for transparency and attribution:
- nmap
- Purpose: Advanced port scanning, OS detection, and service fingerprinting.
- Project: nmap/nmap on GitHub
- Maintainer: Gordon Lyon (Fyodor) and the Nmap Project
- License: Nmap Public Source License (based on GPLv2)
-
NOTE: Since nmap cannot be redistributed under its license, you need to download it and prepare it onto your system. Link: https://nmap.org/download
-
gobuster
- Purpose: Fast directory brute-forcing for web servers using a minimal word list.
- Project: OJ/gobuster on GitHub
- Maintainer: OJ Reeves (@TheColonial)
-
License: Apache License 2.0
-
httpx
- Purpose: Web discovery and probing for responsive HTTP servers.
- Project: projectdiscovery/httpx on GitHub
- Maintainer: ProjectDiscovery
- License: MIT License
Output
Results are saved to the scan_results directory in the following structure:
scan_results/nanitor_import.json: Scan results ready for import via Nanitor APIscan_results/summary.json: Overall scan summaryscan_results/{ip}: Detailed scan results for each host and tool outputsscan_results/{ip}/scan_results.json: Detailed scan results for each host
To change the output folder, use --out-dir.
Importing the results into Nanitor
To import the scan results into Nanitor, after running, you need to Set the environment variables pointing to your Nanitor instance's API and API key, for example:
export NANITOR_API_URL="https://my.nanitor.net/system_api"
export NANITOR_API_KEY="Your API key with write permissions"
python api.py import scan_results/nanitor_import.json --org-id <YOUR_ORGANIZATION_ID>
For more information on API keys and obtaining them, see https://help.nanitor.com/97-rest-api/
Feedback
If you have any feedback, feel free to contact us or submit an Issue. If you have anything to contribute, you can open a pull request. All pull requests will be looked at, though we may not accept everything.