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) logging.info(“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://127.0.0.1:4222”], name=”reporter”)

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

wrapper.run(worker)

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

Here:

{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-0.1.9.9.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

nats_scan_wrapper-0.1.9.9.1-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file nats-scan-wrapper-0.1.9.9.1.tar.gz.

File metadata

  • Download URL: nats-scan-wrapper-0.1.9.9.1.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5

File hashes

Hashes for nats-scan-wrapper-0.1.9.9.1.tar.gz
Algorithm Hash digest
SHA256 e59a0942f08764c9256936fcb4bc50d53490b87ee0191f5ef9757b42750b7ed2
MD5 d1f32535daab86b68a2719910a61ec3e
BLAKE2b-256 10a1a2ea126bcb7d2ec90edabce2cdfc673936faeb84b2396da9e03ce19bc073

See more details on using hashes here.

File details

Details for the file nats_scan_wrapper-0.1.9.9.1-py3-none-any.whl.

File metadata

  • Download URL: nats_scan_wrapper-0.1.9.9.1-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5

File hashes

Hashes for nats_scan_wrapper-0.1.9.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9071382b3159ec4e58ac8fda65b2e7cd18bdaaf9bd7029ba3df20be1d5c40e04
MD5 2dfb9998e7be568f7c6da7b0121f4b16
BLAKE2b-256 9b74c2ddeac030ebf9ec13a58565e910a5f1152639f8ad8d7fc5187ed45de9a4

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