Skip to main content

NATS wrapper for fast scanner development

Project description

from scanner_api.wrappers import scanner_wrapper

Define the worker function which takes two argumentw (source, data).

source - infromation about publisher (e.g. nmap.reporter.masscan - this can catch only in ‘nmap.**’) data - dict with JSON data for scanner, which NATS scheduler send

worker returns a list with data to be sent to next scanner or reporter. (each element of list will be sent as separate message)

You can redefine log format according logging module.

def worker(source, data, meta):

result = [] result = processing…(data)“i do work”) logging.warning(“i warn you”) logging.error(“i made a mistake”) return result

Make a wrapper with define scanner name. The data will be collected from NATS by this name. (e.g. name.***.*** or name). Also name its a queue name.

Define NATS host addr.

wrapper = scanner_wrapper(

nats=[“nats://”], name=”reporter”)

Run by passing an argument worker function. This is blocking call!

LOG FORMAT: Connected to nats. Started module named ‘{name}’ Received from ‘{subject}’: {data} Starting ‘{name}’ Result: {result} n Was sent to ‘{pipeline}’


{name} - scanner name {subject} - queue name {data} - json from NATS {result} - out data from worker function {pipeline} - new addr in NATS queue

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

nats-scan-wrapper- (9.2 kB view hashes)

Uploaded source

Built Distribution

Supported by

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