File tree Expand file tree Collapse file tree
pygoat/introduction/templates/Lab/XSS Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 %}
You can’t perform that action at this time.
0 commit comments