Codebase list phpggc / 253a19c7-3c7a-4cb3-a88f-3a96d6497720/upstream lib / PHPGGC / GadgetChain / FileRead.php
253a19c7-3c7a-4cb3-a88f-3a96d6497720/upstream

Tree @253a19c7-3c7a-4cb3-a88f-3a96d6497720/upstream (Download .tar.gz)

FileRead.php @253a19c7-3c7a-4cb3-a88f-3a96d6497720/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']);
    }
}