![8670a0eb669a316fb09258fef5ac7d1f.png](0f894fe536714b69ab5f6fabc6423638.png)
![13abe9eeb39a3e04a72920a01027b1a6.png](e0529452af89452ab642025232b5e0e9.png)
**Notes:**
1. The questions are always in the same order
2. Sending the wrong answer will move to the next question but provide the correct answer to the previous question
**Goal:**
Write a script that collects every right answer and then sends them in order to complete the challenge
**Script:**
```Python
import requests
import re
url = "http://timesink.be/quizbot/index.php"
answers = []
header = {'User-Agent': 'Mozilla/6.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0'}
s = requests.Session()
i = 0
while i < 1000:
data = {"insert_answer":"wronganser", "submit":"answer"}
r2 = s.post(url, headers=header, cookies=s.cookies, data=data)
answer = re.findall('<div id="answer" align="center">(.*)</div>', r2.text)
answers.append(answer[0])
print(str(i) + ' ' + answer[0])
i += 1
x = 0
while x < len(answers):
data = {"insert_answer":answers[x], "submit":"answer"}
r3 = s.post(url, headers=header, cookies=s.cookies, data=data)
print('Sending answer: ' + answers[x])
if x == 999:
print(r3.text)
x += 1
```
![9571a9facde3375bbe109a48b66698a3.png](4a2b9ddfa08345169f441a2f41236539.png)
-----
Back to [[_WebSite Publish/CTF/CTF Index|CTF Index]]
Tags: #scripting #web_scraping #ctf #python
Related: