static function output(\Un1c0rn\BaseExploit $exploit, $data) { $db = new \Un1c0rn\ElasticDb('pwn', 'hosts'); $host = $db->load($exploit->ip); $insert = $host === false ? true : false; $db->save($exploit->ip, array('ip' => $exploit->ip, 'updated' => time())); $db->addData($exploit->ip, 'leaks', array('port' => $exploit->port, 'date' => time(), 'data' => $data, 'type' => $exploit->getTag())); $db->addData($exploit->ip, 'tags', $exploit->getTag()); }
function get($ip) { global $config; $this->setData('view', 'views/details.tpl'); $_hostDb = new \Un1c0rn\ElasticDb('pwn', 'hosts', $config['elasticsearch']['ip']); $data = $_hostDb->load($ip); $this->templateData = array_merge($this->templateData, array('host' => $data)); $this->templateData['page_title'] = 'Leak history for ' . $data['ip']; $this->render(); }
function get() { global $config; $this->cache304('stats', 120); $this->setData('view', 'views/stats.tpl'); $_hostDb = new \Un1c0rn\ElasticDb('pwn', 'hosts', $config['elasticsearch']['ip']); $this->setData('page_title', 'Global leak statistics'); $this->setData('statsByTags', $_hostDb->getFacets('tags')); $this->setData('statsByPorts', $_hostDb->getFacets('ports')); $this->render(); }
function get($pageId) { global $config; $this->cache304($page, 3600); $this->setData('view', 'views/page.tpl'); $_e = new \Un1c0rn\ElasticDb('site', 'pages', $config['elasticsearch']['ip']); $page = $_e->load($pageId); if (!$page) { $this->templateData['title'] = '404 - Page not found'; $this->templateData['content'] = htmlentities($page) . ' not found :O'; header("HTTP/1.0 404 Not Found"); } $this->templateData = array_merge($this->templateData, $page); $this->render(); }
function get() { global $config; $cacheKey = substr(sha1($_GET['q']), 0, 9); $this->cache304($cacheKey, 3600); $this->setData('view', 'views/results.tpl'); $_e = new \Un1c0rn\ElasticDb('pwn', 'hosts', $config['elasticsearch']['ip']); $page = isset($_GET['page']) ? $_GET['page'] : 1; /* let's stress test. don't get your hopes up, we'll make sure free data is a thing of the past ! * (especially when the new workers will be ready to scan ) if($page > 1 && $_SERVER['SERVER_NAME'] =='un1c0rn.net'){ $this->setData('view','views/results-fo.tpl'); http_response_code(402); return $this->render(); } */ $data = $_e->search($_GET['q'], $page); $data['total'] = $data['hits']['total']; $viewResults = array(); $results = $data['hits']['hits']; foreach ($results as $result) { if (!empty($result['highlight'])) { $result['_source']['highlight'] = isset($result['highlight']['data']) ? $result['highlight']['data'] : array(); $result['_source']['hostname'] = isset($result['highlight']['hostname']) ? implode('...', $result['highlight']['hostname']) : $result['_source']['hostname']; } $viewResults[] = $result['_source']; } $data['Results'] = $viewResults; $data['term'] = htmlentities($_GET['q']); $data['page'] = $_GET['page']; $data['resultsPerPage'] = 5; $data['currentSearchUrl'] = '/search?q=' . urlencode($_GET['q']); $data['page_title'] = 'Leaks matching "' . htmlentities($_GET['q']) . '"'; $this->templateData = array_merge($this->templateData, $data); $this->render(); }