HISE Logo Forum
    • Categories
    • Register
    • Login

    Simple copy protection done right :)

    Scheduled Pinned Locked Moved Presets / Scripts / Ideas
    151 Posts 25 Posters 17.9k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • LindonL
      Lindon @BWSounds
      last edited by

      @BWSounds said in Simple copy protection done right :):

      @ulrik thanks for responding. I’ll try on Mac to see if works then. It’s not working for pc or at least Not for me.

      its working fine on windows here..

      HISE Development for hire.
      www.channelrobot.com

      1 Reply Last reply Reply Quote 0
      • B
        BWSounds
        last edited by

        Sorry to bring this post back up but... I finally got the simple copy protection to work. (Was pretty simple)

        But I updated to the latest commit (needed to) and it’s not working for me. I did the same thing I did to get it to work on the earlier commit (February) but it’s a no go.

        Any one updated to any commit in august and this still works for them?

        ulrikU 1 Reply Last reply Reply Quote 0
        • ulrikU
          ulrik @BWSounds
          last edited by

          @BWSounds I'm using the script node from 19/8 and it's working here on mac

          Hise Develop branch
          MacOs 15.3.1, Xcode 16.2
          http://musikboden.se

          B 1 Reply Last reply Reply Quote 0
          • B
            BWSounds @ulrik
            last edited by

            @ulrik wow... ok 😔

            1 Reply Last reply Reply Quote 0
            • gorangroovesG
              gorangrooves
              last edited by

              Hey guys,
              do you have any tips or tricks on how to automatically populate the Serials.js file with a large number of serials? Since they have to be in a particular format between " " and with , at the end of each line, this will be quite a tedious work to do manually by copy+paste.
              What's your solution?

              Goran Rista
              https://gorangrooves.com

              Handy Drums and Handy Grooves
              https://library.gorangrooves.com

              Dan KorneffD 1 Reply Last reply Reply Quote 0
              • Dan KorneffD
                Dan Korneff @gorangrooves
                last edited by

                @gorangrooves The "Serial Generator" does this for you. Just uncomment the last line to run this function.

                /** This namespace contains the logic to create a new list of serials. 
                    
                    Feel free to remove this when not needed. */
                namespace SerialGenerator
                {
                    inline function getNewRandomChar()
                    {
                        // ASCII, fuck yeah!
                        local a = String.fromCharCode(Math.randInt(65, 90));
                        local b = String.fromCharCode(Math.randInt(48, 57));
                    
                        return Math.random() > 0.5 ? a : b;
                    }
                
                    inline function createNewSerial()
                    {
                        local s = "";
                    
                        s += getNewRandomChar();
                        s += getNewRandomChar();
                        s += getNewRandomChar();
                        s += getNewRandomChar();
                        s += "-";
                        s += getNewRandomChar();
                        s += getNewRandomChar();
                        s += getNewRandomChar();
                        s += getNewRandomChar();
                        s += "-";
                        s += getNewRandomChar();
                        s += getNewRandomChar();
                        s += getNewRandomChar();
                        s += getNewRandomChar();
                        s += "-";
                        s += getNewRandomChar();
                        s += getNewRandomChar();
                        s += getNewRandomChar();
                        s += getNewRandomChar();
                    
                        return s;
                    }
                
                    const var NUM_SERIALS = 1000;
                
                    inline function createNewSerials()
                    {
                        local d = [];
                        d.reserve(NUM_SERIALS);
                    
                        for(i = 0; i < NUM_SERIALS; i++)
                        {
                            d.push(createNewSerial());
                        }
                    
                        local obj = { "Data": d };
                    
                        Engine.dumpAsJSON(obj, "../Serials.js");
                    }
                
                    // Uncomment this line to regenerate serials.
                    //createNewSerials();
                }

                Dan Korneff - Producer / Mixer / Audio Nerd

                gorangroovesG NatanN 3 Replies Last reply Reply Quote 0
                • gorangroovesG
                  gorangrooves @Dan Korneff
                  last edited by

                  @dustbro Thanks very much. I will give this a try.

                  @orange Have you managed to implement the bundle serials solution and if so, would you mind sharing the working code here, please?

                  Goran Rista
                  https://gorangrooves.com

                  Handy Drums and Handy Grooves
                  https://library.gorangrooves.com

                  orangeO 1 Reply Last reply Reply Quote 0
                  • orangeO
                    orange @gorangrooves
                    last edited by orange

                    @gorangrooves

                    • Prepare a bundle serial list .js file (named "List_Main_Bundle_Serials.js" here) like this - I am using 5 simple serial numbers here:
                    const var BundlePackSerials = {
                      "Data": [
                        "BNDL_ABCDEF1",
                        "BNDL_ABCDEF2",
                        "BNDL_ABCDEF3",
                        "BNDL_ABCDEF4",
                        "BNDL_ABCDEF5"
                      ]
                    };
                    
                    
                    • Prepare a single product serial list .js file (named "List_Single_Product_Serials.js" here) like this:
                    const var SingleProductSerials = {
                      "Data": [
                        "SNGL_ABCDEF1",
                        "SNGL_ABCDEF2",
                        "SNGL_ABCDEF3",
                        "SNGL_ABCDEF4",
                        "SNGL_ABCDEF5"
                      ]
                    };
                    
                    

                    Then create an "Authorization.js" file and also below UI components. Also don't forget to include this "Authorization.js" file in the interface script. In "Authorization.js" script:

                    • SerialInput is an editable label for typing the serial in it.
                    • SubmitButton is a button for submitting the serial
                    • Description is a label for the information of the serial validation status.

                    For the conditions, I've used "if", "else if" and "else" respectively.

                    {
                    
                    include("List_Main_Bundle_Serials.js");
                    include("List_Single_Product_Serials.js");
                    
                    
                        const var SerialInput = Content.getComponent("SerialInput");
                        const var SubmitButton = Content.getComponent("SubmitButton");
                        const var Description = Content.getComponent("Description");
                        
                        
                        /** Checks if the serial input is valid and stores the result if successful. */
                        inline function onSubmitButtonControl(component, value)
                        {
                          if(!value) 
                                return;
                        
                            local v = SerialInput.getValue();
                            Console.print(v);
                    	
                             
                                      
                        // Checks if it's in the Bundle Serials List
                        
                            if(BundlePackSerials.Data.contains(v))
                                {
                                    Console.print("Serial number found");
                            
                                    local data = 
                                    {
                                        "Serial": v
                                    };
                    
                                    Description.set("text", "YOUR LICENSE HAS BEEN SUCCESSFULLY REGISTERED");
                                   
                                  // Saves as Bundle_RegistrationInfo.js 
                                    Engine.dumpAsJSON(data, "../Bundle_RegistrationInfo.js");
                                
                                    setValidLicense(true);
                                }      
                    
                                
                       // Checks if it's in the Single Product Serials List
                        
                            else if(SingleProductSerials.Data.contains(v))
                                {
                                    Console.print("Serial number found");
                            
                                    local data = 
                                    {
                                        "Serial": v
                                    };
                    
                                    Description.set("text", "YOUR LICENSE HAS BEEN SUCCESSFULLY REGISTERED");
                                   
                                  // Saves as Bundle_RegistrationInfo.js 
                                    Engine.dumpAsJSON(data, "../ProductA_RegistrationInfo.js");
                                
                                    setValidLicense(true);
                                }      
                            
                            else
                                {
                                    Console.print("Invalid serial number");
                                    Description.set("text", "INVALID KEY THAT DOES NOT MATCH WITH YOUR LICENSE");
                                    setValidLicense(false);
                                }
                        };
                    
                        Content.getComponent("SubmitButton").setControlCallback(onSubmitButtonControl);
                    
                    
                    
                       inline function setValidLicense(isValid)
                        {
                            // Do whatever you want to do here. 
                             
                            if(isValid)
                            {
                    
                    
                            }
                           
                            
                            else
                            {
                    
                                          
                            }
                        }
                    
                    
                    
                    
                        inline function checkOnLoad()
                        {
                            SerialInput.set("text", "");
                            
                            // Load the serial from the stored files
                             
                            local pData_MainBundle = Engine.loadFromJSON("../Bundle_RegistrationInfo.js");
                            local pData_SingleProduct = Engine.loadFromJSON("../ProductA_ProductRegistrationInfo.js");
                            
                            Console.print("Checking serial");
                        
                           
                            
                        
                        
                        // Bundle serials  
                        
                          if(pData_MainBundle)    
                            {
                                local v = pData_MainBundle.Serial;
                                Console.print("Restored serial: " + v);
                            
                               if(BundlePackSerials.Data.contains(v))
                                {
                                    setValidLicense(true);
                                    return;
                                }      
                            }
                    
                            
                       
                        // Single Product serials  
                        
                          if(pData_SingleProduct)    
                            {
                                local v = pData_SingleProduct.Serial;
                                Console.print("Restored serial: " + v);
                            
                               if(SingleProductSerials.Data.contains(v))
                                {
                                    setValidLicense(true);
                                    return;
                                }      
                            }
                           
                    
                          setValidLicense(false);
                      }    
                        
                    // Call this on startup
                        checkOnLoad();
                    
                    }
                    

                    Cheers ;)

                    develop Branch / XCode 13.1
                    macOS Monterey / M1 Max

                    gorangroovesG 1 Reply Last reply Reply Quote 1
                    • gorangroovesG
                      gorangrooves @orange
                      last edited by

                      @orange Thanks a lot for this. I really appreciate it! 👏

                      Goran Rista
                      https://gorangrooves.com

                      Handy Drums and Handy Grooves
                      https://library.gorangrooves.com

                      1 Reply Last reply Reply Quote 1
                      • gorangroovesG
                        gorangrooves @Dan Korneff
                        last edited by

                        @dustbro Finally got around to trying to generate those serials, but I am having no success. I added the code you provided, at the bottom of my Interface onInit script and removed the "//" from the last line, then compile the script. It compiles OK, but no serials are generated. The Serials.js remains with the same codes and nothing new is added. I get no warning or errors.
                        I tried using HISE Master from Oct last year and just now using the latest built from @d-healey's Developer branch, but with no luck.
                        Am I missing something?

                        Goran Rista
                        https://gorangrooves.com

                        Handy Drums and Handy Grooves
                        https://library.gorangrooves.com

                        Dan KorneffD Y 2 Replies Last reply Reply Quote 0
                        • Dan KorneffD
                          Dan Korneff @gorangrooves
                          last edited by

                          @gorangrooves or should drop them in the root of your project folder

                          Dan Korneff - Producer / Mixer / Audio Nerd

                          1 Reply Last reply Reply Quote 0
                          • Y
                            yall @gorangrooves
                            last edited by

                            @gorangrooves me the generation does not work either but I use https://www.motdepasse.xyz/ and I replace it in the .js file and There you go :)

                            gorangroovesG 1 Reply Last reply Reply Quote 0
                            • gorangroovesG
                              gorangrooves @yall
                              last edited by

                              @yall Thanks. I am afraid that the tool doesn't quite offer enough flexibility.

                              @dustbro said in Simple copy protection done right :):

                              @gorangrooves or should drop them in the root of your project folder

                              Was a part of your response missing?

                              Goran Rista
                              https://gorangrooves.com

                              Handy Drums and Handy Grooves
                              https://library.gorangrooves.com

                              1 Reply Last reply Reply Quote 0
                              • Christoph HartC
                                Christoph Hart
                                last edited by

                                @gorangrooves said in Simple copy protection done right :):

                                Serials.js remains with the same codes and nothing new is added. I get no warning or errors.

                                Have you tried deleting the old js file? Maybe it can't overwrite an existing file...

                                gorangroovesG 1 Reply Last reply Reply Quote 0
                                • gorangroovesG
                                  gorangrooves @Christoph Hart
                                  last edited by gorangrooves

                                  @Christoph-Hart I tried only renaming the actual file to "serials.js" (lower case s) to see if it would write a new js file, but it didn't. It only threw an error message that the original Serials.js was missing. It was the copy protection code part of the script that threw the error.

                                  Should I delete the existing data from the Serials.js?

                                  BTW I can edit the js file within HISE, when I open it as one of the scripts. So, it is able to write to it.

                                  Goran Rista
                                  https://gorangrooves.com

                                  Handy Drums and Handy Grooves
                                  https://library.gorangrooves.com

                                  1 Reply Last reply Reply Quote 0
                                  • gorangroovesG
                                    gorangrooves
                                    last edited by

                                    @Christoph-Hart I commented out the copy protection script so that I could delete data from Serials.js and that didn't do the trick. I deleted the js file completely and that didn't do the trick either. The script is not generating a js file.

                                    Goran Rista
                                    https://gorangrooves.com

                                    Handy Drums and Handy Grooves
                                    https://library.gorangrooves.com

                                    gorangroovesG 1 Reply Last reply Reply Quote 0
                                    • gorangroovesG
                                      gorangrooves @gorangrooves
                                      last edited by

                                      @Christoph-Hart @dustbro After reading the manual on GitHub, I realized that the file is being generated in the root folder of the project. Now I understand what you were referring to, dustbro.
                                      @yall Check out the root folder of your project and not the Scripts folder for the Serials.js generated by the script.

                                      Goran Rista
                                      https://gorangrooves.com

                                      Handy Drums and Handy Grooves
                                      https://library.gorangrooves.com

                                      1 Reply Last reply Reply Quote 0
                                      • NatanN
                                        Natan @Dan Korneff
                                        last edited by Natan

                                        @dustbro said in Simple copy protection done right :):

                                        @gorangrooves The "Serial Generator" does this for you. Just uncomment the last line to run this function.

                                        /** This namespace contains the logic to create a new list of serials. 
                                            
                                            Feel free to remove this when not needed. */
                                        namespace SerialGenerator
                                        {
                                            inline function getNewRandomChar()
                                            {
                                                // ASCII, fuck yeah!
                                                local a = String.fromCharCode(Math.randInt(65, 90));
                                                local b = String.fromCharCode(Math.randInt(48, 57));
                                            
                                                return Math.random() > 0.5 ? a : b;
                                            }
                                        
                                            inline function createNewSerial()
                                            {
                                                local s = "";
                                            
                                                s += getNewRandomChar();
                                                s += getNewRandomChar();
                                                s += getNewRandomChar();
                                                s += getNewRandomChar();
                                                s += "-";
                                                s += getNewRandomChar();
                                                s += getNewRandomChar();
                                                s += getNewRandomChar();
                                                s += getNewRandomChar();
                                                s += "-";
                                                s += getNewRandomChar();
                                                s += getNewRandomChar();
                                                s += getNewRandomChar();
                                                s += getNewRandomChar();
                                                s += "-";
                                                s += getNewRandomChar();
                                                s += getNewRandomChar();
                                                s += getNewRandomChar();
                                                s += getNewRandomChar();
                                            
                                                return s;
                                            }
                                        
                                            const var NUM_SERIALS = 1000;
                                        
                                            inline function createNewSerials()
                                            {
                                                local d = [];
                                                d.reserve(NUM_SERIALS);
                                            
                                                for(i = 0; i < NUM_SERIALS; i++)
                                                {
                                                    d.push(createNewSerial());
                                                }
                                            
                                                local obj = { "Data": d };
                                            
                                                Engine.dumpAsJSON(obj, "../Serials.js");
                                            }
                                        
                                            // Uncomment this line to regenerate serials.
                                            //createNewSerials();
                                        }
                                        

                                        I'm Trying To Add A Fixed 4 Digit Name To The Generated Codes, Like:
                                        "HISE-X44A-6SP4-82AS"
                                        "HISE-X0IR-Y022-O14Q"
                                        "HISE-G726-S0GR-C073"

                                        Any Help?

                                        NatanN 1 Reply Last reply Reply Quote 0
                                        • NatanN
                                          Natan @Natan
                                          last edited by

                                          @Natan But EveryTime I Get undefinedundefinedundefinedundefined :) LOL

                                          1 Reply Last reply Reply Quote 0
                                          • NatanN
                                            Natan
                                            last edited by

                                            Okey, I Managed To Find My Way With This :)

                                            In Case Anyone Wants To Generate Serial Codes With 4 Fixed Digits At First, Check This Out

                                            /** This namespace contains the logic to create a new list of serials. 
                                                
                                                Feel free to remove this when not needed. */
                                            namespace SerialGenerator
                                            {
                                                inline function getNewRandomChar()
                                                {
                                                    // ASCII, fuck yeah!
                                                    local a = String.fromCharCode(Math.randInt(65, 90));
                                                    local b = String.fromCharCode(Math.randInt(48, 57));
                                                    
                                                    return Math.random() > 0.5 ? a : b;
                                                }
                                            
                                                inline function createNewSerial()
                                                {
                                                    local s = "HISE-";   /// Change This With Whatever You Want
                                                    
                                                    s += getNewRandomChar();
                                                    s += getNewRandomChar();
                                                    s += getNewRandomChar();
                                                    s += getNewRandomChar();
                                                    s += "-";
                                                    s += getNewRandomChar();
                                                    s += getNewRandomChar();
                                                    s += getNewRandomChar();
                                                    s += getNewRandomChar();
                                                    s += "-";
                                                    s += getNewRandomChar();
                                                    s += getNewRandomChar();
                                                    s += getNewRandomChar();
                                                    s += getNewRandomChar();
                                                
                                                    return s;
                                                }
                                            
                                                const var NUM_SERIALS = 1;
                                            
                                                inline function createNewSerials()
                                                {
                                                    local d = [];
                                                    d.reserve(NUM_SERIALS);
                                                
                                                    for(i = 0; i < NUM_SERIALS; i++)
                                                    {
                                                        d.push(createNewSerial());
                                                    }
                                                
                                                    local obj = { "Data": d };
                                                
                                                    Engine.dumpAsJSON(obj, "../Serials.js");
                                                }
                                            
                                                // Uncomment this line to regenerate serials.
                                                 //createNewSerials();
                                            }
                                            
                                            1 Reply Last reply Reply Quote 1
                                            • First post
                                              Last post

                                            30

                                            Online

                                            1.7k

                                            Users

                                            11.8k

                                            Topics

                                            102.6k

                                            Posts