Challenge
访问 ?action=request 获取一个随机消息,在 1.337
秒内将相同的消息提交回 ?answer=<message>。
1 2 3
| When you visit this link you receive a message. Submit the same message back to .../?answer=the_message Your timelimit is 1.337 seconds
|
Solution
手动打开两个页面来不及,需要用脚本在同一次 shell
调用中完成——变量捕获后立即提交:
1 2
| MSG=$(curl -s -b 'WC=...' 'https://www.wechall.net/challenge/training/programming1/index.php?action=request') curl -s -b 'WC=...' "https://www.wechall.net/challenge/training/programming1/index.php?answer=$MSG"
|
消息每次都不同(如
CRg1xhGuz9、7G7sp7IJGZk),且只有 1.337
秒有效。需要登录态(WC cookie)才能请求。
1 2 3 4 5 6 7 8 9 10 11 12
| import subprocess, sys url = 'https://www.wechall.net/challenge/training/programming1/index.php' cookie = 'WC=...'
msg = subprocess.run( ['curl', '-s', '-b', cookie, url + '?action=request'], capture_output=True, text=True).stdout.strip()
result = subprocess.run( ['curl', '-s', '-b', cookie, url + f'?answer={msg}'], capture_output=True, text=True).stdout print(result)
|
关键是用同一个 shell session
连续执行请求和提交,中间不加人工操作。