Lunker is a multi-region AWS CDK application for registering second-level domains for threat intelligence monitoring. Users authenticate with Amazon Cognito, manage a personal watchlist, and review related results sourced from the webmonitor service.
- Amazon Cognito authentication for the hosted sign-in flow
- Domain management — add or remove second-level domains such as
example.com - TLD validation using the official IANA TLD list, stored in the centralized
tldtable - Threat intelligence enrichment triggered automatically when a domain is registered
- Saved-domain insights — clicking a saved domain loads related suspect, new-registration, and expired-registration sections
- Matched-domain highlighting — exact SLD containment matches are emphasized in red and permutation-based matches in orange; red takes precedence when both conditions apply
- Fast possibility counting — domain details show a lightweight Possibilities count via DynamoDB
Select=COUNT, while the full possibilities view remains de-duplicated and domain-focused - In-session data refresh — a refresh control updates home, domain-detail, permutation, and possibilities views without requiring a full browser reload (including after add/remove workflows)
- Multi-region deployment across
us-east-1,us-east-2, andus-west-2 - GitHub Actions CI/CD via OIDC with no long-lived AWS credentials
The application is deployed as five CDK stacks:
| Stack | Region | Purpose |
|---|---|---|
LunkerDatabase |
us-east-2 |
Creates the global lunker, permutation, and tld DynamoDB tables (with replicas), org-wide resource policies, stream processing, and the action and tld Lambdas |
LunkerPermutation |
us-east-2 |
Creates the permutation Lambda, scheduled daily at 11:00 UTC |
LunkerStackUse1 |
us-east-1 |
Creates the regional home Lambda and related IAM/logging resources for us-east-1 |
LunkerStackUse2 |
us-east-2 |
Creates the GitHub OIDC provider and IAM role used for CI/CD |
LunkerStackUsw2 |
us-west-2 |
Creates the regional home Lambda and related IAM/logging resources for us-west-2 |
action— triggered by DynamoDB Streams on new domain inserts; asynchronously invokes both thesearchlistLambda in the webmonitor account and the localpermutationLambdahome— renders the HTML UI and handles domain listing, add/remove actions, domain section lookups, and matched-domain highlightingpermutation— runs daily at 11:00 UTC; reads domains from thelunkertable, generates permutations, and writes results to thepermutationtable with a TTLtld— deployed inLunkerDatabase(us-east-2), runs daily at 10:00 UTC, and writes to the centralizedtldtable
lunker— global DynamoDB table with its primary region inus-east-2and replicas inus-east-1andus-west-2; stores user-to-domain mappings; enables PITR and deletion protection; includes apk-tk-indexGSI used by the permutation Lambda and anemail-domain-indexGSI used by the home workflow; org-wide read access (DescribeTable,GetItem,Query) is granted via a resource policytld— global DynamoDB table with its primary region inus-east-2and replicas inus-east-1andus-west-2; used by home and tld workflows for top-level-domain validation data; enables PITR and deletion protection; org-wide read access (DescribeTable,GetItem,Query) is granted via a resource policypermutation— global DynamoDB table with its primary region inus-east-2and replicas inus-east-1andus-west-2; key patternpk = LUNKER#andsk = LUNKER#<SLD>#; storessld,perm,count, and TTL viattl; enables PITR and deletion protection; org-wide read access is granted via a resource policylunkerkey schema:pk = LUNKER#,sk = LUNKER#<EMAIL>#<DOMAIN>#,tk (GSI sort key) = LUNKER#<SLD>#<EMAIL>#<DOMAIN>#
-
AWS CDK v2
-
Python 3.13
-
An AWS environment bootstrapped with the CDK qualifier
lukach:cdk bootstrap --qualifier lukach
-
The following SSM parameters available to the stacks:
/organization/id— AWS Organizations ID/account/api— API Gateway account identifier used for invocation permissions/account/cognito— Cognito account identifier used for secret access/account/webmonitor— AWS account ID that owns the webmonitor service
-
S3 buckets containing the
requests.zipLambda layer:packages-use1-lukach-ioinus-east-1packages-use2-lukach-ioinus-east-2packages-usw2-lukach-ioinus-west-2
# Optional: create and activate a virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install Python dependencies
pip install -r requirements.txt
# Synthesize templates
cdk synth
# Review infrastructure changes
cdk diff --profile lunker
# Deploy all stacks
cdk deploy --profile lunker --all --require-approval never
# Deploy a single stack
cdk deploy --profile lunker LunkerDatabase --require-approval neverCDK_DEFAULT_ACCOUNT must be set, or resolvable from the active AWS CLI profile, before deployment.
Use these commands to validate that the core scheduled and event-driven workflows are healthy.
# Confirm all stacks are up to date
cdk diff --profile lunker
# Trigger a one-off TLD sync
aws lambda invoke \
--profile lunker \
--region us-east-2 \
--function-name tld \
--payload '{}' \
/tmp/lunker-tld.json && cat /tmp/lunker-tld.json
# Trigger a one-off full permutation refresh
aws lambda invoke \
--profile lunker \
--region us-east-2 \
--function-name permutation \
--payload '{}' \
/tmp/lunker-permutation-full.json && cat /tmp/lunker-permutation-full.json
# Trigger a targeted permutation run for one SLD
aws lambda invoke \
--profile lunker \
--region us-east-2 \
--function-name permutation \
--payload '{"sld":"example"}' \
/tmp/lunker-permutation-single.json && cat /tmp/lunker-permutation-single.json
# Tail action/permutation logs while testing inserts
aws logs tail /aws/lambda/action --profile lunker --region us-east-2 --follow
aws logs tail /aws/lambda/permutation --profile lunker --region us-east-2 --followTest coverage currently focuses on shared home-handler behavior and in-session refresh integration paths.
pytest -qIf you are using a virtual environment, run tests with the environment interpreter:
.venv/bin/python -m pytest -qThe stacks set most Lambda environment variables automatically at deploy time. The values below are useful when troubleshooting behavior.
| Function | Key environment variables |
|---|---|
action |
FUNCTION_NAME, PERMUTATION_FUNCTION_NAME |
home |
LUNKER_TABLE, PERMUTATION_TABLE, POSSIBILITIES_TABLE, TLD_TABLE, CLIENTID_SECRET_ARN, WM_OSINT, WM_MALWARE, WM_DAILYUPDATE, WM_WEEKLYUPDATE, WM_MONTHLYUPDATE (or fallback WM_MONTHLY), WM_DAILYREMOVE, WM_WEEKLYREMOVE, WM_MONTHLYREMOVE |
permutation |
LUNKER_TABLE, PERMUTATION_TABLE, LUNKER_INDEX (defaults to pk-tk-index), PERMUTATION_TTL_DAYS (defaults to 30) |
tld |
TLD_TABLE |
For each unique second-level domain (SLD) found in the lunker table, the permutation Lambda generates candidate look-alike domains.
- For SLDs shorter than 5 characters, it applies a conservative subset: Homoglyph and Transposition.
- For SLDs with length exactly 5, it applies a medium subset: Homoglyph, Transposition, and Replacement.
- For SLDs longer than 5, it applies the full strategy set below.
| Strategy | Description |
|---|---|
| Homoglyph | Replaces visually similar characters — e.g. o↔0, i↔1↔l, s↔5, a↔4, e↔3, g↔9 |
| Omission | Removes one character at a time from the SLD |
| Repetition | Inserts a duplicate of each existing character adjacent to its original position |
| Transposition | Swaps each pair of adjacent, non-identical characters |
| Hyphenation | Inserts a hyphen at every possible position within the SLD |
| Replacement | Substitutes each character with its QWERTY keyboard neighbors |
| Insertion | Inserts a QWERTY keyboard neighbor of each character before or after it |
| Addition | Prepends or appends every alphanumeric character (a–z, 0–9) to the SLD |
| Bitsquatting | Flips individual bits in each character's ASCII code, keeping only alphanumeric or hyphen results |
| Vowel Swap | Replaces each vowel (a e i o u) with every other vowel |
All candidates are lower-cased, must be at least two characters long, may only contain alphanumeric characters or hyphens, and must not contain the original SLD as a substring. Results are deduplicated before being written to the permutation table with a configurable TTL (default 30 days).
The Lambda also emits one PERMUTATION_STATS log entry per processed SLD, including per-strategy raw counts plus pre-filter and post-filter totals. This is useful for tuning strategy thresholds and tracking false-positive volume over time.
After sign-in, the home page:
- lists the domains saved for the current user
- highlights exact SLD matches in red and permutation-based matches in orange
- lets the user add or remove a domain
- loads detailed domain sections on demand when a saved domain is clicked
- supports in-page refresh via the top-right ↺ control (next to help/logout) so data can be reloaded without logging in again
Refresh behavior is view-aware:
- On the home view, refresh reloads the latest domain list.
- On a domain-details view, refresh clears cached section/permutation data and re-queries the backend.
- On the permutations view, refresh re-fetches the current domain's permutation list.
- On the possibilities view, refresh re-fetches the current domain's possibilities list.
Refresh reliability note:
- After add/remove success pages, selecting Back now re-initializes home-page refresh state correctly.
- This prevents a stale script-state edge case where subsequent refresh actions on domain/permutations/possibilities could incorrectly route back to home.
On the domain-details card, Possibilities is a fast record count (DynamoDB query Select=COUNT) for the current SLD prefix. Opening the Possibilities view still renders the fully extracted and de-duplicated domain list from those records.
To keep the page responsive, the home handlers reuse HTTP connections and cache short-lived identity and highlight lookups during warm Lambda invocations.
app.py # CDK app entry point
requirements.txt # Python dependencies
cdk.json # CDK configuration
lunker/
lunker_database.py # LunkerDatabase stack (us-east-2)
lunker_permutation.py # LunkerPermutation stack (us-east-2)
lunker_stackuse1.py # LunkerStackUse1 stack (us-east-1, home)
lunker_stackuse2.py # LunkerStackUse2 stack (us-east-2, CI/CD)
lunker_stackusw2.py # LunkerStackUsw2 stack (us-west-2, home)
action/
action.py # DynamoDB Streams Lambda handler
home/
home_shared.py # Shared home API logic and HTML rendering helpers
homeuse1.py # Home API Lambda handler for us-east-1
homeusw2.py # Home API Lambda handler for us-west-2
permutation/
permutation.py # Domain permutation Lambda handler
tests/
test_home_refresh_integration.py # Integration tests for view-aware in-page refresh
test_home_shared.py # Unit tests for shared home logic
tld/
tld.py # IANA TLD sync Lambda handler