Commit 1bbb3f7f authored by Félix Sipma's avatar Félix Sipma
Browse files

correction de la copie de la clé du routeur

parent 30b78897
......@@ -57,10 +57,10 @@ print(BLUE + "Copie de la clé de licence depuis le routeur" + NC)
try:
print(BLUE + "Clé de license RouterOS du routeur: " + NC, end="")
subprocess.run("ssh " + SSH_OPT + " admin@" + IP_ROUTEROS + " \"/system license output\"", shell=True)
byteskey = subprocess.check_output("ssh " + SSH_OPT + " admin@" + IP_ROUTEROS + " \"/system license print\" | grep \"software-id:\" | head | sed -E 's/.*software-id: ([[:alnum:]-]+).*/\\1/'.key", shell=True)
# ^ TODO: verify if "byteskey" right is the right output
key = byteskey.decode('utf-8') + ".key"
subprocess.run("scp " + SSH_OPT + " admin@" + IP_ROUTEROS + ":/" + key + "./" + key, shell=True)
byteskey = subprocess.check_output("ssh " + SSH_OPT + " admin@" + IP_ROUTEROS + " \"/system license print\" | grep \"software-id:\" | head | sed -E 's/.*software-id: ([[:alnum:]-]+).*/\\1/'", shell=True)
key = byteskey.decode('utf-8').replace("\n","") + ".key"
print(key)
subprocess.run("scp " + SSH_OPT + " admin@" + IP_ROUTEROS + ":/" + key + " ./", shell=True)
except:
sys.exit(RED + "Échec de la copie de la clé de license du routeur" + NC)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment