Codebase list phpggc / a31df033-663b-44b3-8817-dbcc304fcce9/upstream lib / PHPGGC / GadgetChain / FileRead.php
a31df033-663b-44b3-8817-dbcc304fcce9/upstream

Tree @a31df033-663b-44b3-8817-dbcc304fcce9/upstream (Download .tar.gz)

FileRead.php @a31df033-663b-44b3-8817-dbcc304fcce9/upstreamraw · 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']);
    }
}