#统计各字符数 any_s='flag{beadfe08-7fee-3;dd9;961-b7efb21;9;65}-d9;;8' dic={} for i in any_s: if i notin dic: dic[i]=0 dic[i]+=1 print(dic)
s=[] flag='?'*42
#循环取1000个字符串用于统计 for i inrange(1000): print(i) try: r=remote('119.3.45.222',9999,timeout=2) s.append(r.recvline()) r.close() except: pass
dic2={}
for ss in s: for i inrange(len(ss)): if ss[i] notin dic2: dic2[ss[i]]={} if i notin dic2[ss[i]]: dic2[ss[i]][i]=0 dic2[ss[i]][i]+=1 for k,v in dic2.items(): if k.strip()!='': print((k,dic[k])) res=sorted(v.items(), key=lambda d:d[1], reverse = True) print(res[:dic[k]]) for j in dic[k]: flag[res[j][1]]=k print(flag)