IP Logging in the dedicated console

Nightshades

Banned
Posts
12
Likes
9
Hello everyone, today while playing on duel server i experienced a very bad behavior, a rude person was using fake name from member of J clan, that person lamed me more than 20 times including random people, he was obviously banned but was still reconnecting with fake name, probably using VPN and sometime he disconnected before the admin went on to AVOID BAN.

The actual system is critical and i would suggest the following:
Since we know that they can disconnect and avoid ban, what can be pretty good is to LOG a .txt constantly (until the server shut down or the map changes) which will parse everything the "console has" player message and all and before the "username" adding the IP of the player.

This way the person that has access to the server will be able to read that log and check for any bad behavior and if needed ban the corresponding IP, that would solve many problem and make ban less avoidable.

I would recommend that when we start the dedicated server it automatically open a file stream and write in the .txt for the name of that file i think it could be the "timestamp" (month,day,year,hours,minutes,second,keyword of the actual map) the file stream will be closed once the server shut down or the map change etc.

This would take a very low amount of disk space but it would create many small .txt logs, but i believe it could be a nice way to "control" the players also reviewing what was wrote in the console.

As you know if someone start flaming someone and start going on a laming-chain kill YOU NEED PROOF, the ability to review the entire "Session" logged in a .txt is clearly good for that.

I don't know if we can already log an entire session (console parsing) but the IP of the players should be added.

For the people reading that thread:
Do you think that we need more administration tools for the server ?
 

AaronAaron

Donator
Posts
424
Likes
819
Hello everyone, today while playing on duel server i experienced a very bad behavior, a rude person was using fake name from member of J clan, that person lamed me more than 20 times including random people, he was obviously banned but was still reconnecting with fake name, probably using VPN and sometime he disconnected before the admin went on to AVOID BAN.

The actual system is critical and i would suggest the following:
Since we know that they can disconnect and avoid ban, what can be pretty good is to LOG a .txt constantly (until the server shut down or the map changes) which will parse everything the "console has" player message and all and before the "username" adding the IP of the player.
server ?
This is already a thing for server owners. Its called gamelog
 

LoU

R2D2
Movie Battles II Team Retired
Posts
746
Likes
650
I made few tools for devs which help with reading logs, but since none of them are available for public here you go:
Code:
#!/usr/bin/env python
import re
import codecs
import string
import sys
import getopt
import datetime

