Networking
By intercepting http requests a majority of DRMs will stop working for security reasons. If addons like VCMod doesn't work any more, try disabling http.Fetch and http.Post inspection.
Hooks
swatch_networking_playerauthenticated
Called after player spawned and responded to the sWatch authentication.
After this you can use sWatch.sendLua.
Arguments
(Player) player
swatch_networking_runconsolecommand
Called when RunConsoleCommand
is executed serverside.
Arguments
(String) command
(Vararg) arguments
Returns
(Boolean) block -
false
to block the command from running
swatch_networking_fetch
Analogue to swatch_networking_post
Functions
sWatch.queryIPScore
Arguments
(String) IP-Address
(Player) player (optional)
(Function) callback
Example
local ip = ply:IPAddress()
// Extract IP-Address (remove port and block local addresses)
ip = sWatch.extractIP(ip, true)
if not ip then return end
sWatch.queryIPScore(ip, ply, function(data)
if not data or not data.success then return end
// your code here
end)
You have to first specify an API-Key in the ingame settings. Read more about the callback return value in the official API-Documentation: https://www.ipqualityscore.com/documentation/proxy-detection/overview
sWatch.isPlayerAuthenticated
A player is marked authenticated as soon as we receive our first response netmessage. This may took some time and happens after the PlayerInitialSpawn
hook is called.
This can be used together with sWatch.sendLua (see a example in section below).
Arguments
(Player|SteamID|SteamID64) player
Returns
(Boolean) isAuthenticated
sWatch.sendLua
This addon is fileless for the client. So no code is visible via a conventional filestealer. Every code gets send over netmessages and is then run via RunString
on the client. If protected
is set true, the code is compiled, compressed and encrypted to prevent manipulation and no RunString
is used.
Arguments
(Player|SteamID32|SteamID64) player
(String) code
(Boolean) protected (optional, default=false) - protection against code manipulation
(Boolean) cache (optional, default=false) - only necessary if protected=true. Makes protection faster for large payloads.
Example
// we can only send Lua to authenticated players
if sWatch.isPlayerAuthenticated(ply) then
sWatch.sendLua(ply, [[
for i = 1, 10 do
print(i)
end
// you can write arbitrary Lua code here
]])
end
// wait until the player has authenticated
hook.Add("swatch_networking_playerauthenticated", "my_hook", function(ply)
sWatch.sendLua(ply, [[
// you can write arbitrary Lua code here
]])
end)
sWatch.takeScreenshot
This is usually called via admin menu. If you want to call it manually on the server, the screenshot will get saved in the data folder. See the ingame options under 'Networking' and 'Screenshot' for more details. Make sure to enable this feature in your settings.
Arguments
(Player) player
(Player) creator -
nil
if not called via admin menu)
sWatch.netmessage
This functions creates a netmessage. The real message name gets randomized.
We can restrict the netmessage to our groups ("staff", "protected). If we recieve a message by player that is not allowed to, the message will get blocked and he will get (depending on your settings) punished.
Only use this when necessary, as you have to send the ransomized message name to the client. It is idealy for admin menu and anticheat payload.
Arguments
(String) messageName
(String) restrictedTo - ("staff", "protected" or leave empty for no restrictions)
Returns
(String) randomizedMessageName
Example
// create new netmessage as soon as the sWatch finish loading
hook.Add("swatch_init_loaded", "my_hook", function()
net.Receive(sWatch.netmessage("anticheat_detection"), function(len, ply)
print("received netmessage")
end)
end)
// send client request to send this netmessage
hook.Add("swatch_networking_playerauthenticated", "my_hook", function(ply)
sWatch.sendLua(ply, string.format([[
net.Start(%q)
net.SendToServer()
]], sWatch.netmessage("my_new_netmessage")))
end)
// create a netmessage that only staff members are allowed to send
net.Receive(sWatch.netmessage("staff_only_message", "staff"), function()
end)
// only by protected players
net.Receive(sWatch.netmessage("protected_only_message", "protected"), function()
end)
// by everyone
net.Receive(sWatch.netmessage("message"), function()
end)
sWatch.getNetmessage
Returns the original name of a netmessage
Arguments
(String) randomizedMessage
Returns
(String) originalMessageName (first argument of sWatch.netmessage)
sWatch.isInternalNetmessage
Returns true if the message was created with sWatch.netmessage.
Arguments
(String) netmessageName - can be eighter randomized or internal name
Returns
(Boolean) isInternal
sWatch.isFakenet
If enabled in settings, we create fake backdoors and exploits to trick hackers/cheaters/scriptkids into using them.
Arguments
(String) messagename
Returns
(Boolean) isFakenet
hook.Add("swatch_networking_incoming", "my_hook", function(client, strName, len)
local isFakeNet = sWatch.isFakenet(strName)
if isFakeNet then
print("Player used a fakenet")
client:Kick()
end
end)
sWatch.getExistingExploits
Analogue to sWatch.getExistingBackdoors. Returns a list of all exploits on your server.
Returns
(Table) exploits
Last updated