October 2021 Update: As of October 2021, I am no longer subscribed to SurfShark, so I may not be able to respond to issues that quickly.
Updates the allowed IP for the Surfshark SmartDNS service to your current device's public IP. Useful for people who have dynamic IPs that change frequently.
Script created for both Python and Bash. The script stores the public IP address ss_ipfile.dat
in the temp directory for the last successful update.
Current recommendation is to use either script. Both scripts compare the previous IP and the current IP before making the update call to SurfShark's API.
If possible, please use environment variables environment variables to store your credentials, rather than hardcode them into the code or in a configuration file.
export SHARK_USERNAME="[email protected]"
and export SHARK_PASSWORD="password"
- In your python/virtualenv run
pip install -r requirements.txt
- If environment variables cannot be used, update
sharkConfig.py.example
with your Surfshark username and password - Rename
sharkConfig.py.example
tosharkConfig.py
- Run command
python3 surfshark.py
to update Surfshark SmartDNS IP
- If environment variables cannot be used, update
sharkConfig.py.example
with your Surfshark username and password - Run
chmod +x surfshark.py
- Run
./surfshark.py
orbash surfshark.sh
- The python script only works with Python 3.
- Both scripts can be run using crontab, a really good tool to generate the crontab line is crontab-generator
-
Your code is garbage/needs work/can be improved
- Please raise an issue, or if you can fix it, send me a pull request!
-
I have an idea!
- Raise an issue and I'll check on it
Thanks to piermark for adding in a way to compare IP addresses before running the update call in issue #2