1
This commit is contained in:
parent
9faa706f12
commit
9de6bde5a5
45
hlna.py
45
hlna.py
@ -872,32 +872,33 @@ def rcon(g, m, c):
|
||||
|
||||
|
||||
def rcon_local(g, m="", c=""):
|
||||
try:
|
||||
rcon_ports = []
|
||||
dict_mapname = {}
|
||||
dict_adminpwd = {}
|
||||
for i in list_config:
|
||||
data = read_yaml(i, g="ark")
|
||||
dict_mapname[data['RCONPort']] = data['SessionName']
|
||||
dict_adminpwd[data['RCONPort']] = data['ServerAdminPassword']
|
||||
if m == "all":
|
||||
print_line(m, flag="CYAN")
|
||||
for rcon_p in dict_mapname:
|
||||
rcon_ports.append(rcon_p)
|
||||
else:
|
||||
if g == "ark":
|
||||
try:
|
||||
rcon_ports = []
|
||||
dict_mapname = {}
|
||||
dict_adminpwd = {}
|
||||
for i in list_config:
|
||||
data = read_yaml(i, g="ark")
|
||||
dict_mapname[data['RCONPort']] = data['SessionName']
|
||||
dict_adminpwd[data['RCONPort']] = data['ServerAdminPassword']
|
||||
# if m == "all":
|
||||
# print_line(m, flag="CYAN")
|
||||
# for rcon_p in dict_mapname:
|
||||
# rcon_ports.append(rcon_p)
|
||||
# else:
|
||||
for rcon_p, name_map in dict_mapname.items():
|
||||
if name_map in m:
|
||||
rcon_ports.append(rcon_p)
|
||||
|
||||
for port in rcon_ports:
|
||||
passwd = dict_adminpwd[port]
|
||||
with Client('127.0.0.1', port, passwd=str(passwd)) as client:
|
||||
response = client.run(c)
|
||||
print_line(f"Rcon выполнен {response} {dict_mapname[port]}", flag="GREEN")
|
||||
else:
|
||||
pass
|
||||
except:
|
||||
print_line(f"Ошибка отправки команды {c} в {m}", flag="RED")
|
||||
for port in rcon_ports:
|
||||
passwd = dict_adminpwd[port]
|
||||
with Client('127.0.0.1', port, passwd=str(passwd)) as client:
|
||||
response = client.run(c)
|
||||
print_line(f"Rcon выполнен {response} {dict_mapname[port]}", flag="GREEN")
|
||||
else:
|
||||
pass
|
||||
except:
|
||||
print_line(f"Ошибка отправки команды {c} в {m}", flag="RED")
|
||||
|
||||
|
||||
def zero(x=""):
|
||||
|
Loading…
Reference in New Issue
Block a user