[카테고리:] Wargame

The Python Challenge – Level 2

문제 페이지 : http://www.pythonchallenge.com/pc/def/ocr.html #!C:\pyhton26\python.exe import re str = '''%%$@_$^__#)^)&!_+]!*@&^}@[@%]()%+$&[(_@%+%$*^@$^!+]!&_#)_*}{}}!}_]$[%}@[{_@#_^{* @##&{#&{&)*%(]{{([*}@[@&]+!!*{)!}{%+{))])[!^})+)$]#{*+^((@^@}$[**$&^{$!@#$%)!@(& +^!{%_$&@^!}$_${)$_#)!({@!)(^}!*^&!$%_&&}&_#&@{)]{+)%*{&*%*&@%$+]!*__(#!*){%&@++ !_)^$&&%#+)}!@!)&^}**#!_$([$!$}#*^}$+&#[{*{}{((#$]{[$[$$()_#}!@}^@_&%^*!){*^^_$^ ]@}#%[%!^[^_})+@&}{@*!(@$%$^)}[_!}(*}#}#___}!](@_{{(*#%!%%+*)^+#%}$+_]#}%!**#!^_ )@)$%%^{_%!@(&{!}$_$[)*!^&{}*#{!)@})!*{^&[&$#@)*@#@_@^_#*!@_#})+[^&!@*}^){%%{&#@ @{%(&{+(#^{@{)%_$[+}]$]^{^#(*}%)@$@}(#{_&]#%#]{_*({(])$%[!}#@@&_)([*]}$}&${^}@(% (%[@%!}%*$}(*@)}){+@(%@*$&]*^*}*]&$[}*]%]+*}^!}*$^^_()#$^]++@__){&&+((#%+(&+){)$ %&&#($[[+##*%${)_!+{_[})%++)$#))]]]$]@]@($+{&%&%+!!!@]_]+])^*@$(@#${}}#}{%}#+{(@ #__+{{]${]!{(%${%%^)(_*_@+)$]$#_@$)]](}{}$(}*%+!}#+)$%$}+#@*&^{##}+@(%[*@_}{(^]^ +_*{@+[$!!@%$+{_&(#^(([&[][[&@#+}_]&&]}^*&$&)#_^$@$((%)}+{}$#+{+^}&[#[#_+${#[#]{ (@@[%}[}$%+*#$+[%(**!$+@$@&+$_$#!_&&&&{***+)}][}#^!%#&$*)$!%}*&#}}##(^_%^]{+]&&] }^]#^(}@]&$]*_][])$]{_+})^_}]))()^&)(!*![!&}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@$#^%((#$%+++]])#*@)&([^#]_$%$)[#)){({%@_^ @#}@*!!()[]%$*+*{*$%@**!}&#[*#[[{(@&_){{!}!)++@*{{({_!#^]}+{{#]{$^)&]%}})^@&$%@$ $!_+!{]*^_+@&@){#*!_#+{[@$^(__}*[^$&{&]!(&+++_@+)&}))$%]${+*!(#@(}&&&!)!_!$&@&{[ [@!#!]]#%)(_^!{*[{^{]})$)^&(*)%}#]#()^#+}!{_}*+{@&_^)+%@!%%${$&%}(%*_!)%$((+$&^^ }#[@%+)&^!](]%+_{{]}@]+^]{(!_*&@][]@_%}%(%&)})&!#)[_]^+$)[(%*%({]$[(#+&+[@[*([$# ^*!@{]]#![[{_]#^@])_[[+%]#[%[+_{)^+([^}[]_[}])*^!_+$}^+_)+*@$$^}(&[)_^[+})^]&))) }*+}%){@_)]_)&)!@)*#^_%{}(]]$)+^@+}+$_*&)]%^@&)![!@$[@)@}%!)@$((^![{(%([+#&{$+#[ …

The Python Challenge – Level 1

문제 페이지 : http://www.pythonchallenge.com/pc/def/274877906944.html #!c:\Python26\python.exe import string str = '''g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj.''' str2 = 'map' test = string.maketrans('abcdefghijklmnopqrstuvwxyz', 'cdefghijklmnopqrstuvwxyzab') print str.translate(test) …

The Python Challenge – Level 0

