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.

Install from PIP:

pip install jenkinsenvhunter    

Then:

jenkins-env-hunter --help
jenkins-check-noauth --help

Requirements

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

Install dependencies (if from git clone)

pip install requests alive-progress

CheckNoAuth.py & jenkins-check-noauth

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 (Python and PIP versions listed)

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

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

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

# Verbose output for troubleshooting a single host
python CheckNoAuth.py -f single-host.example.local:8080 -v
jenkins-check-noauth -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 & jenkins-env-hunter

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/
jenkins-env-hunter --url http://jenkins.example.local/

# Scan and save results to a file
python JenkinsEnvHunter.py --url http://jenkins.example.local/ --output findings.txt
jenkins-env-hunter --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
jenkins-env-hunter --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
jenkins-env-hunter --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
jenkins-check-noauth -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
jenkins-env-hunter --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.1.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.1-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for jenkinsenvhunter-0.1.1.tar.gz
Algorithm Hash digest
SHA256 14416763ab20a26f78ffec90356cf988a2d24327bc4b9e8d325e40acbc54cb5f
MD5 bb54448ae09ae087c73a1cb97cc2496e
BLAKE2b-256 f19a72147ad7b17e35215ffe299a54d762ec38972fef531e067806f272c14301

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jenkinsenvhunter-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d78ef602b18130d151892932a2aef6909681c8c2c888c2b5e16b7f24e7903c4a
MD5 38811b8959bc0519ac9dbc2cbc558c90
BLAKE2b-256 b25c8392b9e737cc4f21755b41ba5dd8e4e27cf79c9fffacff01aa655c495eb5

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