[1.1.0] securing runnable scripts against changes --- run them from the net

Asked by vaibhav

I cannot run .skl files using the bat file

Please help me
I'm using the 1.1.0 ver .I am using this command in the batch file:
%~dp0runsikulix.cmd -r %~dp0mysklfile.skl

where mysklfile.skl is the *FOLDER*
Gives me

------------------------------------------------------------------------------------------------------------------------------------------------------
+++ running this Java
C:\Users\Vaibhav>C:\Users\Vaibhav\Desktop\runfromcmd\runsikulix.cmd -r C:\Users\
Vaibhav\Desktop\runfromcmd\myskl.skl
+++ running this Java
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b15)
Java HotSpot(TM) Client VM (build 25.45-b02, mixed mode, sharing)
+++ trying to run SikuliX
+++ using: -Xms64M -Xmx512M -Dfile.encoding=UTF-8 -Dsikuli.FromCommandLine -jar
C:\Users\Vaibhav\Desktop\runfromcmd\sikulix.jar -r C:\Users\Vaibhav\Desktop\runf
romcmd\myskl.skl
[error] FileManager: unzip: not possible: source:
C:\Users\Vaibhav\Desktop\runfromcmd\myskl.skl
target:
C:\Users\Vaibhav\AppData\Local\Temp\Sikulix_401191458\myskl.sikuli
java.io.FileNotFoundException: C:\Users\Vaibhav\Desktop\runfromcmd\myskl.skl (Ac
cess is denied)
[error] FileManager: Script project C:\Users\Vaibhav\AppData\Local\Temp\Sikulix_
401191458\myskl.sikuli
 has no script file myskl.xxx
============================================================
If I put the direct address of the .skl *FILE* I get the error
[error] FileManager: Not a valid Sikuli script project:

----------------------------------------------------------------------------------------------------------
The other folder which is .sikuli works fine with the command

%~dp0runsikulix.cmd -r %~dp0ccvalidator1

===========================================================================
But the .sikuli folder gives the Not a valid sikuli script when I put in the web host

%~dp0runsikulix.cmd -r libup.byethost22.com:ccvalidator1
==========================================================
C:\Users\Vaibhav>C:\Users\Vaibhav\Desktop\runfromcmd\runsikulix.cmd -r libup.bye
thost22.com:ccvalidator1
+++ running this Java
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b15)
Java HotSpot(TM) Client VM (build 25.45-b02, mixed mode)
+++ trying to run SikuliX
+++ using: -Xms64M -Xmx512M -Dfile.encoding=UTF-8 -Dsikuli.FromCommandLine -jar
C:\Users\Vaibhav\Desktop\runfromcmd\sikulix.jar -r libup.byethost22.com:ccvalida
tor1
[error] FileManager: Not a valid Sikuli script project:
C:\Users\Vaibhav\libup.byethost22.com:ccvalidator1
---------------------------------------------------------------------------------------------------------------------------------------------

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
vaibhav
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

sorry, did not see this question first ;-)

... but you should not change other peoples questions

your problem:
apparently you have a access right problem:
java.io.FileNotFoundException: C:\Users\Vaibhav\Desktop\runfromcmd\myskl.skl (Ac
cess is denied)

BTW: Why do you want to use .skl?
It is only there for historical reasons, and has no advantages - only disadvantages.
It is simply a zipped .sikuli folder, that internally is unzipped at runtime into the temp folder to run it.

Revision history for this message
vaibhav (rokrvaibhav) said :
#2

I'm really sorry, I didn't meant to do that I was just playing around I thought it was a bug, but it actually changed.
I was trying to post my question, then I was reading that question, I don't what happened and accidently changed that question instead of getting my posted. :(

I don't want users to read the script, its somewhat "secret algorithm"

Also why does the .sikuli file works in bat when I direct link it and not when I link it to the host? I'm getting a [error] FileManager: Not a valid Sikuli script project: error there

Revision history for this message
RaiMan (raimund-hocke) said :
#3

--- somewhat "secret algorithm"
.skl is not secret at all: just unzip it and you have your source back again.

If you want to secure your code to a level, that is secured against most users:
http://sikulix-2014.readthedocs.org/en/latest/scenarios.html#prepare-and-use-your-own-jar-files-in-the-jython-environment

