Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
27 changed files
with
401 additions
and
143 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,47 @@ | ||
#Old code for testing | ||
|
||
@app.route("/target") | ||
def target(): | ||
""" For setup a fake target page """ | ||
return flask.render_template("payload.html", | ||
payload = "Safe") | ||
|
||
@app.route("/xsstarget") | ||
def xssTarget(): | ||
""" | ||
Test returning something with XSS""" | ||
return flask.render_template("payload.html", | ||
payload = "<script>alert(1)</script>") | ||
|
||
@app.route("/test/text") | ||
def test(): | ||
""" | ||
A page that will test if we can get something using selenium | ||
|
||
For the first Development fuck proper python. | ||
Imports can live here | ||
""" | ||
pageText = driver.getPage("http://flask:5000/target") | ||
return pageText | ||
|
||
@app.route("/test/safe") | ||
def testsafe(): | ||
""" | ||
A page that will test if we can get something using selenium | ||
|
||
For the first Development fuck proper python. | ||
Imports can live here | ||
""" | ||
pageText = driver.checkPage("http://flask:5000/target") | ||
return str(pageText) | ||
|
||
|
||
@app.route("/test/target") | ||
def testtarget(): | ||
""" | ||
A page that will test if we can get something using selenium | ||
|
||
For the first Development fuck proper python. | ||
Imports can live here | ||
""" | ||
pageText = driver.checkPage("http://flask:5000/xsstarget") | ||
return str(pageText) | ||
|
||
## Plan | ||
|
||
Standalone Documentation and Levels for XSS attacks | ||
|
||
- Make use of Flask to host the thing | ||
- Selenium (or Seleniniod) To check for XSS being Trigered | ||
|
||
- Training | ||
- Walk-through of Some simple XSS Style Attacks | ||
- Triggering an Alert | ||
- Page Redirection | ||
- Session Jacking | ||
|
||
- Levels | ||
- N Levels to test skills | ||
- Some "Hand Holding" | ||
- Later Levels rely on research. | ||
- Explain Cutoff for Pass / First In Skills test. | ||
|
||
|
||
## Levels | ||
|
||
| Level | Lang | Notes | | ||
|-------|--------|------------------------------------| | ||
| 0 | Python | Training | | ||
| 1 | Python | Training | | ||
| 2 | Python | CLient Side | | ||
| 3 | Python | Basic Replace | | ||
| 4 | Python | Regexp | | ||
| 5 | PHP | Preg_replace | | ||
| 6 | Python | Stop Execute if "script" in string | | ||
| 7 | Python | Markdown | | ||
| 8 | HTML | Attributes | | ||
|
||
|
||
## Notes | ||
|
||
This might be useful for text | ||
|
||
https://pypi.org/project/jinja-markdown/ | ||
|
||
https://pythonhosted.org/Flask-Markdown/ | ||
|
||
|
||
https://github.com/andymccurdy/redis-py | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
""" | ||
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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
""" | ||
Levels that deal with Sessions and other fun things | ||
""" | ||
|
||
|
||
import xss_trainer.levels.meta as meta | ||
|
||
|
||
class SessionTest(meta.BaseLevel): | ||
""" | ||
A testing level for Sessions | ||
""" | ||
levelname = "Session Tokens" | ||
template = "sessionTest.html" | ||
author = "Dang42" | ||
#Need to be key value | ||
cookie = ["xss_session", "FakeSessionCookie"] | ||
flag = "CUEH{CookieSubmit}" | ||
# renderer = "customRender.html" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<h1>Bar</h1> |
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
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
Oops, something went wrong.