PDA

View Full Version : [COD4]How to make cracked server show in master list?



bigbro
29th December 2013, 07:54
Hello,
I am on linux box, running few cod4 servers and I need some help making them show in master list.

I did some changes in my iptables:


-A INPUT -p udp -m udp -m string --sport 20800 -j DROP --algo bm --string "BANNED_CDKEY"
-A INPUT -p udp -m udp -m string --sport 20800 -j DROP --algo bm --string "INVALID_CDKEY"
-A OUTPUT -p udp -m udp -m string --sport 20800 -j DROP --algo bm --string "INVALID_CDKEY"
-A OUTPUT -p udp -m udp -m string --sport 20800 -j DROP --algo bm --string "BANNED_CDKEY"


and using original bins, it's not working.. msg is "key code is in use".
I need little help here and may be patched bins too :(

bigbro
1st January 2014, 08:44
I found a way to fix it. Unfortunately it is not working with ip tables at all.
Just find getIpAuthoruze in bin file, using hex editor and rename it (first one) with something else, so it will not get IP authorization for clients who want to connect to the server. That's it. :)

Thanks goes to IzNoGoD, who point me to right direction :)

Happy new year to all

IzNoGoD
1st January 2014, 12:48
I dont think I had anything to do with it.
Might have been mitch?

jankarl
7th February 2014, 12:07
Hello,

i renamed getIpAuthorize to other letters, but now i'm getting: "Key Code in use. Please try reconnecting later."

Can anyone help me with this? I want to run cod4 cracked linux server which should be shown in master list. Thanks!

Coldieee
8th May 2014, 13:01
Hi,

I'm also attempting this and had the same issue as jankarl ^^^

Anyone know the solution? Cheers

Coldieee
8th May 2014, 21:05
Couldn't seem to edit my last post..

Found this after more googling:

https://iceops.in/ipb/index.php?/topic/1114-cod4x-faq/

Mitch
8th May 2014, 21:54
Hi,

I'm also attempting this and had the same issue as jankarl ^^^

Anyone know the solution? Cheers

I will look into the porting my cracked solution from cod4 to cod2 when i got time.

See:
https://github.com/kungfooman/libcod/blob/master/libcod.cpp (hook call of AuthorizeState: line 1944)
https://github.com/kungfooman/libcod/blob/master/functions.hpp (requires addresses of Cmd_Argv, Cvar_VariableValue and hook_AuthorizeState_call)

Ok, it seems that my cracked solution from cod2 doesn't work in cod4. Cvar_VariableValue should be 0x0819E7C0.



