$msg
805 | EOT; 806 | if ($url != 'none') { 807 | echo ''; 808 | } 809 | echo <<" . $this->geterror()); 89 | }else { 90 | return $this->result; 91 | } 92 | } 93 | 94 | /** 95 | * 从结果集中取得一行作为关联数组/数字索引数组 96 | * 97 | */ 98 | function fetch_array($query , $type = MYSQL_ASSOC) { 99 | return mysql_fetch_array($query, $type); 100 | } 101 | 102 | function once_fetch_array($sql) { 103 | $this->result = $this->query($sql); 104 | return $this->fetch_array($this->result); 105 | } 106 | 107 | /** 108 | * 从结果集中取得一行作为数字索引数组 109 | * 110 | */ 111 | function fetch_row($query) { 112 | return mysql_fetch_row($query); 113 | } 114 | 115 | /** 116 | * 取得行的数目 117 | * 118 | */ 119 | function num_rows($query) { 120 | return mysql_num_rows($query); 121 | } 122 | 123 | /** 124 | * 取得结果集中字段的数目 125 | */ 126 | function num_fields($query) { 127 | return mysql_num_fields($query); 128 | } 129 | /** 130 | * 取得上一步 INSERT 操作产生的 ID 131 | */ 132 | function insert_id() { 133 | return mysql_insert_id($this->conn); 134 | } 135 | 136 | /** 137 | * 获取mysql错误 138 | */ 139 | function geterror() { 140 | return mysql_error(); 141 | } 142 | 143 | /** 144 | * 获取mysql错误编码 145 | */ 146 | function geterrno() { 147 | return mysql_errno(); 148 | } 149 | 150 | /** 151 | * Get number of affected rows in previous MySQL operation 152 | */ 153 | function affected_rows() { 154 | return mysql_affected_rows(); 155 | } 156 | 157 | /** 158 | * 取得数据库版本信息 159 | */ 160 | function getMysqlVersion() { 161 | return mysql_get_server_info(); 162 | } 163 | 164 | /** 165 | * 取得数据库查询次数 166 | */ 167 | function getQueryCount() { 168 | return $this->queryCount; 169 | } 170 | 171 | /** 172 | * Escapes special characters 173 | */ 174 | function escape_string($sql) { 175 | return mysql_real_escape_string($sql); 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /include/lib/mysqlii.php: -------------------------------------------------------------------------------- 1 | conn = new mysqli(DB_HOST, DB_USER, DB_PASSWD, DB_NAME); 40 | 41 | if ($this->conn->connect_error) { 42 | switch ($this->conn->connect_errno) { 43 | case 1044: 44 | case 1045: 45 | emMsg("连接数据库失败,数据库用户名或密码错误"); 46 | break; 47 | 48 | case 1049: 49 | emMsg("连接数据库失败,未找到您填写的数据库"); 50 | break; 51 | 52 | case 2003: 53 | emMsg("连接数据库失败,数据库端口错误"); 54 | break; 55 | 56 | case 2005: 57 | emMsg("连接数据库失败,数据库地址错误或者数据库服务器不可用"); 58 | break; 59 | 60 | case 2006: 61 | emMsg("连接数据库失败,数据库服务器不可用"); 62 | break; 63 | 64 | default : 65 | emMsg("连接数据库失败,请检查数据库信息。错误编号:" . $this->conn->connect_errno); 66 | break; 67 | } 68 | } 69 | 70 | $this->conn->set_charset('utf8'); 71 | } 72 | 73 | /** 74 | * 静态方法,返回数据库连接实例 75 | */ 76 | public static function getInstance() { 77 | if (self::$instance == null) { 78 | self::$instance = new MySqlii(); 79 | } 80 | 81 | return self::$instance; 82 | } 83 | 84 | /** 85 | * 关闭数据库连接 86 | */ 87 | function close() { 88 | return $this->conn->close(); 89 | } 90 | 91 | /** 92 | * 发送查询语句 93 | */ 94 | function query($sql, $ignore_err = FALSE) { 95 | $this->result = $this->conn->query($sql); 96 | $this->queryCount++; 97 | if (!$ignore_err && 1046 == $this->geterrno()) { 98 | emMsg("连接数据库失败,请填写数据库名"); 99 | } 100 | if (!$ignore_err && !$this->result) { 101 | emMsg("SQL语句执行错误: {$sql}
" . $this->geterror()); 102 | } else { 103 | return $this->result; 104 | } 105 | } 106 | 107 | /** 108 | * 从结果集中取得一行作为关联数组/数字索引数组 109 | */ 110 | function fetch_array(mysqli_result $query, $type = MYSQLI_ASSOC) { 111 | return $query->fetch_array($type); 112 | } 113 | 114 | function once_fetch_array($sql) { 115 | $this->result = $this->query($sql); 116 | return $this->fetch_array($this->result); 117 | } 118 | 119 | /** 120 | * 从结果集中取得一行作为数字索引数组 121 | */ 122 | function fetch_row(mysqli_result $query) { 123 | return $query->fetch_row(); 124 | } 125 | 126 | /** 127 | * 取得行的数目 128 | * 129 | */ 130 | function num_rows(mysqli_result $query) { 131 | return $query->num_rows; 132 | } 133 | 134 | /** 135 | * 取得结果集中字段的数目 136 | */ 137 | function num_fields(mysqli_result $query) { 138 | return $query->field_count; 139 | } 140 | 141 | /** 142 | * 取得上一步 INSERT 操作产生的 ID 143 | */ 144 | function insert_id() { 145 | return $this->conn->insert_id; 146 | } 147 | 148 | /** 149 | * 获取mysql错误 150 | */ 151 | function geterror() { 152 | return $this->conn->error; 153 | } 154 | 155 | /** 156 | * 获取mysql错误编码 157 | */ 158 | function geterrno() { 159 | return $this->conn->errno; 160 | } 161 | 162 | /** 163 | * Get number of affected rows in previous MySQL operation 164 | */ 165 | function affected_rows() { 166 | return $this->conn->affected_rows; 167 | } 168 | 169 | /** 170 | * 取得数据库版本信息 171 | */ 172 | function getMysqlVersion() { 173 | return $this->conn->server_info; 174 | } 175 | 176 | /** 177 | * 取得数据库查询次数 178 | */ 179 | function getQueryCount() { 180 | return $this->queryCount; 181 | } 182 | 183 | /** 184 | * Escapes special characters 185 | */ 186 | function escape_string($sql) { 187 | return $this->conn->real_escape_string($sql); 188 | } 189 | } 190 | -------------------------------------------------------------------------------- /include/lib/view.php: -------------------------------------------------------------------------------- 1 | db = Database::getInstance(); 15 | } 16 | 17 | /** 18 | * 前台获取单篇文章 19 | */ 20 | function getOneLogForHome($blogId) { 21 | $sql = "SELECT * FROM " . DB_PREFIX . " WHERE wynum='$blogId'"; 22 | $res = $this->db->query($sql); 23 | $row = $this->db->fetch_array($res); 24 | if ($row) { 25 | return $row; 26 | } else { 27 | return false; 28 | } 29 | } 30 | /** 31 | * 前台搜索 32 | */ 33 | function getListForUser($keyword,$type,$page = 1){ 34 | //需求:通过标题模糊搜索(1) 可通过 公司模糊搜索(2) 作者(3) 乌云版本号(4) 搜索 35 | $perpage_num = 10; 36 | $start_limit = !empty($page) ? ($page - 1) * $perpage_num : 0; 37 | $limit = "LIMIT $start_limit, " . $perpage_num; 38 | 39 | if($type==1){ 40 | $sql = "SELECT time,title,company,author,bugtype,wynum FROM " . DB_PREFIX . " WHERE title like '%{$keyword}%' order by time desc $limit"; 41 | }elseif($type==2){ 42 | $sql = "SELECT time,title,company,author,bugtype,wynum FROM " . DB_PREFIX . " WHERE company like '%{$keyword}%' order by time desc $limit"; 43 | }elseif($type==3){ 44 | $sql = "SELECT time,title,company,author,bugtype,wynum FROM " . DB_PREFIX . " WHERE author='$keyword' order by time desc $limit"; 45 | }elseif($type==4){ 46 | $sql = "SELECT time,title,company,author,bugtype,wynum FROM " . DB_PREFIX . " WHERE wynum like '%{$keyword}%' "; 47 | }else{ 48 | $sql = "SELECT time,title,company,author,bugtype,wynum FROM " . DB_PREFIX . " WHERE title like '%{$keyword}%' order by time desc $limit"; 49 | } 50 | //echo $sql; 51 | $logs = array(); 52 | $res = $this->db->query($sql); 53 | while ($row = $this->db->fetch_array($res)) { 54 | $logs[] = $row; 55 | } 56 | return $logs; 57 | } 58 | 59 | function getkeyword_array($keyword){ 60 | $sql = "SELECT title,company,wynum,content FROM " . DB_PREFIX . " WHERE title like '%{$keyword}%'"; 61 | $logs = array(); 62 | $res = $this->db->query($sql); 63 | while ($row = $this->db->fetch_array($res)) { 64 | $logs[] = $row; 65 | } 66 | return $logs; 67 | } 68 | 69 | /** 70 | * 获取指定条件的文章条数 71 | * 72 | * @param int $spot 0:前台 1:后台 73 | * @param string $hide 74 | * @param string $condition 75 | * @param string $type 76 | * @return int 77 | */ 78 | function getLogNum($keyword,$type) { 79 | $limit = ''; 80 | if($type==1){ 81 | $sql = "SELECT COUNT(*) AS total FROM " . DB_PREFIX . " WHERE title like '%{$keyword}%' order by wynum desc $limit"; 82 | }elseif($type==2){ 83 | $sql = "SELECT COUNT(*) AS total FROM " . DB_PREFIX . " WHERE company like '%{$keyword}%' order by wynum desc $limit"; 84 | }elseif($type==3){ 85 | $sql = "SELECT COUNT(*) AS total FROM " . DB_PREFIX . " WHERE author='$keyword' order by wynum desc $limit"; 86 | }elseif($type==4){ 87 | $sql = "SELECT COUNT(*) AS total FROM " . DB_PREFIX . " WHERE wynum like '%{$keyword}%' "; 88 | }else{ 89 | $sql = "SELECT COUNT(*) AS total FROM " . DB_PREFIX . " WHERE title like '%{$keyword}%' order by wynum desc $limit"; 90 | } 91 | 92 | $data = $this->db->once_fetch_array($sql); 93 | return $data['total']; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /include/model/splugins_model.php: -------------------------------------------------------------------------------- 1 | read()) 40 | { 41 | if((is_dir("$directory/$file")) AND ($file!=".") AND ($file!="..")) 42 | { 43 | $filedir[] = $file; 44 | tree("$directory/$file"); 45 | } 46 | else if(($file!=".") AND ($file!="..")){ 47 | $filedir[] = $file; 48 | } 49 | 50 | } 51 | $mydir->close(); 52 | return $filedir; 53 | } 54 | 55 | function Getinfo($dirx){ 56 | $filenames = $this->tree($dirx); 57 | $info = array(); 58 | foreach($filenames as $filename){ 59 | $rtext = $this->getLine($dirx.'/'.$filename,1); 60 | $rtext = trim($rtext); 61 | $descript = substr(strrchr($rtext, "#"), 1); 62 | $tem_arr = []; 63 | $tem_arr["descript"] = $descript; 64 | $tem_arr["all_path"] = $dirx.'/'.$filename; 65 | $tem_arr["path"] = $filename; 66 | $info[] = $tem_arr; 67 | } 68 | return $info; 69 | } 70 | 71 | 72 | } -------------------------------------------------------------------------------- /include/model/task_model.php: -------------------------------------------------------------------------------- 1 | db = Database::getInstance(); 11 | } 12 | 13 | /** 14 | * 添加文章、页面 15 | * 16 | * @param array $logData 17 | * @return int 18 | */ 19 | function addlog($logData) { 20 | $kItem = array(); 21 | $dItem = array(); 22 | foreach ($logData as $key => $data) { 23 | $kItem[] = $key; 24 | $dItem[] = $data; 25 | } 26 | $field = implode(',', $kItem); 27 | $values = "'" . implode("','", $dItem) . "'"; 28 | $this->db->query("INSERT INTO " . DB_PREFIX . "tasklist ($field) VALUES ($values)"); 29 | $logid = $this->db->insert_id(); 30 | return $logid; 31 | } 32 | 33 | 34 | function add($url,$descript,$plugins,$spider_plugins,$uid){ 35 | $logData = array(); 36 | $logData["url"] = $url; 37 | $logData["descript"] = $descript; 38 | $logData["status"] = 0; 39 | $logData["addtime"] = time(); 40 | $logData["spider_plugins"] = serialize($spider_plugins); 41 | $logData["plugins"] = serialize($plugins); 42 | $logData["token"] = $this->build_token(); 43 | $logData["uid"] = $uid; 44 | $logData["result"] = ''; 45 | $this->addlog($logData); 46 | return $logData["token"]; 47 | } 48 | 49 | /** 50 | * 显示界面 51 | * 52 | * @param 53 | * @return array $logData 54 | */ 55 | function GetPageData($uid){ 56 | $sql = "SELECT * FROM " . DB_PREFIX . "tasklist where uid='$uid'"; 57 | $res = $this->db->query($sql); 58 | $logData = []; 59 | while ($row = $this->db->fetch_array($res)) { 60 | $logData[] = $row; 61 | } 62 | return $logData; 63 | } 64 | 65 | function build_token(){ 66 | $str = time()."-".rand(100,999); 67 | return md5($str); 68 | } 69 | 70 | function getToken($token){ 71 | $sql = "SELECT * FROM " . DB_PREFIX . "tasklist WHERE token='$token' and status=0"; 72 | $res = $this->db->query($sql); 73 | $row = $this->db->fetch_array($res); 74 | if ($row) { 75 | return $row; 76 | } else { 77 | return false; 78 | } 79 | } 80 | 81 | function update_Result($token,$data){ 82 | $sql = "update " . DB_PREFIX . "tasklist set result = '$data' where token='$token'"; 83 | $res = $this->db->query($sql); 84 | } 85 | 86 | 87 | } -------------------------------------------------------------------------------- /include/model/user_model.php: -------------------------------------------------------------------------------- 1 | db = Database::getInstance(); 11 | } 12 | 13 | 14 | /** 15 | * 添加文章、页面 16 | * 17 | * @param array $logData 18 | * @return int 19 | */ 20 | 21 | function insertData($logData) { 22 | $kItem = array(); 23 | $dItem = array(); 24 | foreach ($logData as $key => $data) { 25 | $kItem[] = $key; 26 | $dItem[] = $data; 27 | } 28 | $field = implode(',', $kItem); 29 | $values = "'" . implode("','", $dItem) . "'"; 30 | $this->db->query("INSERT INTO " . DB_PREFIX . "user ($field) VALUES ($values)"); 31 | $logid = $this->db->insert_id(); 32 | return $logid; 33 | } 34 | 35 | 36 | function checkUser($user,$password){ 37 | $sql = "SELECT * FROM " . DB_PREFIX . "user WHERE user='$user' and password='$password'"; 38 | $res = $this->db->query($sql); 39 | $row = $this->db->fetch_array($res); 40 | if ($row) { 41 | return True; 42 | } else { 43 | return false; 44 | } 45 | } 46 | 47 | function getUser($user,$password){ 48 | $sql = "SELECT * FROM " . DB_PREFIX . "user WHERE user='$user' and password='$password'"; 49 | $res = $this->db->query($sql); 50 | $row = $this->db->fetch_array($res); 51 | if ($row) { 52 | return $row; 53 | } else { 54 | return false; 55 | } 56 | } 57 | 58 | } -------------------------------------------------------------------------------- /include/model/webdna_model.php: -------------------------------------------------------------------------------- 1 | filename = EMLOG_ROOT.'/w7scan/data/cms.json'; 8 | if(file_exists($this->filename)){ 9 | $str = file_get_contents($this->filename);//将整个文件内容读入到一个字符串中 10 | $this->_data = json_decode($str,true); 11 | } 12 | } 13 | function getall(){ 14 | return count($this->_data); 15 | } 16 | 17 | function getdata($index = 0,$num = 10){ 18 | return array_slice(array_reverse($this->_data),$index*10,$num); 19 | } 20 | 21 | function insert($name = '',$url = '',$re = '',$key = ''){ 22 | $temp = array( 23 | "url" => $url, 24 | "name" => $name, 25 | "re" => $re, 26 | "md5" => $md5 27 | ); 28 | $this->_data[] = $temp; 29 | $data = json_encode($this->_data); 30 | file_put_contents($this->filename,$data); 31 | } 32 | } -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | display();*/ 17 | // include View::getview("home"); //首页 18 | // include View::getview("register"); //注册 19 | // include View::getview("login"); //登陆 20 | // include View::getview("webdna_manager"); 21 | // new WebDNA_Model(); 22 | doStripslashes(); 23 | $emDispatcher = Dispatcher::getInstance(); 24 | $emDispatcher->dispatch(); 25 | View::output(); -------------------------------------------------------------------------------- /init.php: -------------------------------------------------------------------------------- 1 | (.*)?',re.I) 61 | title = p.findall(body) 62 | if(len(title)==1): 63 | return title[0] 64 | elif(len(title)>1): 65 | return title[0] 66 | return None 67 | 68 | 69 | @staticmethod 70 | def get_md5(html): 71 | m = hashlib.md5() 72 | m.update(html) 73 | md5 = m.hexdigest() 74 | return md5 75 | 76 | @staticmethod 77 | def thread(func, args, thr): 78 | '''[1] the func to run,[2] the func's args,[3] the thread nums''' 79 | q = Queue.Queue() 80 | t = [] 81 | 82 | def start(q): 83 | while not q.empty(): 84 | func(q.get()) 85 | 86 | for a in args: 87 | q.put(a) 88 | for i in range(int(thr)): 89 | tt = threading.Thread(target=start, args=(q,)) 90 | t.append(tt) 91 | for i in range(int(thr)): 92 | t[i].start() 93 | for i in range(int(thr)): 94 | # t[i].join(timeout=10) 95 | t[i].join() 96 | 97 | class w8_report(object): 98 | def send_report(self,data): 99 | pass 100 | 101 | class UrlManager(object): 102 | def __init__(self): 103 | self.new_urls = set() 104 | self.old_urls = set() 105 | 106 | def add_new_url(self, url): 107 | if url is None: 108 | return 109 | if url not in self.new_urls and url not in self.old_urls: 110 | self.new_urls.add(url) 111 | 112 | def add_new_urls(self, urls): 113 | if urls is None or len(urls) == 0: 114 | return 115 | for url in urls: 116 | self.add_new_url(url) 117 | 118 | def has_new_url(self): 119 | return len(self.new_urls) != 0 120 | 121 | def get_new_url(self): 122 | new_url = self.new_urls.pop() 123 | self.old_urls.add(new_url) 124 | return new_url 125 | 126 | class w8_report(object): 127 | def __init__(self): 128 | self.data = {} 129 | 130 | def send(self): 131 | content = base64.encodestring(self._build()) 132 | try: 133 | w8_Common.post(_B + "?send/"+_Token,"data=" + content) 134 | except Exception,e: 135 | print Exception,":",e 136 | 137 | def add(self,key,data): 138 | self.data[key] = data 139 | 140 | def add_list(self, key, data): 141 | if key not in self.data: 142 | self.data[key] = [] 143 | self.data[key].append(data) 144 | 145 | def _build(self): 146 | return json.dumps(self.data) 147 | 148 | # spider code 149 | import re 150 | from urlparse import urljoin 151 | class SpiderMain(object): 152 | def __init__(self, root, threadNum=10): 153 | global splugins 154 | self.urls = UrlManager() 155 | self.root = root 156 | self.threadNum = threadNum 157 | self.splugins = splugins 158 | 159 | def _judge(self, domain, url): 160 | if (url.find(domain) != -1): 161 | return True 162 | else: 163 | return False 164 | 165 | def _parse(self, page_url, content): 166 | if content is None: 167 | return 168 | # soup = BeautifulSoup(content, 'html.parser') 169 | webreg = re.compile(''']+href=["\'](.*?)["\']''', re.IGNORECASE) 170 | urls = webreg.findall(content) 171 | _news = self._get_new_urls(page_url, urls) 172 | return _news 173 | 174 | def _get_new_urls(self, page_url, links): 175 | new_urls = set() 176 | for link in links: 177 | new_url = link 178 | new_full_url = urljoin(page_url, new_url) 179 | if (self._judge(self.root, new_full_url)): 180 | new_urls.add(new_full_url) 181 | return new_urls 182 | 183 | def craw(self): 184 | 185 | # splugins = [1] 186 | self.urls.add_new_url(self.root) 187 | while self.urls.has_new_url(): 188 | if self.urls.has_new_url() is False: 189 | break 190 | new_url = self.urls.get_new_url() 191 | # print("craw:" + new_url) 192 | report.add_list("爬虫",new_url) 193 | code, head, body, redirect, log =w8_Common.get(new_url) 194 | if code != 200: 195 | continue 196 | new_urls = self._parse(new_url, body) 197 | self.urls.add_new_urls(new_urls) 198 | 199 | for tem_plugin in self.splugins: 200 | code = urllib.urlopen(tem_plugin).read() 201 | exec code 202 | exec "run(new_url,body)" 203 | report.send() 204 | 205 | # _U = 'http://www.adfun.cn/' 206 | report = w8_report() 207 | 208 | def gethostbyname(url): 209 | domain = urlparse.urlparse(url) 210 | # domain.netloc 211 | if domain.netloc is None: 212 | return None 213 | ip = socket.gethostbyname(domain.netloc) 214 | return ip 215 | 216 | def GetBaseInfo(): 217 | report.add("server",w8_Common.getheaders(_U)) 218 | report.add("title",w8_Common.gettitle(_U)) 219 | report.add("ip",gethostbyname(_U)) 220 | GetBaseInfo() 221 | 222 | if plugin is not None: 223 | for temp_plugin in plugin: 224 | code = urllib.urlopen(temp_plugin).read() 225 | exec code 226 | 227 | if splugins is not None: 228 | ww = SpiderMain(_U) 229 | ww.craw() 230 | 231 | if __name__ == '__main__': 232 | pass 233 | # w8_Common.getheaders("https://www.baidu.com") 234 | # print w8_Common.gettitle("https://www.baidu.com") -------------------------------------------------------------------------------- /py/plugins/burtdir.py: -------------------------------------------------------------------------------- 1 | # 目录爆破插件 2 | import os 3 | class webdir: 4 | def __init__(self,root,threadNum): 5 | self.root = root 6 | self.threadNum = threadNum 7 | def _httpGet(self,url): 8 | ls_url = self.root + url 9 | code, head, body, redirect, log = w8_Common.get(ls_url) 10 | if(code!=404): 11 | # print "[%s]%s"%(code,ls_url) 12 | report.add_list("目录爆破",ls_url) 13 | 14 | def run(self): 15 | code, head, body, redirect, log = w8_Common.get("%s/py/data/dir.txt"%_B) 16 | if(code==200): 17 | dictionary = body.split(os.linesep) 18 | w8_Common.thread(self._httpGet,dictionary,self.threadNum) 19 | 20 | print "[...] Initialize DIRBURST ..." 21 | ww = webdir(_U,25) 22 | ww.run() 23 | report.send() -------------------------------------------------------------------------------- /py/plugins/portscan.py: -------------------------------------------------------------------------------- 1 | # 端口扫描插件 2 | import socket,time,thread 3 | import urlparse 4 | 5 | class PortScan: 6 | def __init__(self,ip): 7 | socket.setdefaulttimeout(3) 8 | self.lock = thread.allocate_lock() 9 | self.ip = ip 10 | try: 11 | for i in range(0, 65530): 12 | thread.start_new_thread(self.socket_port, (ip, int(i))) 13 | except: 14 | pass 15 | time.sleep(4) 16 | 17 | def socket_port(self,ip, port): 18 | try: 19 | if port >= 65535: 20 | print u'port end' 21 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 22 | result = s.connect_ex((ip, port)) 23 | if result == 0: 24 | self.lock.acquire() 25 | print ip, ':', port, 'open' 26 | report.add_list("端口",port) 27 | self.lock.release() 28 | s.close() 29 | except: 30 | pass 31 | 32 | ip = gethostbyname(_U) 33 | print "Start scan port -> IP:",ip 34 | PortScan(ip) 35 | report.send() -------------------------------------------------------------------------------- /py/plugins/whatcms.py: -------------------------------------------------------------------------------- 1 | # CMS识别插件 2 | import threading,Queue,sys 3 | reload(sys) 4 | sys.setdefaultcoding('utf-8') 5 | class Webcms: 6 | def __init__(self,url,threadNum): 7 | self.workQueue = Queue.Queue() 8 | self.url = url 9 | self.threadNum = threadNum 10 | self.NotFound = True 11 | self.result = "" 12 | 13 | def th_whatweb(self): 14 | if(self.workQueue.empty()): 15 | self.NotFound = False 16 | return False 17 | 18 | if(self.NotFound is False): 19 | return False 20 | cms = self.workQueue.get() 21 | _url = self.url + cms["url"] 22 | try: 23 | code, head, html, redirect, log = w8_Common.get(_url) 24 | except: 25 | html = None 26 | # print "[whatweb log]:checking %s"%_url 27 | if(html is None): 28 | return False 29 | if cms["re"]: 30 | if(html.find(cms["re"])!=-1): 31 | self.result = cms["name"] 32 | self.NotFound = False 33 | return True 34 | else: 35 | md5 = w8_Common.get_md5(html) 36 | if(md5==cms["md5"]): 37 | self.result = cms["name"] 38 | self.NotFound = False 39 | return True 40 | 41 | def run(self): 42 | _url = "%s/py/data/data.json"%_B 43 | 44 | 45 | try: 46 | body = w8_Common.urlget(_url) 47 | except: 48 | print "read %s whatcms module error!"%_url 49 | body = None 50 | if (body): 51 | webdata = json.loads(body, encoding="utf-8") 52 | for i in webdata: 53 | self.workQueue.put(i) 54 | while (self.NotFound): 55 | th = [] 56 | for i in range(self.threadNum): 57 | t = threading.Thread(target=self.th_whatweb) 58 | t.start() 59 | th.append(t) 60 | for t in th: 61 | t.join() 62 | 63 | if (self.result): 64 | print "[webcms]:%s cms is %s" % (self.url, self.result) 65 | report.add("网站指纹",self.result) 66 | else: 67 | print "[webcms]:%s cms NOTFound!" % self.url 68 | report.add("网站指纹","Not Found!") 69 | 70 | print "[...] Initialize whatweb module ..." 71 | wwb = Webcms(_U,100) 72 | wwb.run() 73 | report.send() -------------------------------------------------------------------------------- /py/spider/2.py: -------------------------------------------------------------------------------- 1 | # 测试插件 2 | def run(url='',body=''): 3 | # this is a test 4 | return False -------------------------------------------------------------------------------- /py/spider/email.py: -------------------------------------------------------------------------------- 1 | # E-mail搜索 2 | def run(url='',body=''): 3 | pattern = re.compile(r'([\w-]+@[\w-]+\.[\w-]+)+') 4 | email_list = re.findall(pattern, body) 5 | if (email_list): 6 | for email in email_list: 7 | print email 8 | report.add_list("E-mail",email) 9 | return True 10 | return False -------------------------------------------------------------------------------- /py/test.py: -------------------------------------------------------------------------------- 1 | print _C 2 | print _U 3 | print _B 4 | print _Plugin 5 | import json 6 | s = json.loads(_Plugin); 7 | print s -------------------------------------------------------------------------------- /theme/about.php: -------------------------------------------------------------------------------- 1 |
About w8scan 扫描器
8 |2 | 5 |