Skip to content
NSE script which leverages the Censys IPv4 API for passive data collection
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


NSE script using the Censys IPv4 API, allowing you to passively gather information about hosts.


Simple place the censys-api.nse script into your nmap scripts folder. e.g:

cp censys-api.nse /usr/share/nmap/scripts/

If nmap is installed on macOS via Homebrew, the scripts folder might instead be at /usr/local/share/nmap/scripts/.


Invoke the script like you would any other NSE script:

nmap  -sn -Pn -n  --script censys-api

API Keys

The Censys API ID and secret can be set with the apiid and apisecret script arguments, CENSYS_API_ID and CENSYS_API_SECRET environment variables, or hardcoded in the .nse file itself. You can get free API credentials from .

Saving to a File

The results can be written to file with the outfile script argument censys-api.outfile.


nmap will still scan the target host normally. If you only want to look up the target in Censys you need to include the -sn -Pn -n flags.

Example Output

Starting Nmap 7.70 ( ) at 2019-01-12 07:28 EST
Nmap scan report for (
Host is up.
Other addresses for (not scanned): 2600:3c01::f03c:91ff:fe18:bb2f

Host script results:
| censys-api: Report for ()
| 80    http   httpd    2.4.7
|_22    ssh    OpenSSH  6.6.1p1

Post-scan script results:
|_censys-api: Censys done: 1 hosts up.
Nmap done: 1 IP address (1 host up) scanned in 1.35 seconds


nmap --script-help censys-api.nse
You can’t perform that action at this time.