Automatic guid code


(7Killer) #1

Hello dear modders,
christmas is soon and will give a presents to et mod community.
My wish is to help et to have a long life :wink:
PB didn’t want give guid to our dear players…
Since some weeks, i had work on a code which allows mod to give a valid pbguid to a client without pb thing.
In the fact , its a client side mod, so that couldn’t runs on a no download server…

code make few things:

[ul]
[li] its check if the cl_guid is a valid one[/li][li]if, not that s download a new one on etkey.org site[/li][li]When etkey file is found ( or download) a guid is computed as pb compute it so the new client guid is fully compatible with pb , xpsave.[/li][/ul]

the code file can be divided as it :

[ul]
[li]cgame folder[/li][li]cg_uid.c cg_uid.h, these files contain the guid computation and detection part.[/li][li]md5.c, md5.h, they contains md5 computation[/li][li]cg_osfile.h, cg_file.c, these file manipulate osfile system, as its come from an old noquarter copy i hope no quarter team will not be angry about me ( if yes , let me know and i will remove it)[/li][li]curl directory, its contains file need to achieve the downloading of etkey file, as its a library, i give you build for windows and linux ( build on an old debian virtual machine) [/li][/ul]

At this point i have to say thats i build windows file on visual on a windows machine, linux one on a virtual debian machine runs with vmware so i couldn’t give you the way to make the crosscompiling for windows on linux. I didn’t try it on mac compilation as i didn’t make ones…

