-
Notifications
You must be signed in to change notification settings - Fork 2
/
solution.py
34 lines (31 loc) · 1.04 KB
/
solution.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import requests
import sys
from datetime import datetime, timezone
import re
if len(sys.argv) != 3:
print('Usage: solution.py <challenge-url> <username>')
# Variables
url = sys.argv[1]
username = sys.argv[2]
password = "wg4TQ6m4lV!!"
# Set-up your main user
with requests.Session() as s:
print("Registering user")
regParam = {'username':username,'password':password,'confirm':password,'submit':'Register'}
s.post(url + '/register',json=regParam)
print("Logging in")
loginParam = {'username':username,'password':password,'submit':'Login'}
s.post(url + '/login', json=loginParam)
score = 0
while score < 50:
r = s.get(url + '/home')
match = re.search('\Score:\s(\d*)', r.text)
score = int(match.group(1))
print("Score:", score)
minute = datetime.now(tz=timezone.utc).minute
second = datetime.now(tz=timezone.utc).second
if minute in range(0, 62, 2):
if second < 30:
s.get(url + '/round?pick=scissors')
r = s.get(url + '/flag')
print(r.text)