|
| 17 Dec 2011 03:55 PM |
----------------------------------------------------------------------------- Protecting Your Source Code - Two Methods -----------------------------------------------------------------------------
Well, you see, when you steal a place, the most important is the scripts. You can't do anything with just parts. So if you just protect your scripts, then your place is safe from place thieves.
But, how to protect your scripts? That's what this thread is going to teach you!
So we know that the source of functions can't be recovered once they're functions. Yep, I'm serious, take this as an example:
function lol() print "lol" end
The source of the function 'lol' can't be recovered. Of course, if you have the script, you can just look at the code of the function 'lol', but in this case, you don't have the script. You have access to the function, though, but all you can do is call it... which won't help you to steal them..
So you have two choices:
Choice 1: Put functions that are going to be called by scripts in _G. (AKA: the not-so-long-but-still-longer way)
You just run a script that registers all the functions that scripts in your game are going to use and that then destroys itself (it isn't needed anymore, as all the functions are now in _G). And then, the scripts just call the functions from _G. If a player manages to steal your scripts, all he will get is source code that calls _G functions, he won't be able to do anything with it, as he won't have these functions.
Choice 2: Put the source code of all your scripts in functions and put these functions in _G. (AKA: the faster and (surprisingly) safer way)
This way is not only faster, it is also safer, surprisingly. You'd expect a longer way to be safer, but in this case, it isn't. So you know that a whole script's source can be put as a function and calling that function will be exactly like running the script. So we just put the source of all our scripts as functions and register these functions in _G and then destroys itself (it isn't needed anymore, as the functions are all in _G, now). Then, the scripts will just call the _G functions.
If a player manages to steal your scripts, all he will get is single line scripts that call a function located in _G. So, lol, he's completely unable to do anything with these (all he'd have would be scripts like this: '_G.Script1()', lol, so he really couldn't do anything).
And you can even go further by removing the functions from _G once the script ran them. These functions aren't needed anymore. Then, the only place they'll be in is in the Lua VM's memory (no, seriously, I can't believe how safe this is, it's hilarious!).
There is no way around either of these methods. They're both completely safe. There is REALLY no way around any of them. The script that contained the source of the scripts and put them in _G destroyed itself and the functions can be called but their source can't be recovered (duh, the Lua VM already compiled them anyways, xD).
Note: I said that the source of a function can't be recovered once it is a function. It is true that you can recover a not-really-similar source by using string.dump on it and then using a Lua "decompiler" (which only 1/50000 ROBLOXians knows of, anyways) or recovering the source by knowing Lua assembly (that reduces the choices to stravant, NecroBumpist and some other people, but why would stravant or NecroBumpist steal your scripts? O_O) and being ready to waste 3 hours of time.
However, that doesn't matter, as you can't recover it anyways. They don't even have access to the functions, as they are server side, as _G is not replicated between the server and the client. So the only way to get a not-really-similar source would be to:
1. Create a script that recovers every function in _G, dumps them and then puts the dumped versions in StringValues. 2. Put every StringValue in UserSettings(). 3. Using a Lua "decompiler" (only 1/50000 ROBLOXians know about a such thing) or asking stravant or NecroBumpist or anyone else that knows Lua assembly (1/100000 ROBLOXians) to get back the source of all these functions.
So this method is really stealing-proof. Even most scripters in this forum would be unable to recover the source of your scripts and the few that could would need to waste 3 hours of time and anyways, they wouldn't even want to steal your place. Oh, and did I mention that, in the first place, they need to know that your functions are in _G? It's not like they even know about it if you don't tell them... |
|
|
| Report Abuse |
|
|
|
| 17 Dec 2011 03:56 PM |
| Thanks. But my places really aren't worth stealing. lol |
|
|
| Report Abuse |
|
|
Legend26
|
  |
