How to run custom script from inside a WAF
This work is based on eventHandler
The starting point is:
- we need to send an input from inside the WAF
- this input needs to be catched by something ouside the WAF
As regards the first point, we could use the sendEvent
property by com.lab126.system
We used something similar some times ago to take a screenshot from inside a WAF.
So, this time, it's quite the same.
Let's place this in the config.xml
<kindle:app name="com.lab126.system" value="yes"/>
Now let's send the message (event) using:
kindle.messaging.sendMessage('com.lab126.system', 'sendEvent', 'YOUR_EVENT_NAME');
You can bind this action to a button or anything else.
If you use
you can now see the event in your log!!
Now it's time to catch the event.
I altered dos1
's script a bit and I called this eventlauncher.sh
lipc-wait-event -m com.lab126.system YOUR_EVENTS_NAME | while read event; do
if [[ "$event" == "YOUR_EVENTS_NAME" ]]; then
You can run a script or a command this way!
Last thing is make eventlauncher.sh
running every time you run your WAF.
Create a new upstart script like this:
# start script for upstart
start on started lab126
stop on stopping lab126
export LANG LC_ALL
and place it in /etc/upstart. Restart your kindle.
This way the eventlauncher.sh
script is automatically executed at startup and stays active to catch your events.
Please note that playing around in upstart folder is potentially dangerous!