Login   Register  
PHP Classes
elePHPant
Icontem

File: sample-kmd-shell.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of François NEUMANN-RYSTOW  >  PHP Command Line Shell  >  sample-kmd-shell.php  >  Download  
File: sample-kmd-shell.php
Role: Example script
Content type: text/plain
Description: wrapping linux console for education or joke purpose.
Class: PHP Command Line Shell
Use ncurses to get key inputs and write shell text
Author: By
Last change:
Date: 2013-07-24 15:18
Size: 495 bytes
 

Contents

Class file image Download
<?php

require 'kmd.php';

class 
kmd_shell extends kmd {
    function 
inv($host) {
        return 
$host ':' getcwd() . '# '
    }
    function 
ret($line) {
        
$line trim($line);
        if (
substr($line02) == 'cd') {
            
chdir(substr($line3));
            return 
"\n";
        }
        elseif (
$line == 'exit') return false;
        else return 
shell_exec($line);
    }
}

$kmd_shell = new kmd_shell(get_current_user() . '@' php_uname('n'));
$kmd_shell->run();

?>