def read_characters_between_underscore_and_chinese(zip_file_path): result = "" with zipfile.ZipFile(zip_file_path, 'r') as zip_ref: # 获取压缩包内的文件列表 file_list = zip_ref.namelist() file_list = [file_name for file_name in file_list if not "flag" in file_name]
file_list.sort(key=lambda x: int(re.search(r'(\d+)', x).group(0)) if re.search(r'(\d+)', x) else float('inf')) # 使用正则表达式匹配下划线和中文字符之间的四个字符 pattern = re.compile(r'_([^_\u4e00-\u9fa5]{4})') for file_name in file_list: match = pattern.search(file_name) if match: characters_between_underscore_and_chinese = match.group(1) print(f"File: {file_name}, Characters: {characters_between_underscore_and_chinese}") result=result+str(characters_between_underscore_and_chinese) return result # 替换 'your_zip_file.zip' 为实际的压缩包文件路径 zip_file_path = "F:\\CTF\\2024COMPLETE\\1\\春秋杯\\misc\\谁偷吃了我的外卖\\out\\外卖箱.zip" result=read_characters_between_underscore_and_chinese(zip_file_path) with open("combinations.txt","w") as file: file.write(result)
将-替换成/
1 2 3 4 5
with open("combinations.txt","r") as file: result=file.read() result=result.replace("-","/") with open("combinations.txt", "w") as file1: file1.write(result)
with open("F:\\CTF\\2024COMPLETE\\1\\春秋杯\\misc\\谁偷吃了我的外卖\\out\\外卖箱_decrypted\\外卖箱\\flag\\txt.galf","r") as file: result=file.read() result=result[::-1] print(result)