# 遍历可能的输入 token for i inrange(1000000): # 6位以内的数字 token = str(i) md5_hash = hashlib.md5(token.encode()).hexdigest() # 获取需要的索引值 a = md5_hash[1] b = md5_hash[14] c = md5_hash[17] d = md5_hash[31] # 条件 1: 第1位, 第14位, 第17位相等 if a == b == c: # 条件 2: (a + a + a) / a = 3 且第31位等于3 if d == '3'and a.isdigit(): a = int(a) if a != 0and (a + a + a) / a == 3: # 确保 a 不为 0,且 (a + a + a) / a == 3 print(f"Found token: {token}") print(f"MD5: {md5_hash}") break
?> Linux version 5.4.0-163-generic (buildd@lcy02-amd64-067) (gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2)) #180-Ubuntu SMP Tue Sep 5 13:21:23 UTC 2023 Linux version 5.4.0-163-generic (buildd@lcy02-amd64-067) (gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2)) #180-Ubuntu SMP Tue Sep 5 13:21:23 UTC 2023
mt_srand查了之后发现是个伪随机数
直接提交得Flag
Web25
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
<?php error_reporting(0); include("flag.php"); if(isset($_GET['r'])){ $r = $_GET['r']; mt_srand(hexdec(substr(md5($flag), 0,8))); $rand = intval($r)-intval(mt_rand()); if((!$rand)){ if($_COOKIE['token']==(mt_rand()+mt_rand())){ echo$flag; } }else{ echo$rand; } }else{ highlight_file(__FILE__); echosystem('cat /proc/version'); } Linux version 5.4.0-163-generic (buildd@lcy02-amd64-067) (gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2)) #180-Ubuntu SMP Tue Sep 5 13:21:23 UTC 2023 Linux version 5.4.0-163-generic (buildd@lcy02-amd64-067) (gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2)) #180-Ubuntu SMP Tue Sep 5 13:21:23 UTC 2023