Toggle navigation
Toggle navigation
This project
Loading...
Sign in
노현종
/
2018-1-Capstone1-VulnNotti
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
이경수
2018-06-08 15:24:22 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d6cc921ea33148862341bccb596a2b099d33414d
d6cc921e
1 parent
e6ba6744
dynamic.html 추가
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
51 additions
and
48 deletions
VulnNotti/VulnNotti/urls.py
VulnNotti/myapp/admin.py
VulnNotti/myapp/templates/dynamic.html
VulnNotti/myapp/templates/static.html
VulnNotti/myapp/urls.py
VulnNotti/myapp/views.py
VulnNotti/static/img/linux_vuln_check_script.sh
VulnNotti/VulnNotti/urls.py
View file @
d6cc921
...
...
@@ -18,14 +18,14 @@ from django.contrib import admin
from
django.contrib.auth
import
views
from
VulnNotti.views
import
*
from
django.conf
import
settings
from
myapp.views
import
*
urlpatterns
=
[
url
(
r'^admin/'
,
admin
.
site
.
urls
),
url
(
r'^$'
,
HomeView
.
as_view
(),
name
=
'home'
),
url
(
r'^home/'
,
HomeView
.
as_view
(),
name
=
'home'
),
url
(
r'^myapp/'
,
include
(
'myapp.urls'
,
namespace
=
'myapp'
)),
url
(
r'^myapp/static'
,
StaticView
.
as_view
(),
name
=
'static'
),
url
(
r'^edit/'
,
EditView
.
as_view
(),
name
=
'edit'
),
url
(
r'^accounts/'
,
include
(
'django.contrib.auth.urls'
)),
...
...
VulnNotti/myapp/admin.py
View file @
d6cc921
from
django.contrib
import
admin
from
myapp.models
import
*
# Register your models here.
class
UploadFileAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'title'
,
'file'
)
admin
.
site
.
register
(
UploadFileModel
,
UploadFileAdmin
)
VulnNotti/myapp/templates/dynamic.html
View file @
d6cc921
...
...
@@ -47,15 +47,16 @@
<h1
class=
"text-uppercase mb-0"
>
동적 분석 페이지입니다.
</h1>
<hr
class=
"star-light"
>
<h2
class=
"font-weight-light mb-0"
>
툴을 다운로드 받은 후 결과 파일을 업로드 해주세요.
</h2>
<a
href=
"{% static 'img/
profile.png
' %}"
download
>
</div>
<div>
<a
href=
"{% static 'img/
linux_vuln_check_script.sh
' %}"
download
>
<button
class=
"btn btn-success"
>
Download!
</button>
</a>
<button
class=
"btn btn-warning"
>
Upload!
</button>
<form
method=
"post"
enctype=
"multipart/form-data"
>
{% csrf_token %}
<input
type=
"file"
name=
"sentFile"
/>
<input
type=
"submit"
name=
"submit"
value=
"Upload"
/>
<!-- <button class="btn btn-warning">Upload!</button> -->
<form
method=
"post"
style=
"display: inline;"
enctype=
"multipart/form-data"
>
{% csrf_token %}
<input
class=
"btn btn-warning"
style=
"background-color: #fcc;"
value=
"Select File"
type=
"file"
name=
"sentFile"
/>
<input
class=
"btn btn-warning"
style=
"color: white;"
type=
"submit"
name=
"submit"
value=
"Upload!"
/>
</form>
</div>
</header>
...
...
@@ -89,7 +90,7 @@
<th>
분류
</th>
<th>
점검항목
</th>
<th>
항목 중요도
</th>
<th>
결과
</th>
<th
style=
"width: 50%;"
>
결과
</th>
</tr>
<tbody>
{% for object in object_list %}
...
...
VulnNotti/myapp/templates/static.html
View file @
d6cc921
This diff is collapsed. Click to expand it.
VulnNotti/myapp/urls.py
View file @
d6cc921
from
django.conf.urls
import
url
,
include
from
myapp.views
import
*
app_name
=
'myapp'
urlpatterns
=
[
url
(
r'^static/'
,
StaticView
.
as_view
(),
name
=
'static'
),
url
(
r'^dynamic/'
,
DynamicView
.
as_view
(),
name
=
'dynamic'
),
]
...
...
VulnNotti/myapp/views.py
View file @
d6cc921
...
...
@@ -3,6 +3,7 @@ from django.views.generic import FormView
from
django.views.generic
import
View
from
django.db
import
connection
from
django.shortcuts
import
render
from
django.http
import
JsonResponse
from
django.http
import
HttpResponseRedirect
from
.forms
import
UploadFileForm
import
re
...
...
@@ -53,7 +54,7 @@ class DynamicView(TemplateView):
# print(str(line, 'UTF-8'))
# r = re.compile('\@.+\@', )
r
=
re
.
compile
(
r'\@(.
+)\@'
,
re
.
MULTILINE
)
r
=
re
.
compile
(
r'\@(.
*?)\@'
,
re
.
DOTALL
)
results
=
r
.
findall
(
temp
)
result_list
=
dict
(
enumerate
(
results
,
0
))
...
...
@@ -87,10 +88,18 @@ class StaticView(TemplateView):
template_name
=
'static.html'
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
context
=
{}
context
[
'form'
]
=
testform
query
=
'SELECT * FROM vuln.vulnInfo'
if
request
.
is_ajax
():
data
=
1
idx
=
request
.
GET
.
get
(
'idx'
)
method
=
request
.
GET
.
get
(
'method'
)
print
(
idx
)
print
(
method
)
return
JsonResponse
(
data
,
safe
=
False
)
context
=
{}
query
=
'SELECT * FROM vuln.vulnInfo LIMIT 50'
param_list
=
[]
...
...
@@ -99,6 +108,8 @@ class StaticView(TemplateView):
columns
=
[
column
[
0
]
for
column
in
cursor
.
description
]
print
(
columns
)
object_list
=
[]
for
row
in
cursor
.
fetchall
():
...
...
@@ -125,27 +136,27 @@ class StaticView(TemplateView):
print
(
text
)
return
render
(
self
.
request
,
self
.
template_name
,
context
)
class
ServerList
(
View
):
template_name
=
'test.html'
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
query
=
'SELECT * FROM vuln.vulnInfo'
param_list
=
[]
with
connection
.
cursor
()
as
cursor
:
cursor
.
execute
(
query
,
param_list
)
columns
=
[
column
[
0
]
for
column
in
cursor
.
description
]
for
row
in
cursor
.
fetchall
():
object_list
.
append
(
dict
(
zip
(
columns
,
row
)))
context
=
{}
object_list
=
[]
context
[
'object_list'
]
=
object_list
return
render
(
self
.
request
,
self
.
template_name
,
context
)
class
TableView
(
TemplateView
):
template_name
=
'myapp_table.html'
#
class ServerList(View):
#
template_name = 'test.html'
#
#
def get(self, request, *args, **kwargs):
#
#
query = 'SELECT * FROM vuln.vulnInfo'
#
param_list = []
#
#
with connection.cursor() as cursor:
#
cursor.execute(query, param_list)
#
#
columns = [column[0] for column in cursor.description]
#
#
for row in cursor.fetchall():
#
object_list.append(dict(zip(columns, row)))
#
#
context = {}
#
object_list = []
#
context['object_list'] = object_list
#
#
return render(self.request, self.template_name, context)
#
#
class TableView(TemplateView):
#
template_name = 'myapp_table.html'
...
...
VulnNotti/static/img/linux_vuln_check_script.sh
0 → 100644
View file @
d6cc921
This diff is collapsed. Click to expand it.
Please
register
or
login
to post a comment