Page 1 of 2

Hiding code in a button in a commercial version of LiveCode

Posted: Sat Jul 04, 2020 7:43 pm
by richmond62
I usually work with the Community version of LiveCode,
but in a moment of madness I purchased an Indy licence about 6 weeks ago, so was wondering . . .

I have a stack I want learners to be able to open in their Community versions of LiveCode, run, but
NOT be able to see the code in the action button.

Is there a way I can password protect the script of a single object using the Indy version of LiveCode?

Re: Hiding code in a button in a commercial version of LiveCode

Posted: Sat Jul 04, 2020 8:12 pm
by SparkOut
Not AFAIK (I'm not certain though), but you could password protect a substack, and leave the mainstack open for edit.

Re: Hiding code in a button in a commercial version of LiveCode

Posted: Sat Jul 04, 2020 9:15 pm
by richmond62
SparkOut wrote:
Sat Jul 04, 2020 8:12 pm
Not AFAIK (I'm not certain though), but you could password protect a substack, and leave the mainstack open for edit.
Thanks for that. 8)

Re: Hiding code in a button in a commercial version of LiveCode

Posted: Sat Jul 04, 2020 11:44 pm
by FourthWorld
The community edition doesn't contain any code to decrypt encrypted scripts. I believe attempts to use them throw an error, though they may just fail silently (I've never tried it myself, so I'm not sure what the behavior is, only that encrypted scripts can't be used in Community).

Re: Hiding code in a button in a commercial version of LiveCode

Posted: Sun Jul 05, 2020 12:00 am
by SparkOut
Ah, then that's a problem for you then Richmond. Sorry, no bright ideas.

Re: Hiding code in a button in a commercial version of LiveCode

Posted: Sun Jul 05, 2020 1:10 am
by dunbarx
Richmond.

Surely you can place the code in some "remote" location, a hidden graphic, say, that nobody will ever suspect the existence of, much less try to read. And you can go further. Have the action button load the code from a custom property into the script of that graphic, execute it, and then delete it. Sounds like fun to me.

Craig

Re: Hiding code in a button in a commercial version of LiveCode

Posted: Sun Jul 05, 2020 8:35 am
by richmond62
SparkOut wrote:
Sun Jul 05, 2020 12:00 am
Ah, then that's a problem for you then Richmond. Sorry, no bright ideas.
I own an INDY licence, so I'm not sure if 'that' is the problem.

Re: Hiding code in a button in a commercial version of LiveCode

Posted: Sun Jul 05, 2020 8:42 am
by richmond62
Sounds like fun to me.
I am not trying to have 'fun'. And, frankly, the idea that
education must always involve 'fun' makes me want to throw up.

I had fun (rather than 'fun') programming our University main-frame in PASCAL from a blind terminal in 1984.

And by "fun" I mean intellectual fun, not the sort of goofy-woofy, dumbing down
that passes for education in a lot of quarters these days.
-
Dead (10).png
-
My aim is to present learners with a stack with a button which, when they click on it,
runs a script, but they are prevented from being able to see the script.

At a certain point learners need to get away from being spoon-fed and start working out
how to effect functionality: a stack with a button that functions but the script cannot be seen
allows end users to script their own button to try to imitate the functionality of the older button
and have access to all the resources in that stack might just serve that purpose.

Re: Hiding code in a button in a commercial version of LiveCode

Posted: Sun Jul 05, 2020 8:58 am
by SparkOut
richmond62 wrote:
Sun Jul 05, 2020 8:35 am
SparkOut wrote:
Sun Jul 05, 2020 12:00 am
Ah, then that's a problem for you then Richmond. Sorry, no bright ideas.
I own an INDY licence, so I'm not sure if 'that' is the problem.
Yes, as if I understand Richard, it seems that you may be able to secure the script in the Indy version, but the Community version you plan on having the students use will not be able to access it, to run, let alone view. I thought you may be able to protect the script with a password, and Community could open and run the stack but not view the script. Apparently it can't even access the protected content.

