Server's files differ from Client's. Cant check CRC

Hi, I’m trying to compare a client’s files and the server’s files CRC for anti cheat purposes

http://puu.sh/7ooJl.png

Yet, this file differs from the servers.

Does anyone know why the default file is different from the servers? (I verify’d my cache, still is fucked up)

You can show us your code maybe something wrong with it.

-snip-

Did you try deleting your cache folder?

Fixed it, I forgot you cant file.read file sent from the server. Now the problem I’m having is this.

contents of catch.lua

print(file.Exists(“lua/catch.lua”, “mod”))
print(file.Read(“lua/catch.lua”, “mod”))

] lua_openscript_cl catch.lua
Running script catch.lua…
true

It cant read it, but it know’s it exists? what the hell?

Try file.Read(“catch.lua”, “LUA”))?

No difference.

I’ve always noticed since the new path stuff was added (mod/data/lua/lsv) the file functions seem to act broken sometimes. It’s really frustrating. Try using “lsv” for the path, I believe this has happened to me before.

I see no error in your code. The only thing is that I don’t have a catch.lua in lua/ so I tried it on test.lua

[lua]] readfile lua/ test.lua
true

if ( !kinect.IsAvailable() ) then return end

if ( !kinect.IsActive() ) then
MsgN( “Stop Using…” )
MsgN( kinect.Stop() )

MsgN( "Start Using.." )
MsgN( kinect.Start() )

end

…[/lua]

using:

[lua]concommand.Add( “readfile”, function( ply, cmd, args )
print( file.Exists( args[ 1 ] … args[ 2 ], “MOD” ) );
print( file.Read( args[ 1 ] … args[ 2 ], “MOD” ) );
end );[/lua]

with listdir showing:
[lua]] listdir lua/ *
[1] = functiondump.lua
[2] = send.txt
[3] = test.lua

[/lua]

using:
[lua]concommand.Add( “listdir”, function( ply, cmd, args )
local _files, _folders = file.Find( args[ 1 ] … args[ 2 ], “MOD” );
print( _files );
end );
[/lua]

Try listing the files… file.Read should be perfectly fine with how you’re running it. You may need to use PrintTable instead.

Additionally, the Exists won’t return true unless you’re spot on with the file-name and location of the directory such as MOD or LUA etc…

Fixed it somehow

cl side which sends to server

src is the path to file.
fr is file read
crc is uitl.crc
[lua]
scans[src] = true
local srcs = fr(src, “GAME”) || “”
local fcrc = crc(srcs)
validate_src(src, fcrc)
[/lua]

sv side which receives and checks

ffr is file.read
fcrc is util.crc

crc is the crc of the file received
[lua]

	local clrcs = ffr(s, "GAME") || ""
	local clcrc = fcrc(clrcs)
	
	if (file.Exists(s, "GAME")) && (clcrc == crc || "0") then
		scans[s] = true
		scans[crc] = true
		//print(s .. " exists")
		print()
	else
		scans[s] = false
		scans[crc] = false
		Ban(p, br)
	end

[/lua]

I think my lua state was literally just bulldozed by constant reconnects and I restarted, file.read started working.

Now I’m checking CRC’s and it seems to work fine, but Im’ worried.\

http://puu.sh/7oxMi.png

I know for a fact dcombobox CL/SV sides are different, so why does it says they’re not?

wtf :frowning:

[editline]9th March 2014[/editline]

Just checked, serverside version is 16 lines shorter than client-sides version. I don’t know why it let it through

[editline]9th March 2014[/editline]

client

http://puu.sh/7oydG.png

server

http://puu.sh/7oyg8.png

Yeah, CRC’s arent the same, yet it still let it through.

[lua]
local file_string = file.Read(path, “game”) || “”
local CRC = util.CRC(file_string)

	if (file.Exists(path, "GAME")) && (CRC_from_server == crc_from_client || "0") then[/lua]

made it more read-able.

Is this incorrect?

[editline]9th March 2014[/editline]

Fixed, it seems I was stupid, and did fuck up my if statement

[lua]
local clrcs = ffr(s, “GAME”) || “”
local clcrc = fcrc(clrcs)
print(s … " " … tostring(file.Exists(s, “GAME”)))
print(clcrc … " 's CRC")
print(crc … " 's client CRC")
print()

	if (file.Exists(s, "GAME")) && (clcrc == crc) then
		scans[s] = true
		scans[crc] = true
		print(s .. " exists")
		print()
	elseif (file.Exists(s, "GAME")) && (crc == "0") then
		scans[s] = true
		scans[crc] = true
		print(s .. " exists")
		print()
	elseif (table.HasValue(whitelists, s)) then
		scans[s] = true
		scans[crc] = true
		print(s .. " exists [whitelisted]")
		print()
	else
		scans[s] = false
		scans[crc] = false
		Ban(p, br)
	end[/lua]

Works, now I simply need to whitelist currently broken shit (according to srcds)

[editline]9th March 2014[/editline]

After looking further, Multiple gmod server side files that do not match the client’s, therefore the CRC is different.

Seems like this method cannot be used