Skip to main content

Hunts Jenkins jobs and builds for sensitive information in Jenkins environment variables

Project description

JenkinsEnvHunter & CheckNoAuth

This repository contains two helper scripts for inspecting Jenkins instances:

  • JenkinsEnvHunter.py — enumerates Jenkins jobs and builds, fetches environment variables (including EnvInject), and highlights likely sensitive keys.
  • CheckNoAuth.py — scans a list of hosts (or a Nessus .nessus export) to detect Jenkins instances and whether anonymous access is allowed.

Only run these scripts against systems you own or have explicit permission to test.

Requirements

  • Python 3.7+
  • requests (required)
  • alive-progress (optional, progress bars)

Install dependencies:

pip install requests alive-progress

CheckNoAuth.py

Purpose: quickly determine which hosts are running Jenkins and whether anonymous access is allowed. The script can also extract hosts from Nessus .nessus exports (plugin 65054).

Usage examples

# Scan hosts listed in hosts.txt using HTTP
python CheckNoAuth.py -f hosts.txt

# Scan hosts using HTTPS and 4 threads
python CheckNoAuth.py -f hosts.txt --ssl -n 4

# Extract Jenkins hosts from a Nessus export and scan them
python CheckNoAuth.py -x scan.nessus

# Verbose output for troubleshooting a single host
python CheckNoAuth.py -f single-host.example.local:8080 -v

Options summary

-f, --file       File with hosts (one per line: HOST, HOST:PORT, http://host:port, [::1]:8080)
-x, --nessus     Nessus .nessus file - extract Jenkins hosts from plugin 65054
-v, --verbose    Print HTTP requests/responses (debug)
--ssl            Use HTTPS (default is HTTP)
-t, --timeout    Request timeout seconds (default: 5)
-n, --threads    Worker threads (default: 1)

Output

  • Per-host lines indicate whether Jenkins was detected and whether authentication appears required.
  • When anonymous access is detected, the script attempts to check /manage/ and reports its accessibility.
  • A final summary lists counts and servers allowing anonymous access.
Check No Auth

JenkinsEnvHunter.py

Purpose: enumerate Jenkins jobs and builds and fetch environment variables. Finds likely sensitive variables by default (regex matching user|pass|key|auth|token|secret) and can save results to a file.

Usage examples

# Scan a Jenkins instance (no auth) and print findings to console
python JenkinsEnvHunter.py --url http://jenkins.example.local/

# Scan and save results to a file
python JenkinsEnvHunter.py --url http://jenkins.example.local/ --output findings.txt

# Scan using credentials (authenticated Jenkins)
python JenkinsEnvHunter.py --url https://jenkins.example.local/ --user alice --token myapitoken --output findings.txt

# Include all environment variables (not only flagged ones)
python JenkinsEnvHunter.py --url http://jenkins.example.local/ --all

Options summary

--url        Jenkins base URL (required), e.g. http://jenkins.example.local/
--user       Jenkins username (optional)
--token      Jenkins API token or password (optional)
--output     Save findings to a file (optional)
--all        Include all environment variables (not just suspicious ones)
--quiet      Reduce console output
-v, --verbose  Show HTTP request/response info (troubleshooting)
--noredirect   Keep requests on the original host:port (useful when proxied)
--threads    Number of worker threads (default: 8)
Env Vars

Notes

  • Default sensitive-key matcher is re.compile(r"(user|pass|key|auth|token|secret)", re.IGNORECASE). Edit JenkinsEnvHunter.py to change matching rules.
  • Use --noredirect to avoid following redirects that change host/path in reverse-proxied environments.
  • When using --output, findings are appended to the specified file.

Example workflow

  1. Discover potentially anonymous Jenkins servers:
python CheckNoAuth.py -f hosts.txt -n 8
  1. For a discovered server that allows anonymous access, run a targeted environment scan:
python JenkinsEnvHunter.py --url http://jenkins.example.local/ --output scan_report.txt

Security & Responsible Use

Only run these tools against systems you own or are authorized to test. Do not attempt to access, enumerate, or exploit services without explicit permission.


Contributing

If you find detection gaps or want to improve regex rules or parsing logic, please open a pull request with non-sensitive test cases or sample output.

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

jenkinsenvhunter-0.1.0.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

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

jenkinsenvhunter-0.1.0-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file jenkinsenvhunter-0.1.0.tar.gz.

File metadata

  • Download URL: jenkinsenvhunter-0.1.0.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jenkinsenvhunter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dbbc87d88a9b188c3707d65e2c7187aaf73144eeca78cc5202e373448fe2296c
MD5 814e7d0f434f5496faf6d828255fa6ee
BLAKE2b-256 7eb481beba759fe1210309bbb0cef8f0d43417291bd0c6a16511d5a800f7b551

See more details on using hashes here.

File details

Details for the file jenkinsenvhunter-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for jenkinsenvhunter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bb57296fa677581d564df93c01cc6559d74552a181dcfae2c85936a56a8897a1
MD5 9534b011469533ae502661b42c033cfb
BLAKE2b-256 88289a09d8cf7108b89c955d576f9574ae0a2863214dc09647973eec996876f0

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