Re: anticheat
Posted: Thu Aug 24, 2017 12:06
https://www.youtube.com/watch?v=5NP8y63Ms4owhat is dat?! WDaFk is dat?!!
The official Minetest discussion board
https://forum.minetest.net/
https://www.youtube.com/watch?v=5NP8y63Ms4owhat is dat?! WDaFk is dat?!!
.......rnd wrote:https://www.youtube.com/watch?v=5NP8y63Ms4owhat is dat?! WDaFk is dat?!!
xD i love dat!rnd wrote:https://www.youtube.com/watch?v=5NP8y63Ms4owhat is dat?! WDaFk is dat?!!
It's been mentioned already in the thread, but it's not a GPL violation because rnd is the copyright author, he wasn't licensed the code to him under the GPL.Linuxdirk wrote:Exactly. It still violates the GPL terms.Naj wrote:Sources of "anticheat_routines.bin" are not distributed. It can't be called open source.azekill_DIABLO wrote:it's open source, it' under LGPL and you can find the public repo here : https://github.com/ac-minetest/anticheat/
Code: Select all
-- DO NOT INCLUDE THIS WITH SOURCES
-- THIS will produce anticheat_routines.bin.
-- instructions:
-- 1. uncomment in init.lua around line 80:
-- dofile(minetest.get_modpath("anticheat").."/anticheat_source.lua")
-- just run server and .bin is generated. Then comment it again.
-- how to use in code(already done):
-- local anticheat_routines=loadfile(minetest.get_modpath("anticheat").."/anticheat_routines.bin")
-- check_noclip, check_fly, check_player = anticheat_routines(minetest,cheat);
local anticheat_routines = function(minetest,cheat, CHECK_AGAIN, punish_cheat)
-- DETAILED NOCLIP CHECK
local check_noclip = function(pos)
local nodename = minetest.get_node(pos).name;
local clear=true;
if nodename ~= "air" then -- check if forbidden material!
clear = cheat.nodelist[nodename]; -- test clip violation
if clear == nil then clear = true end
end
if not clear then -- more detailed check
local anodes = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y+1, z=pos.z+1}, {"air"});
if #anodes == 0 then return false end
clear=true;
end
return clear;
end
-- DETAILED FLY CHECK
local check_fly = function(pos) -- return true if player not flying
local fly = (minetest.get_node(pos).name=="air" and minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name=="air"); -- prerequisite for flying is this to be "air", but not sufficient condition
if not fly then return true end;
local anodes = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y, z=pos.z+1}, {"air"});
if #anodes == 18 then -- player standing on air?
return false
else
return true
end
end
local round = function (x)
if x > 0 then
return math.floor(x+0.5)
else
return -math.floor(-x+0.5)
end
end
--main check routine
local check_player = function(player)
local name = player:get_player_name();
local privs = minetest.get_player_privs(name).kick;if privs then return end -- dont check moderators
if cheat.watcher[name] then return end -- skip checking watchers while they watch
local pos = player:getpos(); -- feet position
pos.x = round(pos.x*10)/10;pos.z = round(pos.z*10)/10; -- less useless clutter
pos.y = round(pos.y*10)/10; -- minetest buggy collision - need to do this or it returns wrong materials for feet position: aka magic number 0.498?????228
if pos.y<0 then pos.y=pos.y+1 end -- weird, without this it fails to check feet block where y<0, it checks one below feet
local nodename = minetest.get_node(pos).name;
local clear=true;
if nodename ~= "air" then -- check if forbidden material!
clear = cheat.nodelist[nodename]; -- test clip violation
if clear == nil then clear = true end
end
local fly = (nodename=="air" and minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name=="air"); -- prerequisite for flying, but not sufficient condition
if cheat.players[name].count == 0 then -- player hasnt "cheated" yet, remember last clear position
cheat.players[name].clearpos = cheat.players[name].lastpos
end
-- manage noclip cheats
if not clear then -- player caught inside walls
local moved = (cheat.players[name].lastpos.x~=pos.x) or (cheat.players[name].lastpos.y~=pos.y) or (cheat.players[name].lastpos.z~=pos.z);
if moved then -- if player stands still whole time do nothing
if cheat.players[name].count == 0 then cheat.players[name].cheatpos = pos end -- remember first position where player found inside wall
if cheat.players[name].count == 0 then
minetest.after(CHECK_AGAIN,
function()
cheat.players[name].count = 0;
if not check_noclip(pos) then
punish_cheat(name)-- we got a cheater!
else
cheat.players[name].count = 0; -- reset
cheat.players[name].cheattype = 0;
end
end
)
end
if cheat.players[name].count == 0 then -- mark as suspect
cheat.players[name].count = 1;
cheat.players[name].cheattype = 1;
end
end
end
-- manage flyers
if fly then
local fpos;
fly,fpos = minetest.line_of_sight(pos, {x = pos.x, y = pos.y - 4, z = pos.z}, 1); --checking node maximal jump height below feet
if fly then -- so we are in air, are we flying?
if player:get_player_control().sneak then -- player sneaks, maybe on border?
--search 18 nodes to find non air
local anodes = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y, z=pos.z+1}, {"air"});
if #anodes < 18 then fly = false end
end -- if at this point fly = true means player is not standing on border
if pos.y>=cheat.players[name].lastpos.y and fly then -- we actually didnt go down from last time and not on border
-- was lastpos in air too?
local lastpos = cheat.players[name].lastpos;
local anodes = minetest.find_nodes_in_area({x=lastpos.x-1, y=lastpos.y-1, z=lastpos.z-1}, {x=lastpos.x+1, y=lastpos.y, z=lastpos.z+1}, {"air"});
if #anodes == 18 then fly = true else fly = false end
if fly then -- so now in air above previous position, which was in air too?
if cheat.players[name].count == 0 then cheat.players[name].cheatpos = pos end -- remember first position where player found "cheating"
if cheat.players[name].count == 0 then
minetest.after(CHECK_AGAIN,
function()
cheat.players[name].count = 0;
if not check_fly(pos) then
punish_cheat(name)-- we got a cheater!
else
cheat.players[name].count = 0;
cheat.players[name].cheattype = 0;
end
end
)
end
if cheat.players[name].count == 0 then -- mark as suspect
cheat.players[name].count = 1;
cheat.players[name].cheattype = 2;
end
end
end
end
end
cheat.players[name].lastpos = pos
end
return check_noclip, check_fly, check_player;
end
-- this produces compiled version of source
local out = io.open(minetest.get_modpath("anticheat").."\\anticheat_routines.bin", "wb");
local s = string.dump(anticheat_routines);
out:write(s);
out:close()
Just for the sake of openness, can you post the password to the encrypted zip file, so we can at least verify that the file you posted before actually contains the same source, and you haven't changed a few bits here or there?rnd wrote:Im not regretting the obfuscation - just the responses are worth all of it - educational/hilarious. Just shows most people who pretend to be "experts" are just too lazy to do the work of learning how stuff works/checking stuff and trust "authority" instead - but they have no problem playing "experts" on stuff they dont really understand.
I think i got enough "insight" from comments now and will now disclose the source for anticheat - not that it will help cheaters since checks are randomized (yup, you all got trolled for the sake of me having fun reading forum responses).
Not entirely, because he has posted several revisions of the file online and it's entirely possible that some of them contained malicious code before:Byakuren wrote:Nobody was claiming that you included malicious code, only that you could have done it. Now that you've revealed the code, people can see it and verify that there isn't anything malicious. Everything is working as intended.
Indeed. And to all those "but but but... previous code could be potentially malicious" out there:Byakuren: Nobody was claiming that you included malicious code, only that you could have done it. Now that you've revealed the code, people can see it and verify that there isn't anything malicious. Everything is working as intended.
Whats stopping you from doing that yourself? Also in first post there is now password to previous zip file, which you can find in git history.red-001 could someone try and verify if the code posted is indeed the code used to compile the binary?
Kudos for doing this. Much appreciated.rnd wrote:Also in first post there is now password to previous zip file, which you can find in git history.
Its not all that BLACK and WHITE is it? Its like : this mod works in 90% of 'fly' and fails to catch '10%' of fly, but on the long run it will catch remaining 10% cause of randomness of it. Note that is far from 'trivial' to make 'fly' detect thatThis mod doesn't really work.
Well what you want me to do? In the small false fly detect percentage it would be better to kill possibly innocent player? I think not, but message is still good cause it helps spot cheaters.it does spot you it doesn't penalise you in any way
Alright then, let's use the anti-cheat method that is on the just_test server that routinely penalizes players with false positives, and has caused many people to leave that server.rubenwardy wrote:...and when it does spot you it doesn't penalise you in any way
That is like, really, unintelligent. Most multiplayer focused mods disable themselves when they are run in singleplayer mode.bosapara wrote:tested in single, but doesnt work at 4.17.1
My mistake. It was not in single. I mean it was in 'offline'.sofar wrote:That is like, really, unintelligent. Most multiplayer focused mods disable themselves when they are run in singleplayer mode.bosapara wrote:tested in single, but doesnt work at 4.17.1
Try running it on a server, and then logging on with an account that doesn't have the `server` priv, instead.
LEst translated this stupid sentence:rnd wrote: ↑Tue Aug 22, 2017 14:15We all know whats the "idea" with this "uncomfortable to read source" - stop beating around the bush.
I just wont make it easy for wannabe cheaters - end of story.
Also im not attacking anyone - you are, cause you want me to make it easy for you and i wont.
Maybe thats just how i like to program, using function someFunc0(INPUT_VAR_0_). I like that style :) If thats too hard for you dont bother then... If you check my other mods you will notice normal style. This is just for this particular mod.