proone-txtrec-del
Python script for deleting DNS TXT records created byproone-txtrec-set for Proone’s TXT REC CNC mechanism.
Overview
proone-txtrec-del removes CNC instruction records from DNS zones, including both header and data records. Essential for cleaning up after testing or terminating CNC operations.
Source: ~/workspace/source/src/proone-txtrec-del
Language: Python 3
Features
- Automatic Discovery: Finds all related data records from header
- Batch Deletion: Removes multiple records in single API call
- Provider Hooks: Supports multiple DNS providers (AWS Route53, etc.)
- Validation: Parses header to identify all records
- Safe Operations: Validates records before deletion
Installation
Requirements
Dependencies
- Python 3.x
prne_txtrecmodule (included in source)boto3(for AWS provider)
Usage
Common Options
| Option | Description |
|---|---|
--hook <provider> | DNS provider hook (aws, etc.) |
--zone-id <id> | DNS zone identifier |
--head-rec <name> | Header record name to delete |
--help | Show help message |
AWS Route53 Example
Basic Deletion
Delete After Testing
How It Works
Record Discovery Process
Enumerate Data Records
Generates data record names:
00000000.data.example.com00000001.data.example.com00000002.data.example.com
Header Parsing
Uses regex patterns:Example Workflow
Complete Cleanup
Automated Test Cleanup
Error Handling
Exit Codes
| Code | Error | Description |
|---|---|---|
| 0 | Success | Records deleted |
| 1 | NOT_IMPL | Provider not implemented |
| 1 | AWS_NO_BOTO3 | boto3 not installed |
| 1 | NO_RR | No records found in zone |
| 1 | NO_HEAD_REC | Header record not found |
| 2 | INV_ARG | Invalid arguments |
Common Errors
Header record not found:- Verify the header record name is correct
- Check if records were already deleted
- Confirm zone ID is correct
- Verify IAM role has
route53:ChangeResourceRecordSets - Check AWS credentials are configured
- Zone ID may be incorrect
- Records may have already been deleted
- Check AWS Route53 console
Provider Hooks
AWS Route53
Requires:- AWS credentials configured (
~/.aws/credentialsor environment) boto3Python library- IAM permissions for Route53 deletions
Custom Providers
Extend error handling and add provider functions:Safety Features
- Validation: Verifies header record exists before attempting deletion
- Batch Operations: Atomic deletion of all related records
- Error Messages: Clear feedback on what went wrong
- No Wildcards: Only deletes specifically identified records
Security Considerations
Deletion is permanent and cannot be undone. Ensure you have backups of important DNS configurations before running deletion commands.
- Permanent Operation: Deleted records cannot be recovered
- Zone-wide Impact: Affects all instances querying these records
- DNS Propagation: Changes propagate within minutes
- Access Control: Limit who can run deletion operations
Performance Notes
- DNS Propagation: Deletions propagate in seconds to minutes
- Batch API: Single API call for all records (efficient)
- Rate Limits: AWS Route53 has API rate limits
- Cache TTL: Clients may cache old records until TTL expires
Verification
Confirm Deletion
Monitor Propagation
Related Tools
- proone-txtrec-set - Create TXT REC CNC records
- proone-htbthost - Test CNC mechanism
- TXT REC CNC - Protocol specification
Implementation Details
Fromproone-txtrec-del:
- Regex-based header parsing
- Enumerates data records by count
- Uses AWS Route53 batch delete API
- Validates records before deletion
- Provides detailed error messages
Source Reference
File:~/workspace/source/src/proone-txtrec-del (Python script)
Module: ~/workspace/source/src/prne_txtrec.py (shared utilities)
Lines: ~150 (deletion logic + error handling)