Skip to content

Add GitHub code-search discovery, tests, and CI for subdomain_searcher - #1

Open
Mankeluvsit wants to merge 1 commit into
mainfrom
codex/create-subdomain-searcher-tool
Open

Add GitHub code-search discovery, tests, and CI for subdomain_searcher#1
Mankeluvsit wants to merge 1 commit into
mainfrom
codex/create-subdomain-searcher-tool

Conversation

@Mankeluvsit

Copy link
Copy Markdown
Owner

Motivation

  • Improve passive discovery coverage by surfacing hardcoded hostnames found in public code repositories.
  • Make the tool more robust and maintainable by adding unit tests and a CI workflow to catch regressions.

Description

  • Add discover_from_github(domain, github_token=None) which queries the GitHub code search API and extracts hostnames using existing HOSTNAME_RE.
  • Wire GitHub results into the main aggregation pipeline and add a --github-token CLI flag for higher API limits.
  • Update README.md usage and method list to include GitHub code search and a tokenized example command using --github-token.
  • Add unit tests in tests/test_subdomain_searcher.py covering normalize_domain, discover_from_crtsh, discover_from_homepage, discover_bruteforce, discover_from_github, and load_wordlist.
  • Add a GitHub Actions workflow at .github/workflows/subdomain-searcher-tests.yml to run pytest on pushes and PRs touching the tool or tests.

Testing

  • Ran pytest -q locally; all tests passed (6 passed).
  • Executed python3 subdomain_searcher.py example.com --json to validate runtime behavior and JSON output; the command completed successfully.
  • CI workflow added to run the same pytest steps on push and pull requests to keep tests enforced.

Codex Task

@Mankeluvsit
Mankeluvsit marked this pull request as ready for review February 21, 2026 11:52

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5f0554dd71

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread subdomain_searcher.py
Comment on lines +131 to +135
text = " ".join(
[
str(item.get("name", "")),
str(item.get("path", "")),
str(item.get("html_url", "")),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Extract hostnames from matched code snippets

This loop builds text from metadata fields (name, path, html_url, repo name) rather than matched file content, so for typical code-search hits where the hostname appears only inside the file body, HOSTNAME_RE finds nothing and the GitHub source silently returns near-empty results. To make this feature work as intended, parse matched fragments (for example via text_matches) or fetch file contents before running hostname extraction.

Useful? React with 👍 / 👎.

Comment thread subdomain_searcher.py
)
for host in HOSTNAME_RE.findall(text):
candidate = host.lower().strip(".")
if candidate.endswith(domain):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Enforce label boundary when filtering by domain suffix

Using candidate.endswith(domain) accepts unrelated hostnames that merely share trailing characters (for example, badexample.com when scanning example.com), which can pollute results with false positives whenever such strings are present in search output. The filter should require an actual DNS boundary, e.g. exact match or '.' + domain suffix.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant