Skip to content

Commit

Permalink
📌 add subfinder settings (#3385)
Browse files Browse the repository at this point in the history
Co-authored-by: Jan Klopper <[email protected]>
  • Loading branch information
zcrt and underdarknl authored Aug 28, 2024
1 parent 75a171f commit 0b44679
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
4 changes: 4 additions & 0 deletions boefjes/boefjes/plugins/pdio_subfinder/boefje.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@
"consumes": [
"Hostname"
],
"environment_keys": [
"SUBFINDER_RATE_LIMIT",
"SUBFINDER_VERSION"
],
"scan_level": 2
}
14 changes: 11 additions & 3 deletions boefjes/boefjes/plugins/pdio_subfinder/main.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
import logging
import os

import docker

from boefjes.job_models import BoefjeMeta

SUBFINDER_IMAGE = "projectdiscovery/subfinder:v2.6.6"


def run(boefje_meta: BoefjeMeta) -> list[tuple[set, bytes | str]]:
"""Create image from docker and run subfinder with only active domains output."""
subfinder_image = f"projectdiscovery/subfinder:{os.getenv('SUBFINDER_VERSION', 'v2.6.6')}"
rate_limit = int(os.getenv("SUBFINDER_RATE_LIMIT", "0"))

client = docker.from_env()
input_ = boefje_meta.arguments["input"]
hostname = input_["name"]

output = client.containers.run(SUBFINDER_IMAGE, ["-silent", "-active", "-d", hostname], remove=True)
logging.info("Using %s with rate limit %s", subfinder_image, rate_limit)
output = client.containers.run(
subfinder_image, ["-silent", "-active", "-rate-limit", str(rate_limit), "-d", hostname], remove=True
)

return [(set(), output)]
20 changes: 20 additions & 0 deletions boefjes/boefjes/plugins/pdio_subfinder/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"title": "Arguments",
"type": "object",
"properties": {
"SUBFINDER_RATE_LIMIT": {
"title": "SUBFINDER_RATE_LIMIT",
"type": "integer",
"minimum": 1,
"maximum": 65535,
"description": "Maximum number of http requests to send per second."
},
"SUBFINDER_VERSION": {
"title": "SUBFINDER_VERSION",
"type": "string",
"maxLength": 10,
"description": "Version string including 'v', e.g. 'v2.6.6'."
}
},
"required": []
}

0 comments on commit 0b44679

Please sign in to comment.