Skip to content

Commit 53df438

Browse files
committed
Enhance documentation and configuration for subenum project
- Updated _config.yml to improve project description and added repository URL. - Added front matter to ARCHITECTURE.md, CONTRIBUTING.md, and DEVELOPER_GUIDE.md for better Jekyll site integration. - Revised index.md to link to Docker usage documentation correctly. - Expanded the project structure in the Developer Guide to include new files and directories for better clarity.
1 parent 99658d0 commit 53df438

File tree

5 files changed

+60
-17
lines changed

5 files changed

+60
-17
lines changed

docs/ARCHITECTURE.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
layout: default
3+
title: Architecture
4+
---
5+
16
# Architecture
27

38
This document describes the architecture of the `subenum` tool, a Go-based command-line utility for subdomain enumeration.
@@ -47,14 +52,14 @@ This architecture is designed to be efficient by performing multiple DNS lookups
4752

4853
* **Purpose**: This is the core component responsible for performing the actual DNS lookup for each constructed subdomain (e.g., `prefix.targetdomain.com`). It determines if a subdomain has a valid DNS record (typically A or CNAME, though the current implementation checks for any successful resolution).
4954
* **Implementation**:
50-
* Function: `resolveDomain(domain string, timeout time.Duration, dnsServer string, verbose bool) bool`
51-
* Function: `resolveDomainWithRetry(domain string, timeout time.Duration, dnsServer string, verbose bool, maxRetries int) bool` — wraps `resolveDomain` with configurable retry logic and exponential backoff between attempts.
55+
* Function: `resolveDomain(ctx context.Context, domain string, timeout time.Duration, dnsServer string, verbose bool) bool`
56+
* Function: `resolveDomainWithRetry(ctx context.Context, domain string, timeout time.Duration, dnsServer string, verbose bool, maxRetries int) bool` — wraps `resolveDomain` with configurable retry logic and exponential backoff between attempts.
5257
* `net.Resolver{}`: A custom DNS resolver is configured.
5358
* `PreferGo: true`: Instructs the resolver to use the pure Go DNS client.
5459
* `Dial func(ctx context.Context, network, address string) (net.Conn, error)`: A custom dial function is provided to control the connection to the DNS server, using the user-specified `dnsServer` address.
5560
* `net.Dialer{Timeout: timeout}`: A `Dialer` is created with the user-specified timeout.
5661
* `d.DialContext(ctx, "udp", dnsServer)`: Establishes a UDP connection to the configured DNS server.
57-
* `resolver.LookupHost(context.Background(), domain)`: Performs the DNS lookup for the given domain. It attempts to find A or AAAA records for the host.
62+
* `resolver.LookupHost(timeoutCtx, domain)`: Performs the DNS lookup for the given domain. The context is derived from the caller via `context.WithTimeout(ctx, timeout)`, so both the per-query timeout and SIGINT cancellation are respected. It attempts to find A or AAAA records for the host.
5863
* The function returns `true` if `LookupHost` returns no error (i.e., the domain resolved), and `false` otherwise.
5964
* **Interactions**: Workers call `resolveDomainWithRetry`, which delegates to `resolveDomain` with retry logic. It takes a fully qualified domain name, timeout duration, DNS server address, verbose flag, and retry count as input. It outputs a boolean indicating whether the domain resolved successfully. The result is used to decide if the domain should be printed to the console and/or written to the output file.
6065

docs/CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
layout: default
3+
title: Contributing
4+
---
5+
16
# Contributing to subenum
27

38
We welcome contributions! Please read this guide to understand how you can contribute.

docs/DEVELOPER_GUIDE.md

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
layout: default
3+
title: Developer Guide
4+
---
5+
16
# Developer Guide
27

