Jump to content

Debug Monitor and Whitelist


Backtrack

Recommended Posts

Hello Members again :D

is there a way to design the debugmonitor by myself background with .png

 

second question how i can whitelist my Linuxserver

 

i used a php whitelist but i this php plugin dont connect with rcon to my server

 

need help pls

Link to comment
Share on other sites

I have fund this script but it dont works for Whitelist

 

<?
class server
{
    private $name='';
    private $ip='';
    private $port='';
    private $pass='';
    private $wlist=array();
    private $msg='';
    private $kicked=array();    
   
    
    
    function __construct($name, $ip, $port, $pass, $msg)
    {
        $this->name=$name;
        $this->port=$port;
        $this->ip=$ip;
        $this->pass=$pass;
        $this->msg=$msg;
    }
    
    private function load_list()
    {
           if (file_exists('guids.txt')) $this->wlist=explode("\n", str_replace("\r", "",file_get_contents('guids.txt')));
           else echo "guids.txt not found! nobody allowed \n";
            
    }
    
    private function error($msg='')
    {
      
        echo $this->name." connection error ({$this->ip} {$this->port} {$this->pass}) ($msg)\n";
       
    }
    
    function check_players()
    {
        $this->load_list();
        $players=$this->rcon('players');
        if (!$players) {
            $this->error('get players list');
            return 0;
        }
        $players=explode("\n", $players);
        $begin=0;
        //$n2=0;
       
        foreach($players as $row)
        {
            if (strpos($row, 'players in total')!==false) break;
            if ($begin) {
                $n=mb_substr($row, 0, strpos($row, " "));
                $player=mb_substr($row, (strpos($row, '(OK)')-32), 255);
                $player=explode('(OK) ', $player);
                if (preg_match("/[^a-z0-9\s]/", $player[0])==0  && preg_match("/[^0-9\s]/", $n)==0 && !in_array($player[0], $this->wlist))
                    {
                        //echo "DEBUG: $row \n";
                        echo "{$this->name}: {$player[1]}({$player[0]}) not in list...";
                        if(!empty($this->kicked[$player[0]]) && $this->kicked[$player[0]]>3)
            {
                if (!$this->rcon("addBan {$player[0]} 1 {$this->msg}"))
                            {
                                $this->error("ban {$player[0]}");
                            }
                else
                {
                    echo "banned \n";
                    return 1;
                }    
            }
            else
            {

                            if (!$this->rcon("kick $n  {$this->msg}"))
                            {
                                $this->error("kick $n");
                            }
                            else
                            {
                                $this->kicked[$player[0]]++;   
                                echo "kicked #$n \n";
                                return 1;
                            }
            }
                       
                    }
                    //$n2++;
            }
            if (strpos($row, '--------------------------------------------------')!==false) $begin=1;
        }
        return 0;
    }
    
    //some rcon functions  from katzsmile / DayZAdmin
    private function strToHex($string)
    {
    $hex='';
    for ($i=0; $i < strlen($string); $i++)
    {
        $hex .= dechex(ord($string[$i]));
    }
    return $hex;
    }

   

    private function computeUnsignedCRC32($str){
       sscanf(crc32($str), "%u", $var);
       $var = dechex($var + 0);
       return $var;
    }
 
    

    private function get_checksum($cs)
    {
        $var = $this->computeUnsignedCRC32($cs);
    
    $x = ('0x');
    $a = substr($var, 0, 2);
    $a = $x.$a;
    $b = substr($var, 2, 2);
    $b = $x.$b;
    $c = substr($var, 4, 2);
    $c = $x.$c;
    $d = substr($var, 6, 2);
    $d = $x.$d;
    return chr($d).chr($c).chr($b).chr($a);
    }
    
    
    

     private function rcon($cmd){
        $serverip=$this->ip;
        $serverport=$this->port;
        $rconpassword=$this->pass;
    $passhead = chr(0xFF).chr(0x00);
    $head = chr(0x42).chr(0x45);
    $pass = $passhead.$rconpassword;
    $answer = "";
    $checksum = $this->get_checksum($pass);

    $loginmsg = $head.$checksum.$pass;

    $rcon = fsockopen("udp://".$serverip, $serverport, $errno, $errstr, 1);
    stream_set_timeout($rcon, 1);

    if (!$rcon) {
        echo "ERROR: $errno - $errstr<br />\n";
    } else {
        fwrite($rcon, $loginmsg);
        $res = fread($rcon, 16);

        $cmdhead = chr(0xFF).chr(0x01).chr(0x00);
        
        $cmd = $cmdhead.$cmd;
        $checksum = $this->get_checksum($cmd);
        $cmdmsg = $head.$checksum.$cmd;
        $hlen = strlen($head.$checksum.chr(0xFF).chr(0x01));

        fwrite($rcon, $cmdmsg);
                
        for ($i=1; $i<3; $i++) $answer .= fread($rcon, 102400);
                

        if ( $this->strToHex(substr($answer, 9, 1)) == "0"){
            $count = $this->strToHex(substr($answer, 10, 1));
            
            for ($i = 0; $i < $count-1; $i++){
                $answer .= fread($rcon, 102400);
            }
        }
        
        $cmd = "Exit";
        $cmd = $cmdhead.$cmd;
        $checksum = $this->get_checksum($cmd);
        $cmdmsg = $head.$checksum.$cmd;
        fwrite($rcon, $cmdmsg);
                fclose($rcon);
    }

    return $answer;
    }
    
}

$config=json_decode(str_replace(chr(239).chr(187).chr(191), "", file_get_contents('config.cfg')), true);
if (!$config) die("bad config \n");

$servers=array();
foreach($config as $name=>$param)
{
    $servers[]=new server($name, $param['ip'], $param['port'], $param['pass'], $param['msg']);
}

echo "LisGames WhiteList tool for Arma2/DayZ v0.28  \n";


while(1)
{
    foreach ($servers as $server)
    {
        while ($server->check_players())
        {
            sleep(1);
        }
    }
     sleep(10);
}

?>
 

Link to comment
Share on other sites

There is one post...I guess on the second page about whitelist. To be honest, I do not know exactly what is meant by a whitelist.

I would add a password in server.cfg...then the server is whitelisted. Or not?

 

For debug monitor and things like this...don't know how others see that here...the normal forum should be used. To keep here the things which are olinux server specific.

 

This is just my opinion or better: how I understand this forum.

Link to comment
Share on other sites

Whitelist is without password

 

Password is a bad think

 

 

Whitelist works with batteleye

 

Batteleye checks a .txt or sql for the GUID  to give player accsess on server . is your GUID not on list you dont get access

 

 

Actually my Whitelist works i need only help with Debug monitor for the background i have my one logo for this

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...