Scratching the Surface
Scratchpad is a built-in text editor
intended for running and debugging JavaScript,
but can also load and save plain-text files.
For example, we can use Scratchpad to save a mytest.txt file
to our home directory.
Browsing that location in Firefox
indicates that the file creation was successful:
This is all well and good,
but it seems we are still limited to running programs through the irc URI method,
which severely limits our abilities.
However, one application in particular,
gtkdialog, may be useful in this situation.
A quick Google search reveals that this application builds interfaces
with an HTML-style markup language.
This could be especially useful
since this machine doesn’t seem to have any other build tools
such as gcc or g++.
Let’s build a simple initial dialog box for testing.
We’ll briefly walk through this example.
An interface is represented by a combination of tags
that define its various parts.
A window tag represents the main window,
and anything between the tags
is considered a subcomponent of the window.
A vbox element is a vertical box that holds other elements.
An hbox is a horizontal box.
A frame acts as a simple container for elements such as text or graphics.
Text elements display text,
and label elements specify the actual text strings
being placed in the text element.
Button objects allow the user to trigger an action
such as a shell or other executable command.
In the example above, when we click the button,
our echo command will be executed,
and the output written to a file via the Linux redirect operator.
Using Scratchpad, we’ll save our sample dialog box code
to the guest user’s home folder as mywindow,
making sure to change the pulldown in the bottom right corner of the save dialog
from “Javascript Files” to “All Files”.
Now, let’s run our sample dialog window with the following URI,
and load our build script with the -f parameter.
This again presents the “Launch Application” dialog,
where we’ll select gtkdialog as our helper application:
This produces a window titled “gtkdialog”:
Nothing appears to happen when we click the OK button,
but if we browse to /tmp/gtkoutput.txt in a new Firefox tab,
we’ll find that the action triggered and wrote our text to the output file.
This means we have command execution on the system
and we are no longer restricted by the initial irc://myhost parameter issue.
Very nice.
This is a great start, but it’s an awkward solution.
For every command we want to execute, we must edit a file,
save it, relaunch our gtkdialog application,
click the button, and then browse to the result through Firefox.
In the next section, we’ll Try Harder.