웹 해킹

[suninatas] 1번 풀이

u0jin 2019. 9. 10. 04:43

<% str = Request("str") If not str = "" Then result = Replace(str,"a","aad") result = Replace(result,"i","in") result1 = Mid(result,2,2) result2 = Mid(result,4,6) result = result1 & result2 Response.write result If result = "admin" Then pw = "????????" End if End if %>

 


해당 언어 = ASP 


< 해석에 필요한 문법 >


Replace ( s, s1, s2 ) : s 문자열에서 s1을 s2 로 모두 바꾼다.

Mid ( 변수 , 지정한 위치 , 지정한 위치로부터 반환할 문자열 길이 ) : 변수의 지정한 위치에서 지정한 길이만큼 문자열을 반환한다.

& : 연결 연산자 - 문자열을 서로 연결시켜주는 연산자

 


위의 코드에서 아래서 부터 천천히 해석하면


result  = result1 & result2

    = _ _ _ / _ _ _ _ _ _ 

    =_ a d / m i n _ _ _ 

a는 aad 로 변경하고, i 는 in 으로 바꾼다.

  

str = a m i  라는것을 알수 있다.  

str 이 ami 이여야 , admin을 얻을수 있기때문이다.


결과적으로 ami를 넣어주면 key를 얻을수 있다.


Authkey : k09rsogjorejv934u592oi