row=[0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00] col=[0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01] s=Solver() res=[[Int("x%d%d"%(i,j)) for i inrange(5)] for j inrange(5)] s.add(res[2][2]==4) #原map中已知值 s.add(res[3][3]==3) for i inrange(5): for j inrange(5): s.add(res[i][j]>=1) s.add(res[i][j]<=5) for k inrange(j): #同一行互不相等 s.add(res[i][j]!=res[i][k]) for k inrange(i): #同一列互不相等 s.add(res[i][j]!=res[k][j]) for i inrange(5): #row=1时当前值>右方的值&&row=2时当前值<右方的值 for j inrange(4): if row[4*i+j]==1: s.add(res[i][j]>res[i][j+1]) elif row[4*i+j]==2: s.add(res[i][j]<res[i][j+1]) for i inrange(4): #col=1时当前值<下方的值&&col=2时当前值>下方的值 for j inrange(5): if col[5*i+j]==1: s.add(res[i][j]<res[i+1][j]) elif col[5*i+j]==2: s.add(res[i][j]>res[i+1][j]) ans=s.check() if ans==sat: # print(s.model()) m=s.model() flag=[] for i in res: for j in i: flag.append(m[j].as_long()) flag=[x+0x30for x in flag] flag[12]=0x30 flag[18]=0x30 flag=bytes(flag) print(flag) print("CISCN{"+md5(flag).hexdigest()+"}")
x=[] y=[] withopen('tcp.txt','r') as f: for line in f.readlines(): ret=re.search(r"tgPos{\d+}\.Value\.\[\d+,\d+,-?\d+]",line) #提取目标字符串 if ret!=None: s=ret.group() idx1=s.find('[') idx2=s.find(',') idx3=s.rfind(',') x.append(int(s[idx1+1:idx2])) y.append(int(s[idx2+1:idx3]))