Switch to desktop version  
BASIC SCRIPT program.bas from one eWON to others - Printable Version

+- Ewon Technical Forum (https://techforum.ewon.biz)
+-- Forum: Development (https://techforum.ewon.biz/forum-50.html)
+--- Forum: BASIC Script (https://techforum.ewon.biz/forum-52.html)
+--- Thread: BASIC SCRIPT program.bas from one eWON to others (/thread-1101.html)

Pages: 1 2


BASIC SCRIPT program.bas from one eWON to others - Nikolai - 21-11-2019

Hi All. 
Is it possible to send program.bas file from one eWON to other?  
Because some eWONs are not reachable by ethernet but old script switching it to modem connection for 1 minute per day. 
May be somebody used new BASIC function - REQUESTHTTPX for similar task? 
I suppose there is no possible to use PUTFTP in that case.
Are there some possibilities to do that?


RE: BASIC SCRIPT program.bas from one eWON to others - simon - 21-11-2019

Hi,

Yes, you have to use PUTFTP to push the new program.bas to the other Ewon.
By HTTP, it is perhaps possible but you'll have to do some reverse engineering...

Simon


RE: BASIC SCRIPT program.bas from one eWON to others - Nikolai - 21-11-2019

Actually I already tried PUTFTP but it didn't work.
I used usual way:

X$ = "program.bas"
Y$ = "[$dtUF $ctG $uf/program.bas]"
Z$ = "adm:adm@213.18x.xxx.208:21"
PUTFTP X$, Y$, Z$
f% = GETSYS PRG,"ACTIONID"
GOTO WAIT_STEP

only got errors
What I did wrong?


RE: BASIC SCRIPT program.bas from one eWON to others - AngelaT - 21-11-2019

Did you put a copy of the program.bas into the usr directory? The $dtUF EBD only works with files in the usr directory so you are probably getting file not found errors when it tries to retrieve the file. Use the $dtPG EBD instead.


RE: BASIC SCRIPT program.bas from one eWON to others - Nikolai - 22-11-2019

Of course I put the file in a usr directory.


RE: BASIC SCRIPT program.bas from one eWON to others - simon - 25-11-2019

Hi,

- Have you tried "/program.bas" ?
- You should remove the ctG in the EBD. The file cannot be gzip'ed

Simon


RE: BASIC SCRIPT program.bas from one eWON to others - Nikolai - 26-11-2019

- Yes, I did all, but only response 24003. If I send it to our server with DNS - no problem.
- Perhaps server rejects ip address. Any ideas?


RE: BASIC SCRIPT program.bas from one eWON to others - Nikolai - 03-12-2019

Simon,
I tried send some command from one ewon to other but these command are executes on source ewon instead of target ewon.
This code:
T2MAccount$ = "xxxx"
T2MUsername$ = "yyy"
T2MPassword$ = "zzzz"
T2MDeveloperId$ = "wwww"
Target_eWON_Name$ = "nnnn"
Target_eWON_Username$ = "adm"
Target_eWON_Password$ = "adm"

url$ = "https://m2web.talk2m.com/t2mapi/get/"+Target_eWON_Name$+"/rcgi.bin/ExeScriptForm?Command1=SETSYS COM, Command2=SETSYS COM,"WANCnx","1", Command3=SETSYS COM,"WANPermCnx","1",Command4=SETSYS COM,"SAVE"

url$ = url$ + "&t2maccount="+T2MAccount$+"&t2musername="+T2MUsername$+"&t2mpassword="+T2MPassword$
url$ = url$ +"&t2mdeveloperid="+T2MDeveloperId$+"&t2mdeviceusername="+Target_eWON_Username$+"&t2mdevicepassword=" + Target_eWON_Password$

REQUESTHTTPX url$, method$, "", ""

actionID% = GETSYS PRG, "ACTIONID"
PRINT "request actionid is "; actionID%

What is wrong at that time?


RE: BASIC SCRIPT program.bas from one eWON to others - simon - 03-12-2019

Hi Nikolai,

Have you set the target Ewon name in Target_eWON_Name$ ? or the Ewon name (in eCatcher) of the one you execute the script on ?

Did you "program.bas" copy script finally work ?

Simon.


RE: BASIC SCRIPT program.bas from one eWON to others - Nikolai - 03-12-2019

Yes, I've set exact target name like it is in eCatcher. But very strange behavior.. May be need change method from get to any other?

No, program.bas is not copied to other ewon, ftp always returns 24003 error.


RE: BASIC SCRIPT program.bas from one eWON to others - simon - 03-12-2019

1. That is strange. The GET method should work. You can try my specific Java IOServer that makes the same but better on https://techforum.ewon.biz/thread-286-post-686.html#pid686
2. The error 24003 means a connection issue (connect socket failed).

Simon


RE: BASIC SCRIPT program.bas from one eWON to others - Nikolai - 03-12-2019

Also get invalid parameter (5) 21: a$ = RESPONSEHTTPX "RESPONSEBODY"


RE: BASIC SCRIPT program.bas from one eWON to others - Nikolai - 03-12-2019

..should be RESPONSE-BODY, so finally I got response body: {"message":"invalid credentials","code":403,"success":false}
solved it
then got:
.. <h1>Bad request</h1>
.. <p.Your browser sent a request that this server could not understand.<br/>
server doesn't understand this script:
...
T2MUsername$ = "adm"
T2MPassword$ = "adm"
method$ = "GET"

url$ = "https://m2web.talk2m.com/t2mapi/get/"+Target_eWON_Name$+"/rcgi.bin/ExeScriptForm&Command1="SETSYS COM,"LOAD","&Command2="SETSYS COM,"WANCnx","1"
url$ = url$ + "&Command3="SETSYS COM,"SAVE"

url$ = url$ + "&t2maccount="+T2MAccount$+"&t2musername="+T2MUsername$+"&t2mpassword="+T2MPassword$
url$ = url$ +"&t2mdeveloperid="+T2MDeveloperId$+"&t2mdeviceusername="+T2MUsername$+"&t2mdevicepassword=" + T2MPassword$

REQUESTHTTPX url$, method$

are there some detailed info how proceed REQUESTHTTPX?


RE: BASIC SCRIPT program.bas from one eWON to others - Nikolai - 04-12-2019

.. I used ewon names with spaces, after I found out that my account advanced but not admin! thats why finally got forbidden..


RE: BASIC SCRIPT program.bas from one eWON to others - simon - 04-12-2019

;-) good you found out!