FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pyt/example/vulnerable_code/command_injection.py at mango · 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
/
command_injection.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
35 lines (24 loc) · 826 Bytes
Breadcrumbs
pyt
/
example
/
vulnerable_code
/
command_injection.py
Copy path
File metadata and controls
35 lines (24 loc) · 826 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
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import
subprocess
from
flask
import
Flask
,
render_template
,
request
app
=
Flask
(
__name__
)
@
app
.
route
(
'/'
)
def
index
():
with
open
(
'menu.txt'
,
'r'
)
as
f
:
menu
=
f
.
read
()
return
render_template
(
'command_injection.html'
,
menu
=
menu
)
@
app
.
route
(
'/menu'
,
methods
=
[
'POST'
])
def
menu
():
param
=
request
.
form
[
'suggestion'
]
command
=
'echo '
+
param
+
' >> '
+
'menu.txt'
subprocess
.
call
(
command
,
shell
=
True
)
with
open
(
'menu.txt'
,
'r'
)
as
f
:
menu
=
f
.
read
()
return
render_template
(
'command_injection.html'
,
menu
=
menu
)
@
app
.
route
(
'/clean'
)
def
clean
():
subprocess
.
call
(
'echo Menu: > menu.txt'
,
shell
=
True
)
with
open
(
'menu.txt'
,
'r'
)
as
f
:
menu
=
f
.
read
()
return
render_template
(
'command_injection.html'
,
menu
=
menu
)
if
__name__
==
'__main__'
:
app
.
run
(
debug
=
True
)
Back
|
FazBrowse Home
|
New Git URL