|
1 |
| -# one.com-ddns-python-script |
2 |
| -A (relatively) simple python script to update one.com type A DNS records |
| 1 | +# one.com DDNS Script |
| 2 | + |
| 3 | +The name is pretty self explanatory. It's a Python script for updating type A DNS records at one.com. |
| 4 | + |
| 5 | +## Required Packages |
| 6 | +- `requests` |
| 7 | +- `json` |
| 8 | +- `os` |
| 9 | +- `sys` |
| 10 | + |
| 11 | +## Usage |
| 12 | +At the very top of the Script there are some customization options and variables for your one.com control panel login credentials. |
| 13 | + |
| 14 | +### Login Credentials |
| 15 | +These are the credentials you use to log into your control panel. |
| 16 | +```python |
| 17 | +# YOUR ONE.COM LOGIN |
| 18 | +USERNAME="email.address@example.com" |
| 19 | +PASSWORD="Your Beautiful Password" |
| 20 | +``` |
| 21 | + |
| 22 | +### Domain |
| 23 | +Since you can have multiple domains on one account you need to specify which domain's DNS records you want to edit. |
| 24 | +```python |
| 25 | +# YOUR DOMAIN ( NOT www.example.com, only example.com )" |
| 26 | +DOMAIN="example.com" |
| 27 | +``` |
| 28 | + |
| 29 | +### Subdomains |
| 30 | +Next up is a list with all the subdomains you want to point at your chosen IP address. |
| 31 | +```python |
| 32 | +# LIST OF SUBDOMAINS YOU WANT POINTING TO YOUR IP |
| 33 | +SUBDOMAINS = ["myddns"] |
| 34 | +``` |
| 35 | +To have the domain itself point to your chosen IP address, instead of a subdomain, insert an empty string into the array. |
| 36 | +```python |
| 37 | +SUBDOMAINS = ["myddns",""] |
| 38 | +# myddns.example.com AND example.com will point to the chosen IP address |
| 39 | +``` |
| 40 | + |
| 41 | +Note that the script is not capable of creating new DNS records. |
| 42 | + |
| 43 | +It can only edit existing ones. |
| 44 | + |
| 45 | +### IP Address |
| 46 | +The `IP` option allows you to specify the IP Address you want your DNS records pointing to. |
| 47 | + |
| 48 | +You can |
| 49 | +- directly specify an IP Address in the script (`'127.0.0.1'`, `'1.1.1.1'`, ...) |
| 50 | +- have the script automatically detect your public IP Address through [ipify](ipify.org) (`'AUTO'`) |
| 51 | +- define an IP Address using command-line arguments (`'ARG'`, execute like `python3 one_com_ddns.py 127.0.0.1`) |
| 52 | +```python |
| 53 | +IP='127.0.0.1' |
| 54 | +IP='AUTO' |
| 55 | +IP='ARG' |
| 56 | +``` |
| 57 | + |
| 58 | +### IP Change Detection |
| 59 | +The `CHECK_IP_CHANGE` option allows you to abort the script, if your IP Address hasn't changed since it was last executed. |
| 60 | + |
| 61 | +In order to detect an IP Address change, your last IP Address has to be saved in a file, specified in `LAST_IP_FILE`. If your given/detected IP Address differs from the one in the file, the script will continue |
| 62 | +```python |
| 63 | +# CHECK IF IP ADDRESS HAS CHANGED SINCE LAST SCRIPT EXECUTION? |
| 64 | +CHECK_IP_CHANGE = True |
| 65 | +# True = only continue when IP has changed |
| 66 | +# False = always continue |
| 67 | + |
| 68 | +# PATH WHERE THE LAST IP SHOULD BE SAVED INBETWEEN SCRIPT EXECUTIONS |
| 69 | +# not needed CHECK_IP_CHANGE is false |
| 70 | +LAST_IP_FILE = "lastip.txt" |
| 71 | +``` |
| 72 | + |
| 73 | +## Contributing |
| 74 | +Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. |
| 75 | + |
| 76 | +Any feature requests are welcome as well. |
| 77 | + |
| 78 | +## Need Help? |
| 79 | +Don't hesitate to contact me: |
| 80 | +- [me@lugico.de](mailto:me@lugico.de) |
| 81 | +- Discord: Lugico#4952 |
0 commit comments