Skip to content

Commit 5206b44

Browse files
committed
Output the help information for the detected system language
1 parent 8a922e7 commit 5206b44

File tree

8 files changed

+46
-20
lines changed

8 files changed

+46
-20
lines changed

sbscan.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,29 @@
88
"""
99
import sys
1010
import signal
11+
import locale
1112
from click import Command, Context
1213
import click
1314
from managers.proxy_manager import ProxyManager
1415
from managers.scanner_manager import ScannerManager
1516
from utils.logging_config import configure_logger
1617
from utils.args_prase import ArgumentParser
17-
from utils.banner import banner
18+
from utils.banner import banner, help_info_en, help_info_zh
1819
logger = configure_logger(__name__)
1920

21+
system_lang = locale.getlocale()[0]
2022

21-
class CustomCommand(Command):
22-
def format_usage(self, ctx: Context, formatter):
23-
formatter.write_text("python3 sbscan.py [OPTIONS]")
2423

25-
26-
@click.command(cls=CustomCommand, add_help_option=False)
24+
@click.command(add_help_option=False)
2725
@click.option("-u", "--url", type=str, help="对单个URL进行扫描")
2826
@click.option("-f", "--file", help="读取文件中的url进行扫描", type=click.Path(exists=True))
2927
@click.option("-m", "--mode", type=str, help="扫描模式选择: [path/cve/all], 默认all", default="all")
30-
@click.option("-p", "--proxy", type=str, help="使用HTTP代理")
28+
@click.option("-p", "--proxy", type=str, help="指定HTTP代理")
3129
@click.option("-t", "--threads", type=int, help="并发线程数, 默认单线程", default=1)
3230
@click.option("-ff", "--fingerprint_filter", is_flag=True, help="只对存在spring指纹的网站开始扫描")
3331
@click.option("-d", "--dnslog", type=str, help="指定dnslog域名", default="")
3432
@click.option("-q", "--quiet", is_flag=True, help="纯净版输出,仅输出命中的结果")
35-
@click.option("-h", "--help", is_flag=True, callback=lambda ctx, param, value: ctx.exit(click.echo(ctx.get_help()) or 0) if value else None, expose_value=False, help="显示帮助信息")
33+
@click.option("-h", "--help", is_flag=True, callback=lambda ctx, param, value: ctx.exit(click.secho(help_info_zh if system_lang.startswith("zh_CN") else help_info_en, fg='cyan') or 0) if value else None, expose_value=False, help="显示帮助信息")
3634
def main(url, file, mode, proxy, dnslog, threads, fingerprint_filter, quiet):
3735
try:
3836
# 参数解析与验证

scanners/cve_scanners/cve_2018_1273.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ def check(url, dns_domain, proxies=None):
4848
res = requests.post(target_url, headers=headers, timeout=TIMEOUT, data=payload, verify=False, proxies=proxies)
4949
logger.debug(Fore.CYAN + f"[{res.status_code}]" + Fore.BLUE + f"[{res.headers}]", extra={"target": target_url})
5050
if res.status_code == 500:
51-
details = f"可能存在{CVE_ID}[无回显漏洞]的RCE漏洞"
51+
details = f"{CVE_ID} vulnerability detected"
5252
if dns_domain == "dnslog.cn":
53-
details += ",建议使用--dnslog参数指定你的dnslog域名后再次扫描"
53+
details += ",use the --dnslog parameter to specify your dnslog domain and then scan again"
5454
else:
55-
details += ",请查看你的dnslog记录确认"
55+
details += ",please check your dnslog record for confirmation"
5656

5757
logger.info(Fore.RED + f"[{CVE_ID} vulnerability detected!]", extra={"target": target_url})
5858
return True, {

scanners/cve_scanners/cve_2019_3799.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def check(url, dns_domain, proxies=None):
4040
return True, {
4141
"CVE_ID": CVE_ID,
4242
"URL": target_url,
43-
"Details": f"检测到{CVE_ID}的RCE漏洞",
43+
"Details": f"{CVE_ID} vulnerability detected",
4444
"response": res.text[:200] + "...."
4545
}
4646
logger.info(f"[{CVE_ID} vulnerability not detected]", extra={"target": url})

scanners/cve_scanners/cve_2021_21234.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def check(url, dns_domain, proxies=None):
5454
return True, {
5555
"CVE_ID": CVE_ID,
5656
"URL": target_url,
57-
"Details": f"检测到{CVE_ID}的RCE漏洞",
57+
"Details": f"{CVE_ID} vulnerability detected",
5858
"response": res.text[:200] + "...."
5959
}
6060
except requests.RequestException as e:

scanners/cve_scanners/cve_2022_22947.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def check(url, dns_domain, proxies=None):
5959
return True, {
6060
"CVE_ID": CVE_ID,
6161
"URL": res3.url,
62-
"Details": f"检测到{CVE_ID}的RCE漏洞",
62+
"Details": f"{CVE_ID} vulnerability detected",
6363
"response": res3.json()
6464
}
6565
logger.info(f"[{CVE_ID} vulnerability not detected]", extra={"target": url})

scanners/cve_scanners/cve_2022_22963.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ def check(url, dns_domain, proxies=None):
4141
logger.debug(Fore.CYAN + f"[{res.status_code}]" + Fore.BLUE + f"[{res.headers}]", extra={"target": target_url})
4242
# 检查响应内容来判断漏洞是否存在
4343
if res.status_code == 500 and '"error":"Internal Server Error"' in res.text:
44-
details = f"可能存在{CVE_ID}[无回显漏洞]的RCE漏洞"
44+
details = f"{CVE_ID} vulnerability detected!"
4545
if dns_domain == "dnslog.cn":
46-
details += ",建议使用--dnslog参数指定你的dnslog域名后再次扫描"
46+
details += ",use the --dnslog parameter to specify your dnslog domain and then scan again"
4747
else:
48-
details += ",请查看你的dnslog记录确认"
48+
details += ",Please check your dnslog record for confirmation"
4949

5050
logger.info(Fore.RED + f"[{CVE_ID} vulnerability detected!]", extra={"target": target_url})
5151
return True, {

scanners/cve_scanners/cve_2022_22965.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def check(url, dns_domain, proxies=None):
5858
return True, {
5959
"CVE_ID": CVE_ID,
6060
"URL": target_url,
61-
"Details": f"检测到{CVE_ID}的RCE漏洞"
61+
"Details": f"{CVE_ID} vulnerability detected"
6262
}
6363
else:
6464
parsed_url = urlparse(target_url)
@@ -71,7 +71,7 @@ def check(url, dns_domain, proxies=None):
7171
return True, {
7272
"CVE_ID": CVE_ID,
7373
"URL": target_url_root,
74-
"Details": f"检测{CVE_ID}的RCE漏洞"
74+
"Details": f"{CVE_ID} vulnerability detected"
7575
}
7676
logger.info(f"[{CVE_ID} vulnerability not detected]", extra={"target": url})
7777
return False, {}

utils/banner.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,34 @@
1010
from rich.console import Console
1111
console = Console()
1212

13+
help_info_en = """
14+
python3 sbscan.py [OPTIONS]
15+
16+
-u --url: Scan a single URL
17+
-f --file: Read URLs from a file for scanning
18+
-m --mode: Scan mode selection: [path/cve/all], default is 'all'
19+
-p --proxy: Specify an HTTP proxy
20+
-t --threads: Number of concurrent threads, default is single-threaded
21+
-ff --fingerprint_filter: Scan only websites with a Spring fingerprint
22+
-d --dnslog: Specify a dnslog domain
23+
-q --quiet: Quiet mode, only outputs the results
24+
-h --help: Show this help information
25+
"""
26+
27+
help_info_zh = """
28+
python3 sbscan.py [OPTIONS]
29+
30+
-u --url: 对单个URL进行扫描
31+
-f --file: 从文件读取URL进行扫描
32+
-m --mode: 扫描模式选择: [path/cve/all], 默认为'all'
33+
-p --proxy: 指定HTTP代理
34+
-t --threads: 并发线程数, 默认单线程
35+
-ff --fingerprint_filter: 只对存在Spring指纹的网站进行扫描
36+
-d --dnslog: 指定dnslog域名
37+
-q --quiet: 纯净版输出,仅输出命中的结果
38+
-h --help: 显示帮助信息
39+
"""
40+
1341

1442
def banner():
1543
colors = ["red", "green", "yellow", "blue", "magenta", "cyan", "white"]
@@ -24,7 +52,7 @@ def banner():
2452
r"name: SBSCAN",
2553
r"author: sule01u",
2654
r"from: [underline]https://github.com/sule01u/SBSCAN[/underline]",
27-
r"desc: springboot information leak scanning & spring vulnerability scanning",
55+
r"desc: springboot information leak scanner && spring vulnerability scanner",
2856
r""
2957
""
3058
]

0 commit comments

Comments
 (0)