TTP IP

# TomTech Productions IP
import time, os
import requests, socket, uuid

## INSERT YOUR KEY AND MAIL HERE ##
domain = "" #company domain
mail = "tom.schelles@live.be" #your email
## INSERT YOUR KEY AND MAIL HERE ##

url = 'https://ttpm.be/data/online/post.php'
mac = uuid.getnode()

def get_lan_address():
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        s.connect(("8.8.8.8", 80))
        return s.getsockname()[0]

while(1):
    lan = get_lan_address()
    name = socket.gethostname()

    myobj = {'lan' : lan, 'mac': mac, 'name': name, 'domain': domain, 'mail': mail }

    try:
        x = requests.post(url, data = myobj)

        if (x.text == "reboot"):
            os.system("shutdown -t 0 -r -f")

        if (x.text == "lock"):
            os.system("shutdown -l")

        if (x.text == "shutdown"):
            os.system("shutdown -t 0 -s -f")

    except:
        print('NO CONNECTION TO SERVICE')
    #update gegevens lokaal om de 10 seconden
    time.sleep(30)