Skip to content

Commit bcf67d0

Browse files
Merge pull request #11 from CarterPerez-dev/project/dns-lookup
feat: add dns-lookup CLI tool
2 parents 9be527c + 590ef42 commit bcf67d0

File tree

14 files changed

+2565
-0
lines changed

14 files changed

+2565
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# =============================================================================
2+
# AngelaMos | 2025
3+
# publish-dns-lookup.yml
4+
# =============================================================================
5+
6+
name: Publish dns-lookup to PyPI
7+
8+
on:
9+
push:
10+
branches:
11+
- main
12+
paths:
13+
- 'PROJECTS/dns-lookup/**'
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
pypi-publish:
20+
name: Upload dns-lookup to PyPI
21+
runs-on: ubuntu-latest
22+
environment:
23+
name: pypi
24+
url: https://pypi.org/p/dnslookup-cli
25+
permissions:
26+
id-token: write
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v4
30+
31+
- name: Set up Python
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: "3.13"
35+
36+
- name: Install build dependencies
37+
run: |
38+
python -m pip install --upgrade pip
39+
pip install build
40+
41+
- name: Build package
42+
working-directory: PROJECTS/dns-lookup
43+
run: python -m build
44+
45+
- name: Publish to PyPI
46+
uses: pypa/gh-action-pypi-publish@release/v1
47+
with:
48+
packages-dir: PROJECTS/dns-lookup/dist/

PROJECTS/dns-lookup/.style.yapf

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# ⒸAngelaMos | 2025 | CarterPerez-dev
2+
[style]
3+
based_on_style = pep8
4+
column_limit = 70
5+
indent_width = 4
6+
continuation_indent_width = 4
7+
indent_closing_brackets = false
8+
dedent_closing_brackets = true
9+
indent_blank_lines = false
10+
spaces_before_comment = 2
11+
spaces_around_power_operator = false
12+
spaces_around_default_or_named_assign = true
13+
space_between_ending_comma_and_closing_bracket = false
14+
space_inside_brackets = false
15+
spaces_around_subscript_colon = true
16+
blank_line_before_nested_class_or_def = false
17+
blank_line_before_class_docstring = false
18+
blank_lines_around_top_level_definition = 2
19+
blank_lines_between_top_level_imports_and_variables = 2
20+
blank_line_before_module_docstring = false
21+
split_before_logical_operator = true
22+
split_before_first_argument = true
23+
split_before_named_assigns = true
24+
split_complex_comprehension = true
25+
split_before_expression_after_opening_paren = false
26+
split_before_closing_bracket = true
27+
split_all_comma_separated_values = true
28+
split_all_top_level_comma_separated_values = false
29+
coalesce_brackets = false
30+
each_dict_entry_on_separate_line = true
31+
allow_multiline_lambdas = false
32+
allow_multiline_dictionary_keys = false
33+
split_penalty_import_names = 0
34+
join_multiple_lines = false
35+
align_closing_bracket_with_visual_indent = true
36+
arithmetic_precedence_indication = false
37+
split_penalty_for_added_line_split = 275
38+
use_tabs = false
39+
split_before_dot = false
40+
split_arguments_when_comma_terminated = true
41+
i18n_function_call = ['_', 'N_', 'gettext', 'ngettext']
42+
i18n_comment = ['# Translators:', '# i18n:']
43+
split_penalty_comprehension = 80
44+
split_penalty_after_opening_bracket = 280
45+
split_penalty_before_if_expr = 0
46+
split_penalty_bitwise_operator = 290
47+
split_penalty_logical_operator = 0

