Skip to main content

PyNuclei is an unofficial python library for Nuclei Scanner.

Project description

PyNuclei

PyNuclei is an unofficial Python library for Nuclei Scanner.

Features

  • Run Nuclei Scans for all or selected templates
  • By default uses random User-Agents for every scan.
  • User-defined rate limit (Default: 150)

Installation

pip3 install PyNuclei

Usage

from PyNuclei import Nuclei
"""
Nuclei(templatePath)
Args:
    nucleiPath [str][Optional]: The path of nuclei binary file

Returns:
    PyNuclei.Nuclei class object

nucleiScanner.scan()
Args:
    host [str]: The hostname of the target which Nuclei will run against
    templates [list][Optional]: If the templates list is not provided all nuclei templates from the "nucleiTemplates" property will be executed
    generatePoc [str]: Generate Burpsuite like Request-Response or Terminal screenshot.
    userAgents [str][Optional]: If not provided random User-Agents will be used.
    rateLimit [int][Optional]: Defaults to 150.
    maxHostError [int][Optional]: It determines to skip host for scanning after n number of connection failures
    stopAfter [int][Optional]: Stop scanning after getting n number of findings, only use for template paths instead of template categories
    metrics [bool][Optional]: It shows the scan progress.   
    verbose [bool][Optional]: Show nuclei results output and PyNuclei warning logs.

Returns:
    result [dict]: Scan results from all templates.
"""

nucleiPath = "/opt/app/src/bin/nuclei"
nucleiScanner = Nuclei(nucleiPath)
scanResult = nucleiScanner.scan(
    "example.com",
    templates=["cves", "network", "ssl"],
    generatePoc=True,
    rateLimit=150, 
    verbose=False,
    metrics=False,
    maxHostError=30,
    stopAfter=None
)
print(scanResult)

Templates

from PyNuclei import Nuclei

nucleiScanner = Nuclei()

"""
All active templates.
"""
print(nucleiScanner.nucleiTemplates)
[
    "cnvd", "cves", "default-logins", "exposed-panels",
    "exposures", "file", "misconfiguration",
    "miscellaneous", "takeovers", "technologies",
    "token-spray", "vulnerabilities", "network", 
    "dns", "iot", "ssl"
]

"""
All ignored templates.
"""
print(nucleiScanner.ignoredTemplates)
[
    "headless", "fuzzing", "helpers", 
]

"""
Returns details of all nuclei templates in JSON format
"""
print(nucleiScanner.returnTemplatesDetails())

NOTE: You can run ignored templates by passing them in the template parameter in nucleiScanner.scan(<host>, template=nucleiScanner.ignoredTemplates)

Image PoC

PyNuclei extends its core capabilities with a powerful feature for generating visual Proof-of-Concepts (PoCs). This functionality allows users to create image-based representations of identified vulnerabilities, significantly enhancing reporting and communication.
You can generate Terminal based PoCs, BurpSuite like request/response PoCs, visually displaying the HTTP interactions that demonstrate the vulnerability, and even code execution POCs, showing the resulting output of arbitrary code run.
Furthermore, PyNuclei automates the process of highlighting critical vulnerability details within the generated PoC images, making it instantly clear where the identified issues lie.

Request-Response PoC

Request-Response/Code-Execution PoC

Code-Execution PoC

Request-Response/Code-Execution PoC

Terminal PoC

Terminal PoC

Update Nuclei

from PyNuclei import Nuclei
"""
This will update Nuclei engine & Nuclei Templates.
"""
Nuclei.updateNuclei(verbose=True)

Connect with me

kushvaibhav

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

pynuclei-1.4.5.tar.gz (122.4 kB view details)

Uploaded Source

Built Distribution

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

pynuclei-1.4.5-py3-none-any.whl (119.0 kB view details)

Uploaded Python 3

File details

Details for the file pynuclei-1.4.5.tar.gz.

File metadata

  • Download URL: pynuclei-1.4.5.tar.gz
  • Upload date:
  • Size: 122.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for pynuclei-1.4.5.tar.gz
Algorithm Hash digest
SHA256 f6e48766b5b119afe928cb96661d903220cf278654c0d67915090bf27e611e4a
MD5 3f8d41964a8deb6f7068b1d3451181b9
BLAKE2b-256 cf3534cb3a32626f51baccf62bceac8f16ccbd2ac8d814d2803df63f27cf5602

See more details on using hashes here.

File details

Details for the file pynuclei-1.4.5-py3-none-any.whl.

File metadata

  • Download URL: pynuclei-1.4.5-py3-none-any.whl
  • Upload date:
  • Size: 119.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for pynuclei-1.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 de495f60ca604994c8945e4b44d8c0011ca8e4e52d6f44cc1dced76330abe8fb
MD5 4011f31dcaf1541023170858c41d2f9d
BLAKE2b-256 10ca6b6eb4b4c9d3ebc951454bf9eac89346c3dac6c6af5d7766b3f0cc47d686

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