38
This guide provides information for developers looking to contribute to or build upon the `subenum` project.
@@ -50,28 +55,56 @@ To work with `subenum`, you'll need:
5055
```
5156
subenum/
5257
├── main.go # Main application code
58+
├── main_test.go # Test suite
5359
├── go.mod # Go module definition
60+
├── Makefile # Build, test, lint, Docker targets
61+
├── Dockerfile # Multi-stage Docker build
62+
├── docker-compose.yml # Docker Compose config
63+
├── .golangci.yml # Linter configuration
5464
├── README.md # Project overview
5565
├── LICENSE # License information
56-
├── docs/ # Documentation
66+
├── SECURITY.md # Security policy and disclosure
67+
├── .github/
68+
│ ├── workflows/
69+
│ │ ├── go.yml # CI: build, test, lint, release
70+
│ │ ├── pages.yml # GitHub Pages deployment
71+
│ │ └── codeql.yml # CodeQL security scanning
72+
│ ├── dependabot.yml # Automated dependency updates
73+
│ ├── PULL_REQUEST_TEMPLATE.md
74+
│ └── ISSUE_TEMPLATE/ # Bug report & feature request templates
75+
├── docs/ # Documentation (served via GitHub Pages)
76+
│ ├── _config.yml # Jekyll site configuration
77+
│ ├── index.md # Site home page
5778
│ ├── ARCHITECTURE.md # Architectural details
5879
│ ├── DEVELOPER_GUIDE.md # This file
5980
│ ├── CODE_OF_CONDUCT.md # Community guidelines
60-
│ └── CONTRIBUTING.md # Contribution guidelines
81+
│ ├── CONTRIBUTING.md # Contribution guidelines
82+
│ └── docker.md # Docker usage guide
83+
├── data/
84+
│ └── wordlist.txt # Default wordlist
6185
├── examples/ # Example files and usage demos
62-
│ └── sample_wordlist.txt # Sample subdomain prefixes
63-
└── logs/ # Logs and change tracking
86+
│ ├── sample_wordlist.txt # Sample subdomain prefixes
87+
│ ├── sample_domains.txt # Sample domain list
88+
│ └── advanced_usage.md # Advanced usage examples
89+
├── tools/
90+
│ ├── wordlist-gen.go # Wordlist generator utility
91+
│ └── README.md # Wordlist generator docs
92+
└── logs/
6493
└── CHANGELOG.md # Project change history
6594
```
6695
6796
## Running Tests
6897
69-
*Note: Test development is ongoing. This section will be expanded as the test suite grows.*
70-
7198
To run all tests:
7299
73100
```bash
74-
go test ./...
101+
go test -v -race ./...
102+
```
103+
104+
To run only fast, offline tests (skips network-dependent tests):
105+
106+
```bash
107+
go test -v -short ./...
75108
```
76109

77110
### Writing Tests
@@ -82,6 +115,7 @@ When adding new features or modifying existing ones, please ensure you add appro
82115
package main
83116

84117
import (
118+
"context"
85119
"testing"
86120
"time"
87121
)
@@ -109,7 +143,7 @@ func TestResolveDomain(t *testing.T) {
109143

110144
for _, tc := range testCases {
111145
t.Run(tc.name, func(t *testing.T) {
112-
result := resolveDomain(tc.domain, tc.timeout, DefaultDNSServer, false)
146+
result := resolveDomain(context.Background(), tc.domain, tc.timeout, DefaultDNSServer, false)
113147
if result != tc.expected {
114148
t.Errorf("Expected %v for domain %s, got %v", tc.expected, tc.domain, result)
115149
}

docs/_config.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
theme: jekyll-theme-cayman
22
title: subenum
3-
description: A Go-based CLI tool for subdomain enumeration
3+
description: A fast, concurrent Go CLI tool for subdomain enumeration — for educational and legitimate security testing
44
show_downloads: true
5-
google_analytics:
6-
github:
7-
is_project_page: true
8-
repository_url: https://github.com/TMHSDigital/subenum
5+
url: "https://tmhsdigital.github.io"
6+
baseurl: "/subenum"
7+
repository: TMHSDigital/subenum

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ make docker-build docker-run
8181

8282
- [Usage Guide](https://github.com/TMHSDigital/subenum#usage)
8383
- [Advanced Usage Examples](https://github.com/TMHSDigital/subenum/blob/main/examples/advanced_usage.md)
84-
- [Docker Usage](#using-docker)
84+
- [Docker Usage](docker.html)
8585
- [Architecture](ARCHITECTURE.html)
8686
- [Developer Guide](DEVELOPER_GUIDE.html)
8787
- [Contributing](CONTRIBUTING.html)

0 commit comments

Comments
 (0)