void *__cdecl sub_816FE18(int a1, char a2, __int16 a3, int a4, int a5)
{
const char *v5; // edx@2
__int32 v6; // eax@4
int v7; // edx@4
int v8; // esi@4
signed int v9; // edx@7
const char *v10; // ebx@9
void *result; // eax@15
int v12; // eax@35
int v13; // [sp+18h] [bp-430h]@13
int v14; // [sp+18h] [bp-430h]@24
char *v15; // [sp+18h] [bp-430h]@40
signed int v16; // [sp+34h] [bp-414h]@7
signed int v17; // [sp+38h] [bp-410h]@8
char v18; // [sp+3Ch] [bp-40Ch]@42

if ( !sub_813C0C4(a1, a2, a3, a4, a5, v13e7844c, v13e78450, v13e78454) )
return (void *)sub_8122B2E(15, "SV_AuthorizeIpPacket: not from authorize server\n");
v5 = "%s%s\t\n" + 6;
if ( *(_DWORD *)(4 * v8879a40 + 0x8879A84) > 1 )
v5 = *(const char **)(*(_DWORD *)(4 * v8879a40 + 0x8879AA4) + 4);
v6 = __strtol_internal(v5, 0, 10, 0);
v8 = 0;
v7 = 0;
while ( v6 != *(_DWORD *)(v7 + 333857868) )
{
++v8;
v7 += 80;
if ( v8 == 1024 )
return (void *)sub_8122B2E(15, "SV_AuthorizeIpPacket: challenge not found\n");
}
*(_DWORD *)(80 * v8 + 0x13E64454) = v90b4f84;
v9 = *(_DWORD *)(4 * v8879a40 + 0x8879A84);
v16 = 136494744;
if ( v9 > 2 )
{
v16 = *(_DWORD *)(*(_DWORD *)(4 * v8879a40 + 0x8879AA4) + 8);
v17 = 136494744;
if ( v9 <= 3 )
{
LABEL_9:
v10 = "%s%s\t\n" + 6;
if ( v9 <= 5 )
goto LABEL_10;
goto LABEL_17;
}
}
else
{
v17 = 136494744;
if ( v9 <= 3 )
goto LABEL_9;
}
v17 = *(_DWORD *)(*(_DWORD *)(4 * v8879a40 + 0x8879AA4) + 12);
v10 = "%s%s\t\n" + 6;
if ( v9 > 5 )
LABEL_17:
v10 = *(const char **)(*(_DWORD *)(4 * v8879a40 + 0x8879AA4) + 20);
LABEL_10:
if ( !sub_81AAAE2(v16, "deny") )
{
if ( !v17 || !*(_BYTE *)v17 )
goto LABEL_45;
if ( !sub_81AAAE2(v17, "CLIENT_UNKNOWN_TO_AUTH") || !sub_81AAAE2(v17, 136518348) )
{
v13 = (int)"needcdkey";
goto LABEL_14;
}
if ( sub_81AAAE2(v17, "INVALID_CDKEY") )
{
sub_81AAAE2(v17, "BANNED_CDKEY");
v13 = (int)"error\nEXE_ERR_BAD_CDKEY";
}
else
{
LABEL_45:
v13 = (int)"error\nEXE_ERR_CDKEY_IN_USE";
}
LABEL_14:
sub_813D086(
1,
*(_DWORD *)(80 * v8 + 0x13E64438),
*(_DWORD *)(80 * v8 + 0x13E6443C),
*(_DWORD *)(80 * v8 + 0x13E64440),
*(_DWORD *)(80 * v8 + 0x13E64444),
*(_DWORD *)(80 * v8 + 0x13E64448),
v13);
return memset((void *)(80 * v8 + 333857848), 0, 0x50u);
}
if ( strcmp((const char *)(80 * v8 + 333857892), v10) )
{
sub_8122B2E(
15,
"rejecting connection due to mismatched GUID: expected \"%s\", got \"%s\"\n",
80 * v8 + 333857892,
v10);
v14 = (int)"error\nEXE_ERR_BAD_CDKEY";
LABEL_25:
sub_813D086(
1,
*(_DWORD *)(80 * v8 + 0x13E64438),
*(_DWORD *)(80 * v8 + 0x13E6443C),
*(_DWORD *)(80 * v8 + 0x13E64440),
*(_DWORD *)(80 * v8 + 0x13E64444),
*(_DWORD *)(80 * v8 + 0x13E64448),
v14);
return memset((void *)(80 * v8 + 333857848), 0, 0x50u);
}
if ( !sub_81AAAE2(v16, "demo") )
{
if ( !(unsigned __int8)sub_819E7C0("fs_restrict") )
{
v14 = (int)"error\nEXE_ERR_NOT_A_DEMO_SERVER";
goto LABEL_25;
}
goto LABEL_35;
}
result = (void *)sub_81AAAE2(v16, "accept");
if ( result )
{
if ( v17 && *(_BYTE *)v17 )
{
sprintf(&v18, "error\n%s", v17);
v15 = &v18;
}
else
{
v15 = "error\nEXE_ERR_BAD_CDKEY";
}
sub_813D086(
1,
*(_DWORD *)(80 * v8 + 0x13E64438),
*(_DWORD *)(80 * v8 + 0x13E6443C),
*(_DWORD *)(80 * v8 + 0x13E64440),
*(_DWORD *)(80 * v8 + 0x13E64444),
*(_DWORD *)(80 * v8 + 0x13E64448),
v15);
return memset((void *)(80 * v8 + 333857848), 0, 0x50u);
}
if ( !*(_DWORD *)(80 * v8 + 0x13E64460) )
{
LABEL_35:
v12 = sub_81A9F8A("challengeResponse %i", *(_DWORD *)(80 * v8 + 0x13E6444C));
result = (void *)sub_813D086(
1,
*(_DWORD *)(80 * v8 + 0x13E64438),
*(_DWORD *)(80 * v8 + 0x13E6443C),
*(_DWORD *)(80 * v8 + 0x13E64440),
*(_DWORD *)(80 * v8 + 0x13E64444),
*(_DWORD *)(80 * v8 + 0x13E64448),
v12);
}
return result;
}


You could hook all the calls in this function to sub_81AAAE2. (which compares the state with deny or accept)

Mitch
11th May 2014, 00:11
I think this should do the trick:



