Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
245-Labs/Week7_XSS/Challenges/webapp/xss_trainer/levels/contrib.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
42 lines (32 sloc)
1.1 KB
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
""" | |
User Contributed Levels | |
""" | |
import base64 | |
import xss_trainer.levels.meta as meta | |
class EscapeChars(meta.BaseLevel): | |
""" | |
Bens level for escape Characters | |
""" | |
levelname = "Escape Characters" | |
template = "EscapeChars.html" | |
author = "Sharkmoos" | |
def sanitise(self, data): | |
# This is more of a level 2/3 difficulty | |
payload = (data.replace("'", "\\'")).replace('"', '\\"') | |
return payload | |
class Encoding(meta.BaseLevel): | |
""" | |
Base 64 Encoding is a thing | |
""" | |
levelname = "Encoding" | |
template ="Encoding.html" | |
author = "Sharkmoos" | |
def sanitise(self, data): | |
payload = (data.replace("<", "")).replace(">","") | |
# We are expecting a b64 string, so we need to add out own padding if thats not what they give us | |
try: | |
# Rather than using .decode('base64') and leave it as bytex, let's format a nice string | |
decoded_payload = base64.b64decode(payload.encode('ascii')).decode('ascii') | |
except Exception: | |
decoded_payload = ("Input did not have correct encoding") | |
return decoded_payload |