User:d00p > Shell Output Extension

Shell Output Extension

This extension is designed to execute shell commands and display their output on DekiWiki. This extension is based onVivieny's Deki_Extension_for_PHP and needs at least DekiWiki 8.05. If you have any question, please open a new thread on the forum and send me a private message with the post link.

INSTALLATION

  1. Create two new folder /var/www/deki-hayes/config/extensions and /exec
  2. Copy to /var/www/deki-hayes/config/extensions the files DekiExt.php and IXR_Library.inc.php.txt as described at Vivieny's Deki_Extension_for_PHP
  3. Copy to /var/www/deki-hayes/config/extensions the attached files exec.php and shell.php
  4. Take ownership of all new files
    1. chown -R www-data:www-data  /var/www/deki-hayes/config/*
    2. chown -R www-data:www-data  /exec
  5. Go to Service managmenent in the Control Panel of your wiki
  6. Under Add Service, click on Remote, and configure:
    1. Type = Extension
    2. Description = Shell Output Extension
    3. URI = http://localhost/config/extensions/shell.php
    4. Status = Enabled
  7. Click on add service
  8. This extension will only execute executable files found at /exec folder. So you must create there any scripts you need to execute or create symlinks to any executable you want. For example:

ln -s /bin/ps /exec/ps

         

FUNCTIONS

shell.exec(program:str):xml

This function will execute the parameter program and display the command output on the wiki page. For example:

{{ shell.exec("ps") }}

will display something similar to

PID TTY          TIME CMD
8523 ?        00:01:04 mono
14984 ?        00:00:00 apache2
14987 ?        00:00:00 apache2
14988 ?        00:00:00 apache2
14989 ?        00:00:00 apache2
15526 ?        00:00:00 apache2
15527 ?        00:00:00 apache2
15528 ?        00:00:00 apache2
15529 ?        00:00:00 apache2
15530 ?        00:00:00 apache2
15531 ?        00:00:00 apache2
15911 ?        00:00:00 ps

execExternal(program:str):xml

This function will display a link that will open a new window display the command output . For example:

{{ shell.execExternal("ps") }}

will display something similar to

ps   

      

Tag page

Files 2

FileSizeDateAttached by 
 exec.php
No description
304 bytes21:38, 8 May 2008d00pActions
shell.php
No description
2.84 kB08:17, 9 May 2008d00pActions
You must login to post a comment.
Powered by MindTouch Deki v.8.08.2