Showing
7 changed files
with
51 additions
and
48 deletions
| ... | @@ -18,14 +18,14 @@ from django.contrib import admin | ... | @@ -18,14 +18,14 @@ from django.contrib import admin |
| 18 | from django.contrib.auth import views | 18 | from django.contrib.auth import views |
| 19 | from VulnNotti.views import * | 19 | from VulnNotti.views import * |
| 20 | from django.conf import settings | 20 | from django.conf import settings |
| 21 | - | 21 | +from myapp.views import * |
| 22 | 22 | ||
| 23 | urlpatterns = [ | 23 | urlpatterns = [ |
| 24 | url(r'^admin/', admin.site.urls), | 24 | url(r'^admin/', admin.site.urls), |
| 25 | url(r'^$', HomeView.as_view(), name='home'), | 25 | url(r'^$', HomeView.as_view(), name='home'), |
| 26 | url(r'^home/', HomeView.as_view(), name='home'), | 26 | url(r'^home/', HomeView.as_view(), name='home'), |
| 27 | url(r'^myapp/', include('myapp.urls', namespace='myapp')), | 27 | url(r'^myapp/', include('myapp.urls', namespace='myapp')), |
| 28 | - | 28 | + url(r'^myapp/static', StaticView.as_view(), name='static'), |
| 29 | url(r'^edit/', EditView.as_view(), name='edit'), | 29 | url(r'^edit/', EditView.as_view(), name='edit'), |
| 30 | 30 | ||
| 31 | url(r'^accounts/', include('django.contrib.auth.urls')), | 31 | url(r'^accounts/', include('django.contrib.auth.urls')), | ... | ... |
| ... | @@ -47,15 +47,16 @@ | ... | @@ -47,15 +47,16 @@ |
| 47 | <h1 class="text-uppercase mb-0">동적 분석 페이지입니다.</h1> | 47 | <h1 class="text-uppercase mb-0">동적 분석 페이지입니다.</h1> |
| 48 | <hr class="star-light"> | 48 | <hr class="star-light"> |
| 49 | <h2 class="font-weight-light mb-0">툴을 다운로드 받은 후 결과 파일을 업로드 해주세요.</h2> | 49 | <h2 class="font-weight-light mb-0">툴을 다운로드 받은 후 결과 파일을 업로드 해주세요.</h2> |
| 50 | - | 50 | + </div> |
| 51 | - | 51 | + <div> |
| 52 | - <a href="{% static 'img/profile.png' %}" download> | 52 | + <a href="{% static 'img/linux_vuln_check_script.sh' %}" download> |
| 53 | <button class="btn btn-success">Download!</button> | 53 | <button class="btn btn-success">Download!</button> |
| 54 | </a> | 54 | </a> |
| 55 | - <button class="btn btn-warning">Upload!</button> | 55 | + |
| 56 | - <form method="post" enctype="multipart/form-data">{% csrf_token %} | 56 | + <!-- <button class="btn btn-warning">Upload!</button> --> |
| 57 | - <input type="file" name="sentFile" /> | 57 | + <form method="post" style="display: inline;" enctype="multipart/form-data">{% csrf_token %} |
| 58 | - <input type="submit" name="submit" value="Upload" /> | 58 | + <input class="btn btn-warning" style="background-color: #fcc;"value="Select File" type="file" name="sentFile" /> |
| 59 | + <input class="btn btn-warning" style="color: white;" type="submit" name="submit" value="Upload!" /> | ||
| 59 | </form> | 60 | </form> |
| 60 | </div> | 61 | </div> |
| 61 | </header> | 62 | </header> |
| ... | @@ -89,7 +90,7 @@ | ... | @@ -89,7 +90,7 @@ |
| 89 | <th>분류</th> | 90 | <th>분류</th> |
| 90 | <th>점검항목</th> | 91 | <th>점검항목</th> |
| 91 | <th>항목 중요도</th> | 92 | <th>항목 중요도</th> |
| 92 | - <th>결과</th> | 93 | + <th style="width: 50%;">결과</th> |
| 93 | </tr> | 94 | </tr> |
| 94 | <tbody> | 95 | <tbody> |
| 95 | {% for object in object_list %} | 96 | {% for object in object_list %} | ... | ... |
This diff is collapsed. Click to expand it.
| 1 | from django.conf.urls import url, include | 1 | from django.conf.urls import url, include |
| 2 | from myapp.views import * | 2 | from myapp.views import * |
| 3 | 3 | ||
| 4 | - | 4 | +app_name = 'myapp' |
| 5 | urlpatterns = [ | 5 | urlpatterns = [ |
| 6 | url(r'^static/', StaticView.as_view(), name='static'), | 6 | url(r'^static/', StaticView.as_view(), name='static'), |
| 7 | url(r'^dynamic/', DynamicView.as_view(), name='dynamic'), | 7 | url(r'^dynamic/', DynamicView.as_view(), name='dynamic'), |
| 8 | - | ||
| 9 | ] | 8 | ] | ... | ... |
| ... | @@ -3,6 +3,7 @@ from django.views.generic import FormView | ... | @@ -3,6 +3,7 @@ from django.views.generic import FormView |
| 3 | from django.views.generic import View | 3 | from django.views.generic import View |
| 4 | from django.db import connection | 4 | from django.db import connection |
| 5 | from django.shortcuts import render | 5 | from django.shortcuts import render |
| 6 | +from django.http import JsonResponse | ||
| 6 | from django.http import HttpResponseRedirect | 7 | from django.http import HttpResponseRedirect |
| 7 | from .forms import UploadFileForm | 8 | from .forms import UploadFileForm |
| 8 | import re | 9 | import re |
| ... | @@ -53,7 +54,7 @@ class DynamicView(TemplateView): | ... | @@ -53,7 +54,7 @@ class DynamicView(TemplateView): |
| 53 | # print(str(line, 'UTF-8')) | 54 | # print(str(line, 'UTF-8')) |
| 54 | 55 | ||
| 55 | # r = re.compile('\@.+\@', ) | 56 | # r = re.compile('\@.+\@', ) |
| 56 | - r = re.compile(r'\@(.+)\@', re.MULTILINE) | 57 | + r = re.compile(r'\@(.*?)\@', re.DOTALL) |
| 57 | results = r.findall(temp) | 58 | results = r.findall(temp) |
| 58 | 59 | ||
| 59 | result_list = dict(enumerate(results, 0)) | 60 | result_list = dict(enumerate(results, 0)) |
| ... | @@ -87,10 +88,18 @@ class StaticView(TemplateView): | ... | @@ -87,10 +88,18 @@ class StaticView(TemplateView): |
| 87 | template_name = 'static.html' | 88 | template_name = 'static.html' |
| 88 | 89 | ||
| 89 | def get(self, request, *args, **kwargs): | 90 | def get(self, request, *args, **kwargs): |
| 90 | - context = {} | ||
| 91 | - context['form'] = testform | ||
| 92 | 91 | ||
| 93 | - query = 'SELECT * FROM vuln.vulnInfo' | 92 | + if request.is_ajax(): |
| 93 | + data = 1 | ||
| 94 | + idx = request.GET.get('idx') | ||
| 95 | + method = request.GET.get('method') | ||
| 96 | + | ||
| 97 | + print(idx) | ||
| 98 | + print(method) | ||
| 99 | + return JsonResponse(data, safe=False) | ||
| 100 | + | ||
| 101 | + context = {} | ||
| 102 | + query = 'SELECT * FROM vuln.vulnInfo LIMIT 50' | ||
| 94 | 103 | ||
| 95 | param_list = [] | 104 | param_list = [] |
| 96 | 105 | ||
| ... | @@ -99,6 +108,8 @@ class StaticView(TemplateView): | ... | @@ -99,6 +108,8 @@ class StaticView(TemplateView): |
| 99 | 108 | ||
| 100 | columns = [column[0] for column in cursor.description] | 109 | columns = [column[0] for column in cursor.description] |
| 101 | 110 | ||
| 111 | + print(columns) | ||
| 112 | + | ||
| 102 | object_list = [] | 113 | object_list = [] |
| 103 | 114 | ||
| 104 | for row in cursor.fetchall(): | 115 | for row in cursor.fetchall(): |
| ... | @@ -125,27 +136,27 @@ class StaticView(TemplateView): | ... | @@ -125,27 +136,27 @@ class StaticView(TemplateView): |
| 125 | print(text) | 136 | print(text) |
| 126 | return render(self.request, self.template_name, context) | 137 | return render(self.request, self.template_name, context) |
| 127 | 138 | ||
| 128 | -class ServerList(View): | 139 | +# class ServerList(View): |
| 129 | - template_name = 'test.html' | 140 | +# template_name = 'test.html' |
| 130 | - | 141 | +# |
| 131 | - def get(self, request, *args, **kwargs): | 142 | +# def get(self, request, *args, **kwargs): |
| 132 | - | 143 | +# |
| 133 | - query = 'SELECT * FROM vuln.vulnInfo' | 144 | +# query = 'SELECT * FROM vuln.vulnInfo' |
| 134 | - param_list = [] | 145 | +# param_list = [] |
| 135 | - | 146 | +# |
| 136 | - with connection.cursor() as cursor: | 147 | +# with connection.cursor() as cursor: |
| 137 | - cursor.execute(query, param_list) | 148 | +# cursor.execute(query, param_list) |
| 138 | - | 149 | +# |
| 139 | - columns = [column[0] for column in cursor.description] | 150 | +# columns = [column[0] for column in cursor.description] |
| 140 | - | 151 | +# |
| 141 | - for row in cursor.fetchall(): | 152 | +# for row in cursor.fetchall(): |
| 142 | - object_list.append(dict(zip(columns, row))) | 153 | +# object_list.append(dict(zip(columns, row))) |
| 143 | - | 154 | +# |
| 144 | - context = {} | 155 | +# context = {} |
| 145 | - object_list = [] | 156 | +# object_list = [] |
| 146 | - context['object_list'] = object_list | 157 | +# context['object_list'] = object_list |
| 147 | - | 158 | +# |
| 148 | - return render(self.request, self.template_name, context) | 159 | +# return render(self.request, self.template_name, context) |
| 149 | - | 160 | +# |
| 150 | -class TableView(TemplateView): | 161 | +# class TableView(TemplateView): |
| 151 | - template_name = 'myapp_table.html' | 162 | +# template_name = 'myapp_table.html' | ... | ... |
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment