OpenArena Message Boards

OpenArena => Technical Snafus => Topic started by: skankychicken on April 05, 2008, 05:54:39 AM



Title: using rcon in html
Post by: skankychicken on April 05, 2008, 05:54:39 AM

well.. instead of providing 4 lines of code which makes this possible, i didnt know it was so obvious and embarrased by the time *I* spent on it. I got my geek friend who has never played an online game to give us some insight on how he has set up his server instead. :D  expect typos and stuff in any command syntax, its just an example.


If you can handle simple unix/windows admin then here's a couple of things that may or not be of any interest :D I/me wrote down most of it but i got him to check it out and remove any embarrassing noob stuff :D


1) Make use of standard tables and maps for your hosts.  dhcp tables can also map stuff for you. It will serve as your master list of servers or even games. It might make things easier

eg:  /etc/hosts

0.0.163.69 local.linuxhosts.de local linuxhosts.com rcona lazergun-saw-n-rope-thing rcon-noob-a
192.246.40.56 authorize.quake3arena.com auththing auth-god


^
ok you can map rcon-noob-a with other stuff but this is simply specifying hosts on the system. Any gurus (which i certainly am not ) will be able use 'routing tables' n stuff ... as I am led to believe that might help you with all the house keeping  :D (Luke keeps all his config names and clientinfo in hosts file using the # ignore thingy as his master reference)

---------
if you want to get really geeky then you can also use services
example /etc/inetd.conf

#
shell   stream  tcp     nowait  root    /usr/sbin/tcpd  /usr/sbin/in.rshd
login   stream  tcp     nowait  root    /usr/sbin/tcpd  /usr/sbin/in.rlogind
exec    stream  tcp     nowait  root    /usr/sbin/tcpd  /usr/sbin/in.rexecd
talk    dgram   udp     wait    root    /usr/sbin/tcpd  /usr/sbin/in.ntalkd
rcon dgram   udp     wait    root    /usr/sbin/rcona  /usr/sbin/in.rconslut

oh..
if you have lots of users you can even give them an interaction interface,

qotd stream 1337/tcp (or should that be udp) nowait root /usr/sbin/tcpd \
/bin/rcon


creme-egg:/# telnet localhost 1337
Trying 127.0.0.1
Connected to localhost
Press 1 to enter quick list of admin and monitor control
Escape character is '^]'.
rcon interface connected
Type c and return for cvarlist
Enter ticket number if supplied :
# rcon mute Jack Thompson
useage : rcon <command> "<value>"
aaaaaaaaaaah fuck off... this must be a bug
Connection closed by foreign host.
creme-egg:/#

So you can use ports in a different way, maybe 1= serveradmin 2= clientadmin 3= statsadmin

^
but none of that is important.. its just an example. If you want to do anything like this then you have all security you do/dont require.

2) Grab an rcon prog that can be used preferebly with a web server (cgi/php/whatever..)... blah they all do the same thing so you cant go wrong.

so your command might be like this...
rconprog -39.33.3.3 -port 3333 -cmd "g_chickenrocks 1"

Modify this to suit.. if your using the same ip then theres no need for these ops, just edit it to suit (ex. rcon -p 2002 -cmd).

With that you can use that as a function from the command line... or even better.. use 'aliases'..

[root@local NoGhost]# vi ~/.bashrc
alias b3='cd /usr/local/games/quake3/baseq3 ; ls ; echo "chicken rocks" # VERY IMPORTANT'

edit :

you can go crazy here if you want :)

$ cd myconfigs
$ more example-wild* | grep chicken | xargs rcon say "chicken nooooob"



--------------------------

So using above stuff should enable you to submit a form and pass the data to a one two line file..

eg

#!/bin/mychelle
$getvars
rcon -s $server -cmd $cmd

Pipe cvarlist and collect the values which are then cached for a  php script when a server is started, rcon isnt required for this. Means you have all the defaults of the main server, and do the same for configs. If anyone wants any parsing scripts then ask me/chicken to send them. The data is portable and can be easily sent to mysql  dbs etc and all the crap is removed from the cvarlist output

 lol Well i would add that try and use config based strings and make use of the cvars. Make use of vstrs echo's and touch files.  If you look at the Cvar guide wont take long before you realise you can quickly set up cmd which you can use to trigger an event.

oki. like this?  # rcon g_listmenoobs | egrep 'chicken|url' | -exec chickensEmail-spammed2pornsites.sh

chicken asked me not to include it but you can | -exec and things like that which will run a command to execute a bash script for each entry using find. If things like stats and users url are set then a web admin will know that they can shut down their clansite for violations of abuse. Even on some other host if the state law permits, you can make $eg-a-user  aware that you aint in the mood for taking any shit. I have never used anything like this but do have a blacklist of serious offenders which will have an auto mail with some nice template sent to their isp and abuse departments.