def main(argv):
    logfile = ''
    global OPTION
    global DESCR

    try:
        opts, args = getopt.getopt(argv,"hl:o:",["logfile=","option="])
    except getopt.GetoptError:
        print 'scan.py -l <logPath> [Optional: -o OPTION n (1 - smod, 2 - Nick+IP, 3 - Chat) ]'
        print 'example: scan.py -l server.log -o 2'      
        sys.exit(2)
    for opt, arg in opts:
        if opt == '-h':
            print 'scan.py -l <logPath>  [Optional: -o OPTION n (1 - smod, 2 - Nick+IP, 3 - Chat) ]'
            print 'example: scan.py -l server.log -o 2'
            sys.exit()
        elif opt in ("-l", "--logfile"):
            logfile = arg
        elif opt in ("-o", "--option"):
            OPTION = int(arg)
        if logfile == "":
            print 'scan.py -l <logPath> [Optional: -o OPTION n (1 - smod, 2 - Nick+IP, 3 - Chat) ]'
            print 'example: scan.py -l server.log -o 2'
            sys.exit()
    now = datetime.datetime.now()
    print "========================"
    print "LogParser"
    print "========================"
    print "Save: NO"
    print "Log path:", logfile
    print "========================"
    print "[1] Smod Actions"
    print "[2] Nickname + IPs"
    print "[3] Chat"
    print "[4] EXIT"
    print "========================"

    def check():
        global OPTION
        global DESCR
        try:
            OPTION=int(raw_input('Please select option 1-4: '))
        except ValueError:
            print "Error: No option selected. Please select option 1-4"
            check()
        if OPTION == 1:
            DESCR = "Smod Actions - todo"
        elif OPTION == 2:
            DESCR = "Nicknames + IPs"
        elif OPTION == 3:
            DESCR = "Chat Logs"
        elif OPTION == 4:
            print "Quitting..."
            exit()
        else:
            print "Error: No option selected. Please select option 1-4"
            check()

    #print "option nu", OPTION
    if 'OPTION' in globals():
        print "DEBUG OK"
    else:
        check()
    if OPTION == 1:
        DESCR = "Smod Actions - todo"
    elif OPTION == 2:
        DESCR = "Nicknames + IPs"
    elif OPTION == 3:
        DESCR = "Chat Logs"

    print "Option: ", OPTION, " ", DESCR
    file = open(logfile, "r")
    LOG = file.read()
    htmlpath = now.strftime("log-%Y-%m-%d--%H-%M.html")
    exphtml = open(htmlpath,"w")
    print "================="

    if OPTION == 3:
        exphtml.write("<body bgcolor='grey'><font face=courier><BR>")
        for match in re.finditer('.*say: (.*).*"(.*)"$', LOG, re.MULTILINE):
            print match.group(1), match.group(2)
            NAME = "<font color=white>"+match.group(1)
            MESSAGE = "<font color=lime>"+match.group(2)
            NAME = string.replace(NAME, '^0', '<font color="black">')
            NAME = string.replace(NAME, '^1', '<font color="red">')
            NAME = string.replace(NAME, '^2', '<font color="lime">')
            NAME = string.replace(NAME, '^3', '<font color="yellow">')
            NAME = string.replace(NAME, '^4', '<font color="blue">')
            NAME = string.replace(NAME, '^5', '<font color="cyan">')
            NAME = string.replace(NAME, '^6', '<font color="purple">')
            NAME = string.replace(NAME, '^7', '<font color="white">')
            NAME = string.replace(NAME, '^8', '<font color="red">')
            NAME = string.replace(NAME, '^9', '<font color="red">')

            MESSAGE = string.replace(MESSAGE, '^0', '<font color="black">')
            MESSAGE = string.replace(MESSAGE, '^1', '<font color="red">')
            MESSAGE = string.replace(MESSAGE, '^2', '<font color="lime">')
            MESSAGE = string.replace(MESSAGE, '^3', '<font color="yellow">')
            MESSAGE = string.replace(MESSAGE, '^4', '<font color="blue">')
            MESSAGE = string.replace(MESSAGE, '^5', '<font color="cyan">')
            MESSAGE = string.replace(MESSAGE, '^6', '<font color="purple">')
            MESSAGE = string.replace(MESSAGE, '^7', '<font color="white">')
            MESSAGE = string.replace(MESSAGE, '^8', '<font color="red">')
            MESSAGE = string.replace(MESSAGE, '^9', '<font color="red">')


            writeText = NAME+" "+ MESSAGE + "<BR>"
            exphtml.write(writeText)

    if OPTION == 2:
        exphtml.write("<body bgcolor='grey'><font face=courier><table><tr><td>IP</td><td>Name</td></tr>")
        for x in re.finditer(r'.*ClientConnect:.*: (.*):.*\n.*ClientUserinfoChanged.*n\\(.*)\\t\\.*$', LOG, re.MULTILINE):
            print x.group(1), x.group(2)
            IP = "<font color=white>"+x.group(1)
            NAME = "<font color=white>"+x.group(2)
            NAME = string.replace(NAME, '^0', '<font color="black">')
            NAME = string.replace(NAME, '^1', '<font color="red">')
            NAME = string.replace(NAME, '^2', '<font color="lime">')
            NAME = string.replace(NAME, '^3', '<font color="yellow">')
            NAME = string.replace(NAME, '^4', '<font color="blue">')
            NAME = string.replace(NAME, '^5', '<font color="cyan">')
            NAME = string.replace(NAME, '^6', '<font color="purple">')
            NAME = string.replace(NAME, '^7', '<font color="white">')
            NAME = string.replace(NAME, '^8', '<font color="red">')
            NAME = string.replace(NAME, '^9', '<font color="red">')
            writeText = "<tr><td>" + IP+"</td><td>" + NAME +"</td></tr>"

            exphtml.write(writeText)
    exphtml.write("</table>")
    exphtml.close()



if __name__ == "__main__":
   main(sys.argv[1:])

This is simple python script which parses log and puts output to html page like "log-2017-11-27--13-37.html"
It's for server owners mostly since it needs server log file.

Usage
Code:
scan.py -l <logPath> [Optional: -o OPTION n (1 - smod, 2 - Nick+IP, 3 - Chat) ]
example: scan.py -l server.log -o 2

With only -l arg:
Code:
./scan.py -l games.log
========================
LogParser
========================
Save: NO
Log path: games.log
========================
[1] Smod Actions
[2] Nickname + IPs
[3] Chat
[4] EXIT
========================
Please select option 1-4: 3
Option:  3   Chat Logs
=================
Spaniard:  ok try it
Spaniard:  noob
^3A^7ncient (practising) ^3J^7edi:  such bullshit
^7lo^0s^1er:  your mom
^3A^7ncient (practising) ^3J^7edi:  i press speed yet nothing happens
Haddon70:  idiot move
-Viper-XL:  same goes for me when I try to Grip
Dark shinobi:  lol didn even swing wtf

Code:
./scan.py -l games.log -o 2
========================
LogParser
========================
Save: NO
Log path: games.log
========================
[1] Smod Actions
[2] Nickname + IPs
[3] Chat
[4] EXIT
========================
Option:  2   Nicknames + IPs
=================
130.204.XX.YY -Viper-XL
95.14.XX.YY lag
217.191.XX.YY W^1!^7zard
124.185.XX.YY ^2S^7i|vio
70.65.XX.YY Padawan


It's old and never finished, so it may be buggy. Basically you can setup cron or sth and parse log every X minutes/hours
 
Last edited:
  • Like
Reactions: SK5

Nightshades

Banned
Posts
12
Likes
9
Hello, maybe i badly explained, i meant that when we start up the dedicated we have the GUI console (JKA: MP Console) what i want as an addition is more features, such as all the list of players (in a ListBox at the right) and the real time parsing of what's happening in-game (player being killed, message etc) all of that in the JKA:MP Console (Of the dedicated server).

And maybe a "Menu" when we right click the player name, for quick ban/kick and why not a menu for map changes.

And as for the logs i think JSON would be much better.

As i seen that it's creating a log .txt it's fine, but the dedicated console lack of features.
 
Top