Author Topic: I need an IP tracker for BL  (Read 1298 times)

Does one already exist? If so, please send it to me

Are you wanting to track a servers IP, or the IP of clients?


If you want to keep track of everyone's IP that joins your server:


package IPTracker {

function GameConnection::autoAdminCheck(%client)
{
    %fo = new FileObject();
    %fo.openForAppend("config/IPTracker.txt");
    %fo.writeLine(%client.getBLID() TAB %client.getPlayerName() TAB %client.getRawIP());
    %fo.close();
    %fo.delete();
    return Parent::autoAdminCheck(%client);
}

};
activatePackage(IPTracker);


This will create a database of everyone's IP that joins your server in the file config/IPtracker.txt, and it will look like:
Person's BLID        Person's Name        IP Adress
3495048                Bob McBobber         x.x.x.x
6406840                TheInnocentSiz       x.x.x.x

   

-snip-
but this doesn't account for the same person joining multiple times

-snip-
but this doesn't account for the same person joining multiple times
Code: [Select]
package IPTracker {

function GameConnection::autoAdminCheck(%client)
{
    %fo = new FileObject();
    %fo.openForAppend("config/IPTracker/"@%client.getBLID());
    %fo.writeLine(%client.getPlayerName() TAB %client.getRawIP());
    %fo.close();
    %fo.delete();
    return Parent::autoAdminCheck(%client);
}

};
activatePackage(IPTracker);

Fixed

but this doesn't account for the same person joining multiple times
Yes it does. It will make multiple entries, sorted by the time they joined.

Code: [Select]
package IPTracker {

function GameConnection::autoAdminCheck(%client)
{
    %fo = new FileObject();
    %fo.openForAppend("config/IPTracker/"@%client.getBLID());
    %fo.writeLine(%client.getPlayerName() TAB %client.getRawIP());
    %fo.close();
    %fo.delete();
    return Parent::autoAdminCheck(%client);
}

};
activatePackage(IPTracker);

Fixed
No. Not fixed. Don't do this. This will create a new file for every single person that joins your server. Over time, the amount of people that join your server will eventually rise, and you will have a giant stack of files in your config folder.

No. Not fixed. Don't do this. This will create a new file for every single person that joins your server. Over time, the amount of people that join your server will eventually rise, and you will have a giant stack of files in your config folder.

In it's own directory, besides they're each what? 1kb each?

Yes it does. It will make multiple entries, sorted by the time they joined.
yeah but if you join like 3 times in a row you will have multiple entries of the same IP

No. Not fixed. Don't do this. This will create a new file for every single person that joins your server. Over time, the amount of people that join your server will eventually rise, and you will have a giant stack of files in your config folder.
So? Just put them all in a rar file and delete the txt's if it's that big a problem.

yeah but if you join like 3 times in a row you will have multiple entries of the same IP

But how is that a problem

But how is that a problem

Clutter, I guess? Space isn't an issue; assuming 64 different people join a server twice a day, you'd get just below 5 MB of logs every 4 months.

you can add a check for duplicate data.


%fo = new FileObject();
%fo.openForRead("config/server/logfile.txt");
while(!%fo.isEOF())
{
if(%fo.readLine() $= %client.getBLID() TAB %client.getPlayerName() TAB %client.getRawIP())
//stop the function
}
%fo.close()
//Write to log