Suninatas Game 01

posted
read
78 words · 1 min
contents

challenges

Game 01

Code Analysis

<%
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
%>
  1. Replace(str, "a", "aad"): Replaces every ‘a’ with ‘aad’.
  2. Replace(result, "i", "in"): Replaces every ‘i’ with ‘in’.
  3. Mid(result, 2, 2): Extracts 2 characters starting from the 2nd index.
  4. Mid(result, 4, 6): Extracts up to 6 characters starting from the 4th index.
  5. The goal is to make the final concatenated result equal to admin.

If we input ami:

  • a -> aad
  • i -> in
  • Intermediate result: aadmin
  • result1 = Mid("aadmin", 2, 2) = ad
  • result2 = Mid("aadmin", 4, 6) = min
  • result = ad + min = admin

ami