def testString(target_host, cgi_path):
    status = reason = delay= res = status = reason = delay = res2 = None
    command = 'echo -e "Content-type: text/html\\n\\n%s">&1' %TEST_STRING
    try:
        status, reason, delay, res = exploit(target_host, cgi_path, command)
        data = res.read()
        res.close()
        warning = vulnerable = TEST_STRING in data
        if vulnerable: 
            print "%s%s\t VULNERABLE TO STRING TEST" %(target_host, cgi_path)
        shellshocktest = {'host': target_host,
                    'cgi_path': cgi_path,
                    'requests': [(command, status,reason,delay,res), (None,None,None,None,None)],
                    'vulnerable' : vulnerable,
                    'warning' : warning,
                    'error': False,
                    'delay_diff' : 0
                    }   
        print "%s%s - %s - %s - %s" %(target_host, cgi_path, "string test", "VULNERABLE" if shellshocktest['vulnerable'] else "False", shellshocktest['requests'][0][3])
        return shellshocktest
    except Exception as e:
        # print e.__class__, e
        shellshocktest = {'host': target_host,
                    'cgi_path': cgi_path,
                    'requests': [(command, status,reason,delay,res), (None,None,None,None,None)],
                    'vulnerable' : False,
                    'warning' : False,
                    'error': True,
                    'delay_diff' : 0
                    }   
        return shellshocktest


    if not shellshocktest['error']:
        shellshocktest['warning'] = shellshocktest['requests'][1][4] > PING_DELAY # Delay command request > sleep time
        shellshocktest['vulnerable'] = shellshocktest['warning'] and shellshocktest['delay_diff'] > PING_DELAY
        if shellshocktest['vulnerable']: 
            print "%s%s\t VULNERABLE" %(target_host, cgi_path)
        print "%s%s - %s - %s" %(target_host, cgi_path, shellshocktest['vulnerable'], shellshocktest['requests'][1][3])
    return shellshocktest
dataset/ETHPy150Open gry/shellshock-scanner/shellshock_scanner.py/testString/original