shell rcon

No replies
VIOLENCE
xDiloc's picture
Offline
Joined: Mar 2010
Posts:

rcon.sh

#!/bin/bash
 
# settings
host="set ip"
port="27960"
pass="set pass"
timeout="1"
nc="$(which nc6 2>/dev/null || which nc)"
 
while :; do
	echo "=====================================================";
	echo "[say], [s], [cp], [status], [map], [serverinfo], [cvarlist], [cmdlist], [exit]";
	echo "[fdir *.pk3], [fdir *.bsp], [fdir *.cfg]";
	echo "=====================================================";
	read -p "rcon@$host: " cmd;
	[ "$cmd" == "exit" ] && exit
	echo -e "\xff\xff\xff\xffrcon\x20$pass\x20$cmd\x00" | $nc -q $timeout -u $host $port 2>/dev/null | sed -ne ':x;/\xFF/{N;s/\xFF\xFF\xFF\xFFprint\n//;tx};/^$/d;p'
done