-
-
[SWPUCTF 2021 新生赛]老鼠走迷宫(详细版
-
发表于: 2023-10-14 14:27 10177
-
https://wwvc.lanzouj.com/iYLez1br84jg
下载附件,拿到一个无后缀的文件,丢入winhex里看看,发现是MZ开头的,去搜MZ开头是什么文件
MZ开头的是.EXE可执行文件
修改后缀
64位,无壳,但是该exe是被pyinstaller打包后得到的,我们需要将exe转换为py形式
pyinstxtractor.py自行下载,在这个页面打开cmd
使用pyinstxtractor.py反编译exe文件,命令如下:python pyinstxtractor.py 可执行文件exe的地址
在当前文件夹会多出一个文件夹
可以看到可疑的文件5,struct
这里我们需要先将文件5和struct加上后缀.pyc,因为后续需要进行.pyc反编译成.py文件(其实struct可要可不要,struct的作用就是给5.pyc补齐前面缺失的十六进制数值,将其他的正常的.pyc文件替换struct.pyc也可以,因为我发现.pyc文件的前16位数值都是一样的)
在winhex打开两个pyc文件,将struct的前16位十六进制数复制到5.pyc开头
记得保存
将5.pyc文件反编译成.py文件,网址:https://tool.lu/pyc/
down下来,得到一个python文件
在maze下面添加一个for循环,输出maze,会报错,把最下面的return none直接删了,这不是重点不要紧
修改之后的代码,可以直接输出maze
[1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
[1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1]
[1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1]
[1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1]
[1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1]
[1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 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 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1]
[1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1]
[1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]
[1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1]
[1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1]
Mice walk in a maze: wasd to move,q to quit
flag is the shortest path's md5,example:if the shortest path is wasdsdw,the flag is md5('wasdsdw')
Process finished with exit code 0
接下来可以自己慢慢找,也可以写脚本,我直接从佬那拉的脚本,可以直接输出迷宫的最小路径
迷宫最短路径
使用wasd表示最短路径就是(一定不要忘了最后一个 * 还需要往下走一个才到达终点,我服,看了半天才找到这个错误):
sssssddssddssaaaassssddwwddddssssssaawwaassssddssaassddddwwddssddwwwwwwwwaawwddwwwwaaaawwddwwwwddssssddwwwwddddwwddddssaassaassddddssddssaassssssddsssssss
根据python里面的内容,flag是用wasd表示的最短路径的md5值
取32位小写,69193150b15c87d39252d974bc323217
flag:NSSCTF{69193150b15c87d39252d974bc323217}
#!/usr/bin/env python
# visit https://tool.lu/pyc/ for more information
# Version: Python 3.7
import
random
import
msvcrt
(row, col)
=
(
12
,
12
)
(i, j)
=
(
0
,
0
)
maze
=
[
[
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
],
[
1
,
0
,
1
,
0
,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
1
,
0
,
0
,
0
,
1
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
1
,
0
,
1
,
0
,
1
,
0
,
1
],
[
1
,
0
,
1
,
0
,
1
,
1
,
1
,
0
,
1
,
0
,
1
,
0
,
1
,
0
,
1
,
1
,
1
,
0
,
1
,
0
,
1
,
0
,
1
,
0
,
1
],
[
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
],
[
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
]]
print
(
'Mice walk in a maze: wasd to move,q to quit'
)
print
(
"flag is the shortest path's md5,example:if the shortest path is wasdsdw,the flag is md5('wasdsdw')"
)
(i, j)
=
(
0
,
1
)
n
=
0
while
i
=
=
row
*
2
and
j
=
=
col
*
2
-
1
:
print
(
'ohhhh!!!!you did it'
)
break
print
(
'your position:({},{})'
.
format
(i, j))
inp
=
msvcrt.getch()
n
+
=
1
ti
=
i
tj
=
j
if
b
'a'
=
=
inp
and
i >
0
:
tj
-
=
1
elif
b
'w'
=
=
inp
and
j >
0
:
ti
-
=
1
elif
b
's'
=
=
inp
and
j < row
*
2
:
ti
+
=
1
elif
b
'd'
=
=
inp
and
i < col
*
2
:
tj
+
=
1
elif
b
'q'
=
=
inp:
exit(
'bye!!'
)
else
:
print
(
'What???'
)
if
maze[ti][tj]
=
=
1
:
print
(random.choice([
'no wayy!!'
,
"it's wall"
,
'nop'
]))
continue
elif
maze[ti][tj]
=
=
0
:
print
(random.choice([
'nice!!'
,
'yeah!!'
,
'Go on'
]))
i
=
ti
j
=
tj
return
None
#!/usr/bin/env python
# visit https://tool.lu/pyc/ for more information
# Version: Python 3.7
import
random
import
msvcrt
(row, col)
=
(
12
,
12
)
(i, j)
=
(
0
,
0
)
maze
=
[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
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
0
,
1
,
0
,
1
,
1
,
1
,
0
,
1
,
0
,
1
],
[
1
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
1
,
0
,
1
,
0
,
1
,
0
,
1
],
[
1
,
0
,
1
,
0
,
1
,
1
,
1
,
0
,
1
,
0
,
1
,
0
,
1
,
0
,
1
,
1
,
1
,
0
,
1
,
0
,
1
,
0
,
1
,
0
,
1
],
[
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
],
[
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
]]
print
(
'Mice walk in a maze: wasd to move,q to quit'
)
print
(
"flag is the shortest path's md5,example:if the shortest path is wasdsdw,the flag is md5('wasdsdw')"
)
(i, j)
=
(
0
,
1
)
n
=
0
while
i
=
=
row
*
2
and
j
=
=
col
*
2
-
1
:
print
(
'ohhhh!!!!you did it'
)
break
print
(
'your position:({},{})'
.
format
(i, j))
inp
=
msvcrt.getch()
n
+
=
1
ti
=
i
tj
=
j
if
b
'a'
=
=
inp
and
i >
0
:
tj
-
=
1
elif
b
'w'
=
=
inp
and
j >
0
:
ti
-
=
1
elif
b
's'
=
=
inp
and
j < row
*
2
:
ti
+
=
1
elif
b
'd'
=
=
inp
and
i < col
*
2
:
tj
+
=
1
elif
b
'q'
=
=
inp:
exit(
'bye!!'
)
else
:
print
(
'What???'
)
if
maze[ti][tj]
=
=
1
:
print
(random.choice([
'no wayy!!'
,
"it's wall"
,
'nop'
]))
continue
elif
maze[ti][tj]
=
=
0
:
print
(random.choice([
'nice!!'
,
'yeah!!'
,
'Go on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
,
0
,
1
],
[
1
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
1
],
[
1
,
0
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
0
,
1
,
0
,
1
,
1
,
1
,
0
,
1
,
0
,
1
],
[
1
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
1
,
0
,
1
,
0
,
1
,
0
,
1
],
[
1
,
0
,
1
,
0
,
1
,
1
,
1
,
0
,
1
,
0
,
1
,
0
,
1
,
0
,
1
,
1
,
1
,
0
,
1
,
0
,
1
,
0
,
1
,
0
,
1
],
[
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
],
[
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
]]
for
row
in
maze:
print
(row)
print
(
'Mice walk in a maze: wasd to move,q to quit'
)
print
(
"flag is the shortest path's md5,example:if the shortest path is wasdsdw,the flag is md5('wasdsdw')"
)
(i, j)
=
(
0
,
1
)
n
=
0
while
i
=
=
row
*
2
and
j
=
=
col
*
2
-
1
:
print
(
'ohhhh!!!!you did it'
)
break
print
(
'your position:({},{})'
.
format
(i, j))
inp
=
msvcrt.getch()
n
+
=
1
ti
=
i
tj
=
j
if
b
'a'
=
=
inp
and
i >
0
:
tj
-
=
1
elif
b
'w'
=
=
inp
and
j >
0
:
ti
-
=
1
elif
b
's'
=
=
inp
and
j < row
*
2
:
ti
+
=
1
elif
b
'd'
=
=
inp
and
i < col
*
2
:
tj
+
=
1
elif
b
'q'
=
=
inp:
exit(
'bye!!'
)
else
:
print
(
'What???'
)
if
maze[ti][tj]
=
=
1
:
print
(random.choice([
'no wayy!!'
,
"it's wall"
,
'nop'
]))
continue
elif
maze[ti][tj]
=
=
0
:
print
(random.choice([
'nice!!'
,
'yeah!!'
,
'Go on'
]))
i
=
ti
j
=
tj
#!/usr/bin/env python
# visit https://tool.lu/pyc/ for more information
# Version: Python 3.7
import
random
import
msvcrt
(row, col)
=
(
12
,
12
)
(i, j)
=
(
0
,
0
)
maze
=
[
[
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
],
[
1
,
0
,
1
,
0
,
0
,
0
,