pyBEscanner

The option in servers.ini is called Scan Server Logs, didn't want to confuse the issue more :p

Nothing as yet filters wise
It just reads line by line, adds to a backup file.
Checks if the line = chat + logs to a seperate log file -- chat-logs.txt
Saves its current position in the text file, to avoid rescanning the whole log file again.

Its relatively easy to add in kicking player if there was custom rpt diag_log code output in rpt logs, with the players name in there.....
But i am not sure how useful that is really for anyone...

Banning players requires abit more work really, since server console logs lag to far behind in updates to be useful.
i.e no point banning a player 10-30 mins after the fact.
So need to write python code / C# app to retreive GUID info from rcon basicly + fallback to console logs for GUID info if player is not on rcon playerlist (i.e left the server).

Anyway i no longer have logs / a server to test with, so its doubtful i get the above coded for banning, anytime soon.

https://github.com/Torndeco/pyBEscanner/blob/master/modules/logs_server.py
 
edit:- Was late last night, i assumed u had a managed server with only ftp access at best

I have full access to the linux box and I have python installed. When running pyBEscanner I'm getting this error:

Code:
python pyBEscanner.py
 
---------------------------------------------------------
      Loading Config File
---------------------------------------------------------
 
 
Scanning .
Reloading Bans: SLAYSTATION
 
tools/rcon/rcon_reloadbans.exe
Traceback (most recent call last):
  File "pyBEscanner.py", line 296, in <module>
    main.start()
  File "pyBEscanner.py", line 280, in start
    rcon.reloadbans()
  File "/home/user/servers/pyBEscanner-19.01.2013/modules/rcon_cscript.py", line 39, in reloadbans
    subprocess.call([temp, self.ip, str(self.port), self.password])
  File "/usr/lib/python2.7/subprocess.py", line 493, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1259, in _execute_child
    raise child_exception
OSError: [Errno 13] Permission denied

I'm running my dayz server via Wine, so I have it apparently. This is the output I get when trying to run rcon_reloadbans.exe via wine:

Code:
 wine tools/rcon/rcon_reloadbans.exe 127.0.0.1 2302 password
wine: Install Mono 2.8 or greater for Windows to run .NET 4.0 applications.

installed mono:

Code:
sudo apt-get install mono-complete

then

Code:
mono tools/rcon/rcon_reloadbans.exe 127.0.0.1 2302 password
Connecting to 127.0.0.1:2302...
Connected!
RCon admin #1 (127.0.0.1:58565) logged in
PublicVariable Log: #8 Duty_General_Tachenko (cab6b45652da3972dcd8c3bdad2b14b4) - #18 "remExField" = [,<NULL-object>,"say",["z_spotted_9",40]]
Disconnected!
Disconnected!

I assume that it works.
So where do I need to put the "mono" part in rcon_cscript.py ?

Code:
import subprocess
import os
 
class Rcon:
        def __init__(self, ip, port, password):
 
                # Initialize Variables
                self.ip = ip
                self.port = port
                self.password = password
 
 
        def kickplayers(self, kickfile):
                temp = os.path.join("tools", "rcon", ("rcon_kick.exe"))
                print temp
                subprocess.call([temp, "--ip=" + self.ip, "--port=" + self.port, "--password=" + self.password, "--file=" + kickfile])
 
        def reloadbans(self):
                temp = os.path.join("tools", "rcon", ("rcon_reloadbans.exe"))
                print temp
                subprocess.call([temp, self.ip, str(self.port), self.password])

and last but not least - Thanks for your help Torndeco. Really appreciated.
 
Thx for the feedback...
Looks like mono should work out...

Have a new commit on github with some changes...
Give me a shout if it works or doesn't for u....