| Joined: 08 Sep 2008 |
| Total Posts: 10586 |
|
|
| 17 Dec 2011 04:02 PM |
"You can't do anything with just parts"
You have no idea what you can do with just parts... |
|
|
| Report Abuse |
|
|
|
| 17 Dec 2011 04:06 PM |
"You have no idea what you can do with just parts..."
I do, but making a fun game with only parts is... kind of hard, don't you think?
Try making a fun game _THAT DOESN'T CONTAIN A SINGLE SCRIPT_. Good luck. |
|
|
| Report Abuse |
|
|
| |
|
TheMyrco
|
  |
| Joined: 13 Aug 2011 |
| Total Posts: 15105 |
|
|
| 17 Dec 2011 04:09 PM |
Or wrap the whole script in a coroutine and add this line after the coroutine:
script:Destroy()
~Myrco; Music lover, nederlands/dutch and a scripter |
|
|
| Report Abuse |
|
|
|
| 17 Dec 2011 04:10 PM |
"Can I use weapons?"
Yes, but only if they don't contain scripts (AKA: no, because a weapon that doesn't contain scripts is impossible). |
|
|
| Report Abuse |
|
|
Legend26
|
  |
| Joined: 08 Sep 2008 |
| Total Posts: 10586 |
|
|
| 17 Dec 2011 04:10 PM |
| Since when did a place have to be 'fun'? |
|
|
| Report Abuse |
|
|
TheMyrco
|
  |
| Joined: 13 Aug 2011 |
| Total Posts: 15105 |
|
|
| 17 Dec 2011 04:10 PM |
>THAT DOESN'T CONTAIN A SINGLE SCRIPT
Impossible, players have scripts in theirselves.
~Myrco; Music lover, nederlands/dutch and a scripter |
|
|
| Report Abuse |
|
|
|
| 17 Dec 2011 04:16 PM |
"Impossible, players have scripts in theirselves."
Players aren't a part of the place. Duh. |
|
|
| Report Abuse |
|
|
|
| 17 Dec 2011 04:24 PM |
| Oh, and the CoreScripts don't count either. They're not a part of the place, they're not even saved with the place, actually. They're recreated when the server runs. |
|
|
| Report Abuse |
|
|
|
| 17 Dec 2011 04:38 PM |
| All I can say to this. Genius. Sadly, none of my places are worth stealing. :/ |
|
|
| Report Abuse |
|
|
|
| 17 Dec 2011 06:11 PM |
"All I can say to this. Genius."
thx.
Yay, now, I'm a genius! :D |
|
|
| Report Abuse |
|
|
HatHelper
|
  |
 |
| Joined: 02 Mar 2009 |
| Total Posts: 46305 |
|
| |
|
Varp
|
  |
| Joined: 18 Nov 2009 |
| Total Posts: 5333 |
|
|
| 17 Dec 2011 07:13 PM |
How do you put a function in _G without having a script with the function's source? Wouldn't the script that puts them there have to exist before the place execution starts?
Also, "protecting" your scripts implies someone's trying to steal it. The fact is that, firstly, people aren't trying to steal your script. Secondly, people aren't after the source of your script unless they're trying to learn to script; they're more interested in being able to utilize your script without ever seeing how it works. So you might foil a few prospective scripters, but no one else. |
|
|
| Report Abuse |
|
|
TheMyrco
|
  |
| Joined: 13 Aug 2011 |
| Total Posts: 15105 |
|
|
| 17 Dec 2011 07:16 PM |
@Hat: I was before you, my chromosons...just...perfection!
~Myrco; Music lover, nederlands/dutch and a scripter |
|
|
| Report Abuse |
|
|
|
| 17 Dec 2011 07:25 PM |
"How do you put a function in _G without having a script with the function's source? Wouldn't the script that puts them there have to exist before the place execution starts?"
Yep. And once it ran and put all the functions in _G, it destroys itself (script:Destroy()) so players can't find the source from it. Even if the script that put a variable in _G is destroyed, the variable still exists in _G...
"Also, "protecting" your scripts implies someone's trying to steal it. The fact is that, firstly, people aren't trying to steal your script. Secondly, people aren't after the source of your script unless they're trying to learn to script; they're more interested in being able to utilize your script without ever seeing how it works. So you might foil a few prospective scripters, but no one else."
Well, actually, if someone steals it, the place won't work at all, it will have nothing else than parts. He'd need to remake all the scripts. |
|
|
| Report Abuse |
|
|
Corecii
|
  |
