Raised This Month: $51 Target: $400
 12% 

check lan or public ip


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
arvEL.
Senior Member
Join Date: Dec 2014
Location: Iraq
Old 02-23-2018 , 01:28   check lan or public ip
Reply With Quote #1

how can i check if the server have LAN IP or Public IP ?
__________________
arvEL. is offline
Send a message via Skype™ to arvEL.
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-23-2018 , 22:02   Re: check lan or public ip
Reply With Quote #2

You can check if the IP is in a reserved IP range. If it's not then it's on the internet.

If that doesn't answer your question, you'll need to explain what you are actually wanting to know about this server in question.
__________________

Last edited by fysiks; 02-23-2018 at 22:03.
fysiks is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-24-2018 , 12:54   Re: check lan or public ip
Reply With Quote #3

What he means, arvEL., is LAN IP's will typically begin with a constant set of values such as '192.168.1.' with the last value being unique to a device on the LAN: 192.168.1.21. So you can basically determine it is an internet IP if it does not start with '192.168.1' (or whatever values are used on the LAN).
__________________

Last edited by Bugsy; 02-24-2018 at 12:55.
Bugsy is offline
arvEL.
Senior Member
Join Date: Dec 2014
Location: Iraq
Old 02-24-2018 , 13:27   Re: check lan or public ip
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
You can check if the IP is in a reserved IP range. If it's not then it's on the internet.

If that doesn't answer your question, you'll need to explain what you are actually wanting to know about this server in question.
Quote:
Originally Posted by Bugsy View Post
What he means, arvEL., is LAN IP's will typically begin with a constant set of values such as '192.168.1.' with the last value being unique to a device on the LAN: 192.168.1.21. So you can basically determine it is an internet IP if it does not start with '192.168.1' (or whatever values are used on the LAN).
hi guys..
i need make simple plugin , when the plugin run he will check ip server

PHP Code:
    new ServerIP[35]; 
    
// 1=without port, 0=with port. 
    
get_user_ip(0ServerIPcharsmaxServerIP ), 1); 
if the ip of server contain '192.168.' it will used function

PHP Code:
set_fail_state 
__________________
arvEL. is offline
Send a message via Skype™ to arvEL.
arvEL.
Senior Member
Join Date: Dec 2014
Location: Iraq
Old 02-24-2018 , 13:41   Re: check lan or public ip
Reply With Quote #5

ok solved guys.. this solution.

PHP Code:
public client_putinserver (id)
{
    new 
ServerIP[35]; 
    
// 1=without port, 0=with port. 
    
get_user_ip(0ServerIPcharsmaxServerIP ), 1);

    if(
contain(ServerIP"192.168.") != -1)
    { 
        
set_fail_state("This addons protected"
    }

__________________
arvEL. is offline
Send a message via Skype™ to arvEL.
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-24-2018 , 13:52   Re: check lan or public ip
Reply With Quote #6

That only accounts for just one type of LAN IP address. The 192.168.0.0/16 range is common but it's not the only one used.

Also, that type of check is pointless and can easily be bypassed even without the source code.
__________________
fysiks is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-24-2018 , 14:15   Re: check lan or public ip
Reply With Quote #7

Quote:
Originally Posted by arvEL. View Post
ok solved guys.. this solution.

PHP Code:
public client_putinserver (id)
{
    new 
ServerIP[35]; 
    
// 1=without port, 0=with port. 
    
get_user_ip(0ServerIPcharsmaxServerIP ), 1);

    if(
contain(ServerIP"192.168.") != -1)
    { 
        
set_fail_state("This addons protected"
    }

I can change one cvar and get rid of your entire "protection".
__________________
HamletEagle is offline
arvEL.
Senior Member
Join Date: Dec 2014
Location: Iraq
Old 02-24-2018 , 22:40   Re: check lan or public ip
Reply With Quote #8

Quote:
Originally Posted by fysiks View Post
That only accounts for just one type of LAN IP address. The 192.168.0.0/16 range is common but it's not the only one used.

Also, that type of check is pointless and can easily be bypassed even without the source code.
Quote:
Originally Posted by HamletEagle View Post
I can change one cvar and get rid of your entire "protection".
no guys.. i really no need to protect in lan ip,, i need make check like this

PHP Code:
if(!(contain(ServerIP"192.168.") != -1)) 
if this server not have '192.168.' the plugin will used set_fail_state
__________________

Last edited by arvEL.; 02-24-2018 at 22:42.
arvEL. is offline
Send a message via Skype™ to arvEL.
Old 02-25-2018, 05:29
raizo11
This message has been deleted by raizo11.
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-25-2018 , 05:32   Re: check lan or public ip
Reply With Quote #9

Quote:
Originally Posted by arvEL. View Post
no guys.. i really no need to protect in lan ip,, i need make check like this

PHP Code:
if(!(contain(ServerIP"192.168.") != -1)) 
if this server not have '192.168.' the plugin will used set_fail_state
You don't understand, this line can be bypassed with 0 effort. It's useless.
__________________
HamletEagle is offline
arvEL.
Senior Member
Join Date: Dec 2014
Location: Iraq
Old 02-25-2018 , 06:25   Re: check lan or public ip
Reply With Quote #10

Quote:
Originally Posted by HamletEagle View Post
You don't understand, this line can be bypassed with 0 effort. It's useless.
so! how can i make my plugin work just in lan ip not in public ip
__________________
arvEL. is offline
Send a message via Skype™ to arvEL.
Reply



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 20:58.


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