mirror of
https://github.com/FAUSheppy/monitoring-tools
synced 2025-12-06 03:21:35 +01:00
update: change rcon pass file checking
This commit is contained in:
@@ -14,16 +14,18 @@ if __name__ == "__main__":
|
||||
args = parser.parse_args()
|
||||
|
||||
password = None
|
||||
if not os.path.isfile(PW_FILE):
|
||||
try:
|
||||
with open(PW_FILE) as f:
|
||||
password = f.read().strip()
|
||||
except PermissionError as e:
|
||||
print("Insurgency CRITICAL - Permission Error on /etc/rcon.pass".
|
||||
sys.exit(1)
|
||||
except FileNotFoundError as e:
|
||||
print("Insurgency CRITICAL - Missing /etc/rcon.pass".
|
||||
sys.exit(1)
|
||||
|
||||
with open(PW_FILE) as f:
|
||||
password = f.read().strip()
|
||||
|
||||
cmd = [ "/usr/local/bin/rcon", "-P{}".format(password), "-a{}".format(args.host),
|
||||
"-p{}".format(port), "sm plugins info Skillbird" ]
|
||||
|
||||
"-p{}".format(port), "sm plugins info Skillbird" ]
|
||||
p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding=ENCODING)
|
||||
out = p.stdout.encode("ascii")
|
||||
if p.returncode != 0:
|
||||
|
||||
Reference in New Issue
Block a user