| Joined: 06 Aug 2010 |
| Total Posts: 687 |
|
|
| 17 Dec 2011 07:52 PM |
Steps to steal scripts in place: 1) Make sure you can access the ability to run a script in game. 2) Insert a new script with a source that: (if you can't put one in directly, use CharacterAppearance stuff) 2.1) The script should get all functions in _G then 2.2) Create a StringValue in Workspace with the dumped source 2.9) Then you can steal the dumped source 3) With the dumped source, you can use one of those converter things to convert it (if those really work). 4) You won't have the EXACT source, but it'll do the same, and you can modify it. 4) OmgHai 5) You stole the place |
|
|
| Report Abuse |
|
|
|
| 17 Dec 2011 08:33 PM |
"Steps to steal scripts in place: 1) Make sure you can access the ability to run a script in game. 2) Insert a new script with a source that: (if you can't put one in directly, use CharacterAppearance stuff) 2.1) The script should get all functions in _G then 2.2) Create a StringValue in Workspace with the dumped source 2.9) Then you can steal the dumped source 3) With the dumped source, you can use one of those converter things to convert it (if those really work). 4) You won't have the EXACT source, but it'll do the same, and you can modify it. 4) OmgHai 5) You stole the place"
You also have to know that the functions are in _G in the first place. How could you guess it?
You know, I got an idea that would allow you to just put '_G.RunScript()' in every script. Yes, the exact same function. That function just checks getfenv(0)["script"] to know which script called it and runs the appropriate function. ;)
That way, there is literally no way _AT ALL_ to steal the code, as the only place it is contained in is the server side memory of the RunScript function, meaning the only thing that can access it is the Lua VM, which you do strictly not have access to.
kthxbai, my method has no flaws at all, even a decompiler wouldn't help, you can't even access the function, therefore, you can't dump it. :) |
|
|
| Report Abuse |
|
|
cool12309
|
  |
| Joined: 21 Sep 2008 |
| Total Posts: 1442 |
|
|
| 17 Dec 2011 09:26 PM |
| so how do you edit it once you put it in _G... |
|
|
| Report Abuse |
|
|
|
| 17 Dec 2011 09:34 PM |
"so how do you edit it once you put it in _G..."
You don't. Anyways, you couldn't, even without using this method. It's not like you can access and edit Script.Source, anyways. :)
I think you didn't get the point of this. You edit the code either directly in the script, either by putting it back in the original script, etc... |
|
|
| Report Abuse |
|
|
|
| 17 Dec 2011 09:35 PM |
| This would only occur in online servers, you could still edit it in edit mode. You put it in _G. in an online server so it cannot be edited/stolen |
|
|
| Report Abuse |
|
|
|
| 17 Dec 2011 09:36 PM |
| meh, I need a time machine to return all of my latetoast. |
|
|
| Report Abuse |
|
|
br45entei
|
  |
| Joined: 06 Nov 2010 |
| Total Posts: 1058 |
|
|
| 18 Dec 2011 12:47 AM |
VERY cool, using posted methods, tracking thread, favoriting web page.
~entei~ ~ http://www.roblox.com/Secret-item?id=67830298 ~ |
|
|
| Report Abuse |
|
|
|
| 18 Dec 2011 01:56 AM |
I made a script that uses a variant of these methods. It is available here:
http://www.roblox.com/Forum/ShowPost.aspx?PostID=59740641 |
|
|
| Report Abuse |
|
|