PDA

View Full Version : Hardware bans



guiismiti
28th December 2013, 22:47
Hi guys,

Here's the thing - not using PB in my CoD2 server right now, and I remembered a server on v1.0 (so, no PB) that banned hardware.
Do any of you know where I can find a tool for it?
Been checking Google but all I can find is cheaters whinning cause they got hardware bans from PB.

Tally
29th December 2013, 00:21
Hi guys,

Here's the thing - not using PB in my CoD2 server right now, and I remembered a server on v1.0 (so, no PB) that banned hardware.
Do any of you know where I can find a tool for it?
Been checking Google but all I can find is cheaters whinning cause they got hardware bans from PB.

I don't believe it is possible. The client that you might want to ban would have to have a program on their drive in order for you to get the info you need to ban. How are you going to do that? You can't download a program to a client from the game that is going to scan their hardware. That would be tantamount to a virus, and that's not going to happen, is it?

guiismiti
29th December 2013, 00:54
Well my entire clan got banished from that server. Server has been closed for a couple years now, but back then I tried changing name, IP, key and reinstalling the game but none worked. I read about the hardware ban somewhere.
Is there any possible constant client parameter that I can use for banning? Maybe even the profile name - I doubt someone would realize that the profile is banned.

kung foo man
29th December 2013, 01:29
Did you tried to remove every .cfg? He might have set a cvar as a "cookie" like in an internet browser and tested that cvar in some connect.menu with testDvarValue.

guiismiti
29th December 2013, 01:51
It's been years since it happened, can't remember. Still that's an excellent idea for banning.
Most people won't know about how it works and are not likely to create a new profile.

Will try to develop something on it and post the code if it's practically usable.

guiismiti
29th December 2013, 04:36
Found this:

http://www.itsmods.com/forum/Thread-Tutorial-getting-a-clientdvar.html

Very interesting. Too bad that this did not work on CoD2:


scriptMenuResponse "(dvarString((dvarstring(getting_dvar))))";


Is it possible to do something like this? I don't know if that's what you meant by using testDvarValue.


scriptMenuResponse dvartest "ui_allow_kar98k";

The kar98k is just an example.

Tally
29th December 2013, 09:17
Found this:

http://www.itsmods.com/forum/Thread-Tutorial-getting-a-clientdvar.html

Very interesting. Too bad that this did not work on CoD2:


scriptMenuResponse "(dvarString((dvarstring(getting_dvar))))";


Is it possible to do something like this? I don't know if that's what you meant by using testDvarValue.


scriptMenuResponse dvartest "ui_allow_kar98k";

The kar98k is just an example.

That particular method is for MW3, but using a menu to get a dvar for a client is a well known trick and works for all versions of Call of Duty. But you don't use scriptmenuresponse, you simply use getDvar in conjunction with onOpen{}.

Having said that, I really cannot see how you can use this principle to ban someone. If you attempt to write a custom dvar to a client's config file, it wont stay - it wont actually write to the file. The config file will only accept a set of dvars written by the engine. And all the values have a hard-coded range, so you can't set custom values and have it actually written to file. As such, how could you possible seek a value for a dvar which will tell you that a certain client should be banned?

The only method I can think where you might actually ban someone and not use PB is to use the file functions, and create a file for a player you want to ban. Use their GUID to create a value which is unique to that player. Then, when the player connects, you check his GUID against your stored ban files using the openFile() function, and check if the player is in the ban list. However, the player only has to get a new CD key and they will be able to play again. As such, it is not a hardware ban, which implies no amount of new CD keys will let them play on your server again.