Here is the differents steps to achieve compilation of this :

  • [li]1rst step[/li]Add cgame file in yr cgame folder
    copy curl directory on the same place that your cgame directory.
    add guid-test() call in yr mod ( mine is into client init)
  • 2nd step
    [LIST]
    [li]On visual in windows[/li]add cgame file into yr cgame project
    modify propriety of the project
    in C/C++ tab,in genaral part
    edit the include directory to add the curl/include folder
    (if u copy at the correct place, u ll have something like .\curl-7.22.0\include)
    in link editor tab, in input part add this to your dependaries library
    odbc32.lib
    odbccp32.lib
    ws2_32.lib
    wldap32.lib
    winmm.lib
    wsock32.lib
    …/curl-7.22.0/lib/LIB-Release/libcurl.lib
    Maybe some of them are no need as i have others specials features on my mod.
    [li]On linux[/li]you need to edit Sconscript.cgame file
    add cg_osfile.c ,cg_uid.c , md5.c on the source file list
    add local_env.Append(CPPPATH = [’./curl-7.22.0/include’]
    add local_env.Append(LINKFLAGS = [’-L ./curl-7.22.0/lib/LIB-Release/’, ‘-lcurl’]

[li]3rd step Enjoy and compile[/li][/LIST]
As i am a nice guy , i give you the curl library release, if u want u can download curl source and build it by yourself.
Since some players have pb enable but not etkey, their cl_guid fiel is now equals to NO_GUID value, etpub has update his code few days ago to avoid invalid kick on duplicate guid spoof and others.
The code is gave you check all invalid know value for cl_guid field. I know it can be improved to check if cl_guid has the correct size and contains only 0-9 A F characters ( hexa value in char).I let add this part as u want.
File can be foundhere
If u ask yourself why put this and catch it for me, just becasue this knowledge will be more valuable if its shared!!!:smiley:


(Nitrox_) #2

For those who want to check if the GUID doesn’t contain invalid characters, here’s what you need:


qboolean nitrox_GUIDCheckValid( char *guid ){
	int i;
	for (i = 0 ; i < 32 ; i++){
		if ((guid[i] < 48 || ( guid[i] > 57 && guid[i] < 65) || (guid[i] > 70) {
			return qfalse;
		}
	}
	return qtrue;
}


(cheesy) #3

Lol all the major mods are close to get this guid system in place but nobody wants to share.

However you did. You are the man 7killer! Thanks for looking out for the whole community…not just your mod :slight_smile:


(BigBear) #4

Very interesting initiative :slight_smile:


(KMETAVZER) #5

Very good work 7Killer,
but isn’t better generate a new etkey file directly from mod (clientside ofcourse) than download etkey (and include all libs) from etkey.org ?!?

Here is a simple batch script that pipe it’s output to a new etkey:


@echo Date: %DATE% Time: %TIME% User: %USERNAME% Hostname: %COMPUTERNAME% OS: %OS% CPU: %Processor_Identifier% CPU Arch: %Processor_Architecture% Cores: %Number_Of_Processors% CPU Rev: %Processor_Revision% CPU Level: %Processor_Level% Key: %RANDOM%%RANDOM%%RANDOM%%RANDOM%%RANDOM%%RANDOM%%RANDOM%%RANDOM% >>etkey

Ofcourse it have to be converted into C, placed into the right place, compiled and included into client.
Good working !

P.s.:
You maybe know what happened with etpub’s forum ???
I can’t connect (Page 403 Forbidden).


(7Killer) #6

main problem to generate etkey from mod is :
etkey is date based , and even if the case that 2 clients generate the same key, its exists.
Or client can change date in easy way that s why i choose to download it from etkey, schnogg ( which i grats so much to help me to found the way to compute the pb guid) use a net server date based for create key, that s the best way in my eyes.
u can answer that we can add the net date server access in mod but as download, we will add another library…
For etpub forum, it s seems be ****ed by spam bot, and as i never chieve to contact etpub team, i couldn’t help them :confused:
and i f orgot osrry for my wierd english


(CoD4Fun) #7

Good initiative.

I don’t understand the

datebased
thing. You mean databased ?

So when you get a key now from etkey.org, it will be be saved in a db, so that you are not able to generate an already given out key ?

How long will etkey.org exist by the way ?


(CoD4Fun) #8

Good initiative.

I don’t understand the

datebased

thing. You mean databased ?

(edit)
I just downloaded a key, there seem no date in there ?


(CoD4Fun) #9

How long will etkey.org exist by the way ?


(7Killer) #10

datebased ie etkey field contains date
So when you get a key now from etkey.org, it will be be saved in a db, so that you are not able to generate an already given out key ?
schnoog assure me that s his system can not generate 2 same key. i don’t know if he put it into a database…
How long will etkey.org exist by the way ? agree , that s why or the download site must a server cvars or we need thats client side auto-generate the etkey…( but etkey.org as pb site can be close a day i m agree)
I really think we need a global answer, that s will i put this code on public place , that will open the debate…


(CoD4Fun) #11

The answer is already there, look 3 posts above you ^^


(7Killer) #12

plus

@echo Date: %DATE% Time: %TIME% User: %USERNAME% Hostname: %COMPUTERNAME% OS: %OS% CPU: %Processor_Identifier% CPU Arch: %Processor_Architecture% Cores: %Number_Of_Processors% CPU Rev: %Processor_Revision% CPU Level: %Processor_Level%

i dodn’t know if all this field exists on linux windows and mac os…


(7Killer) #13

forgot 7killer xfire seb7seb that s will help the debate


(CoD4Fun) #14

Hm that is a valid point. Not all the identifiers are available on all systems i think, especially processor identifier is not every where available. But what this does is taking basically a hardware fingerprint. It should be also unique. You need to only hash it, so that not everybody can openly read your system specs ^^


(7Killer) #15

to generate unique identifier, its exists many and many way, i choose and put here the pb one way, so that s require no change in level or xpsave system, that s my choose…
Now we can use client mac (if u didn’t know how to, etpub has it to his code) and some others but that s means that a client which have a valid etkey and pb_guid will have his xp and level reset if we use a different identification system…
best way will be found a parallel way at pb.dll, that s will allow us to have a system which works with existing mod without change anything in their code…
but that s require thats the client manually install the thing…


(CoD4Fun) #16

Yeah but the good thing is, that it is selfsustained.

Drop the old pb balast imo, noone cares if there admin level/or xpsave reset, you can regain xp easily, hell some even hate xpsave. It is also fun to regain, and admin levels can be set again by admins.

So lets go ^^ Global solution etkey congress opened ^^ We need immediatey results ^^ Etkey.org is only an emergency solution, we all agreed to that.

P.S. sad that no of the mod makers from jaymod/nq/etpub(ok this one is dead) are actually contributing any discussion here on the forum -.-


(7Killer) #17

P.S. sad that no of the mod makers from jaymod/nq/etpub(ok this one is dead) are actually contributing any discussion here on the forum -.-

totally agree with that…
I pm jaybird some day ago on his forum, no answer…
for nq, i didn’t know how to contact them
for etpub same but their svn seems be continue to be update that mean that s only website is closed…

Paul just noticed that to me, etkey can be download on etkey.net too
simply change in cg_uid.c line 118 char *url = “www.etkey.org/etkey.php”; by char *url = “http://etkey.net/getkey”;


(schnoog) #18

I`ll keep up etkey.org as long as no official solution replaces it.
The way i calculate the etkey is:

The server resync its time every day with a ntp server.
This time, as unix timestamp is used, so it`s not possible to generate a etkey twice.
Structure:
0000001002 (base for ET)
99 (to ensure evenbalance never gave this key)
xxxxxxxxxx (unix timestamp, reversed)
YYYYYY (6 random numbers)

I foundet wolffiles, etkey and resurrected splatterladder to keep ET alive. Thats the reason I`m not thinking about closedown etkey.org while no solution from EB / SD replaced it.


(CoD4Fun) #19

Ah, that sheds some like to how the key is generated. I always thought the etkey at etkey.org just generates 28 (it is 28 ? yeah think so) random numbers, and just hopes that the generated key does not collide with any further generated keys. Like this, indeed, it is good.

However, the world looks different in 5 years, ppl get older, get a girlfriend/wife/family and more, and just drop support. So there is no guarantee that there will be etkey generators in 5 years. Ok, maybe others will arise, but where does this end, in constantly fixing the sources of the mods ? That will be annoyance!


(schnoog) #20

Thats absolutly true. I even cannot guarantee that the page will be up for more than weeks. Im mortal at all ;) But I can say: When Im not longer interessted in ET, I`ll give the domains and pages to some other which are interessted in it.
(only SL which, so I agreed to proddi, will go OpenSource when I retire and will not be assigned to somebody else).