A python module to update a dynamic IP address of a server on more clients.
NOTE: THIS CODE IS NOT WORKING AS IS, I AM REVIEWING IT AND WILL PUSH CHANGES SOON.
A python module to update a dynamic IP address of a server on more clients.
I wrote this program to help a friend that needed to syncronize the IP address of a server on more clients around the country.
One possible solution could be to buy a static IP addres from the provider but for me this was sort of a game to play so I wrote the program.
The idea is to have an application always running on the server that gets the IP address from an online service https://api.ipify.org/ and sends an email to a specified address, once every hour.
On the client side there should be a program that the staff can run when a certain condition shous up. I.e. when certain program shows “offline” status most probable reason is that the server is no more reachable thus the IP address changed.
As you know, your IP is logged on a lot of sites you visit and I do not consider it “higly confidential” indeed I do prefer not to store the history of my IP adresses on my Gmail that is openly harvested for informations by Google.
One observation I made is that if I send an email to myself Google is clever enough for not bouncing all over the world but, seen the header, is clear that uses a loopback IP. In this way therereal “tranmission”, the email is sent through SSL connection to Google and that’s it.
A IP address is clearly visible and can be identified with a simple regex while scanning through massive amount of data so I thought to sor of “encrypt” it.
My encryption works in this way:
int * (key * factor)
This is an example of what is the aspect of ‘192.168.0.1’ with the following parameters
alpha = ['o', 'd', 'z', 'm', 't', 'a', 'c', 'i', 'r', 'u']
paddingPool = 'befghjklnpqsvwxy'
encryptionFactor = -9.616013867352109
-5538.823987594815mn-9692.941978290926cq-0.0ox-9.616013867352109db
Because this program is meant to be used by “users” there must be some sort of communication with them and the best way I foun are simple windows.
Almost every function has a decorator with the purpose of execute that function for n times or until it returns and return its retur value or either fail or return False.
All of this can be controlled by some arguments passed to the decorator.