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

Protect Plugin By IP


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 08-13-2014 , 08:46   Protect Plugin By IP
Reply With Quote #1

This is a away to you protect your amxx files.
I had some requests about it. Some people using "untrustable" hosts, sharing FTPs etc.

With this way, it still being possible to make the plugin run in others servers, but is more complicated and in some cases may be impossible to do it with regedit.

Since i dont have much time i will try to hurry. Later i might fix some things, explain better etc.

Example with IP: 77.111.197.790:27015
PHP Code:
#include <amxmodx>

// With this IP you have the numbers- 7 | 1 | 9 | 0 | 2 | 5
// You also need to add the characters- . | :
// Total: 8 characters
// So you will make: The const with value 8
new const IPX[8][] = {
    
"."// This will be: IPX[0]
    
":"// This will be: IPX[1]
    
"7"// This will be: IPX[2]
    
"1"// This will be: IPX[3]
    
"9"// This will be: IPX[4]
    
"0"// This will be: IPX[5]
    
"2"// This will be: IPX[6]
    
"5" // This will be: IPX[7]
}

new 
SERVER_IP[22// This is for get server IP

public plugin_init() {
    
register_plugin("Plugin""Version""Author")
    
    
get_user_ip(0SERVER_IP21false// Getting server IP with Port
    
    // Ok, now you can build server IP with formatex
    
new PROTECTED_IP[21// Since the IP in example has 20 characters in total (counting the repeated ones), lets make here 21
    // Since the IP has 20 characters, you need 20 %s at formatex
    
formatex(PROTECTED_IPcharsmax(PROTECTED_IP), "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"/*77*/IPX[2], IPX[2], /*.*/IPX[0], /*111*/IPX[3],
    
IPX[3], IPX[3], /*.*/IPX[0], /*197*/IPX[3], IPX[4], IPX[2], /*.*/IPX[0], /*790*/IPX[2], IPX[4], IPX[5], /*:*/IPX[1], /*27015*/IPX[6], IPX[2], IPX[5], IPX[3], IPX[7])
    
    
// OK! Now you have the server IP, and Protected IP
    // Time to check if is not equal to the server IP
    
if(!equal(PROTECTED_IPSERVER_IP))
    {
        new 
error[100]
        
formatex(errorcharsmax(error), "[IP PROTECTION] You are not allowed to run this plugin!")
        
set_fail_state(error)
        return
    }

__________________

Last edited by Jhob94; 08-13-2014 at 09:13. Reason: change register plugin. It was sort advertise, copied things from another plugin i had
Jhob94 is offline
Old 08-13-2014, 11:50
GordonFreeman (RU)
This message has been deleted by GordonFreeman (RU). Reason: del
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 08-14-2014 , 09:01   Re: Protect Plugin By IP
Reply With Quote #2

If I recompile AMXX using
PHP Code:
static cell AMX_NATIVE_CALL set_fail_state(AMX *amxcell *params){
    return 
0;

But, if your code is at the top, the "return" statement will stop plugin_init execution, so the plugin won't work as expected. In that case I would recompile AMXX with a console message inside "equal"'s native, so I can know what are you comparing, then I only need to add a condition that if the param 1 is your ip, the functions returns true).

At least use an infinite loop to crash the server and a loop to check if the string matches your ip. Of course it won't be 100% secure, but it will be harder.
__________________

Last edited by Neeeeeeeeeel.-; 08-14-2014 at 09:05.
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 08-14-2014 , 09:06   Re: Protect Plugin By IP
Reply With Quote #3

Quote:
Originally Posted by Neeeeeeeeeel.- View Post
But, if your code is at the top, the "return" statement will stop plugin_init execution
No it will not, certain forwards ignore the return value, plugin_init being one of them. Plus, an empty return is the same as doing "return 0".

Oh, and simply editing get_user_ip to throw an error if the index is 0 would be much easier.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).

Last edited by YamiKaitou; 08-14-2014 at 09:08.
YamiKaitou is offline
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 08-14-2014 , 09:35   Re: Protect Plugin By IP
Reply With Quote #4

To comply with the GPL you need to ship your private plugins with the source code included, which means that the user can easily edit this code out. It only has a purpose if you intend to break the AMXX license.
__________________
In Flames we trust!
Nextra is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 08-14-2014 , 09:52   Re: Protect Plugin By IP
Reply With Quote #5

Quote:
Originally Posted by Nextra View Post
To comply with the GPL you need to ship your private plugins with the source code included, which means that the user can easily edit this code out. It only has a purpose if you intend to break the AMXX license.
Not really, if you going to sell a plugin breaking the license, you wouldnt really set a IP protection.

Like stated in first post. There are many ways your amxx can get leaked/stole.
Bad host, ftp share, even teamviewer.
__________________
Jhob94 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-14-2014 , 15:05   Re: Protect Plugin By IP
Reply With Quote #6

Quote:
Originally Posted by Jhob94 View Post
Not really, if you going to sell a plugin breaking the license, you wouldnt really set a IP protection.

Like stated in first post. There are many ways your amxx can get leaked/stole.
Bad host, ftp share, even teamviewer.
LOL, TeamViewer. How the hell would this happen?
__________________
fysiks is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 08-14-2014 , 15:25   Re: Protect Plugin By IP
Reply With Quote #7

Quote:
Originally Posted by fysiks View Post
LOL, TeamViewer. How the hell would this happen?
Only when you go to toilet LOL
TheDS1337 is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 08-14-2014 , 15:44   Re: Protect Plugin By IP
Reply With Quote #8

Quote:
Originally Posted by fysiks View Post
LOL, TeamViewer. How the hell would this happen?
If you have some plugin in desktop. Ofc you can see him transfering, but is too late since it does it fast.
Idk about recent versions of team viewer since i dont give much use of it recently, but before you didnt need to authorizate the downloads. So yeah, it can even be stole via teamviewer
__________________
Jhob94 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-14-2014 , 16:10   Re: Protect Plugin By IP
Reply With Quote #9

Quote:
Originally Posted by Jhob94 View Post
If you have some plugin in desktop. Ofc you can see him transfering, but is too late since it does it fast.
Idk about recent versions of team viewer since i dont give much use of it recently, but before you didnt need to authorizate the downloads. So yeah, it can even be stole via teamviewer
I would call that simply a really bad choice by you if you were to open up your computer to someone you don't know or can't trust. So, it is not the fault of TeamViewer but rather the fault of the person giving full access to your computer to someone that you can't trust.

Also, who keeps plugins on their desktop?
__________________
fysiks is offline
Mario AR.
Senior Member
Join Date: May 2011
Location: Lima, Perú
Old 08-14-2014 , 18:55   Re: Protect Plugin By IP
Reply With Quote #10

get_user_ip for index 0 returns the value of a cvar (net_address), not the real IP.
Mario AR. is offline
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 05:07.


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