from time import sleep import requests import json import re from concurrent.futures import ThreadPoolExecutor
pattern = re.compile(r'hack\[(.+?)\]')
s = requests.Session() session_value = "eyJ0b2tlbiI6IjMyNTpNRVVDSUdYazdZLzRzOGxISTVtaXRVN0Fub3h6YnpZU0tZRjBSUmJPYzZZaGtiOTlBaUVBN25BS2xQOGVuTWJSUEpEaW5oclZYU1dOdVpBM3BPdlZTZkUrQmUwbEhrcz0ifQ.ZTyNJQ.kI1MQJvggl1tTd9Je6vajHJbTkU" s.cookies['session'] = session_value
get_url = "http://202.38.93.111:10021/api/getMessages"
def delete_message(i, flag_text): delete_url = "http://202.38.93.111:10021/api/deleteMessage" delete_data = {"id": i} delete_response = s.post(delete_url, json=delete_data) if delete_response.status_code == 200: while "error" in delete_response.text: delete_response = s.post(delete_url, json=delete_data) print(f"成功删除 id: {i + 1}") print(delete_response.text)
def handle_message(i, message): text = message.get('text', '') match = pattern.search(text) if match: flag_text = match.group(1) print(f"找到 flag: {flag_text}, 对应的 id: {i + 1}") delete_message(i, flag_text)
response = s.post(get_url)
if response.status_code == 200: resp_json = json.loads(response.text) messages = resp_json.get('messages', []) print(f"获取到 {len(messages)} 条消息")
for i, message in enumerate(messages): handle_message(i, message)
flag_url="http://202.38.93.111:10021/api/getflag" print(s.post(flag_url).text)
|