AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   IP logger (https://forums.alliedmods.net/showthread.php?t=305346)

Wacci 02-16-2018 14:27

IP logger
 
Can someone create a plugin that saves the connected player's IP addresses in a log file (in /csgo/logs dicertory) ? :oops:


Thank you in advance for your help!

Kerem Er 02-16-2018 14:59

Re: IP logger
 
https://forums.alliedmods.net/showthread.php?p=1845362

PinHeaDi 02-16-2018 15:06

Re: IP logger
 
PHP Code:

#include <sourcemod>

static const char logfile[] = "addons/sourcemod/logs/ip_log_onconnect.log";

public 
void OnClientPutInServer(int client)
{
    
char name[MAX_NAME_LENGTH], ip[32], steamid[32];
    
GetClientName(clientnamesizeof(name));
    
GetClientIP(clientipsizeof(ip));
    
GetClientAuthId(clientAuthId_Steam2steamidsizeof(steamid));

    
LogToFile(logfile"%N connected (SteamID: %s | IP: %s)"namesteamidip)



midnight9 02-16-2018 18:45

Re: IP logger
 
https://forums.alliedmods.net/showthread.php?t=255493

Hawkins 12-20-2021 13:32

Re: IP logger
 
Quote:

Originally Posted by PinHeaDi (Post 2578550)
PHP Code:

#include <sourcemod>

static const char logfile[] = "addons/sourcemod/logs/ip_log_onconnect.log";

public 
void OnClientPutInServer(int client)
{
    
char name[MAX_NAME_LENGTH], ip[32], steamid[32];
    
GetClientName(clientnamesizeof(name));
    
GetClientIP(clientipsizeof(ip));
    
GetClientAuthId(clientAuthId_Steam2steamidsizeof(steamid));

    
LogToFile(logfile"%N connected (SteamID: %s | IP: %s)"namesteamidip)



The output of ip_log_onconnect.log (i edited out the IP, was the same):
Code:

L 12/20/2021 - 19:28:43: [IP_logger.smx] Console connected (SteamID: BOT | IP: xxx.x.x.x)
L 12/20/2021 - 19:28:43: [IP_logger.smx] Console connected (SteamID: BOT | IP: xxx.x.x.x)
L 12/20/2021 - 19:28:43: [IP_logger.smx] Console connected (SteamID: BOT | IP: xxx.x.x.x)
L 12/20/2021 - 19:28:43: [IP_logger.smx] Console connected (SteamID: BOT | IP: xxx.x.x.x)
L 12/20/2021 - 19:28:55: [IP_logger.smx] Console connected (SteamID: BOT | IP: xxx.x.x.x)
L 12/20/2021 - 19:29:49: [IP_logger.smx] Console connected (SteamID: BOT | IP: xxx.x.x.x)
L 12/20/2021 - 19:29:49: [IP_logger.smx] Console connected (SteamID: BOT | IP: xxx.x.x.x)
L 12/20/2021 - 19:29:50: [IP_logger.smx] Console connected (SteamID: BOT | IP: xxx.x.x.x)


`666 12-25-2021 13:24

Re: IP logger
 
Quote:

Originally Posted by Hawkins (Post 2766561)
The output of ip_log_onconnect.log (i edited out the IP, was the same):

Just add to check if client is fake

Code:

#include <sourcemod>

static const char logfile[] = "addons/sourcemod/logs/ip_log_onconnect.log";

public void OnClientPutInServer(int client)
{
        if (!IsFakeClient(client)) {
                char name[MAX_NAME_LENGTH], ip[32], steamid[32];
                GetClientName(client, name, sizeof(name));
                GetClientIP(client, ip, sizeof(ip));
                GetClientAuthId(client, AuthId_Steam2, steamid, sizeof(steamid));

                LogToFile(logfile, "%N connected (SteamID: %s | IP: %s)", name, steamid, ip);
        }
}



All times are GMT -4. The time now is 01:54.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.