Last active
March 7, 2020 01:41
-
-
Save nickcjohnston/464053b581f9a6fc0d402e1bd37a921e to your computer and use it in GitHub Desktop.
CTF Programming Problem
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
#!/usr/bin/python3 | |
# to make this work you must run "sudo pip3 install BeautifulSoup4" | |
import requests, base64 | |
from bs4 import BeautifulSoup | |
s = requests.session() | |
url = "http://127.0.0.1/index.php" | |
page = s.get(url) | |
#print(page.text) | |
content = BeautifulSoup(page.text, 'html.parser').findAll("p", {"class":"data"}) | |
challenge_text = content[0].text | |
# print(challenge_text) | |
challenge_text = challenge_text.strip().encode('ascii') | |
encoded_text = base64.b64encode(challenge_text) | |
# print(encoded_text) | |
answer = url + "?answer=" + str(encoded_text, 'utf-8') | |
page = s.get(answer) | |
print(page.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment