FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pyt/example/vulnerable_code/XSS_form.py at 8githubScanRefactor · python-security/pyt · GitHub
python-security
pyt
Repository navigation
Code
Issues
26
(26)
Pull requests
2
(2)
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
pyt
/
example
/
vulnerable_code
/
XSS_form.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
21 lines (16 loc) · 602 Bytes
Breadcrumbs
pyt
/
example
/
vulnerable_code
/
XSS_form.py
Copy path
File metadata and controls
21 lines (16 loc) · 602 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from
flask
import
Flask
,
render_template
,
request
,
make_response
import
random
import
string
app
=
Flask
(
__name__
)
@
app
.
route
(
'/example2'
)
def
example2
():
return
render_template
(
'example2_form.html'
)
html1
=
open
(
'templates/example2_response.html'
).
read
()
@
app
.
route
(
'/example2action'
,
methods
=
[
'POST'
])
def
example2_action
():
data
=
request
.
form
[
'my_text'
]
resp
=
make_response
(
html1
.
replace
(
'{{ data }}'
,
data
))
resp
.
set_cookie
(
'session_id'
,
''
.
join
(
random
.
choice
(
string
.
ascii_uppercase
)
for
x
in
range
(
16
)))
return
resp
if
__name__
==
'__main__'
:
app
.
run
(
debug
=
True
)
Back
|
FazBrowse Home
|
New Git URL