/** *Loads, instantiates, configures http object */ private function configureHttpAdapter(\CmdLineParser $parser) { $options = $parser->getParsedOptions(); $this->_httpAdapter->setMethod($options["http-method"]); $this->_httpAdapter->setUrl($options["url"]); $urlVariables = explode(",", $options["urlvars"]); $realUrlVars = array(); $value = ""; $var = ""; foreach ($urlVariables as $urlVar) { $var = explode("=", $urlVar); $value = isset($var[1]) ? $var[1] : ""; $this->_httpAdapter->addRequestVariable($var[0], $value); } if (!empty($options["proxy-server"])) { $this->_httpAdapter->setProxyServer($options["proxy-server"]); $this->_httpAdapter->setProxyPort($options["proxy-port"]); $this->_httpAdapter->setProxyType($options["proxy-type"]); } if (!empty($options["proxy-auth"])) { $this->_httpAdapter->setProxyAuth($options["proxy-auth"]); $this->_httpAdapter->setProxyUser($options["proxy-user"]); $this->_httpAdapter->setProxyPassword($options["proxy-password"]); } }
function testLinks(array $links, \HttpAdapter &$httpAdapter, \CmdLineParser &$cmdParser, \Logger &$log) { $log->log("Amount of links to be tested for injection:" . sizeof($links), 0, "light_cyan"); $parsedOptions = $cmdParser->getParsedOptions(); $tmpLinks = array_keys($links); foreach ($tmpLinks as $lnk) { $log->log($lnk, 0, "light_cyan"); } foreach ($links as $path => $query) { if ($path === 0) { $cmdParser->setOption("url", $parsedOptions["url"]); } else { $cmdParser->setOption("url", $path); } $cmdParser->setOption("urlvars", $query); if (isVulnerable($cmdParser, $httpAdapter, $log) && (bool) $parsedOptions["immediate-mode"]) { break; } } }
requireParser("TagMatcher"); requireParser("Dummy"); requireParser("MySQLError"); //Functions requireFunction("launcher"); checkPHPVersion(); $logger = new Logger(); $logger->setEcho(TRUE); banner($logger); try { unset($_SERVER["argv"][0]); $sites = array(); $links = array(); $parameters = mergeConfig($_SERVER["argv"], "config/config.ini"); $cmdParser = new CmdLineParser($config, $parameters); $parsedOptions = $cmdParser->getParsedOptions(); if (isset($parsedOptions["log-save"])) { $logger->setFilename($parsedOptions["log-save"]); } $logger->setColors($parsedOptions["colors"]); if (!empty($parsedOptions["url"])) { $sites[0] = $parsedOptions["url"]; } //Instance of the http adapter, shared by aggregation through all classes $httpAdapter = new $parsedOptions["http-adapter"](); if (isset($parsedOptions["connect-timeout"])) { $httpAdapter->setConnectTimeout($parsedOptions["connect-timeout"]); } if (isset($parsedOptions["request-interval"]) && $parsedOptions["request-interval"] > 0) { $httpAdapter->setRequestInterval($parsedOptions["request-interval"]); }