Shapeshifter is a project mainly written in Python, based on the BSD-2-Clause license.
A http-based tool for executing commands remotely.
Shapeshifter is a tool for interacting with remote servers. It
consists of a controller script (ssc
) and a set of modules which run
on the servers with which we want to interact. There is a small
set of core, bootstrap modules. All modules (including the bootstrap
ones) can be uploaded and replaced at run time. Use cases include:
git://github.com/mmakowski/shapeshifter.git
bootstrap
directory to some temporary place on your
computer and run webserver.py
in there.ssc.py localhost PUT /ssmodule/hello module=file:modules/hello.py
ssc.py localhost POST /hello/World
You can play around with modifying modules/hello.py
and then
running the two ssc
command above to update and execute it.
Let's see what happens in the demo above:
webserver.py
starts a process which listens for HTTP connections
on port 5457.ssc.py
sends a PUT
request to the listening process with URI
/ssmodule/hello
and body of type multipart/form-data
containing
the contents of modules/hello.py
file.ssmodule
, loads a module with this name and calls a PUT()
function (corresponding to the HTTP method used) in it, passing in
the remainder of the URI ("hello"
) as an argument.ssmodule.PUT()
creates a file hello.py
writing to it the
content retrieved from the request body.ssc
sends a POST request with URI
/hello/World
.hello.POST()
function (defined in the module created in response to the previous
request) and passing to it "World"
.hello.POST()
prints the greeting on the standard output.ssc.py <targets> <method> <URI> [<data>]
<targets>
: a comma-separated list of machines to which requests
are to be sent.<method>
: HTTP method; currently supported methods are DELETE
,
GET
, POST
and PUT
. <URI>
: the URI to be requested. The first element of it (up to the
first /
) determines the module which will be invoked.<data>
: a set of key-value pairs to be sent as form data in the
format:
<key_1>=<value_1>,...,<key_n>=<value_n>
. If a value is of the format
file:<path>
then the contents of file denoted by <path>
will be
sent.