Python 프로그래밍 연습하는데 이만한 좋은 사이트는 없는거 같다! http://www.pythonchallenge.com/ 문제 페이지 : http://www.pythonchallenge.com/pc/def/0.html #!C:\Python26\python.exe import math print math.pow(2, 38)

Vortex – Level 0

http://www.overthewire.org/wargames/vortex/level0.shtml Level Goal: Your goal is to connect to port 5842 on vortex.labs.pulltheplug.org and read in 4 unsigned integers. Add these integers together and send back the results to get a username and password for level 1. Note: that vortex is on an x86 machine (meaning, a little endian architecture) 소켓 프로그래밍을 통하여 4개의 unsigned …

blowfish.smashthestack.org – Level11 풀이

Level11 역시 문제 소스가 제공되지 않는다. 문제를 실행하여 보면 세그먼트 폴트 오류만 뜬다. 막막해 하지말고 일단 gdb로 한번 디스어셈블러해 보도록 하자. level11@blowfish:/levels/tmp/geegeegee$ gdb -q /levels/level11 Using host libthread_db library /lib/tls/libthread_db.so.1. (gdb) disassemble main Dump of assembler code for function main: 0x080483f4 <main+0>: push %ebp 0x080483f5 <main+1>: mov %esp,%ebp 0x080483f7 <main+3>: sub $0x28,%esp 0x080483fa <main+6>: and …

blowfish.smashthestack.org – Level10 풀이

Level10 문제는 아주 간단한 문제이다. 먼저 문제 파일을 실행하여 보자. Would you like to play a game? 실행하면 먼저 화면이 clear되고 위와 같은 메세지가 나온다. 여기서 우리는 해당 문제파일이 clear 명령어를 이용하고 있다는 것으로 짐작할 수 있다. strings 명령어를 이용하여 문제 파일의 문자열을 확인하여 보자. strilevel10@blowfish:~$ strings /levels/level10 /lib/ld-linux.so.2 _Jv_RegisterClasses __gmon_start__ libc.so.6 printf geteuid fgets …

blowfish.smashthestack.org – Level9 풀이

Level9로 접속하여 README 파일을 읽어보면 다음과 같다. This level is a race condition. There is no source. Use /levels/tmp. Good Luck! 레이스 컨디션 문제이다. /levels/level9 를 실행하여 보면 다음과 같다. level9@blowfish:/levels/tmp/level9$ /levels/level9 usage : /levels/level9 file message 파일과 메세지를 입력하라고 한다. 여기서 존재하지 않는 파일을 명시하고 아무 메세지나 입력하게 되면 다음과 같이 출력이 된다. level9@blowfish:/levels/tmp/level9$ …

blowfish.smashthestack.org – Level8 풀이

Level8 문제 소스를 보면 다음과 같다. #include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { char buffer[64]; char *pointer = changeme; if(argc < 3) return -1; strncpy(buffer, argv[3], sizeof(buffer)-1); printf(\n\tpointer: ); printf(pointer); printf(\n\tinput: ); printf(buffer); printf(\n\n); return 0; } printf(buffer); 와 같이 printf() 함수를 저렇게 사용하였을시에 FSB(Format String Bug)가 일어난다. 일단 공격 전에 필요한 …

blowfish.smashthestack.org – Level7 풀이

Level7의 소스는 다음과 같다. #include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { int i; char buffer[32]; //char *key1 = /; char *p1, *p2, *p3, *p4, *p5; char key2[2], key3[2], key4[2], key5[2]; // if(argc != 2) // return -1; for(i = 1; i < argc; i++) { memset(argv[i], 0, strlen(argv[i])); } sprintf(key2, %c, 0x90); …

blowfish.smashthestack.org – Level6 풀이

문제 코드는 아래와 같다. #include <stdio.h> #include <string.h> int badfunc(char *string1, char *string2) { char buffer1[1024]; char buffer2[1024]; if(strlen(string1)>=sizeof(buffer1)) { printf(\n\t(!) overflow detected.\n); printf(\t(-) exiting…\n\n); return -1; } else { printf(\n\t(+) copying string1 into the buffer…); snprintf(buffer1,sizeof(buffer1),%s,string1); printf(\t\t[done] (%d)\n, strlen(buffer1)); } if(strlen(string2)>=sizeof(buffer2)*3) { printf(\n\t(!) overflow detected.\n); printf(\t(-) exiting…\n\n); return -1; } else { printf(\t(+) copying …