PROJECTS/dns-lookup/README.md

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
# DNS Lookup Tool
2+
3+
Professional DNS lookup CLI with beautiful Rich terminal output. Query DNS records, perform reverse lookups, trace resolution paths, and retrieve WHOIS information.
4+
5+
## Features
6+
7+
- **Multi-Record Queries**: Query A, AAAA, MX, NS, TXT, CNAME, SOA records
8+
- **Reverse DNS**: IP to hostname resolution
9+
- **DNS Trace**: Visualize the resolution path from root to authoritative servers
10+
- **Batch Lookups**: Query multiple domains concurrently
11+
- **WHOIS Integration**: Domain registration information
12+
- **JSON Export**: Machine-readable output for scripting
13+
- **Beautiful Output**: Color-coded tables, spinners, and tree visualizations
14+
15+
## Installation
16+
17+
```bash
18+
# Clone the repository
19+
git clone https://github.com/CarterPerez-dev/Cybersecurity-Projects.git
20+
cd PROJECTS/dns-lookup
21+
22+
# Install with uv
23+
uv sync
24+
25+
# Or install with pip
26+
27+
python -m venv .venv
28+
29+
source .venv/bin/activate
30+
31+
pip install -e .
32+
```
33+
34+
## Usage
35+
36+
### Basic DNS Query
37+
38+
```bash
39+
# Query all record types
40+
dnslookup query example.com
41+
42+
# Query specific record types
43+
dnslookup query example.com --type A,MX,TXT
44+
45+
# Use custom DNS server
46+
dnslookup query example.com --server 8.8.8.8
47+
48+
# Output as JSON
49+
dnslookup query example.com --json
50+
```
51+
52+
### Reverse DNS Lookup
53+
54+
```bash
55+
# IPv4
56+
dnslookup reverse 8.8.8.8
57+
58+
# IPv6
59+
dnslookup reverse 2606:4700:4700::1111
60+
```
61+
62+
### DNS Trace
63+
64+
Trace the resolution path from root servers to authoritative nameservers:
65+
66+
```bash
67+
dnslookup trace example.com
68+
dnslookup trace example.com --type MX
69+
```
70+
71+
### Batch Lookups
72+
73+
Query multiple domains from a file:
74+
75+
```bash
76+
# Create a file with domains (one per line)
77+
echo -e "google.com\ngithub.com\ncloudflare.com" > domains.txt
78+
79+
# Run batch lookup
80+
dnslookup batch domains.txt
81+
82+
# Save results to JSON
83+
dnslookup batch domains.txt --output results.json
84+
```
85+
86+
### WHOIS Lookup
87+
88+
```bash
89+
dnslookup whois example.com
90+
dnslookup whois google.com --json
91+
```
92+
93+
## Example Output
94+
95+
### DNS Query
96+
```
97+
🌐 DNS Lookup: example.com
98+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
99+
100+
┌──────────────────────────────────────────┐
101+
│ DNS Records │
102+
├──────┬───────────────────────┬───────────┤
103+
│ Type │ Value │ TTL │
104+
├──────┼───────────────────────┼───────────┤
105+
│ A │ 93.184.216.34 │ 1h │
106+
│ AAAA │ 2606:2800:220:1:... │ 1h │
107+
│ MX │ mail.example.com (10) │ 1d │
108+
│ NS │ ns1.example.com │ 2d │
109+
└──────┴───────────────────────┴───────────┘
110+
111+
✓ Found 8 records in 45ms
112+
```
113+
114+
### DNS Trace
115+
```
116+
🔍 DNS Trace: example.com
117+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
118+
119+
🌍 DNS Resolution Path
120+
├── [.] Root
121+
│ └── → a.root-servers.net (198.41.0.4)
122+
│ └── Referred to com. servers
123+
├── [com.] TLD
124+
│ └── → a.gtld-servers.net (192.5.6.30)
125+
│ └── Referred to example.com NS
126+
└── [example.com.] Authoritative
127+
└── → ns1.example.com (93.184.216.34)
128+
└── A: 93.184.216.34
129+
130+
✓ Resolution complete: 93.184.216.34
131+
```
132+
133+
## Development
134+
135+
```bash
136+
# Install dev dependencies
137+
just install-dev
138+
139+
# Run the tool
140+
just run query example.com
141+
142+
# Run tests
143+
just test
144+
145+
# Lint code
146+
just lint
147+
148+
# Format code
149+
just ruff-fix
150+
151+
# Run all checks
152+
just ci
153+
```
154+
155+
## Available Commands
156+
157+
| Command | Description |
158+
|---------|-------------|
159+
| `just run *ARGS` | Run the CLI tool |
160+
| `just test` | Run test suite |
161+
| `just lint` | Run ruff linter |
162+
| `just ruff-fix` | Auto-fix and format |
163+
| `just mypy` | Type checking |
164+
| `just ci` | Run all checks |
165+
| `just clean` | Remove cache files |
166+
167+
168+
## License
169+
170+
MIT License - See LICENSE for details.
171+
172+
## Author
173+
174+
CarterPerez-dev
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"""
2+
CarterPerez-dev | 2025
3+
__init__.py
4+
"""
5+
6+
__version__ = "0.1.0"
7+
__author__ = "CarterPerez-dev"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""
2+
CarterPerez-dev | 2025
3+
__main__.py
4+
5+
Entry point for python -m dnslookup
6+
"""
7+
8+
from dnslookup.cli import app
9+
10+
if __name__ == "__main__":
11+
app()

0 commit comments

Comments
 (0)