Advertisement
estriole

EST_CS2 - SCRIPT CONTROL

Jun 14th, 2014
743
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 14.87 KB | None | 0 0
  1. =begin
  2.  ■ Information      ╒═════════════════════════════════════════════════════════╛
  3. #==============================================================================
  4. # EST_CS2 - SCRIPT CONTROL
  5. #==============================================================================
  6. # Author  : Estriole & caitsith2
  7. # Version : 2.0
  8. #==============================================================================
  9.  
  10.   #==============================================================================
  11.   # TDS - SCRIPT DISABLER
  12.   #==============================================================================
  13.   # Author  : TDS
  14.   # Version : 1.0
  15.   #==============================================================================
  16.  
  17.  ■ Changelog        ╒═════════════════════════════════════════════════════════╛
  18.  v1.0 2014.06.14     >     Initial Release
  19.  v1.1 2014.06.16     >     Add simple dumb encryption so the rvdata2 cannot read easily
  20.  v1.2 2014.06.18     >     Improve the dumb encryption with reverse method.
  21.                      >     Add REAL encryption using cypher method.
  22.                      >     Make the encryption and decryption as method.
  23.                      >     Add support for having crypt key hidden inside the hidden script
  24.                            so it's harder to crack. double encryption
  25.  v1.3 2014.06.27     >     Fix script folder cannot be changed. thx to caitsith2 for pointing it out.
  26.                      >     Add temp_key encryption to your hidden key. harder to crack
  27.  v1.4 2014.06.30     >     Add Triple encryption using caitsith2 code. (scramble method)  
  28.  v1.5 2014.07.04     >     Add Protection from write to file method. expert coder
  29.                            might still able to crack it. but it will be difficult.
  30.                            and if they can crack it... by logic. they're have the ability
  31.                            to create scripts better than what they want to steal anyway...
  32.  v1.6 2014.07.05     >     Removed the dumb encryption and reverse method. because there's
  33.                            potential it can ruin the scripts if it have trailing tokens.
  34.                            thanks to killozapit to point it out. this script already
  35.                            have better encryption anyway (cypher + scramble)
  36.  v1.7 2014.07.06     >     Improve the write to file prevention method by LOTS!
  37.                      >     Added protecion from script modification. so when this
  38.                            script changed after people decrypt the project...
  39.                            it will fail the decryption.
  40.                            coder that CAN crack this update only mean to test his/her
  41.                            skill not thinking on stealing your scripts :D
  42.                            if anyone can crack this. share with me please so i can
  43.  v1.8 - v1.9         >     Never released because can be cracked immediately
  44.                            after i add extra security... but i still left the code
  45.                            in 2.0 to make extra steps that thief have to do before
  46.                            they can crack this script...
  47.  v.2.0               >     Since any prevention method (in v.1.8 / v.1.9) can be
  48.                            undone by the thief (not easily. but doable)... by
  49.                            modifying the script control scripts...
  50.                            i decide to use dll (thanks to tsukihime for her tutorial...
  51.                            this script can't use dll without her tutorial)
  52.                            
  53.  ■ License        ╒═════════════════════════════════════════════════════════╛
  54.  Free to use in all project (except the one containing pornography)
  55.  as long as i credited (ESTRIOLE).
  56.  
  57.  I started writing this script. but then caitsith2 helps me a lot in improving
  58.  this script. so i think this script already become collaboration between me and
  59.  him. so the second person need to credited is catsith2 !
  60.  
  61.  EDIT: policy change... game containing pornography ALLOWED to use this script.
  62.  because i think it would be better so no more people can steal their scripts
  63.  and create ANOTHER pornography game. this exception is valid ONLY for this script
  64.  and EST - ENCRYPTER script.
  65.  
  66.  This script written based (also take some code) from TDS SCRIPT DISABLER script.
  67.  so you need to credit TDS too if you use this script.
  68.  
  69.  From v2.0 > this script use dll. using knowledge learned from tsukihime's tutorial
  70.  about using dll in RPG MAKER VX ACE... so Added Tsukihime in the credit list...
  71.  
  72.  so in summary this is all people that you need to credit when using this script:
  73.  1) Estriole
  74.  2) caitsith2
  75.  3) TDS
  76.  4) Tsukihime
  77.  
  78.  ■ Introduction     ╒═════════════════════════════════════════════════════════╛
  79.     This script created to give better control to the script. we can disable
  80.  a single script, disable a group of scripts and import script from external files
  81.  replacing marked script editor entry. the external scripts CAN be encrypted too.
  82.  read the how to use on how to encrypt it.
  83.  
  84.  ■ Features     ╒═════════════════════════════════════════════════════════╛
  85.  - v.2.0 >>> NOW use dll to avoid thief modification !!!
  86.  - 99% guarantee to make script thief's head dizzy.
  87.  - Disable single script
  88.  - Disable group script
  89.  - Import script from external .txt files
  90.  - Encrypt your external script.
  91.  - Hide your personal script from the decrypter program. they can access your
  92.  project but cannot read the script easily. (yes... perhaps expert coder can
  93.  reverse the code and make it .txt but it will give them hell at least).
  94.  - from v 1.2 > added real encryption and add double encryption support.
  95.  - from v 1.4 > added triple encryption. OMG... this really mean bussiness.
  96.  - from v 1.5 > added write to file protection
  97.  - from v 1.7 > added script modification protection. so if people modify
  98.                 the script after decrypting your project. it will fail the decryption.
  99.                 people that can crack this protection only do that for testing
  100.                 their skill. i'm 100% sure they don't need your script because
  101.                 they can script better. :p.
  102.  - from v 1.9 > add sc check that make thief harder to edit scripts.
  103.  
  104.  ■ Requirement     ╒═════════════════════════════════════════════════════════╛
  105.  - RPG MAKER VX ACE program :D
  106.  - EST_CS2_SCRIPT_CONTROL.dll can be downloaded either from demo or from script page...
  107.  put that dll file INSIDE your project folder.
  108.  
  109.  ■ Compatibility     ╒═════════════════════════════════════════════════════════╛
  110.   1) MUST BE PLACED ABOVE ALL SCRIPTS you want disabled/imported
  111.   2) TXT Files must use UTF-8 Encoding
  112.   3) this script name MUST be: EST_CS2 - SCRIPT CONTROL for better security.
  113.      you can have other name. but it won't as secure then.
  114.  
  115.  ■ How to Use     ╒═════════════════════════════════════════════════════════╛  
  116.  0) DOWNLOAD EST_CS2_SCRIPT_CONTROL.dll either from demo or from script page...
  117.  put that dll file INSIDE your project folder. (see demo for more info).
  118.  
  119.  1) Disable single script
  120.   add # at start of script name in script editor to disable single script
  121.   example: #Victor Basic Module
  122.  
  123.   External script can also disabled using this feature
  124.   example: #&Victor Basic Module
  125.    
  126.  2) Disable group scripts
  127.   To disable a group of scripts make 2 new blank scripts and in their name
  128.   add this:
  129.  
  130.   <Disabled_Scripts>
  131.  
  132.   </Disabled_Scripts>
  133.  
  134.   Any scripts put between these 2 new scripts will be disabled at the start
  135.   of the game.
  136.  
  137.   External script can also disabled using this feature
  138.   example:
  139.   <Disabled_Scripts>
  140.   &Victor Basic Module
  141.   &Yanfly Ace Battle Engine
  142.   </Disabled_Scripts>
  143.  
  144.  3) Importing external script.
  145.   - First create "Scripts" folder inside your project folder
  146.   (if no folder named "Script" this script will throw error print in console)
  147.   - create/copy the txt files that contain your scripts.
  148.   (some scripters use strange character to make the scripts look neater. me included: ■ :D)
  149.   so... MAKE SURE the txt files saved using UTF-8 Encoding. if you got error about unicode
  150.   character. then your txt files not UTF-8 Encoding. just save as and choose the correct
  151.   Encoding.
  152.  
  153.   - then add & at the start of the txt files name. (REQUIRED)
  154.   example: &Victor Basic Module.txt
  155.            &Yanfly Battle Engine.txt
  156.            
  157.   - open up your script editor. make new blank scripts in the position where you
  158.   want the imported script placed. you can move it later too when you need to
  159.   reorder your script list. rename the scripts name to the txt files name (without .txt).
  160.   example according above:
  161.            &Victor Basic Module
  162.            &Yanfly Battle Engine
  163.   then the blank script with that name will automatically replaced with the external script.
  164.  
  165.   NOTE: do not use &cypher_key as script name for your script.
  166.         because it's reserved to use in double encryption...
  167.         use it only for scripts containing your hidden key and recrypt process.
  168.  
  169.  4) Encrypting your game with the external scripts imported.
  170.  just use step 5. it's safer.
  171.  
  172.  5) Encrypting your scripts. with the crypt key INSIDE the imported scripts.
  173.  (double encryption)
  174.  - finish your game first.
  175.  
  176.  - DOWNLOAD &cypher_key.txt from the topic page / GRAB it from demo Scripts folder.
  177.  
  178.  open the txt file and change mykey variable in CONFIGURATION section:
  179.  
  180.  ##################################################
  181.  #                                                #
  182.  #             CONFIGURATION                      #
  183.  #                                                #
  184.  ##################################################
  185.  
  186.  mykey = x
  187.  
  188.  change x any TEXT you want... (not unique array like v.1.9 or below)
  189.  
  190.  example:
  191.  
  192.  ##################################################
  193.  #                                                #
  194.  #             CONFIGURATION                      #
  195.  #                                                #
  196.  ##################################################
  197.  
  198.  mykey = "don't steal my script please... i'll buy you some candy... what flavour you like"
  199.  
  200.  some tips. you can cut and paste from the array to reorder your key.
  201.  it save time.
  202.  
  203.  NOTE: Do not change anything else beside the config. to make sure your
  204.  scripts protected.
  205.  
  206.  - SAVE the changes
  207.  
  208.  - open up your script editor. make new blank scripts directly BELOW this script.
  209.    name it &cypher_key
  210.  - play test with DO_CONVERSION_TO_RVDATA = true
  211.  - after that change DO_CONVERSION_TO_RVDATA = false (OPTIONAL)
  212.  - delete your Scripts folder. encrypt the game using editor normally.
  213.  
  214.  WARNING: DO NOT PLAYTEST AGAIN WITH DO_CONVERSION_TO_RVDATA = true
  215.  after you DELETE the SCRIPTS FOLDER !!! it will re-encrypt your project
  216.  with no external SCRIPTS!!!
  217.  
  218.  EXTRA WARNING: IT WOULD BE WISE TO BACKUP YOUR SCRIPTS FOLDER SOMEWHERE
  219.  IN CASE YOU WANT TO EDIT THE GAME AGAIN :D.
  220.  
  221.  ■ Future Plan     ╒═════════════════════════════════════════════════════════╛  
  222.  - None at current time.  
  223.      
  224. =end
  225.  
  226. ($imported ||= {})["EST_CS2 - SCRIPT CONTROL"] = true
  227.  
  228. module ESTRIOLE
  229.   module SCRIPT_CONTROL
  230.   # >> SETTINGS
  231.     # Would you like to convert all .txt files in the "Scripts" folder to a
  232.     # .rvdata data file which can be encrypted with the game
  233.     DO_CONVERSION_TO_RVDATA = true
  234.     # play test first so your scripts got converted to EST_Scripts.rvdata2.
  235.     # after that. set DO_CONVERSION_TO_RVDATA to false
  236.     # then encrypt your game. then delete the Scripts folder.
  237.     SCRIPTS_FOLDER = "Scripts/" # Folder where you put your scripts as txt
  238.     #SCRIPTS_FOLDER = "Scripts/" -> this means at your project folder/Scripts/
  239.    
  240.   # >> CYPHER ENCRYPTION
  241.     # TEMPORARY crypt key name (you can create another txt files that contain
  242.     # your REAL crypt key. set this to nil to not using temporary crypt key
  243.     CRYPT_KEY = "cFZuhSVFMDMl2ZM3HYmtN0T1W6v3LZSQVpqaqsqVEpGk6XFBsWxEGFx4IcrgSeO"
  244.     # from 2.0 you can use any text you like... it would be better strange unpredicted text though
  245.    
  246.     #DO NOT CHANGE BELOW. change at your own risk.
  247.     CRYPT_KEY_NAME = "&cypher_key"    
  248.     CRYPT_KEY = CRYPT_KEY.split(//) if CRYPT_KEY.is_a?(String)
  249.   end
  250. end
  251.  
  252. def control_scripts
  253.   for i in 0 ... $RGSS_SCRIPTS.size
  254.     $RGSS_SCRIPTS[i][2] = $RGSS_SCRIPTS[i][3] = "" if $RGSS_SCRIPTS[i][1] =~ /^#/
  255.   end
  256.   delete_active =  false
  257.   $RGSS_SCRIPTS.each_with_index {|data, i|
  258.     delete_active = true  if data.at(1) =~ /<Disabled_Scripts>/i
  259.     if data.at(1) =~ /<\/Disabled_Scripts>/i
  260.       delete_active = false
  261.       $RGSS_SCRIPTS.at(i)[2] = $RGSS_SCRIPTS.at(i)[3] = ""
  262.     end
  263.     next unless delete_active
  264.     $RGSS_SCRIPTS.at(i)[2] = $RGSS_SCRIPTS.at(i)[3] = ""
  265.   }#do not remove this
  266. end
  267.  
  268. begin
  269. EST_CS2_add_entropy =  Win32API.new("EST_CS2_SCRIPT_CONTROL.dll", "add_entropy", "", "P")
  270. EST_CS2_cipher =  Win32API.new("EST_CS2_SCRIPT_CONTROL.dll", "cipher", "", "P")
  271. EST_CS2_prepare_scramble_key =  Win32API.new("EST_CS2_SCRIPT_CONTROL.dll", "prepare_scramble_key", "", "P")
  272. EST_CS2_convert_scripts_to_rvdata =  Win32API.new("EST_CS2_SCRIPT_CONTROL.dll", "convert_scripts_to_rvdata", "", "P")
  273. EST_CS2_decrypt_rvdata_to_scripts =  Win32API.new("EST_CS2_SCRIPT_CONTROL.dll", "decrypt_rvdata_to_scripts", "", "P")
  274. EST_CS2_recrypt_script =  Win32API.new("EST_CS2_SCRIPT_CONTROL.dll", "recrypt_script", "", "P")
  275. EST_CS2_execute =  Win32API.new("EST_CS2_SCRIPT_CONTROL.dll", "execute", "", "P")
  276.  
  277. eval(EST_CS2_add_entropy.call())
  278. eval(EST_CS2_cipher.call())
  279. eval(EST_CS2_prepare_scramble_key.call())
  280. eval(EST_CS2_convert_scripts_to_rvdata.call())
  281. eval(EST_CS2_decrypt_rvdata_to_scripts.call())
  282. eval(EST_CS2_recrypt_script.call())
  283. eval(EST_CS2_execute.call())
  284. rescue
  285.   puts "EST_CS2_SCRIPT_CONTROL.dll missing...\nPlace it inside your project folder (same location as Game.exe)"
  286.   puts "The Project will continue but only with script control function.\nIt will not load your encrypted script."
  287. end
  288. control_scripts
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement