Codebase list phpggc / 0a0732bb-898c-41f1-b464-b9ba025c444d/main lib / PHPGGC / GadgetChain / FileRead.php
0a0732bb-898c-41f1-b464-b9ba025c444d/main

Tree @0a0732bb-898c-41f1-b464-b9ba025c444d/main (Download .tar.gz)

FileRead.php @0a0732bb-898c-41f1-b464-b9ba025c444d/mainraw · history · blame

<?php

namespace PHPGGC\GadgetChain;

abstract class FileRead extends \PHPGGC\GadgetChain
{
    public static $type = self::TYPE_FR;
    public static $parameters = [
        'remote_path'
    ];

    public function test_setup()
    {
        return [
            'remote_path' => \PHPGGC\Util::rand_file('test file read')
        ];
    }

    public function test_confirm($arguments, $output)
    {
        $expected = file_get_contents($arguments['remote_path']);
        return strpos($output, $expected) !== false;
    }

    public function test_cleanup($arguments)
    {
        if(file_exists($arguments['remote_path']))
            unlink($arguments['remote_path']);
    }
}