Skip to main content

Python equivalant of the rust nrich program. Simple async Python program to interact with the Shodan InternetDB API.

Project description

Nrich

Python equivalent of the Rust nrich program, developed by Shodan. Simple async Python program to interact with the Shodan InternetDB API.

In addition to the official tool, you can specify subnets, and this tool just unpacks them.

Usage

nrich --help:

usage: nrich.py [-h] [-input-file INPUT_FILE] [-output-file OUTPUT_FILE] [-output-type {json,str}] [-skip_missing]

options:
  -h, --help            show this help message and exit
  -input-file INPUT_FILE, -i INPUT_FILE
                        File to parse IPs from, if not given parse from stdin
  -output-file OUTPUT_FILE, -o OUTPUT_FILE
                        file to write IPs to
  -output-type {json,str}, -t {json,str}
                        Format to output in
  -skip_missing, -s     skip IPs with no information on them.

Standalone

To run this program as a standalone tool, run:

python3 -m nrich <your command>

For example, you can get the InternetDB information for a single IP, with the following command:

echo -e "<< your IP HERE>>\n" | python3 -m nrich
INFO:root:creating queue and IPlookup object...
INFO:root:creating tasks...
INFO:ShodanLookupper:Starting session...
INFO:root:running tasks...
INFO:ShodanLookupper:Got response: ShodanResult(ip=None, cpes=[], hostnames=[], ports=[], tags=[], vulns=[], detail='No information available', empty=False)...
{"ip": null, "cpes": [], "hostnames": [], "ports": [], "tags": [], "vulns": [], "detail": "No information available", "empty": false}

Any stdout piped input will be consumed by Shodan, when it is a file that contains IPs, line by line. Refer to the --help statement for usage when you want to consume files instead.

parse_internetdb.py

Example script to parse the shodan internet.db output

Installation

This package is available via PyPi. In order to install you can use the following command

pip install nrich

Nix users

For users of nix a flake is avaible. Have a look at flake.nix for the targets.

If you just want a shell where the package is available, run:

nix develop

License

GPLv3, see license.txt

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nrich-0.1.3.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nrich-0.1.3-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file nrich-0.1.3.tar.gz.

File metadata

  • Download URL: nrich-0.1.3.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.5.0-1021-azure

File hashes

Hashes for nrich-0.1.3.tar.gz
Algorithm Hash digest
SHA256 82f6f26b24b015fd0c1436e6bbf96375f5c5b996cbe8abb8fca7137dede88dd2
MD5 9a29e50bddc972410ebf8e88cf28470f
BLAKE2b-256 180bca079464867d98f2e16798759a4a803862afee9c59a647f381b9300175ed

See more details on using hashes here.

File details

Details for the file nrich-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: nrich-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.5.0-1021-azure

File hashes

Hashes for nrich-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a0600edc64c9d5bef7a1ccd4a1449ceb1395241c9086abacb8207de8e7264d64
MD5 491d3160f8208b315a49b2c0c279706b
BLAKE2b-256 17e007ca288bc65b480858eb8df730d669f5152bd8d118c54029ff3358257fac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page