

view-source를 클릭하면 정규표현식을 이용하여 val에 들어있는 데이터와 매칭하여 참이면 점수를 획득할 수 있을 것으로 보인다.
... 생략 ...
<?php
$pat="/[1-3][a-f]{5}_.*$_SERVER[REMOTE_ADDR].*\tp\ta\ts\ts/";
if(preg_match($pat,$_GET['val'])){
solve(11);
}
else echo("<h2>Wrong</h2>");
echo("<br><br>");
?>
... 생략 ...
정규 표현식을 분해하자.
패턴에 맞게 val값을 전달해 주면 점수를 획득할 수 있다.
import urllib.request
val = urllib.parse.quote('1aaaaa_61.251.215.194_\tp\ta\ts\ts')
url = 'https://webhacking.kr/challenge/code-2/?val='+val
header = {'Cookie': 'PHPSESSID=s5g2rgani18o2h3nbe34lln6bd'}
request = urllib.request.Request(url, headers=header)
response= urllib.request.urlopen(request)
result = response.read().decode()
print(result)
[Output]
<html>
<title>Challenge 11</title>
<style type="text/css">
body { background:black; color:white; font-size:10pt; }
</style>
</head>
<body>
<center>
<br><br>
<script>alert('old-11 Pwned!');</script><hr>old-11 Pwned. You got 30point. Congratz!<hr><br><br><a href=./?view_source=1>view-source</a>
</center>
</body>
</html>