Skip to content

Commit

Permalink
starting web variants
Browse files Browse the repository at this point in the history
  • Loading branch information
zardus committed Jan 25, 2025
1 parent 1f6d460 commit 7a604b3
Show file tree
Hide file tree
Showing 18 changed files with 418 additions and 2 deletions.
26 changes: 26 additions & 0 deletions web-security/path-traversal-1/_0/server
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/opt/pwn.college/python

import flask
import os

app = flask.Flask(__name__)


@app.route("/package", methods=["GET"])
@app.route("/package/<path:path>", methods=["GET"])
def challenge(path="index.html"):
requested_path = app.root_path + "/files/" + path
print(f"DEBUG: {requested_path=}")
try:
return open(requested_path).read()
except PermissionError:
flask.abort(403, requested_path)
except FileNotFoundError:
flask.abort(404, f"No {requested_path} from directory {os.getcwd()}")
except Exception as e:
flask.abort(500, requested_path + ":" + str(e))


app.secret_key = os.urandom(8)
app.config["SERVER_NAME"] = f"challenge.localhost:80"
app.run("challenge.localhost", 80)
25 changes: 25 additions & 0 deletions web-security/path-traversal-1/_0/web-security-level-1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/opt/pwn.college/python

import flask
import os

app = flask.Flask(__name__)


@app.route("/", methods=["GET"])
@app.route("/<path:path>", methods=["GET"])
def serve_static(path="index.html"):
requested_path = app.root_path + "/files/" + path
print(f"DEBUG: {requested_path=}")
try:
return open(requested_path).read()
except PermissionError:
flask.abort(403, requested_path)
except FileNotFoundError:
flask.abort(404, f"No {requested_path} from directory {os.getcwd()}")
except Exception as e:
flask.abort(500, requested_path + ":" + str(e))


app.secret_key = os.urandom(8)
app.run("0.0.0.0", 80)
26 changes: 26 additions & 0 deletions web-security/path-traversal-1/_1/server
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/opt/pwn.college/python

import flask
import os

app = flask.Flask(__name__)


@app.route("/content", methods=["GET"])
@app.route("/content/<path:path>", methods=["GET"])
def challenge(path="index.html"):
requested_path = app.root_path + "/files/" + path
print(f"DEBUG: {requested_path=}")
try:
return open(requested_path).read()
except PermissionError:
flask.abort(403, requested_path)
except FileNotFoundError:
flask.abort(404, f"No {requested_path} from directory {os.getcwd()}")
except Exception as e:
flask.abort(500, requested_path + ":" + str(e))


app.secret_key = os.urandom(8)
app.config["SERVER_NAME"] = f"challenge.localhost:80"
app.run("challenge.localhost", 80)
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import os
app = flask.Flask(__name__)


@app.route("/", methods=["GET"])
@app.route("/<path:path>", methods=["GET"])
@app.route("/docs", methods=["GET"])
@app.route("/docs/<path:path>", methods=["GET"])
def challenge(path="index.html"):
requested_path = app.root_path + "/files/" + path
print(f"DEBUG: {requested_path=}")
Expand Down
26 changes: 26 additions & 0 deletions web-security/path-traversal-1/_11/server
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/opt/pwn.college/python

import flask
import os

app = flask.Flask(__name__)


@app.route("/data", methods=["GET"])
@app.route("/data/<path:path>", methods=["GET"])
def challenge(path="index.html"):
requested_path = app.root_path + "/files/" + path
print(f"DEBUG: {requested_path=}")
try:
return open(requested_path).read()
except PermissionError:
flask.abort(403, requested_path)
except FileNotFoundError:
flask.abort(404, f"No {requested_path} from directory {os.getcwd()}")
except Exception as e:
flask.abort(500, requested_path + ":" + str(e))


app.secret_key = os.urandom(8)
app.config["SERVER_NAME"] = f"challenge.localhost:80"
app.run("challenge.localhost", 80)
26 changes: 26 additions & 0 deletions web-security/path-traversal-1/_12/server
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/opt/pwn.college/python

import flask
import os

app = flask.Flask(__name__)


@app.route("/repository", methods=["GET"])
@app.route("/repository/<path:path>", methods=["GET"])
def challenge(path="index.html"):
requested_path = app.root_path + "/files/" + path
print(f"DEBUG: {requested_path=}")
try:
return open(requested_path).read()
except PermissionError:
flask.abort(403, requested_path)
except FileNotFoundError:
flask.abort(404, f"No {requested_path} from directory {os.getcwd()}")
except Exception as e:
flask.abort(500, requested_path + ":" + str(e))


app.secret_key = os.urandom(8)
app.config["SERVER_NAME"] = f"challenge.localhost:80"
app.run("challenge.localhost", 80)
26 changes: 26 additions & 0 deletions web-security/path-traversal-1/_13/server
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/opt/pwn.college/python

import flask
import os

app = flask.Flask(__name__)


@app.route("/package", methods=["GET"])
@app.route("/package/<path:path>", methods=["GET"])
def challenge(path="index.html"):
requested_path = app.root_path + "/files/" + path
print(f"DEBUG: {requested_path=}")
try:
return open(requested_path).read()
except PermissionError:
flask.abort(403, requested_path)
except FileNotFoundError:
flask.abort(404, f"No {requested_path} from directory {os.getcwd()}")
except Exception as e:
flask.abort(500, requested_path + ":" + str(e))


app.secret_key = os.urandom(8)
app.config["SERVER_NAME"] = f"challenge.localhost:80"
app.run("challenge.localhost", 80)
26 changes: 26 additions & 0 deletions web-security/path-traversal-1/_14/server
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/opt/pwn.college/python

import flask
import os

app = flask.Flask(__name__)


@app.route("/deliverables", methods=["GET"])
@app.route("/deliverables/<path:path>", methods=["GET"])
def challenge(path="index.html"):
requested_path = app.root_path + "/files/" + path
print(f"DEBUG: {requested_path=}")
try:
return open(requested_path).read()
except PermissionError:
flask.abort(403, requested_path)
except FileNotFoundError:
flask.abort(404, f"No {requested_path} from directory {os.getcwd()}")
except Exception as e:
flask.abort(500, requested_path + ":" + str(e))


app.secret_key = os.urandom(8)
app.config["SERVER_NAME"] = f"challenge.localhost:80"
app.run("challenge.localhost", 80)
26 changes: 26 additions & 0 deletions web-security/path-traversal-1/_15/server
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/opt/pwn.college/python

import flask
import os

app = flask.Flask(__name__)


@app.route("/payload", methods=["GET"])
@app.route("/payload/<path:path>", methods=["GET"])
def challenge(path="index.html"):
requested_path = app.root_path + "/files/" + path
print(f"DEBUG: {requested_path=}")
try:
return open(requested_path).read()
except PermissionError:
flask.abort(403, requested_path)
except FileNotFoundError:
flask.abort(404, f"No {requested_path} from directory {os.getcwd()}")
except Exception as e:
flask.abort(500, requested_path + ":" + str(e))


app.secret_key = os.urandom(8)
app.config["SERVER_NAME"] = f"challenge.localhost:80"
app.run("challenge.localhost", 80)
26 changes: 26 additions & 0 deletions web-security/path-traversal-1/_2/server
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/opt/pwn.college/python

import flask
import os

app = flask.Flask(__name__)


@app.route("/files", methods=["GET"])
@app.route("/files/<path:path>", methods=["GET"])
def challenge(path="index.html"):
requested_path = app.root_path + "/files/" + path
print(f"DEBUG: {requested_path=}")
try:
return open(requested_path).read()
except PermissionError:
flask.abort(403, requested_path)
except FileNotFoundError:
flask.abort(404, f"No {requested_path} from directory {os.getcwd()}")
except Exception as e:
flask.abort(500, requested_path + ":" + str(e))


app.secret_key = os.urandom(8)
app.config["SERVER_NAME"] = f"challenge.localhost:80"
app.run("challenge.localhost", 80)
26 changes: 26 additions & 0 deletions web-security/path-traversal-1/_3/server
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/opt/pwn.college/python