int hook_StateCompare(char * state, char * base)
{
if ((CvarVariableValue == NULL || CvarVariableValue("sv_cracked") == 1) && strcmp (state, "deny") == 0) // when sv_cracked 1 and deny state
{
if(strcmp(base, "accept") == 0) // when compare value is accept return true
return 0;
else
return 1; // when compare to value is deny return false
}

return strcmp(state, base);
}

#if COD_VERSION == COD4_1_7
cracking_hook_call(0x0816FF42, (int)hook_StateCompare);
cracking_hook_call(0x081701D6, (int)hook_StateCompare);
#endif


Basically it changes the compare function to returning false (1) when it compares deny to deny. And it returns true (0) when it compares deny to accept.

IzNoGoD
11th May 2014, 01:32
Shouldnt this be more like


int hook_StateCompare(char * state, char * base)
{
if (CvarVariableValue == NULL || CvarVariableValue("sv_cracked") == 1)
return 0;
return strcmp(state, base);
}

Mitch
11th May 2014, 09:43
Shouldnt this be more like


int hook_StateCompare(char * state, char * base)
{
if (CvarVariableValue == NULL || CvarVariableValue("sv_cracked") == 1)
return 0;
return strcmp(state, base);
}

No, because I hook these 2 calls.



if ( !sub_81AAAE2(v16, "deny") )
result = (void *)sub_81AAAE2(v16, "accept");

kill3ill
11th June 2014, 00:10
I think this should do the trick:



int hook_StateCompare(char * state, char * base)
{
if ((CvarVariableValue == NULL || CvarVariableValue("sv_cracked") == 1) && strcmp (state, "deny") == 0) // when sv_cracked 1 and deny state
{
if(strcmp(base, "accept") == 0) // when compare value is accept return true
return 0;
else
return 1; // when compare to value is deny return false
}

return strcmp(state, base);
}

#if COD_VERSION == COD4_1_7
cracking_hook_call(0x0816FF42, (int)hook_StateCompare);
cracking_hook_call(0x081701D6, (int)hook_StateCompare);
#endif


Basically it changes the compare function to returning false (1) when it compares deny to deny. And it returns true (0) when it compares deny to accept.

Hey Mitch, i look for a way for a long time to run a cod4 cracked server and never found anything in internet!! Sorry for my noob question, but how do u use this php codes u just gave here??

Thanks for your help,
ps: sorry for my bad english, i'm french :)
Kill3ill

Mitch
11th June 2014, 18:59
Hey Mitch, i look for a way for a long time to run a cod4 cracked server and never found anything in internet!! Sorry for my noob question, but how do u use this php codes u just gave here??

Thanks for your help,
ps: sorry for my bad english, i'm french :)
Kill3ill

The code is supposed to be adding to libcod. See https://github.com/kungfooman/libcod. (you will need to be able to edit your start up line for this to work. Also linux only)
But i never got around to test that code.

In https://github.com/kungfooman/libcod/blob/master/libcod.cpp:

Add after 'char * hook_AuthorizeState( int arg ) { **** }' (line 1446)


int hook_StateCompare(char * state, char * base)
{
if ((CvarVariableValue == NULL || CvarVariableValue("sv_cracked") == 1) && strcmp (state, "deny") == 0) // when sv_cracked 1 and deny state
{
if(strcmp(base, "accept") == 0) // when compare value is accept return true
return 0;
else
return 1; // when compare to value is deny return false
}

return strcmp(state, base);
}


Add this before #ifdef IS_JAVA_ENABLED (line 2022)


#if COD_VERSION == COD4_1_7
cracking_hook_call(0x0816FF42, (int)hook_StateCompare);
cracking_hook_call(0x081701D6, (int)hook_StateCompare);
#endif


Note: This code hasn't be tested so it might be that it could crash your game server. (cod4_lnxded)

Edit: try this binary at http://znation.nl/libcod/

kill3ill
11th June 2014, 22:48
Hi Mitch,


Thanks for your reply. Well, i downloaded this file here: http://znation.nl/libcod/, so what to do with this now?

KB

Mitch
13th June 2014, 18:25
Hi Mitch,


Thanks for your reply. Well, i downloaded this file here: http://znation.nl/libcod/, so what to do with this now?

KB

I added a nomysql version (less work to install).

Download http://znation.nl/libcod/libcod4_1_7_nomysql.so and upload it next to your cod4 binary.
Modify your startup line to:



