suneo-bot.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:Shodita 作者: Quantika14 项目源码 文件源码
def detect_wp(html, dominio):
    soup = BeautifulSoup(html, "html.parser")
    try:    
        #Buscamos generator
        gen = soup.findAll(attrs={"name":"generator"})
        if "Wordpress" in str(gen):
            return True
        else: #Buscamos wp-content en el html
            if html.find("wp-content")>0:
                return True
            else:#Buscamos links con xmlrpc.php
                links = soup.findAll("link")
                for l in links:
                    if "xmlrpc.php" in str(l):
                        return True
                    else:#Buscamos el readme.html
                        try:
                            url = "http://" + dominio + "/readme.html"
                            html = urllib.urlopen(url).read()
                            soup = BeautifulSoup(html)
                            for h1 in soup.find_all('h1', {'id':"logo"}):
                                h1 = remove_tags(str(h1)) #PARSER
                                if h1:
                                    return True
                        except urllib2.HTTPError, e:
                            continue 
                        except urllib2.URLError, e:
                            continue
                        except httplib.HTTPException, e:
                            continue
    except:
        return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号