import flask
import os

app = flask.Flask(__name__)


@app.route("/public", methods=["GET"])
@app.route("/public/<path:path>", methods=["GET"])
def challenge(path="index.html"):
requested_path = app.root_path + "/files/" + path
print(f"DEBUG: {requested_path=}")
try:
return open(requested_path).read()
except PermissionError:
flask.abort(403, requested_path)
except FileNotFoundError:
flask.abort(404, f"No {requested_path} from directory {os.getcwd()}")
except Exception as e:
flask.abort(500, requested_path + ":" + str(e))


app.secret_key = os.urandom(8)
app.config["SERVER_NAME"] = f"challenge.localhost:80"
app.run("challenge.localhost", 80)
26 changes: 26 additions & 0 deletions web-security/path-traversal-1/_4/server
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/opt/pwn.college/python

import flask
import os

app = flask.Flask(__name__)


@app.route("/blob", methods=["GET"])
@app.route("/blob/<path:path>", methods=["GET"])
def challenge(path="index.html"):
requested_path = app.root_path + "/files/" + path
print(f"DEBUG: {requested_path=}")
try:
return open(requested_path).read()
except PermissionError:
flask.abort(403, requested_path)
except FileNotFoundError:
flask.abort(404, f"No {requested_path} from directory {os.getcwd()}")
except Exception as e:
flask.abort(500, requested_path + ":" + str(e))


app.secret_key = os.urandom(8)
app.config["SERVER_NAME"] = f"challenge.localhost:80"
app.run("challenge.localhost", 80)
26 changes: 26 additions & 0 deletions web-security/path-traversal-1/_5/server
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/opt/pwn.college/python

import flask
import os

app = flask.Flask(__name__)


@app.route("/docs", methods=["GET"])
@app.route("/docs/<path:path>", methods=["GET"])
def challenge(path="index.html"):
requested_path = app.root_path + "/files/" + path
print(f"DEBUG: {requested_path=}")
try:
return open(requested_path).read()
except PermissionError:
flask.abort(403, requested_path)
except FileNotFoundError:
flask.abort(404, f"No {requested_path} from directory {os.getcwd()}")
except Exception as e:
flask.abort(500, requested_path + ":" + str(e))


app.secret_key = os.urandom(8)
app.config["SERVER_NAME"] = f"challenge.localhost:80"
app.run("challenge.localhost", 80)
26 changes: 26 additions & 0 deletions web-security/path-traversal-1/_6/server
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/opt/pwn.college/python

import flask
import os

app = flask.Flask(__name__)


@app.route("/data", methods=["GET"])
@app.route("/data/<path:path>", methods=["GET"])
def challenge(path="index.html"):
requested_path = app.root_path + "/files/" + path
print(f"DEBUG: {requested_path=}")
try:
return open(requested_path).read()
except PermissionError:
flask.abort(403, requested_path)
except FileNotFoundError:
flask.abort(404, f"No {requested_path} from directory {os.getcwd()}")
except Exception as e:
flask.abort(500, requested_path + ":" + str(e))


app.secret_key = os.urandom(8)
app.config["SERVER_NAME"] = f"challenge.localhost:80"
app.run("challenge.localhost", 80)
26 changes: 26 additions & 0 deletions web-security/path-traversal-1/_7/server
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/opt/pwn.college/python

import flask
import os

app = flask.Flask(__name__)


@app.route("/filesystem", methods=["GET"])
@app.route("/filesystem/<path:path>", methods=["GET"])
def challenge(path="index.html"):
requested_path = app.root_path + "/files/" + path
print(f"DEBUG: {requested_path=}")
try:
return open(requested_path).read()
except PermissionError:
flask.abort(403, requested_path)
except FileNotFoundError:
flask.abort(404, f"No {requested_path} from directory {os.getcwd()}")
except Exception as e:
flask.abort(500, requested_path + ":" + str(e))


app.secret_key = os.urandom(8)
app.config["SERVER_NAME"] = f"challenge.localhost:80"
app.run("challenge.localhost", 80)
Loading

0 comments on commit 7a604b3

Please sign in to comment.