import subprocess flag_1="hgame{" flag=[] index=6 for x inrange(len(flag_1)): flag.append(ord(flag_1[x])) while index<31: for i inrange(32,128): flag_guess=[0]*31 for j inrange(len(flag)): flag_guess[j]=flag[j] flag_guess[index]=i flag_guess_str="".join(chr(x)for x in flag_guess) p=subprocess.Popen(["D:\\my re code\\hgame 2022\\week4\\hardasm.exe"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) #设置子进程状态 p.stdin.write(flag_guess_str.encode()) p.stdin.close() out=p.stdout.read() iflen(flag_1)==30: print(flag_1+"}") break iflen(out)>index: flag.append(i) flag_1+=chr(i) index+=1 print(flag_1)