I might bug u in the future how u got it to run on linux, i gave up on that awhile ago, just ended up payin extra for win os :(


edit: Just another commit, fixed a typo mistake....
 
I'm getting this:

Code:
python pyBEscanner.py
 
---------------------------------------------------------
      Loading Config File
---------------------------------------------------------
 
 
Scanning .Traceback (most recent call last):
  File "pyBEscanner.py", line 298, in <module>
    main.start()
  File "pyBEscanner.py", line 254, in start
    logs_battleye.Scanner(server).scan()
  File "/home/user/servers/pyBEscanner-20.01.2013_1/modules/logs_battleye.py", line 37, in __init__
    self.rcon = rcon_cscript.Rcon(self.server_settings["ServerIP"], self.server_settings["ServerPort"], self.server_settings["RconPassword"])
TypeError: __init__() takes exactly 5 arguments (4 given)

do I need to enter my IP/pass etc inside rcon_cscript.py once this information is already in /conf/servers.conf ?



I might bug u in the future how u got it to run on linux, i gave up on that awhile ago, just ended up payin extra for win os:(
.

My server's OS is Ubuntu, and I basically used this simple guide to run dayz bliss -> http://dayzmod.com/forum/index.php?/topic/98298-guide-hosting-a-dayz-1726-server-on-linux/
combined with the readme file from the repo.

installed perl, wine, winetricks, directx9, vcrun2008, vcrun2010, dotnet40, xinit, fluxbox
+ also installed Visual C++ 2010 (exe) with Wine

and it worked.
 
No your don't it reads the info from the servers.ini file

Basicly i altered the code to pass the os platform to rcon_cscript.Rcon thus the complaining about a extra argument.
That way when it detects Windows it launchs normally, otherwise it launchs mono to run the C# apps

The change highlighted an old small piece of code (causing the crash), was meant to been removed when i last updated the code for kicking / banning players.

There a fix on github if u wanna try again...
Should hopefully works now for u
 
It works!

Code:
python pyBEscanner.py
 
---------------------------------------------------------
      Loading Config File
---------------------------------------------------------
 
Scanning .====================================
ZEDAR.COM.AR // RCon Kicker Started!
====================================
Connecting to 127.0.0.1:2302...
Connected!
Vanok_1488
Eric
 
Reloading Bans: Server1
 
Ban Added: 6c68c7ef2ac340178f1e368dfb071c48
Ban Added: bf80f91589c2f729982449407dbe5464
Ban Added: 78.83.41.101
Ban Added: 64.229.126.139
Ban Added: 86.125.204.39
Ban Added: c9e9f5c02abbe48b41b209556285863e
Connecting to 127.0.0.1:2302...
Connected!
RCon admin #3 (127.0.0.1:42924) logged in
Disconnected!
Disconnected!
 
Scanning .


Thank you so much for taking the time out to help me {thumbs up} :)
 
@helldesign
Nice :)

Thanks for links on running dayz on linux etc...
I might just grab a linux server in the next week or so then.



@Everyone else
pyBEscanner should work under linux/unix now....
requirements = python 2.7 + mono

There is also a bug fix if anyone actually used "standard+kick " option for scanning log-files.
Would have resulted in pyBEscanner crashing basicly (old code got left behind)

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

pyBEutility.py = just a utility script i started to work on with pyBEscanner-v3...

It just has the ability to pause the scanning on pyBEscanner.
Handly if u have a script to delete server logs @ restarts + don't want to run into a race condition with pyBEscanner having the file opened at same time.

Planned Feature = ability to tell it to load banfile i.e from CBL / BanZ Union.
App will just scan the files + add missing bans to servers bans.txt
 
Hi Torndeco,

Can you add not exceptions to the spam filters, for example:

30 10 BAN . !"Not_This", !"And_Not_This"
 
U could try out
Code:
30 10 LOG (?!((#0 Not_This)|(#0 And_Not_This)))
or
30 10 LOG (?!((.* Not_This)|(.* And_Not_This)))
Recommend u use http://www.pythonregex.com/ to test out regrex rules to make sure they work...

edit:
Also if u save a regrex rule with typo / mistake in it.
It will cause pyBEscanner to crash the first time it loads the filter up.
 
U could try out
Code:
30 10 LOG (?!((#0 Not_This)|(#0 And_Not_This)))
or
30 10 LOG (?!((.* Not_This)|(.* And_Not_This)))
Recommend u use http://www.pythonregex.com/ to test out regrex rules to make sure they work...

edit:
Also if u save a regrex rule with typo / mistake in it.
It will cause pyBEscanner to crash the first time it loads the filter up.

Doh, course got you now. I made the not exception in battleye to cut the exceptions off at source until I brush up on my regex.
 
Hum, since I updated to the last commit (15a9762d25335e69f4ea80a67836cc0cb77724b6), I got this when I start it :
Code:
Traceback (most recent call last):
  File "pyBEscanner.py", line 301, in <module>
    main.start()
  File "pyBEscanner.py", line 223, in start
    print "System Platform = " + os_name
TypeError: cannot concatenate 'str' and 'function' objects
and it crashes

It worked perfectly until that update. Any idea ? I'm using Windows Server 2012 Standard x64 and I'm using that command to start it :
Code:
C:\Python27\python.exe pyBEscanner.py
 
Trying to pull my filters from a v11 build into the current v16

If I fresh install and use the default filters from the commit, it runs fine.

If I copy over my folder of filters from my v11 install, it instantly closes the window after launch

any ideas?

Did some syntax change or is a regex causing problems perhaps?
 
Sorry if I'm being dense here. Why do we need to set a server_console.log and give the location to the rpt file? Aren't those the same thing just with two different names?

Please advise where/how to set up a server_console.log if it is indeed different from the .rpt files.
 
In your server.cfg
rpt = diag_log from server
console log = dedicated server console output into textfile into a file, ingame chat + player connecting / disconnecting etc...
Code:
logFile = "server_console.log";
 
Does this program use its own detection scripts; or am I responsible for updating the detection scripts in the Battleye folders; per server.
 
Back
Top