LD_LIBRARY_PATH=. LD_PRELOAD=libcod4_1_7_nomysql.so ./cod4_lnxded ...your other parameters here...

(LD_LIBRARY_PATH might be optional)

kill3ill
13th June 2014, 19:57
When you say "next to your cod4 binary" you mean the cod4_lnxded (cracked file or original file?)

Thanks,

KB

IzNoGoD
13th June 2014, 20:23
No need for cracked lnxded file when you have sv_cracked with libcod

but ye, next to that file

YokohamaBG
5th July 2014, 11:22
Hi guys, a friend of mine has cod 4 legit game and when he start original server, but when people like me with cracked game try to join it says key code in use. When he starts cracked server everyone can join but need to have server ip adress cuz it dont shows up in the master server list, I followed the tutorial with hex editor and edited cracked server.exe now the server shows but says key code in use on cracked games. How to fix that.

IzNoGoD
5th July 2014, 22:28
Hi guys, a friend of mine has cod 4 legit game and when he start original server, but when people like me with cracked game try to join it says key code in use. When he starts cracked server everyone can join but need to have server ip adress cuz it dont shows up in the master server list, I followed the tutorial with hex editor and edited cracked server.exe now the server shows but says key code in use on cracked games. How to fix that.

Im pretty damn impressed by running a cod4 libcod enabled server or iptables mod with a .exe file...

Mitch
9th November 2014, 11:33
I tested my libcod cracked version for cod4, but it doesn't work yet. The server is currently rejecting the connection because of mismatched guid.

Edit: fixed the rejecting connection now

https://github.com/M-itch/libcod/commit/41e77ae260f697470896aa9e7ba9923472725116

Download ('set sv_cracked 1' to enable semi-cracked)
1.7: http://znation.nl/libcod/libcod4_1_7.so
1.7 (query limit): http://znation.nl/libcod/libcod4_1_7_l.so

I couldn't test it completely, because I am having trouble with my previous cod4 installation. I need to install cod4 correctly.

rgl12
28th March 2018, 00:50
I tested my libcod cracked version for cod4, but it doesn't work yet. The server is currently rejecting the connection because of mismatched guid.

Edit: fixed the rejecting connection now

https://github.com/M-itch/libcod/commit/41e77ae260f697470896aa9e7ba9923472725116

Download ('set sv_cracked 1' to enable semi-cracked)
1.7: http://znation.nl/libcod/libcod4_1_7.so
1.7 (query limit): http://znation.nl/libcod/libcod4_1_7_l.so

I couldn't test it completely, because I am having trouble with my previous cod4 installation. I need to install cod4 correctly.

In the coming days Ill try to make my servers available by the second libcod file.

Right me if Im wrong - my starting commands should be like this? :

LD_LIBRARY_PATH=. LD_PRELOAD=libcod4_1_7_l.so ./cod4_lnxded +set sv_punkbuster "0" + set net_port "28968" +exec hc.cfg +map_rotate

rgl12
29th March 2018, 13:18
Can someone provide me, to resolve my problem?


root@TeamSpeak:/home/cod4server# LD_LIBRARY_PATH=. LD_PRELOAD=libcod4_1_7_l.so ./cod4_lnxded +set sv_punkbuster "0" + set net_port "28966" +exec dedicated.cfg +map_rotate
> [WARNING] Compiled for: 4171
Compiled: Mar 13 2016 14:20:07 using GCC 4.8.4
Segmentation fault (core dumped)
root@TeamSpeak:/home/cod4server#


Im using Ubuntu 16.04 x64

voron00
29th March 2018, 13:32
Can someone provide me, to resolve my problem?


root@TeamSpeak:/home/cod4server# LD_LIBRARY_PATH=. LD_PRELOAD=libcod4_1_7_l.so ./cod4_lnxded +set sv_punkbuster "0" + set net_port "28966" +exec dedicated.cfg +map_rotate
> [WARNING] Compiled for: 4171
Compiled: Mar 13 2016 14:20:07 using GCC 4.8.4
Segmentation fault (core dumped)
root@TeamSpeak:/home/cod4server#


Im using Ubuntu 16.04 x64

Libcod for cod4 is no longer supported, use cod4x server if you want more features.

rgl12
29th March 2018, 13:33
any details? source?

voron00
29th March 2018, 13:34
https://cod4x.me/

rgl12
29th March 2018, 14:24
Libcod for cod4 is no longer supported, use cod4x server if you want more features.

What if I install gcc 4.8.4 library? libcod still wont be usable?