io.smashthestack.org – Level 2

Level 2 문제를 실행하면 아래와 같다.
[code lang-sh]level2@io:/tmp/by$ /levels/level02
Append the 39th through 42nd numbers in the sequence as a string and feed it to this binary via argv[1]. 1, 2, 3, 5, 8, 13, 21…
The 4th through the 7th numbers would give you 581321
level2@io:/tmp/by$
[/code]
위 수열에서 39번째부터 42번째를 이어서 쓴 값을 argv[1]로 넣으라고 한다…

[code lang-python]#!/usr/bin/python
”’
Append the 39th through 42nd numbers in the sequence as a string and feed it to this binary via argv[1]. 1, 2, 3, 5, 8, 13, 21…
The 4th through the 7th numbers would give you 581321
”’
list = [1, 2, 3]
for x in range(1, 43):
    tmp =  list[x] + list[x+1]
    list.append(tmp)

ret = ”
for x in range(38, 42):
    ret += str(list[x])
print ret
[/code]

[code lang-sh]level2@io:/tmp/by$ ./level2.py
102334155165580141267914296433494437
level2@io:/tmp/by$ /levels/level02 102334155165580141267914296433494437
Win.
sh-3.2$ id
uid=1002(level2) gid=1002(level2) euid=1003(level3) groups=1002(level2),1029(nosu)
sh-3.2$ cat /home/level3/.pass
okviql9o
sh-3.2$
[/code]

댓글 남기기

이메일은 공개되지 않습니다. 필수 입력창은 * 로 표시되어 있습니다