Skip to content

Commit 807c419

Browse files
committed
Add CHANGELOG.md and enhance error handling in DNS resolution
- Created CHANGELOG.md to document project changes and adhere to semantic versioning. - Updated `resolveAttempts` function to return an error for invalid flag combinations, improving error handling. - Adjusted main.go to handle errors from `resolveAttempts`, ensuring graceful exits on invalid input. - Revised README.md to link to the new CHANGELOG.md for better visibility of project updates.
1 parent 8cf97a7 commit 807c419

File tree

10 files changed

+84
-35
lines changed

10 files changed

+84
-35
lines changed

.github/CODE_OF_CONDUCT.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone.
5+
6+
## Our Standards
7+
Examples of behavior that contributes to a positive environment:
8+
- Using welcoming and inclusive language
9+
- Being respectful of differing viewpoints and experiences
10+
- Gracefully accepting constructive criticism
11+
- Focusing on what is best for the community
12+
13+
Examples of unacceptable behavior:
14+
- Harassment, trolling, or insulting comments
15+
- Public or private harassment
16+
- Publishing others' private information without permission
17+
- Other conduct which could reasonably be considered inappropriate
18+
19+
## Enforcement
20+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening a [Security Advisory](https://github.com/TMHSDigital/subenum/security/advisories/new) or contacting the maintainers privately.
21+
22+
## Attribution
23+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.

.github/CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Contributing
2+
3+
See the full contributing guide at [docs/CONTRIBUTING.md](../docs/CONTRIBUTING.md).

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Set up Go
2626
uses: actions/setup-go@v6
2727
with:
28-
go-version: '1.22'
28+
go-version-file: 'go.mod'
2929

3030
- name: Initialize CodeQL
3131
uses: github/codeql-action/init@v4

.github/workflows/go.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Set up Go
1919
uses: actions/setup-go@v6
2020
with:
21-
go-version: '1.22'
21+
go-version-file: 'go.mod'
2222

2323
- name: Cache Go build artifacts
2424
uses: actions/cache@v5
@@ -73,6 +73,11 @@ jobs:
7373
goarch: amd64
7474
artifact_name: subenum
7575
asset_name: subenum-macos-amd64
76+
- os: ubuntu-latest
77+
goos: linux
78+
goarch: arm64
79+
artifact_name: subenum
80+
asset_name: subenum-linux-arm64
7681

7782
runs-on: ${{ matrix.os }}
7883

@@ -82,7 +87,7 @@ jobs:
8287
- name: Set up Go
8388
uses: actions/setup-go@v6
8489
with:
85-
go-version: '1.22'
90+
go-version-file: 'go.mod'
8691

8792
- name: Cache Go build artifacts
8893
uses: actions/cache@v5
@@ -113,3 +118,14 @@ jobs:
113118
files: ${{ matrix.asset_name }}
114119
env:
115120
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121+
122+
- name: Generate checksum
123+
shell: bash
124+
run: sha256sum ${{ matrix.asset_name }} > ${{ matrix.asset_name }}.sha256
125+
126+
- name: Upload checksum to release
127+
uses: softprops/action-gh-release@v2
128+
with:
129+
files: ${{ matrix.asset_name }}.sha256
130+
env:
131+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

logs/CHANGELOG.md renamed to CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7272
- Initial project setup with basic functionality
7373
- Concurrent subdomain enumeration using goroutines
7474
- DNS resolution with configurable timeout
75-
- Command-line flags for wordlist, concurrency, and timeout
75+
- Command-line flags for wordlist, concurrency, and timeout

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88

99
[![Build](https://img.shields.io/github/actions/workflow/status/TMHSDigital/subenum/go.yml?branch=main&style=for-the-badge&label=build)](https://github.com/TMHSDigital/subenum/actions)
1010
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg?style=for-the-badge)](LICENSE)
11+
<!-- Update Go version badge when go.mod changes -->
1112
[![Go](https://img.shields.io/badge/Go-1.22+-00ADD8?style=for-the-badge&logo=go&logoColor=white)](https://go.dev)
1213
[![CodeQL](https://img.shields.io/github/actions/workflow/status/TMHSDigital/subenum/codeql.yml?label=CodeQL&style=for-the-badge)](https://github.com/TMHSDigital/subenum/actions/workflows/codeql.yml)
1314
[![Release](https://img.shields.io/github/v/release/TMHSDigital/subenum?style=for-the-badge)](https://github.com/TMHSDigital/subenum/releases)
15+
[![Go Report Card](https://goreportcard.com/badge/github.com/TMHSDigital/subenum?style=for-the-badge)](https://goreportcard.com/report/github.com/TMHSDigital/subenum)
1416

1517
`Concurrent Workers` &middot; `Context-Aware Cancellation` &middot; `Retry with Backoff` &middot; `Wildcard Detection` &middot; `Simulation Mode` &middot; `Zero Dependencies`
1618

17-
[Quick Start](#-installation) | [Documentation](./docs) | [Architecture](#-system-architecture) | [Changelog](./logs/CHANGELOG.md)
19+
[Quick Start](#installation) | [Documentation](./docs) | [Architecture](#system-architecture) | [Changelog](./CHANGELOG.md)
1820

1921
</div>
2022

@@ -242,8 +244,6 @@ subenum/
242244
│ └── wordlist/
243245
│ ├── reader.go # LoadWordlist (dedup + sanitize)
244246
│ └── reader_test.go # Wordlist loading and dedup tests
245-
├── logs/
246-
│ └── CHANGELOG.md # Versioned release history
247247
├── tools/
248248
│ └── wordlist-gen.go # Custom wordlist generator utility
249249
├── main.go # CLI entry point: flag parsing, wiring
@@ -253,6 +253,7 @@ subenum/
253253
├── docker-compose.yml # Compose orchestration
254254
├── Makefile # Build, test, lint, simulate, Docker targets
255255
├── .golangci.yml # Linter configuration (golangci-lint v2)
256+
├── CHANGELOG.md # Versioned release history
256257
├── SECURITY.md # Vulnerability disclosure policy
257258
└── LICENSE # GNU General Public License v3.0
258259
```

SECURITY.md

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,14 @@
22

33
## Reporting a Vulnerability
44

5-
If you discover a security vulnerability in `subenum`, please follow these steps to report it responsibly:
5+
If you discover a security vulnerability in `subenum`, **do not open a public issue.**
66

7-
1. **Do NOT** disclose the vulnerability publicly until it has been addressed.
8-
2. Send details of the vulnerability to the repository maintainers via GitHub Issues or create a private report through GitHub's Security tab.
9-
3. Include the following information:
10-
- A description of the vulnerability
11-
- Steps to reproduce the issue
12-
- Potential impact
13-
- Any suggested fixes (if available)
7+
Report it privately using GitHub's Security Advisory feature:
8+
1. Go to the [Security tab](https://github.com/TMHSDigital/subenum/security/advisories/new) of this repository.
9+
2. Click **"Report a vulnerability"**.
10+
3. Fill in the description, reproduction steps, and impact.
1411

15-
## What to Expect
16-
17-
- You'll receive acknowledgment of your report within 48 hours.
18-
- We'll investigate and provide an estimated timeline for a fix.
19-
- You'll be kept informed about the progress.
20-
- After the issue is resolved, you'll be credited for the discovery (unless you prefer anonymity).
12+
You will receive acknowledgment within 48 hours. We will investigate, provide a fix timeline, keep you informed throughout, and credit you upon resolution (unless you prefer anonymity).
2113

2214
## Scope
2315

@@ -33,4 +25,4 @@ Using this tool against systems without explicit permission is potentially illeg
3325

3426
## Thank You
3527

36-
Security researchers and responsible disclosure are vital to maintaining secure software. We appreciate your efforts to disclose vulnerabilities responsibly.
28+
Security researchers and responsible disclosure are vital to maintaining secure software. We appreciate your efforts to disclose vulnerabilities responsibly.

internal/output/writer.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ func (w *Writer) Progress(pct float64, processed, total, found int64) {
4545

4646
// ProgressDone writes the final newline on stderr after progress reporting ends.
4747
func (w *Writer) ProgressDone() {
48+
w.mu.Lock()
49+
defer w.mu.Unlock()
4850
fmt.Fprintln(os.Stderr)
4951
}
5052

main.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,15 @@ func main() {
9191
force := flag.Bool("force", false, "Continue scanning even if wildcard DNS is detected")
9292
flag.Parse()
9393

94-
// Resolve -attempts / -retries precedence.
95-
maxAttempts := resolveAttempts(*attempts, *retries)
94+
maxAttempts, err := resolveAttempts(*attempts, *retries)
9695

9796
out := output.New(nil, *testMode)
9897

98+
if err != nil {
99+
out.Error("%v", err)
100+
os.Exit(1)
101+
}
102+
99103
if *testMode {
100104
out.Info("")
101105
out.Info("╔════════════════════════════════════════════════════════════════════╗")
@@ -325,21 +329,19 @@ done:
325329
}
326330

327331
// resolveAttempts merges the -attempts and deprecated -retries flags.
328-
func resolveAttempts(attempts, retries int) int {
332+
func resolveAttempts(attempts, retries int) (int, error) {
329333
attemptsSet := attempts != 0
330334
retriesSet := retries != 0
331335

332336
switch {
333337
case attemptsSet && retriesSet:
334-
fmt.Fprintln(os.Stderr, "Error: cannot use both -attempts and -retries; use -attempts only")
335-
os.Exit(1)
336-
return 0
338+
return 0, fmt.Errorf("cannot use both -attempts and -retries; use -attempts only")
337339
case retriesSet:
338340
fmt.Fprintln(os.Stderr, "Warning: -retries is deprecated, use -attempts instead")
339-
return retries
341+
return retries, nil
340342
case attemptsSet:
341-
return attempts
343+
return attempts, nil
342344
default:
343-
return 1
345+
return 1, nil
344346
}
345347
}

main_test.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,20 @@ func TestValidateDomain(t *testing.T) {
8787
}
8888

8989
func TestResolveAttempts(t *testing.T) {
90-
if got := resolveAttempts(0, 0); got != 1 {
91-
t.Errorf("default: got %d, want 1", got)
90+
got, err := resolveAttempts(0, 0)
91+
if err != nil || got != 1 {
92+
t.Errorf("default: got %d, err %v; want 1, nil", got, err)
9293
}
93-
if got := resolveAttempts(5, 0); got != 5 {
94-
t.Errorf("-attempts=5: got %d, want 5", got)
94+
got, err = resolveAttempts(5, 0)
95+
if err != nil || got != 5 {
96+
t.Errorf("-attempts=5: got %d, err %v; want 5, nil", got, err)
97+
}
98+
got, err = resolveAttempts(0, 3)
99+
if err != nil || got != 3 {
100+
t.Errorf("-retries=3: got %d, err %v; want 3, nil", got, err)
101+
}
102+
_, err = resolveAttempts(5, 3)
103+
if err == nil {
104+
t.Error("both set: expected error, got nil")
95105
}
96106
}

0 commit comments

Comments
 (0)