Skip to content

Commit 9fcb9c5

Browse files
Add files via upload
1 parent 3a1e38e commit 9fcb9c5

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{% extends "introduction/base.html" %}
2+
{% block content %}
3+
{% block title %}
4+
5+
<title>XSS LAB 2</title>
6+
{% endblock %}
7+
<h1>Welcome to XSS Challenge</h1>
8+
<form method="post" action="/xssL2">
9+
{% csrf_token %}
10+
<div class="jumbotron">
11+
<label for="username">Comment:</label>
12+
<input type="text" class="form-control" id="username" name="username" required>
13+
<input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}">
14+
</div>
15+
<button class="btn btn-info" type="submit">
16+
Go
17+
</button>
18+
</form>
19+
<br>
20+
<p>Hello, {{ username|safe }}</p>
21+
<script>
22+
function setCookie(name, value) {
23+
document.cookie = name + "=" + value + ";path=/;";
24+
}
25+
26+
function getCookie(name) {
27+
var name = name + "=";
28+
var decodedCookie = decodeURIComponent(document.cookie);
29+
var ca = decodedCookie.split(';');
30+
for (var i = 0; i < ca.length; i++) {
31+
var c = ca[i];
32+
while (c.charAt(0) == ' ') {
33+
c = c.substring(1);
34+
}
35+
if (c.indexOf(name) == 0) {
36+
return c.substring(name.length, c.length);
37+
}
38+
}
39+
return "";
40+
}
41+
</script>
42+
<script>
43+
var flag = getCookie("flag");
44+
if (flag === "success") {
45+
alert("Congratulations! You have solved the XSS Challenge");
46+
}
47+
</script>
48+
<br>
49+
<div align="right">
50+
<button class="btn btn-info" type="button" onclick="window.location.href='/xss'">Back to Lab Details</button>
51+
</div>
52+
{% endblock content %}

0 commit comments

Comments
 (0)