Re: Hiding code in a button in a commercial version of LiveCode

Posted: Sun Jul 05, 2020 9:24 am
by richmond62
Blast.

Well, let's see now as I am 'here' in front of my happy Mac Mini with both Community 9.6.0
and Indy 9.6.0 and see what happens . . .
-
Screenshot 2020-07-05 at 11.20.36.png
-
gives me this when attempting to open the stack in Community:
-
Screenshot 2020-07-05 at 11.21.34.png

Re: Hiding code in a button in a commercial version of LiveCode

Posted: Sun Jul 05, 2020 9:32 am
by richmond62
So . . . the trick . . .
-
Screenshot 2020-07-05 at 11.28.57.png
-
stack "codeRUN" is a small and invisible substack of "testLock",

and quite frankly if some kid manages to crack their way into the button on the substack
that in itself will be marvellous. 8)

Of course line 5 was a bit of a pain in the bum:

Code: Select all

on mouseUp
   put 1 into XX
   repeat until XX > 10
      put ("D" & XX & ".png") into QQ
      set the backGroundPattern of grc "fr" of stack "testLock" to the ID of img QQ of stack "testLock"
      wait 15 ticks
      add 1 to XX
   end repeat
end mouseUp

Re: Hiding code in a button in a commercial version of LiveCode

Posted: Sun Jul 05, 2020 11:32 am
by ajperks
I wonder if this suggestion might work?
Years ago, I developed a large programme in modules. The main part was effectively buttons that triggered the called exe module. Nothing wonderful, but perhaps your script could become an ex, called by your button?

Re: Hiding code in a button in a commercial version of LiveCode

Posted: Sun Jul 05, 2020 11:38 am
by richmond62
The main part was effectively buttons that triggered the called exe module. Nothing wonderful, but perhaps your script could become an ex, called by your button?
1. I don't completely understand that.

2. "exe" sounds like Windows: I "don't do Windows" unless desperate.

3. The solution needs to be 100% cross-platform so learners can access the stack regardless of which OS they are
deploying LiveCode on.

Re: Hiding code in a button in a commercial version of LiveCode

Posted: Sun Jul 05, 2020 11:54 am
by bogs
dunbarx wrote:
Sun Jul 05, 2020 1:10 am
Richmond.
Surely you can place the code in some "remote" location, a hidden graphic, say, that nobody will ever suspect the existence of, much less try to read. And you can go further. Have the action button load the code from a custom property into the script of that graphic, execute it, and then delete it. Sounds like fun to me.

Craig
richmond62 wrote:
Sun Jul 05, 2020 9:32 am
stack "codeRUN" is a small and invisible substack of "testLock",and quite frankly if some kid manages to crack their way into the button on the substack
that in itself will be marvellous.
As to the bold part(s), anyone using the PB will see that code is listed in whatever object it is attached too, whether the item is visible or not, and can reach that code just by clicking on the blue read me code button :P
aPic_youCantSeeMe.png
I'm not here right now, but I've left you a message a BLIND man could see!
The italic/underlined part would be better (but still not impossible to read), however, if any of these kids are precocious in the least, I wouldn't count on that either.

Having said that, you could probably generate a hash and use encode/decode, or a few other little tricks to make it harder than the above, as kids would be unlikely to know about things you have not (presumably) taught them yet, but the really talented (or clever) would still be tough to get past.

Of course, you've left out the most obvious way to deal with this, turn it into an encrypted standalone in Indy, and just run the standalone, then let them reason out what is going on.

While I was composing this, ajperks made me remember programming in early pascal :)

Re: Hiding code in a button in a commercial version of LiveCode

Posted: Sun Jul 05, 2020 2:06 pm
by dunbarx
Bogs.
anyone using the PB will see that code is listed in whatever object it is attached too,
Which is why I thought further that storing the to-be executed code in a custom property, and running it from there was an even better kluge. If someone was to examine all controls in detail, they would find this, of course, but is that a real danger? If the students are savvy enough to do all that, they need little instruction from anyone.

Craig