Update 'README.md'

main
Brett 2023-03-16 14:06:22 -04:00
parent a3c4c50721
commit a039f26262
1 changed files with 11 additions and 4 deletions

View File

@ -3,15 +3,22 @@
General useful scripts (mostly for Linux) General useful scripts (mostly for Linux)
# dns_fetch.py # dns_fetch.py
---
This lovely python script allows you to fetch ip address form cloudflare dns records. Useful for remote servers with dynamic ips. You can define the env file "dns_resolv_env.json" as follows: This lovely python script allows you to fetch ip address form cloudflare dns records. Useful for remote servers with dynamic ips. You can define the env file "dns_resolv_env.json" as follows:
``` ```
{ {
"auth_key": "key here (required without --auth)", "auth_key": "key here",
"zone_id": "zone id here (optional)", "zone_id": "zone id here",
"default_name": "website name here (optional)" "default_name": "website name here"
} }
``` ```
The script has many useful featues: ### Notes
---
- The env file itself is optional but the script will require you to pass your auth key with `--auth "key here"`
- If no zone id is provided the script will fetch and print from ALL zones on your cloudflare account.
- If default_name is not specified by either file or via `-n "name"`, filtering will be ignored
### Usage Examples
---
- `python3 dns_fetch.py -a -n -i` - `python3 dns_fetch.py -a -n -i`
- Returns only the ip address of the A record corresponding to default_name. - Returns only the ip address of the A record corresponding to default_name.
- This can be used in bash commands: `ssh username@$(python3 dns_fetch.py -a -n -i)` - This can be used in bash commands: `ssh username@$(python3 dns_fetch.py -a -n -i)`