PHP Classes

File: sample-kmd-php.php

Recommend this page to a friend!
  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: 11 years ago
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($line, 0, 2) == '<?') $tag_a = true;
        if (
substr($line, $lline - 2) == '?>') $tag_z = true;
        if (
$tag_z == true) $line = substr($line, 0, $lline - 2);
        if (
$tag_a == true) {
           
$this->code = '';
           
$line = substr($line, 2);
            if (
substr($line, 0, 3) == 'php') $line = substr($line, 3);
        }
       
$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();

?>