Author Topic: Encrypt scripts?  (Read 928 times)

0 Members and 1 Guest are viewing this topic.

Offline elMorvano

  • Major(1)
  • Posts: 44
  • Center Of Soldat
    • Center Of Soldat
Encrypt scripts?
« on: April 07, 2014, 08:50:38 am »
Is there a way to protect my script against edit/ copy from file? I would like to do file with a password or something where only soldatserver could read this.

I would like share my scripts without possiblity to change it or copy.
www.facebook.com/coSoldat

Center Of Soldat

Offline Bonecrusher

  • Global Moderator
  • Veteran
  • *****
  • Posts: 1397
  • High above
    • Zabijaka.pl
Re: Encrypt scripts?
« Reply #1 on: April 07, 2014, 08:54:26 am »
I once saw this method being used, I believe it was one of Curt's or CurryWurst scripts.

check this out

http://wiki.freepascal.org/DCPcrypt

also simple "encrypt" in search bar will reveal this little gem of a thread
http://forums.soldat.pl/index.php?topic=41766.msg504645#msg504645
« Last Edit: April 07, 2014, 08:58:12 am by Bonecrusher »

Im chill like that

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Encrypt scripts?
« Reply #2 on: April 07, 2014, 11:31:20 am »
EnEsCe used to have a tool to encrypt scripts that only he had, and you had to ask him to encypt it. You might want to talk to Falcon or Mr about it and if encrypting is still supported and if there are any tools out there that can actually encrypt the script for you.

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: Encrypt scripts?
« Reply #3 on: April 07, 2014, 02:09:03 pm »
In theory from SC3 you can share only the bytecode generated by compiler (the .psb file), which should work out of the box. However in case of soldat, Shoozza asked me to implement a mechanism that would still verify if there's original source present, which will prevent bytecode loading if it's not found. He said that "private" or "closed source" scripts could possibly destroy scripting scene (because nobody would download/launch an unknown thing) or could be dangerous (pretty much same reasoning). So for now this file only serves a purpose of cache, so that server doesn't have to recompile sources over and over again.
However, if you convince Shoozza to change his mind, i'll be happy to remove that mechanics so that only .psb file can be shared.

In case you wanted to ask: What can be read from bytecode file?
IIRC it stores names off all function names (because server might want to call them, for instance events or CrossFunc()), all global variables (because server might want to check them or write to them) and all global types (not sure why is that). Body of functions is in some internal IL, all local variables are scrambled. There's also a decompiler bundled with pascalscript that can print all the info i've mentioned (that is, all global types, variable names and methods with their body written in "IL assembly").

As for the encryption that was already mentioned, it was broken long time ago. There is even some decryption tool available if you google long enough. So it'll secure your script, of course, but if somebody will want it hard enough, they can eventually get it*

*actually, decrypted SC2 script sources are kept in memory for entire server lifetime anyway so...
« Last Edit: April 07, 2014, 02:14:13 pm by FalconPL »
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

Offline jrgp

  • Administrator
  • Flamebow Warrior
  • *****
  • Posts: 5037
Re: Encrypt scripts?
« Reply #4 on: April 07, 2014, 09:45:06 pm »
Wouldn't it be possible to program, in any random language, your custom script logic into a .so/dll/dylib and then load that within your script (in a similar manner to the other scripts which interface to functions in dll's)

The hard part from this approach would be to call the scriptcore functions from within your compiled code but I think it's doable somehow.
There are other worlds than these