From 8c5697a88383bec25e9895cac7125832687f4586 Mon Sep 17 00:00:00 2001 From: officereso Date: Wed, 26 Feb 2020 21:15:38 -0600 Subject: [PATCH] added rcon password support --- .gitignore | 1 + scr/Modules/SSC/ChangeServer/Change.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index dd508b1..af526c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /sqlPass.txt /token.txt /scr/Modules/SSC/ChangeServer/text.txt +/rcon.txt diff --git a/scr/Modules/SSC/ChangeServer/Change.py b/scr/Modules/SSC/ChangeServer/Change.py index 217701f..47c9e26 100644 --- a/scr/Modules/SSC/ChangeServer/Change.py +++ b/scr/Modules/SSC/ChangeServer/Change.py @@ -5,6 +5,7 @@ import os from mcrcon import MCRcon password = open("../sqlPass.txt", 'r').read() +rcon = open("../rcon.txt", 'r').read() con = pymysql.connect(host='localhost', user='Bot', @@ -34,10 +35,10 @@ def change(ip1, ip2): os.system("systemctl stop mc mcL mcP mcEvent1 mcEvent2") for i in range(len(allServerRcon)): - print("192.168.1.52 " + f"{password} " + str(allServerRcon[i]['serverRCON']) + "________________________________________________________________________________________________") + print("192.168.1.52 " + f"{rcon} " + str(allServerRcon[i]['serverRCON']) + "________________________________________________________________________________________________") for i in range(len(allServerRcon)): - with MCRcon("192.168.1.52", f"{password}", port=allServerRcon[i]['serverRCON']) as mcr: + with MCRcon("192.168.1.52", f"{rcon}", port=allServerRcon[i]['serverRCON']) as mcr: mcr.command("stop") f = open("/etc/systemd/system/mcEvent1.service", "w")