Raised This Month: $32 Target: $400
 8% 

IP logger


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Wacci
AlliedModders Donor
Join Date: May 2017
Location: Hungary
Old 02-16-2018 , 14:27   IP logger
Reply With Quote #1

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


Thank you in advance for your help!
__________________
Wacci is offline
Kerem Er
Member
Join Date: Mar 2015
Old 02-16-2018 , 14:59   Re: IP logger
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?p=1845362
Kerem Er is offline
PinHeaDi
Senior Member
Join Date: Jul 2013
Location: Bulgaria
Old 02-16-2018 , 15:06   Re: IP logger
Reply With Quote #3

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)

__________________
PinHeaDi is offline
midnight9
Senior Member
Join Date: Nov 2012
Old 02-16-2018 , 18:45   Re: IP logger
Reply With Quote #4

https://forums.alliedmods.net/showthread.php?t=255493
midnight9 is offline
Hawkins
Senior Member
Join Date: Jul 2021
Old 12-20-2021 , 13:32   Re: IP logger
Reply With Quote #5

Quote:
Originally Posted by PinHeaDi View Post
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)

Last edited by Hawkins; 12-20-2021 at 13:46.
Hawkins is offline
`666
AlliedModders Donor
Join Date: Jan 2006
Old 12-25-2021 , 13:24   Re: IP logger
Reply With Quote #6

Quote:
Originally Posted by Hawkins View Post
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);
	}
}
`666 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:10.


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