
minimal script to help find script into the nse database
================================================
_ _ _____ _____ _
| \ | |/ ___|| ___| | |
| \| |\ `--. | |__ __ _ _ __ ___ | |__
| . ` | `--. \| __| / _` || '__| / __|| '_ |
| |\ |/\__/ /| |___ | (_| || | | (__ | | | |
\_| \_/\____/ \____/ \__,_||_| \___||_| |_|
================================================
Version 0.6b https://github.com/jtibaquira/nsearch @jjtibaquira
Email: [email protected]
================================================
NSEarch helps you find the scripts used by nmap (NSE). You can search by name, category, and author, or combine all three in a single query. You can also read a script's documentation, keep a list of favorites, run nmap with predefined templates, and run workflows: chains of scans where each stage only scans what earlier stages found, with reports you can save and compare.
0.6b
On Windows 10/11, install Python 3.12 or later and the official Nmap installer, including Npcap. The Windows installer accepts either the Python launcher (py -3) or python.
The Python dependencies are listed in requirements.txt. The install script places them in a local virtual environment.
Get the code first:
$ git clone https://github.com/jtibaquira/nsearch.git
$ cd nsearch
The script supports Debian, Ubuntu, Red Hat, Fedora, CentOS, and macOS. On Linux, it uses sudo to install system packages.
$ bash install.sh
Use bash, not sh: under sh, the script stops and asks you to run it with bash.
Run PowerShell from the project directory:
powershell -ExecutionPolicy Bypass -File .\install.ps1
The installer creates .venv and config.yaml. If Nmap is installed in a different directory, pass its installation path with -NmapDir:
powershell -ExecutionPolicy Bypass -File .\install.ps1 -NmapDir 'D:\Tools\Nmap'
NSEarch runs the nmap.exe in the folder above scriptsPath when scriptsPath is a full path with a drive letter or a network share, or the one in a standard Nmap install folder. It never runs an nmap.exe from PATH or from the current folder.
The installer restricts the project folder to your account, SYSTEM, and Administrators. New files and folders inside it, including the configuration and the SQLite database, inherit those permissions, while reports gets its own ACL restricted to your account as owner, SYSTEM, and Administrators. It does not request or need Administrator privileges. If it cannot apply the permissions, it stops and advises you to clone the project into a folder you own.
In config.yaml, quote Windows paths with single quotes. Do not put a trailing slash on scriptsPath:
config:
scriptsPath: 'C:\Program Files (x86)\Nmap\scripts'
filePath: 'C:\Program Files (x86)\Nmap\scripts\script.db'
Run NSEarch with the virtual environment's Python:
.\.venv\Scripts\python.exe nsearch.py
Without Administrator privileges, nmap uses a connect scan (-sT), as it does without root on Unix. The included templates and workflows do not use -sS, -O, -sU, or -A.
The Windows console does not provide readline, so Tab autocompletion is unavailable. NSEarch enables ANSI colors at startup; older consoles that do not support them may show the color codes as text. Windows Terminal is recommended.
If you press Ctrl+C during a workflow, nmap is stopped. Use workflow resume id:<id> to continue with the saved results; see Workflows for resume behavior.
Install nmap and Python 3.12 or later, then create the virtual environment:
$ python3 -m venv .venv
$ .venv/bin/pip install -r requirements.txt
Find the path to script.db:
$ find /usr /opt -type f -name script.db 2>/dev/null
Copy config.yaml.example to config.yaml in the main directory of the project, and set the paths you found:
config:
scriptsPath: '/usr/share/nmap/scripts/'
filePath: '/usr/share/nmap/scripts/script.db'
fileBackup: 'scriptbk.db'
scriptdb: 'nmap_scripts.sqlite3'
categories: ["auth","broadcast","brute","default","discovery","dos","exploit","external","fuzzer","intrusive","malware","safe","version","vuln"]
checksum: ''
$ .venv/bin/python nsearch.py
The first run creates the local database. Later runs rebuild it only when nmap's script.db changes, and your favorites are kept.
nsearch> help
Nsearch Commands
================
EOF clear doc help last run showfav
addfav delfav exit history modfav search workflow
nsearch> help search
name : Name of the script
category : Search by category
author : Search by author
Usage:
search name:http
search category:exploit
search author:fyodor
search name:http category:exploit author:fyodor
Results are sorted by name. Use quotes when a value contains spaces, such as search author:"Paulino Calderon".
nsearch> search name:http author:calderon category:vuln
*** Name Author
[+] http-adobe-coldfusion-apsa1301.nse Paulino Calderon <[email protected]>
[+] http-avaya-ipoffice-users.nse Paulino Calderon <[email protected]>
[+] http-awstatstotals-exec.nse Paulino Calderon <[email protected]>
...
Use last to display the most recent results again.
doc accepts the script name with or without .nse. Press TAB to autocomplete from the last results.
nsearch> doc sshv1.nse
description = [[
Checks if an SSH server supports the obsolete and less secure SSH Protocol Version 1.
]]
author = "Brandon Enright"
license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
categories = {"default", "safe"}
nsearch> addfav name:http-vuln-cve2012-1823.nse ranking:great
[+] http-vuln-cve2012-1823.nse The script was added successfully
nsearch> addfav name:sslv2.nse
[+] sslv2.nse The script was added successfully
nsearch> showfav
*** Name Ranking
[+] http-vuln-cve2012-1823.nse great
[+] sslv2.nse normal
nsearch> modfav name:sslv2.nse newranking:great
[+] sslv2.nse The script was updated successfully
nsearch> delfav name:sslv2.nse
[+] sslv2.nse The script was removed successfully
showfav also accepts filters, such as showfav ranking:great or showfav name:http ranking:great.
Only scan systems that you own or are explicitly authorized to test.
run requires a target and a template. The target can be a host name, an IP address, or a network range.
Add output:<name> to also save the results as plain text in reports/<name>.txt, for example run template:http net:192.0.2.10 output:http-scan. The name must be a single file name, without a folder; .txt is optional. The file gets the same restricted permissions as workflow reports, and an existing file is never overwritten: run says so and does not scan. Nothing is saved if the scan is cancelled, blocked or fails.
nsearch> run template:ping net:127.0.0.1
Running scan
----------------------------------------------------
Host : 127.0.0.1 (localhost)
State : up
The templates are in the templates directory: