1.
index.php를 방문 후, tryout.php에서 문자열을 가져와서, solution.php?solution="+letters.
와 같은 형식으로 전송. 많이 해본 버튼 빨리 누르기같은거....
#-*- coding: cp949 -*- import urllib2,re req = urllib2.Request('http://www.bright-shadows.net/challenges/programming/get_started/tryout.php') req.add_header('cookie','쿠키') text = re.findall("'(.*?)'",urllib2.urlopen(req).read())[0] print text req = urllib2.Request('http://www.bright-shadows.net/challenges/programming/get_started/solution.php?solution='+text) req.add_header('cookie','쿠키') print urllib2.urlopen(req).read()
2.
문자열을 두개 받아서 xor하는건데, 랜덤하게 나오는 문자열이 고정된 문자열보다 길이가 더 길수도있고, 더 짧을수도 있다. 난 랜덤으로 나오는 문자열이 더 길다는 가정하에 프로그래밍을 했다. 그러므로 성공하려면 여러번 돌려야됨...
#-*- coding: cp949 -*- import urllib2,re req = urllib2.Request('http://www.bright-shadows.net/challenges/programming/xor/tryout.php') req.add_header('cookie','PHPSESSID=쿠키') text = re.findall("'(.*?)'",urllib2.urlopen(req).read())[0] xor = 'C12W4BERT954'; ans = '' print text,xor for i in range(len(text)): ans += chr( ord(text[i]) ^ ord(xor[i%len(xor)]) ) print ans req = urllib2.Request('http://www.bright-shadows.net/challenges/programming/xor/solution.php?solution='+ans) req.add_header('cookie','PHPSESSID=쿠키') print urllib2.urlopen(req).read()
3.
2가 구분자인 모스 부호이다. 1은 짧은 신호, 0은 긴 신호로 해석하면 된다.
#-*- coding: cp949 -*- import urllib2,re req = urllib2.Request('http://www.bright-shadows.net/challenges/programming/dit_dit_dah/tryout.php') req.add_header('cookie','PHPSESSID=쿠키') text = re.findall("'(.*?)'",urllib2.urlopen(req).read())[0].split('2') morse = {'10':'a','0111':'b','0101':'c','011':'d','1':'e','1101':'f', '001':'g','1111':'h','11':'i','1000':'j','010':'k','1011':'l', '00':'m','01':'n','000':'o','1001':'p','0010':'q','101':'r', '111':'s','0':'t','110':'u','1110':'v','100':'w','0110':'x', '0100':'y','0011':'z'} ans = '' for i in range(len(text)): ans += morse[text[i]] print ans req = urllib2.Request('http://www.bright-shadows.net/challenges/programming/dit_dit_dah/solution.php?solution='+ans) req.add_header('cookie','PHPSESSID=쿠키') print urllib2.urlopen(req).read()
'Python > 2.7 simple coding(+ c++)' 카테고리의 다른 글
hack this site Programming missions : String manipulation (0) | 2015.01.21 |
---|---|
hack this site Programming missions : Reverse Ascii Shift (0) | 2015.01.20 |
WeChall Training: ASCII, Encodings: URL, Training: Crypto - Caesar I (0) | 2015.01.11 |
WeChall Training: Net Ports, Can you read me (0) | 2015.01.05 |
WeChall Training: Programming 1, Flow Over Astronomy (0) | 2015.01.04 |