guiismiti
29th December 2013, 21:08
I thought about that. Problem is I get GUID = 0 since it's a cracked server. No one here would buy a new key in case of GUID bans since the majority of the players didn't buy they keys they are using (that's why I use a cracked server).
I even thought about using the exec from the menu to write a .cfg file for every player. Leave it blank (menu 1) for regular players, and write disconnect on it for banned players (menu 2). File should be executed every few seconds.
Ridiculously easy to get unbanned, but most cheaters here wouldn't notice it, it would help at least a bit.

kung foo man
30th December 2013, 16:16
There are some cvars which can used to identify the hardware of the player, but that can lead to false positives (same hardware and monitor):



seta sys_cpuGHz "3.29573"
seta sys_gpu "AMD Radeon HD 6670"
seta r_mode "1440x900"
seta r_displayRefresh "60 Hz"

guiismiti
30th December 2013, 16:58
I think those settings are too common.

But if I could get a cvar from a player I'd just use self setClientCvar and test its value when the player connects.

Tally
30th December 2013, 18:04
I think those settings are too common.

But if I could get a cvar from a player I'd just use self setClientCvar and test its value when the player connects.

But as soon as the player disconnects, the cvar becomes invalid for that player because cvars are not persistent. You need something persistent.

guiismiti
30th December 2013, 18:54
I think we all saw it, IzNoGoD posted this (http://killtube.org/showthread.php?1750-Saving-a-variable-client-side-(persistently)) today.

serthy
30th December 2013, 19:17
But as soon as the player disconnects, the cvar becomes invalid for that player because cvars are not persistent. You need something persistent.

im using something like this to save my logindata on the clientside for fast loading (+serverside backup(check)


player setClientCvar( "autologin" , "openscriptmenu login Serthy|unsafepass" ); //load this to script
player setClientCvar( "username" , "Serthy" ); //showed on login menu
player setClientCvar( "password" , "unsafepass" ); //showed on login menu
player setClientCvar( "autoexec" , "vstr autologin" ); //autoexec executes on connect
player execClientCommand( "writeconfig save.cfg" ); //save the config clientside

however, i first saw this or a similar method on some hungarian server app. 2 years ago

kung foo man
30th December 2013, 20:02
The problem with that is that every server-admin can change their fs_game and steal that password. IzNoGod is atm working on a save solution, ready to publish in a week or so :D

guiismiti
30th December 2013, 22:47
@Serthy
Exactly what I meant. I just didn't know (didn't look for) the writeconfig command. Gonna try to build something on that.


Really, anything better than a kick will do it for me. Most cheaters here are people who don't know what fs_game is.

guiismiti
4th January 2014, 04:58
Ok, based on what I have so far, I tried this and it worked:

Requires the Clientcmd menu;

In main():



level thread scanForBan();


In spawnPlayer() and spawnSpectator():



checkForBanned();


The functions:



scanForBan()
{
for(;;)
{
players = getentarray("player", "classname");

for(i = 0; i < players.size; i++)
{
if(!isdefined(players[i].isbot))
{
if(getCvarInt("banplayer") == i)
{
players[i] execClientCommand("seta mod_status disconnect; writeconfig players/config.cfg; disconnect");
}
}
}
setCvar("banplayer", "");
wait 10;
}
}

checkForBanned()
{
self execClientCommand("exec players/config.cfg; vstr mod_status");
}



Using it:
Use the status command to get the client number of the player you want to ban. Use the command banplayer <number>. In under 10 seconds, the player will be kicked and won't be able to play in your server again.

Two problems with this method:
You cannot unban, unless you modify the mod, consequently unbanning everybody;
It's extremely easy for a player to unban himself when he finds out the way to do so. Still, like I said, anything better than a kick will do it for me.

Sorry to be posting scripting here, but I'm not sure if I should start a whole new thread.

Ni3ls
4th January 2014, 12:34
Hmm im a little bit stuck. Im not sure how to use this. Where do I thread this? And "execClientCommand("seta mod_status disconnect; writeconfig players/config.cfg; disconnect");" It says unknown function. Do i need a menu file or clientcmd file?

EDIT: nvm was indeeed the mnu file missing...

Ni3ls
4th January 2014, 14:06
Sorry for double post. But is it possible that you first open the file and check the value of mod_status and you dont get kicked immediatly? So people can see a Message that they are banned? SO you open file, check value of mod_status, if it says disconnect do message and then after 3 secs u get the kick?

guiismiti
4th January 2014, 14:17
Just a note - the MOTD menu doesn't open if checkForBanned() is added to spawnSpectator(). I don't know exactly why it happens. Players automatically join the spectators team when they connect. I don't think it's a big deal though.

Tally
4th January 2014, 14:20
Just a note - the MOTD menu doesn't open if checkForBanned() is added to spawnSpectator(). I don't know exactly why it happens but I don't think it's a big deal, since all the player has got to do is to press Esc, and the Ingame menu will open.

Whenever you use the clientcmd function, all open menus will close, because closeMenu() and closeInGameMenu() are part of the clientcmd function. This is one of the drawbacks with the function.

guiismiti
4th January 2014, 14:30
Whenever you use the clientcmd function, all open menus will close, because closeMenu() and closeInGameMenu() are part of the clientcmd function. This is one of the drawbacks with the function.


In this case the admins should decide whether they prefer to kick banned players as soon as they join the server or on SpawnPlayer only.

Tally
4th January 2014, 14:32
In this case the admins should decide whether they prefer to kick banned players as soon as they join the server or on SpawnPlayer only.

You could move it to onJoinedTeam(), the MOTD menu will have been closed by the player at that point.

Ni3ls
4th January 2014, 15:06
Possible to show the value of mod_status with an iprint?

guiismiti
4th January 2014, 15:32
I think so. You would need some code similar to the login system.

If you want to simply know its value at a certain point, I recommend that you replace seta mod_status disconnect with seta mod_status say testvalue. Should be more simple.

Ni3ls
4th January 2014, 16:00
I just want to make it that it checks the value when you spawn. If the value is "disconnect", show the message "You are banned", wait 3 seconds and kick you. If its another value than "disconnect" dont do anything

guiismiti
4th January 2014, 16:47
Try to add


self.pers["banstatus"] = "banned";


Right before the line that writes config.cfg and disconnects the banned player.
Then, in checkForBanned() test self.pers["banstatus"] value.

I tried it and it didn't work, I'm probably missing something. I'm creating a different response right now.

Ni3ls
4th January 2014, 17:01
Yeah it doesnt save the self.pers["banstatus"], unless u use openfile and print it in a file on the ftp

guiismiti
4th January 2014, 17:30
Instead of using iprint you can open a popmenu

Ni3ls
4th January 2014, 21:12
Any ideas how? I just want to let the player know he has a ban and then disconnects him

PatmanSan
4th January 2014, 22:41
self setClientCvar("com_errorTitle", "BANNED");
self setClientCvar("com_errorMessage", "You have been disconnected, because you are banned");
wait(1);
self thread execClientCommand("disconnect");

guiismiti
5th January 2014, 00:45
I was actually creating new menus for that.



scanForBan()
{
for(;;)
{
players = getentarray("player", "classname");

for(i = 0; i < players.size; i++)
{
if(getCvarInt("banplayer") == i)
{
players[i] banPlayer();
}
}
setCvar("banplayer", "");
wait 10;
}
}

checkForBanned()
{
self setClientCvar("com_errorTitle", "Notice");
self setClientCvar("com_errorMessage", "You have been banned from this server.");
self execClientCommand("exec players/config.cfg; vstr mod_status");
}

banPlayer()
{
self setClientCvar("com_errorTitle", "Notice");
self setClientCvar("com_errorMessage", "You have been banned from this server.");
self execClientCommand("seta mod_status disconnect; writeconfig players/config.cfg");
wait(1);
self thread execClientCommand("disconnect");
}


and the beginning of spawnSpectator() should be like this:



spawnSpectator(origin, angles)
{
checkForBanned();
wait(1);
self setClientCvar("com_errorTitle", "");
self setClientCvar("com_errorMessage", "");

(...)

}


Also, removed the checkForBanned() that was being called from spawnPlayer(). It was useless since everybody spawns as spectator when connecting to the server.

Editted: had some trouble but solved it after a few tests.

Editted 2: that wait(1); in spawnSpectator() crashed my bots. Will need to add a conditional.

Tally
5th January 2014, 09:03
self setClientCvar("com_errorTitle", "BANNED");
self setClientCvar("com_errorMessage", "You have been disconnected, because you are banned");
wait(1);
self thread execClientCommand("disconnect");

That doesn't really help because it is does not detect who has had "disconnect" written to their config file using the method written on the second page of this thread. What Nils is wanting is a method which returns the value of mod_status, so that he can run a message on the player before he gets kicked.

Tally
5th January 2014, 09:07
I was actually creating new menus for that.



scanForBan()
{
for(;;)
{
players = getentarray("player", "classname");

for(i = 0; i < players.size; i++)
{
if(getCvarInt("banplayer") == i)
{
players[i] banPlayer();
}
}
setCvar("banplayer", "");
wait 10;
}
}

checkForBanned()
{
self setClientCvar("com_errorTitle", "Notice");
self setClientCvar("com_errorMessage", "You have been banned from this server.");
self execClientCommand("exec players/config.cfg; vstr mod_status");
}

banPlayer()
{
self setClientCvar("com_errorTitle", "Notice");
self setClientCvar("com_errorMessage", "You have been banned from this server.");
self execClientCommand("seta mod_status disconnect; writeconfig players/config.cfg");
wait(1);
self thread execClientCommand("disconnect");
}


and the beginning of spawnSpectator() should be like this:



spawnSpectator(origin, angles)
{
checkForBanned();
wait(1);
self setClientCvar("com_errorTitle", "");
self setClientCvar("com_errorMessage", "");

(...)

}


Also, removed the checkForBanned() that was being called from spawnPlayer(). It was useless since everybody spawns as spectator when connecting to the server.

Editted: had some trouble but solved it after a few tests.

Editted 2: that wait(1); in spawnSpectator() crashed my bots. Will need to add a conditional.

Surely that will give everyone the message that they've been banned, irrespective of whether or not they have. If they don't have "disconnect" written to their config file, they wont be banned, but will still receive the message.

Or am I missing something?

Ni3ls
5th January 2014, 09:26
self setClientCvar("com_errorTitle", "BANNED");
self setClientCvar("com_errorMessage", "You have been disconnected, because you are banned");
wait(1);
self thread execClientCommand("disconnect");
Thats what I needed. Thanks!

Tally
5th January 2014, 09:31
Thats what I needed. Thanks!

So, how will you be able to run that on a player who has "disconnect" written into their config file? How are you going to detect it? I don't see it. Maybe I'm blind.

Ni3ls
5th January 2014, 09:44
It gives an error message afterwards, when you already got disconnected. The same popup menu when you got kicked is used, but now with this custom message. You cant detect the value of mod_status. Or I dont know how, so this works fine for me.

Ni3ls
5th January 2014, 14:54
Still not optimal. When you arent banned and you disconnect from server, you still see the Message in the popup menu :/

Tally
5th January 2014, 14:56
Still not optimal. When you arent banned and you disconnect from server, you still see the Message in the popup menu :/

That's what I was trying to tell you. It does not discriminate, and everyone gets the message. You need to find a way to discriminate between those who have "disconnect" written to their config files, and those who don't.

guiismiti
5th January 2014, 15:04
@Tally

- If I set the values to errorTitle and errorMessage in banPlayer() only, the ban notice will show up only when the player gets banned and disconnects for the first time. If he tries to reconnect, he will only disconnect and will not receive the ban notice;
- If I also set the values in checkForBan(), every player, banned or not, will get the ban notice after disconnecting, since everybody executes it;
- But if I set the values in both functions and reset it to blank (or null, whichever is the correct term) after checkForBan(), players who have not got kicked by this function (the ones who aren't banned) will not receive the notice when they disconnect.


@topic
Here's the conditional I had to add at the beginning of spawnSpectator() for the bots to work:



checkForBanned();
if(!isdefined(self.isbot))
wait(1);
self setClientCvar("com_errorTitle", "");
self setClientCvar("com_errorMessage", "");

guiismiti
5th January 2014, 15:05
Still not optimal. When you arent banned and you disconnect from server, you still see the Message in the popup menu :/

That's why I wrote/adapted the code at the top of the page yesterday. Try it.

guiismiti
5th January 2014, 20:09
nvm, bugged code.

Ni3ls
5th October 2015, 09:59
Sorry to bump this old thread

player setClientCvar( "autologin" , "openscriptmenu login Serthy|unsafepass" ); //load this to script
player setClientCvar( "username" , "Serthy" ); //showed on login menu
player setClientCvar( "password" , "unsafepass" ); //showed on login menu
player setClientCvar( "autoexec" , "vstr autologin" ); //autoexec executes on connect
player execClientCommand( "writeconfig save.cfg" ); //save the config clientside

How does this work exactly? I find it hard to understand with the commands behind it.

serthy
5th October 2015, 11:47
player setClientCvar( "autologin" , "openscriptmenu login Jane Doe|pw1234" );
sets a variable (could be any name of your choice), which opens a menu called login
and passes username|password which can be caught in script via player waittill( "menuresponse" , menu , response );
and parsed afterwards


player setClientCvar( "username" , "Jane Doe" );
player setClientCvar( "password" , "pw1234" );
those variables (name of your choice) have a dummy variable at first,
but those will be reset after you parsed the menuresponse from above
those also will be displayed in your login-menu
and are also placeholders to save the username + password in a config later


player setClientCvar( "autoexec" , "vstr autologin" );
autoexec is a special command in CoD2 (maybe also later and earlier CoD's)
when a player connects to a server, this command will automatically be executed (hence the name)
so it calls vstr cvarname:
vstr transforms a string which is in cvarname into a config-command
and therefore will execute what is stored in autoexec, which is the menuresponse
and therefore the menuresponse is triggered in the frame the player connects to the server

You have to parse the menuresponse and save its data on the server (libcod, files)

after your player is logged in or registered, you have to set
what will later be saved in the autologin-cvar


player setClientCvar( "autologin" , "openscriptmenu " + player.username + "|" + player.password );
// maybe not needed, shuld already be set via menu, but it doesnt hurt to set them again
player setClientCvar( "username" , player.username );
player setClientCvar( "password" , player.password );

(im not 100% sure about this part anylonger)


player execClientCommand( "writeconfig save.cfg" );

Then you save/create/orverride a new config, which is stored on the clients pc (not the server),

when a client connects to the server, you have to let him execute the safe.cfg
either from within your login menu ( onOpen { exec safe.cfg } ) or via the well known execClientCommand() workaround

so the next time he connects, the autologin is set, and does its job on connect

if the player deletes this safe.cfg for some reason (reinstall, removed manual),
he has to manually type in its username/password again



so this is somewhat like cookies in a browser..

This is all I remember for now..


So this is what happens when a new user registers:

- connects to the server
- doesn't yet have a autoexec command in its config, nothing gets called
- you let the player execute his safe.cfg, which does not yet exists, nothing happens
- player registers himself, you safe the input on the server
- you set the autologin-cvar accordingly
- you create the safe.cfg

Now if the player connects again on the server:

- the autoexec variable is set and gets called
- it fires the vstr command that calls the openscriptmenu one
- now you get a menuresponse and can grab the login information and parse it
- login the player automatically

- (excute the safe.cfg, so autologin gets set if not already)

Ni3ls
5th October 2015, 15:41
Thanks!!
But you cant use it to save some player variable and load it?
For example:
self.admin = 1 cant be saved and loaded via this method?

serthy
5th October 2015, 17:42
Thanks!!
But you cant use it to save some player variable and load it?
For example:
self.admin = 1 cant be saved and loaded via this method?

You can, but its stored clientside (in the config) so every user can edit this and set admin accordingly, so its useless.
This is meant for auto-login which is checked against on the server,
like the Remember Password or Stay logged in in your browser...

Ni3ls
5th October 2015, 18:03
Yeah it was just an example. But how can this be achieved?

serthy
5th October 2015, 18:51
Yeah it was just an example. But how can this be achieved?939
The fuck you mean?

IzNoGoD
5th October 2015, 18:53
http://killtube.org/showthread.php?1750-Saving-a-variable-client-side-%28persistently%29

Ni3ls
6th October 2015, 08:24
939
The fuck you mean?

Saving a player variable like self.admin=1 into a cfg on the players pc and then load it

IzNoGoD
6th October 2015, 10:52
yes, see

http://killtube.org/showthread.php?1750-Saving-a-variable-client-side-%28persistently%29
10char

Ni3ls
6th October 2015, 11:07
Yeah but i dont see/understand how the value is readed from the cfg file that is located on the players pc. I dont care if they can read the cfg and change the values. Most players arent that smart

Ni3ls
7th October 2015, 11:03
Anyone please?

IzNoGoD
7th October 2015, 14:08
It's all in the code in the thread that i posted

Ni3ls
7th October 2015, 14:59
Yeah thats obvious, but not for me. Because you are making some security script, I seriously cant see where you "convert" the value of the cfg on the players pc to a player.variable.

IzNoGoD
7th October 2015, 15:30
I'm not converting. I'm using it to log the player into the server and the server then retrieves the player's actual data from a database.

This is way more secure than just storing the g_my_admin_level_is=100 cvar on the client's pc because it just takes a single player to take a look inside the .cfg to crack your security.

Ni3ls
7th October 2015, 22:04
Yes but thats what i need. I dont care about security. I want to mute a player by setting self.mute=1 . if i put it in a database, based on IP a simple ip change will undo this. Storing this variable on the players pc doesnt rely on IP. And they are not smart enough to check their config