first commit

This commit is contained in:
BF
2026-04-14 22:53:52 +08:00
commit b37cba8735
156 changed files with 773977 additions and 0 deletions

View File

@@ -0,0 +1,214 @@
# -*- coding: UTF-8 -*-
'''
@Project :domainScanDemo
@File :juziseo_detector.py
@IDE :PyCharm
@Author :梦伴
@Date :2026/4/9 0:03
@explain : 桔子SEO检测器
'''
import requests
from curl_cffi import requests as curl_requests
import re
from app.detectors.base import BaseDetector
class JuziseoDetector(BaseDetector):
"""
桔子SEO检测器
"""
def __init__(self):
"""
初始化桔子SEO检测器
"""
super().__init__()
self.url = 'https://seo.juziseo.com'
self.history_url = 'https://seo.juziseo.com/history/{domain}'
self.backlink_url = 'https://seo.juziseo.com/backlink/{domain}'
def check_domain(self, domain):
"""
检测域名
:param domain: 域名
:return: dict - 检测结果
"""
try:
# 检查历史信息
history_result = self.check_history(domain)
# 检查外链
backlink_result = self.check_backlink(domain)
return {
'history': history_result,
'backlink': backlink_result
}
except Exception as e:
return self._handle_exception(e, domain)
def check_history(self, domain):
"""
检查历史信息
:param domain: 域名
:return: dict - 检测结果
"""
try:
# 构建查询URL
query_url = self.history_url.format(domain=domain)
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36'
}
# 使用curl_cffi模拟浏览器
response = curl_requests.get(query_url, headers=headers, impersonate='chrome', timeout=10)
if response.status_code == 200:
content = response.text
# 提取历史信息
history_info = self._extract_history_info(content)
# 检查是否包含敏感词
has_sensitive = self._check_sensitive(history_info)
# 检查是否有百度历史收录
has_baidu_history = '百度历史收录' in content
# 检查是否有子域名
has_subdomains = '子域名' in content
# 检查是否为简体中文
is_simplified = self._check_simplified(content)
return {
'has_sensitive': has_sensitive,
'has_baidu_history': has_baidu_history,
'has_subdomains': has_subdomains,
'is_simplified': is_simplified
}
else:
self._log_warning(f"桔子SEO历史查询失败: {response.status_code}")
return {'has_sensitive': False, 'has_baidu_history': False, 'has_subdomains': False, 'is_simplified': True}
except Exception as e:
self._handle_exception(e, domain)
return {'has_sensitive': False, 'has_baidu_history': False, 'has_subdomains': False, 'is_simplified': True}
def check_backlink(self, domain):
"""
检查外链
:param domain: 域名
:return: dict - 检测结果
"""
try:
# 构建查询URL
query_url = self.backlink_url.format(domain=domain)
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36'
}
# 使用curl_cffi模拟浏览器
response = curl_requests.get(query_url, headers=headers, impersonate='chrome', timeout=10)
if response.status_code == 200:
content = response.text
# 检查是否包含敏感词
has_sensitive = self._check_backlink_sensitive(content)
# 检查是否有子域名
has_subdomains = '子域名' in content
return {
'has_sensitive': has_sensitive,
'has_subdomains': has_subdomains
}
else:
self._log_warning(f"桔子SEO外链查询失败: {response.status_code}")
return {'has_sensitive': False, 'has_subdomains': False}
except Exception as e:
self._handle_exception(e, domain)
return {'has_sensitive': False, 'has_subdomains': False}
def _extract_history_info(self, content):
"""
提取历史信息
:param content: 页面内容
:return: str - 历史信息
"""
try:
# 这里需要根据实际页面结构调整正则表达式
pattern = r'<div class="history-info">(.*?)</div>'
match = re.search(pattern, content, re.DOTALL)
if match:
return match.group(1).strip()
return ''
except Exception as e:
self._handle_exception(e, 'extract_history_info')
return ''
def _check_sensitive(self, history_info):
"""
检查是否包含敏感词
:param history_info: 历史信息
:return: bool - 是否包含敏感词
"""
# 敏感词
sensitive_words = [
'色情', '赌博', '博彩', '毒品', '暴力', '诈骗',
'足球', '直播', '证券', '配资', '软件',
'体育', '商行', '下载', '影视', '网络',
'计算', 'app', 'HTML SiteMap', '模拟器', '传媒',
'二次元', '成人', '米乐', '小说', '凯发',
'人才', '华体', '娱乐', '开户'
]
for word in sensitive_words:
if word in history_info:
return True
return False
def _check_simplified(self, content):
"""
检查是否为简体中文
:param content: 页面内容
:return: bool - 是否为简体中文
"""
# 检查是否包含简体中文标识
if '简体中文' in content:
return True
# 检查是否包含繁体中文标识
if '繁体中文' in content:
return False
return True
def _check_backlink_sensitive(self, content):
"""
检查外链是否包含敏感词
:param content: 页面内容
:return: bool - 是否包含敏感词
"""
# 敏感词
sensitive_words = [
'内幕', '猛料', '精料', '高手', '绝杀',
'权威', '澳门', '色情', '赌博', '博彩'
]
for word in sensitive_words:
if word in content:
return True
return False