Kali Linux

Knock for Subdomain Enumeration and DNS Recon

Knock for Subdomain Enumeration and DNS Reconnaissance

Knock is a Python-based subdomain enumeration tool that helps security professionals discover subdomains associated with a target domain. It uses wordlists to identify potential subdomains and supports DNS-related checks that can help map a domain’s exposed infrastructure.

The tool was designed to detect potential DNS zone transfer issues and handle wildcard DNS records during enumeration. The original version also supported retrieving subdomain information from VirusTotal through an API key configured in its settings file. Because Knock has multiple versions and its original installation instructions may be outdated, check the repository documentation before installing it on a modern system.

Key Features of Knock

  • Subdomain enumeration: Tests candidate subdomains using a supplied or default wordlist.
  • Wildcard DNS handling: Helps reduce misleading results caused by wildcard DNS records.
  • DNS checks: Includes options for resolving domain names and IP addresses. DNS zone transfer checks depend on the version and its supported features.
  • VirusTotal integration: Historical versions support querying VirusTotal for additional subdomain information when an API key is configured.
  • Report export: Supported versions can save scan results in JSON or CSV format for later review.
  • Custom wordlists: Lets testers supply a wordlist suited to the target environment.

How to Install Knock

Knock’s original repository provides a Python-based installation workflow. First, install Git and Python tools if they are not already available. Then clone the project and review its current requirements.

git clone https://github.com/guelfoweb/knock.git
cd knock

Older releases used a setup script and the dnspython package. The original instructions included commands such as the following, but these may not work with current Python versions or newer packaging standards.

sudo apt-get install python-dnspython
sudo python setup.py install

Prefer a virtual environment and the installation method documented by the repository version you choose. Avoid running legacy installation commands with elevated privileges unless you understand what they change.

Project repository: Knock on GitHub.

Basic Knock Usage

After installation, check the available options for your installed version:

knockpy --help

The original Knock documentation shows a basic scan using a domain name:

knockpy example.com

Replace example.com with a domain you own or are explicitly authorized to assess. If your version supports a custom wordlist, specify its path with the documented wordlist option.

knockpy example.com -w wordlist.txt

Older releases also documented JSON and CSV output options. For example:

knockpy example.com --json
knockpy -c example.com

Option names and behavior can vary between releases. Run the help command first and confirm that your installed version supports each flag before using it in a workflow.

Configure VirusTotal Support

Some historical versions of Knock allow VirusTotal lookups through an API key stored in knockpy/config.json. If this feature is available in your release, obtain an API key from VirusTotal and follow the repository’s configuration instructions.

Keep API keys private, avoid committing configuration files containing credentials to public repositories, and review the service’s usage limits and terms before running queries.

Use Knock in an Authorized Reconnaissance Workflow

Subdomain enumeration can help security teams identify forgotten test environments, exposed development systems, and assets missing from an organization’s inventory. Validate discovered names before treating them as active assets, since DNS records can be stale or point to third-party infrastructure.

For broader reconnaissance, see our guide to website OSINT tools and techniques for reconnaissance. Use Knock only against domains you own or have permission to test, and avoid intrusive follow-up activity without explicit authorization.

Cyber Defence

Recent Posts

What Is a Data Protection Platform and Why Your Organization Needs One

A data protection platform is a unified system that helps organizations discover, classify, monitor, and…

2 weeks ago

How Swiss Privacy Rules Affect AI Companies Under GDPR

AI companies operating in or around Switzerland face a compliance challenge that most legal teams…

2 weeks ago

Swiss FADP vs EU GDPR: Key Differences for AI and Data Privacy

Two major data privacy laws now govern how organizations handle personal data across Europe; the…

2 weeks ago

Kali Linux Commands Cheat Sheet: Complete Quick Reference

This cheat sheet covers the essential Kali Linux commands every pentester and ethical hacker uses…

1 month ago

What I Wish I Knew Before Learning Malware Analysis and Reverse Engineering

When I first started learning malware analysis and reverse engineering, I thought the hardest part…

2 months ago

git fetch vs git pull: How They Work and When to Use Each

Both git fetch and git pull talk to a remote repository, but they do very different things to your…

2 months ago