Archived
1
0
Fork 0
This repository has been archived on 2024-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
smartlock/Core.py

21 lines
899 B
Python
Raw Normal View History

import shelve, subprocess
2019-03-15 11:56:33 +01:00
from os.path import isfile
if not isfile("Settings.conf"):
subprocess.check_call(["sudo", "yhsm-generate-keys", "-D", "/etc/yubico/yhsm/keys.json", "--key-handle", "1", "--start-public-id", "interncccccc", "-c", "10"])
out = str(subprocess.check_output(["sudo", "ykval-gen-clients", "--urandom", "10"]))
out = out[2:-1].split("\\n")
keys = dict()
for i in out:
id = i.find(",")
keys[i[:id]] = i[id:] #Risque d'y avoir un \n ?
with shelve.open("Settings.conf") as settings:
settings["keys"] = keys
settings["register"] = list()
2019-05-22 15:40:28 +02:00
subprocess.check_call(["screen", "-S", "setup", "-d", "-m", "sudo", "python3.7", "Setup.py"])
subprocess.check_call(["screen", "-S", "internet", "-d", "-m", "sudo", "python3.7", "internet.py"])
subprocess.check_call(["screen", "-S", "yubikey", "-m", "sudo", "python3.7", "yubikey.py"])