Skip to main content

No project description provided

Project description

httpscan 🌐🔍

A configurable HTTP scanner for finding publicly available dumps, backups, configs, and more. It can send requests using other HTTP methods besides GET. It can bypass Cloudflare checks, but Node.js must be installed on your system.

I've been using the httpx tool for a long time. That tool is great except for its configurability (and it doesn't know how to bypass CloudFlare). I needed a declarative way to describe scanning rules, plus the tool had to download the found backups, dumps, etc., on its own. The same developers have nuclei, but it solves slightly different problems, and mainly, I can't just rewrite tons of code in Go, where doing many things is a pain.

Installation 🛠️

pipx install httpscan

Use pipx instead of pip to install packages containing executables.

Install the latest version from GitHub:

pipx install git+https://github.com/s3rgeym/httpscan.git

Usage 🚀

$ httpscan -i urls.txt -o results.json -vv --proxy 'socks5://localhost:1080'

Help:

$ httpscan -h
  • --workers specifies the total number of workers.
  • Each worker processes one link from the queue.
  • There is a --delay between attempts on the same link (site) because Nginx often limits the number of requests from one IP per second.
  • --parallel is the maximum number of parallel attempts for ALL PROBES run by different workers.

If the config path is not specified, files named httpscan.yml or httpscan.yaml will be searched in the current working directory or ~/.config.

Fields contained in the config: see Config.

The config has a probes field, which contains a list of ProbeDict objects.

Example probe for finding DB dumps:

probes:
# ...
- condition: status_code == 200
  match: INSERT INTO
  name: database dump
  path: /{db,dump,database,backup}.sql
  save_file: true

The repository contains a sample.httpscan.yml (you can move it to ~/.config/httpscan.yml).

  • Each element in the probes array contains a required name field with the name of the probe.
  • path is the path to be appended to each URL. The path supports brace expansion like in BASH, for example, /{foo,ba{r,z}}.biz (the paths /foo.biz, /bar.biz, and /baz.biz will be checked).
  • method specifies the HTTP method; params is for passing QUERY STRING parameters, data for parameters sent via application/x-www-form-urlencoded, json..., cookies..., headers...
  • condition allows filtering results. A built-in expression engine supports operators ==, !=, <, <=, >, >=, ! or NOT, AND or &&, OR or ||. =~ checks if a string matches a pattern, similar to calling bool(re.search(right, left)). All operators are case-insensitive. They can be grouped using parentheses. Available variables: status_code, content_length, content_type, title... For example, status_code == 200 && content_type == 'application/json'. Note that strings must be in quotes...
  • match, not_match check for matching a regular expression pattern in the server's response. extract and extract_all allow extracting content that matches a pattern. Since the response body can be huge, the probe reads the first 64 KB of data from the socket by default. For an HTML page, this is enough (according to this site, the average HTML size in 2022 was 31 KB), and archives can be checked for the absence of HTML tags.
  • save_file: true saves the file in case of success by default in the ./output/%hostname% directory.

Scanning results are output in JSONL format (JSON Lines, where each object is on a new line). Use jq to work with them.

{
  "content_languages": ["en"],
  "content_length": 303,
  "content_type": "application/octet-stream",
  "host": "domain.tld",
  "http_version": "1.1",
  "input": "https://domain.tld",
  "port": 443,
  "probe": {
    "name": "docker config file",
    "not_match": "^\\s*<[a-zA-Z]+",
    "path": "/{{prod,dev,}.env,Dockerfile{,.prod,.dev},docker-compose{,.prod,.dev}.yml}",
    "save_file": true
  },
  "response_headers": {
    "Accept-Ranges": "bytes",
    "Cache-Control": "no-cache, no-store, must-revalidate",
    "Content-Length": 303,
    "Date": "Tue, 16 Jul 2024 17:38:08 GMT",
    "Etag": "\"12f-60425670233e7\"",
    "Expires": "0",
    "Last-Modified": "Wed, 30 Aug 2023 15:15:48 GMT",
    "Pragma": "no-cache",
    "Server": "Apache",
    "Strict-Transport-Security": "max-age=31536000; includeSubDomains",
    "Vary": "User-Agent",
    "X-Content-Type-Options": "nosniff",
    "X-Frame-Options": "sameorigin",
    "X-XSS-Protection": "1; mode=block"
  },
  "response_url": "https://domain.tld/.env",
  "saved_as": "/tmp/x/domain.tld/.env",
  "saved_bytes": 303,
  "server": "Apache",
  "status_code": 200,
  "status_reason": "OK"
}

Other Features 🧩

  • Each link to be scanned uses a random User-Agent.
  • Proxy support, for example, socks5://localhost:1080.
  • --exclude-hosts can be used to pass a list of ignored hosts, and patterns with asterisks like *.shopify.com can be used to filter out subdomains. Domains can be written in any case.
  • Certain response codes can be skipped, for example, --exclude-statuses 401 403.

Development 🖥️

git clone ... && cd ...
python -m venv .venv
. .venv/bin/activate
# install all dependencies from pyproject.toml
pip install .

TODO

  • set_state: next_state
  • on_state: state_name
  • run_python: script_name
def run(...) -> ...:
    ...

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

httpscan-0.3.3.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

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

httpscan-0.3.3-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file httpscan-0.3.3.tar.gz.

File metadata

  • Download URL: httpscan-0.3.3.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.4

File hashes

Hashes for httpscan-0.3.3.tar.gz
Algorithm Hash digest
SHA256 fb0da2fc4759f440f046192dd794fcce7cf8547de79d73b3f5ea8fa99860ff61
MD5 dc96422096156ef2358678551a0c0418
BLAKE2b-256 3fe0ba89ed2f51f702cc16f0a917c21b2a076dd3377696cbcb5ad2e90a82f8e4

See more details on using hashes here.

File details

Details for the file httpscan-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: httpscan-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.4

File hashes

Hashes for httpscan-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 11230302c87fb03601f1c3eea4dfe129e619402b8b1f9049a994f1d1b5f4cce5
MD5 c334bb2386859bbf3edbe59c52179932
BLAKE2b-256 c160b7e1724b2406551f3fd6b4769b6d67bebbdb880579037451caded2fd3236

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