REX: Remote Execution Framework for PHP
<< Introduction to REX Back to Contents Security and REX >>

A First Example

As a first example let's create a Hello World application.

For this example we'll assume the user is sitting at the CLI of a REX enabled Linux client (called rexclient). The code will be uploaded onto the server (called codeserver) and published via apache in the directory http://codeserver/rex/

The REX Code

REX code is simply PHP but usually saved with a .rex extension (to stop it being executed by apache when requested).

Here is the sourcecode for our file index.rex:
echo "Hello World!"

We save this file to the directory published by our codeserver as /rex/ (usually something like /var/www/html/rex in the codeserver file system).

Two key points:

Executing on the REX-enabled client

Now the code has been created and saved onto the codeserver we can request and execute it on the client:
$ php rex.php http://codeserver/rex/

Will start REX and tell it to download the file from http://codeserver/rex/ (because this is a directory it will try the file index.rex in that directory).

Expected Output

$ php rex.php http://codeserver/rex/
Hello World!

And there you have it - your first REX application.

Note a similar example (and others) are available hosted at PurplePixie for you to browse online or request via REX. You can find these on the examples page.

<< Introduction to REX Back to Contents Security and REX >>