--- ... and not when I link it to the host
I guess you are talking about
C:\Users\Vaibhav\libup.byethost22.com:ccvalidator1

this is indeed not a valid .sikuli location.
It must still be a valid path to the local file system.

... but it is now possible to run scripts, that are hosted in a HTTP accessible location.
read: http://sikulix-2014.readthedocs.org/en/latest/scripting.html#running-scripts-and-snippets-from-within-other-scripts-and-run-scripts-one-after-the-other

Revision history for this message
vaibhav (rokrvaibhav) said :
#4

-------
I got the jar file made by the command
Sikulix.buildJarFromFolder("E:\Projects\Latest\we.jar", "E:\Projects\Latest\ccvalidator1.sikuli")
where we.jar is a blank file I made with notepad and other .sikuli folder contains one .py file and one .html file

But it doesn't work: invalid or corrupt jar file

What I could be doing wrong?

(a side note , Sikuli won't accept the file path correct if we have named it only numerical for eg. "2.jar", possible bug maybe?)
--------------

I got this command from
http://sikulix-2014.readthedocs.org/en/latest/faq/010-command-line.html#command-line-options-intention-run-a-script-without-opening-the-ide

quote: "sikulix.com:scripts/test1"
where as my command in the batch file : %~dp0runsikulix.cmd -r libup.byethost22.com:ccvalidator1
I guess its according the document base-url>:script-name

Why doesn't it work?

also the document you referred to me ,
runScript("libup.byethost22.com:ccvalidator1.sikuli")

[error] FileManager: Not a valid Sikuli script project: C:\Users\Vaibhav\Downloads\sikuli1.1\libup.byethost22.com:ccvalidator1.sikuli

Revision history for this message
RaiMan (raimund-hocke) said :
#5

I am sorry for the situation:
I had to realize, that running scripts from the net currently did not fully work yet (only for test scripts from github).

I fixed that now to some useable level (available with tomorrows build).
Please check the docs again tomorrow.

One caveat though:
I did not succeed, to download .py files from the net. Currently, I do not have the time, to look for a solution.
So for now, a Python script, to be run from the net has to look like this:
<base-url>
   - someFolder
      - theScript
         theScript.py.txt

- someFolder is optional and might be more than one level
- the folder theScript should not have .sikuli
- the contained .py file has to have .txt appended

to run the above script you can use one of these:
http://<base-url>/someFolder/theScript
http://<base-url>:someFolder/theScript
<base-url>:someFolder/theScript

Revision history for this message
RaiMan (raimund-hocke) said :
#6

--- But it doesn't work: invalid or corrupt jar file

the jars produced with this feature can only be used for import together with the load() feature (which puts them on the class path).

They are not runnable in any way.

Revision history for this message
vaibhav (rokrvaibhav) said :
#7

Hello!
is it new built available?

thanks for helping me so much. developing&troubleshooting would be hell of a work for you. Respect sir

I changed the name of folder and removed .sikuli and made the .py.txt .

Ran the runScript("libup.byethost22.com:test123") command still getting an error.

Is this thing working for older versions of sikuli? if yes please guide me to it.

I checked the built, it was still the 20150626.231021-115 which I currently have.

I want the run the script from http badly as

1) it would solve my https://answers.launchpad.net/sikuli/+question/268632
to check internet would no longer be needed
2) the code won't be available to the user.

==================================================================================

Damn,I can't code java and I also can't find any documentation for load() command and using it.
If the download from online source problem solves won't need to pack the jar file

Revision history for this message
RaiMan (raimund-hocke) said :
#8

sorry for the delay.

Try again in about 1 hour.
Just fired the new build and upload.

Revision history for this message
RaiMan (raimund-hocke) said :
#9
Revision history for this message
vaibhav (rokrvaibhav) said :
#10

it is still the 20150626.231021-115?

Revision history for this message
vaibhav (rokrvaibhav) said :
#11

nevermind found it

Revision history for this message
vaibhav (rokrvaibhav) said :
#12

Thanks raiman it worked :D

thank you so much :D

Revision history for this message
RaiMan (raimund-hocke) said :
#13

Thanks for feedback.