[REBOL] [shell core] Shell access for rebol/core on win32
From: luke:marmaladefoo at: 10-Jan-2004 14:14
I've been annoyed at the lack of shell access in REBOL for
some time now. So I have implemented a simple fix. I
know others have done other fixes, but this works for me.
This setup is for Windows, for unix you would have to
write a slightly different cgi page.
It requires a cgi-compatible webserver (e.g. Apache,
Xitami etc) and python with the python win32 extensions.
python win32 extensions:
My contribution are the two scripts below. One REBOL
script which sends the command to the python cgi script
running on a webserver on the same machine. I use Xitami
because it is small and easy to configure, but if you are
running Apache, that should work too.
It uses base64 encoding of the command-line and
response to ensure correct transfer of data without
It could be tightened up to increase security (e.g. only
permit connections from 127.0.0.1), but that is left as an
exercise for the reader.
_____REBOL SHELL CLIENT___________
;---the function "call"
;---relies on a python CGI-script which takes one argument "cmd" (base64 encoded command)
;---and returns the result base64 encoded.
;---you will have to set shell-server-url as appropriate
shell-call: func [shell-string /local rslt shell-server-url] [
rslt: read to-url rejoin [shell-server-url "?cmd=" enbase/base shell-string 64]
return to-string (debase/base :rslt 64)
_____PYTHON CGI SHELL SERVER____________
print "Content-Type: text/plain\n\n"
#assume cmd is base64 encoded
cmd = base64.decodestring(The_Form["cmd"].value)
#open a pipe with that command
f = win32pipe.popen(cmd)
#return the response base64 encoded
#close the pipe
Various gadgets widgets, links and chat