diff --git a/addons/builtin/ssh22.py b/addons/builtin/ssh22.py index ddd7d32..8279232 100644 --- a/addons/builtin/ssh22.py +++ b/addons/builtin/ssh22.py @@ -44,7 +44,7 @@ async def fetch_ssh(collector, session: aiohttp.ClientSession, proxy: str = None paddr = conn._proxy_host pport = conn._proxy_port else: - parsed = proxy.lstrip("http://").rstrip("/").split(":") + parsed = proxy.removeprefix("http://").rstrip("/").split(":") paddr = parsed[0] pport = int(parsed[1]) diff --git a/utils/cleaner.py b/utils/cleaner.py index aa535a9..2aa477d 100644 --- a/utils/cleaner.py +++ b/utils/cleaner.py @@ -1758,7 +1758,7 @@ def unzip_targz(input_file: Union[str, Path], output_path: Union[str, Path]) -> """解压 tar.gz 文件, 返回解压后的文件名称列表""" unzip_files = [] try: - temp_path = str(input_file).rstrip(".gz") + temp_path = str(input_file).removesuffix(".gz") path = Path(input_file) path2 = Path(output_path) with gzip.open(path, 'rb') as f_in, open(temp_path, 'wb') as f_out: diff --git a/utils/websocket/ws_server.py b/utils/websocket/ws_server.py index e2867e2..fa3f58a 100644 --- a/utils/websocket/ws_server.py +++ b/utils/websocket/ws_server.py @@ -213,7 +213,7 @@ async def main(): if not isinstance(bindaddr, str): logger.error("绑定地址解析错误,请重试!") sys.exit() - ba = bindaddr.lstrip('http:').strip('/').split(':') + ba = bindaddr.removeprefix('http:').strip('/').split(':') try: if len(ba) != 2: logger.error("绑定地址解析错误,请重试!")