CG-CTF single

1. Drag it into ida and analyze it statically first.
Insert picture description here
There are three functions. Click to see when
Insert picture description here
a1 is 0. When a2 [i] is 0, assign its own value to this position. When a1 is 0, you do n’t need it. move.
Insert picture description here
Insert picture description here
Insert picture description hereThese three functions all imply that this thing is Sudoku. Each row and column has a number from 1 to 9 and cannot be repeated. . .
Take out the previous number, operate it with an online array solver
Insert picture description here
and write a script at the same time, change the place that was not zero to 0, which is the flag

shudu=[0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x02, 0x04, 0x09, 0x00, 0x00, 0x09, 0x00, 0x01, 0x00, 0x07, 0x00, 0x06, 0x00, 0x07, 0x04, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x07, 0x00, 0x08, 0x00, 0x09, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x07, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
for i in range(9):
  for j in range(9):
    print(str(int(shudu[9*i+j]))+" ",end="")
  print("")
flag="431695728657832491892147365746321589518479632923586147185964273374218956269753814"
trueflag=""
for i in range(9):
  for j in range(9):
    if shudu[9*i+j]!=0:
      trueflag+="0"
    else:
      trueflag+=flag[9*i+j]
print(trueflag)

Insert picture description here

161 original articles published · Liked 14 · Visits 7616

Guess you like

Origin blog.csdn.net/YenKoc/article/details/105427253