AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Protecting the Plugin Author Name (https://forums.alliedmods.net/showthread.php?t=50559)

dutchmeat 01-29-2007 03:43

Protecting the Plugin Author Name
 
Hi,
this is a question for advanced programmers,
this is actually meant for a RTCW(Return to Castle Wolfenstein) mod, there are many people that use a Hex progam to change the mod's name into theirs(Also called Modstealing).

So i made a Proof Of Concept of how to protect a name(string)...

Code:

#include <amxmodx>

public plugin_init()
 
{
 register_plugin("Name Check","1.0","dutchmeat")
}
 
new alfabet[][0] = { "a", "b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}
 
//new alfabet[][] = { "a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}
//        0  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26
public function(){
new name[10] = "dutchmeat";
new number;
for (new i=0; i<8; i++) {
 for (new j = 0; j < 26; j++) {
  if (name[i] == alfabet[j][0])
  number = number + j;
 }
}
if (number != 86) //The perfect name check !?!
 return//return if the name is correct
console_print(id,"The name is incorrect...")
}

// D u t c h m e a t
// 3 20 19 2 7 12 13 0 19 = 86
//This should check if all the characters match, if they do, they copy the 'alfabet' number into the var 'number',
//If number matches '86', the string should be 'dutchmeat'


dutchmeat 01-29-2007 08:16

Re: Protecting the Plugin Author Name
 
Code:

char alfabet[] = { 'a', 'b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char name[] = "dutchmeata";
int number = 0,a,j;
int strl = strlen( name ); //9 in this case.
for (a=0; a<30; a++) {
for (j = 0; j < 26; j++) {
if (name[a] == alfabet[j])
number += j;
}
}
if (number == 86 && strl == 9 ){
printf("Woohoo! we have a correct name\n");
}else{
printf("The name is incorrect.\n");
}

Explanation:
Every name has it's own number, for example amxx has the number '23' (a = 0, + a = 0 + x=23)
//new alfabet[][] = { "a","b","c","d","e","f","g","h","i","j","k"," l","m","n","o","p","q","r","s","t","u","v","w ","x","y","z"}
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
In this case the 'name number' is 86.
So if the 'name number' is correct, there's a second check to match the length of the name.
This is C++, and not small, but you can easily port it if you need it...
I hope someone find it useful.

MaximusBrood 01-29-2007 08:24

Re: Protecting the Plugin Author Name
 
This 'protection' can be easily circumvented, you only have to change one integer.
Also, your code has one unneeded for() loop. (the second one)

dutchmeat 01-29-2007 08:26

Re: Protecting the Plugin Author Name
 
I don't think that that integer is shown in a game dll, and why is the second loop unneeded? i need to check every character with the alfabet.

MaximusBrood 01-29-2007 10:15

Re: Protecting the Plugin Author Name
 
Quote:

Originally Posted by dutchmeat (Post 433115)
I don't think that that integer is shown in a game dll.

Of course it is stored, how else do you think it is going to check that the sum is 84?

Quote:

Originally Posted by dutchmeat (Post 433115)
and why is the second loop unneeded? i need to check every character with the alfabet.

Yes, you're right. I misread it because you have a stupid way of adding the numbers, just use the char numbers.

dutchmeat 01-29-2007 10:37

Re: Protecting the Plugin Author Name
 
Have you ever coded for q3 games?
You will see when the game is compiled in either a .dll or .qvm, there isn't much left to decompile, only the most important strings and variables.
Also how do you know the num is 86 ?(if you haven't viewed the source)

schnitzelmaker 01-29-2007 10:39

Re: Protecting the Plugin Author Name
 
Why not use md5 or an random integer.
Code:

md5 - Calculates the md5 keysum of a string.
md5 ( const szString[], md5buffer[34] )


Quote:

Also how do you know the num is 86 ?(if you haven't viewed the source)
Dissamble it.

dutchmeat 01-29-2007 10:44

Re: Protecting the Plugin Author Name
 
There is no way you can disamble the gamedll of a q3 game in a proper way.

schnitzelmaker 01-29-2007 10:53

Re: Protecting the Plugin Author Name
 
Best is using md5,or did you know that this "755d08eef0a2c557877828998eda3d75" is your name?

Quote:

There is no way you can disamble the gamedll of a q3 game in a proper way.
There exist allways an Way.

dutchmeat 01-29-2007 10:54

Re: Protecting the Plugin Author Name
 
well you're right, but would someone take that much effort to rename a mod ?


All times are GMT -4. The time now is 00:43.

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