Jump to content

[TUT] Scripting Security


Anubhav

Recommended Posts

Today while I was thinking of a security. Some people compile thier scripts but the server gets hacked and they steal the server side. So why not make a script which WON'T WORK ON THE SERVER AT ALL? That would protect your scripts and prevent being leaked!

Some functions you can use:

  
local serverName = getServerName() 
  
function blablabla() 
      if serverName == "Your server name here" then  
            -- your script starts! 
end 
end 
  

Make sure to compile it.

See? Whenever blablablaba function starts you should make this check. You can even use setElementData! Something like this would work:

First script:

  
local sec = false 
function enableAccount(source) 
       if getAccountName(getPlayerAccount(source)) == "adminAccName" then -- to check if the acc name is of admin then only! Keep your acc name! 
            setElementData( root, "serverProtected", true ) 
            sec = true 
      end 
end 
addCommandHandler("enableSecurity", enableAcconut) 
  
function join() 
      if sec == true then 
            setElementData( root, "serverProtected", true ) 
end 
end 
addEventHandler("onPlayerLogin", root, join) 
  

And in your another script you can use

getElementData( root, "serverProtected")

Like this:

  
function one() 
      if getElementData( root, "serverProtected" ) == true then 
end 
end 
  

Please remember to compile them. This will make your security system more better. Please tell some scripters who din't visit this page to do. It can help them to. I'll be finding more things to improve MTA SA security. :)

Edited by Guest
Link to comment

1. What's point of this? Un-encrypting and decompiling the scripts is pretty easy if you know how to do it, and hacking a server is much harder. So if someone succeeds to hack whole server, he surely knows how to decompile/unencrypt the scripts, so it's kinda useless.There aren't really much people who would just hack into server and run compiled/encrypted scripts.

2. Your element data would fail after some time.

You put element data to everyone that server is "protected" and after someone else joins who previously hasn't, he won't have that element data.Same thing if some player reconnects. And the result would be that server is unprotected and script(s) would fail to load.

Link to comment
1. What's point of this? Un-encrypting and decompiling the scripts is pretty easy if you know how to do it, and hacking a server is much harder. So if someone succeeds to hack whole server, he surely knows how to decompile/unencrypt the scripts, so it's kinda useless.There aren't really much people who would just hack into server and run compiled/encrypted scripts.

2. Your element data would fail after some time.

You put element data to everyone that server is "protected" and after someone else joins who previously hasn't, he won't have that element data.Same thing if some player reconnects. And the result would be that server is unprotected and script(s) would fail to load.

1. Decompiling is not possible if you tick the Encrypt button and Anti-Decompile.

2. Thanks for telling, I din't noticed that!

Link to comment
  • 2 weeks later...
  • 9 months later...

I liked your attempt but this type of security doesn't work very well. If someone who knew basic scripting got a hold of these, they could simply create a new file and override the getServerName function.

Something like this would work:

function getServerName ( ) 
     return "The the required name"; 
end 

Link to comment
  • 5 months later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...