Login   Register  
PHP Classes
elePHPant
Icontem

File: sample-kmd-php.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-php.php  >  Download  
File: sample-kmd-php.php
Role: Example script
Content type: text/plain
Description: rewrite of php -a, php interactive shell
Class: PHP Command Line Shell
Use ncurses to get key inputs and write shell text
Author: By
Last change:
Date: 2013-07-24 15:17
Size: 898 bytes
 

Contents

Class file image Download
<?php

require 'kmd.php';

class 
kmdphp extends kmd {
    var 
$code '';
    function 
ret($line) {
        
$tag_a false;
        
$tag_z false;
        
$lline strlen($line);
        if (
substr($line02) == '<?'$tag_a true;
        if (
substr($line$lline 2) == '?>'$tag_z true;
        if (
$tag_z == true$line substr($line0$lline 2); 
        if (
$tag_a == true) {
            
$this->code '';
            
$line substr($line2);
            if (
substr($line03) == 'php'$line substr($line3);
        }
        
$this->code .= $line "\n";
        if (
$tag_z == true) {
            
ob_start();
            eval(
$this->code);
            
$ret ob_get_contents();
            
ob_end_clean();
            return 
"\n<?php\n/*\n" $ret "\n*/\n?>\n\n\n";
        }
    }
}

$kmdphp = new kmdphp('''script-only.php''script-text.php');
$kmdphp->run();

?>