Git Product home page Git Product logo

ip_server's Introduction

NOTE: THIS CODE IS NOT WORKING AS IS, I AM REVIEWING IT AND WILL PUSH CHANGES SOON.

IP_server

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.

Overall concept

Server side

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.

Client side

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.

Security

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.

In transit

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.

Storage

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.

Encryption

My encryption works in this way:

  1. I divide the IP in 4 integer numbers, removing the dots.
  2. I sum every cypher of every number until I get a number thet is < 9 (one cipher number). This will be the key cipher.
  3. A random encryption factor is generated from a pool starting from -10 up to +10. This myst be known on both sides.
  4. Every integer number obtained in point 1 is divided in this way:
    int * (key * factor)
    
  5. The key nombers are translated into letters following an array of random letters that must be nown on both sides.
  6. At the end of every float will be attached the "key" translated into a letter, and a "padding" letter.

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

Graphics

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.

Wrapper

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.

TODO

  1. Complete docstrings
  2. Insert some comment lines
  3. Improve this README.md (language and clarity)
  4. Clean-up, reshape, improve the graphical part
  5. Anything could be done to improve stability and render the code more "pythonic"
  6. Add cli arguments parsing like calling the module with the --client or --server arguments
  7. Clear or shorten variables names

ip_server's People

Contributors

alexlab2017 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.