Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hunter-ht.cn
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘莹莹
hunter-ht.cn
Commits
4f494701
Commit
4f494701
authored
Apr 25, 2020
by
liuyingying
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
累死我了
parent
1bcfb3c0
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
124 additions
and
29 deletions
+124
-29
models.py
Hunter_ht/hunter/models.py
+1
-1
style.css
Hunter_ht/hunter/static/hunter/style.css
+35
-12
index.html
Hunter_ht/hunter/templates/hunter/index.html
+8
-1
user.html
Hunter_ht/hunter/templates/hunter/user.html
+0
-0
urls.py
Hunter_ht/hunter/urls.py
+8
-3
views.py
Hunter_ht/hunter/views.py
+72
-12
No files found.
Hunter_ht/hunter/models.py
View file @
4f494701
...
...
@@ -33,7 +33,7 @@ class Publications(models.Model):
publishType
=
models
.
CharField
(
max_length
=
100
,
default
=
' '
)
journalname
=
models
.
CharField
(
max_length
=
1000
,
default
=
' '
)
date
=
models
.
DateField
(
default
=
timezone
.
now
)
indexType
=
models
.
CharField
(
max_length
=
100
,
default
=
'
'
)
indexType
=
models
.
CharField
(
max_length
=
100
,
default
=
''
)
uploadByUser
=
models
.
CharField
(
max_length
=
50
,
default
=
'no records'
)
isOpen
=
models
.
CharField
(
max_length
=
5
,
default
=
'1'
)
...
...
Hunter_ht/hunter/static/hunter/style.css
View file @
4f494701
...
...
@@ -12,11 +12,14 @@ body{
width
:
100%
;
}
button
{
line-height
:
25px
;
/* border: solid 1px black; */
border-radius
:
5px
;
cursor
:
pointer
;
}
select
{
height
:
30px
;
font-weight
:
200
;
}
#error_log
{
color
:
red
;
width
:
60%
;
...
...
@@ -219,6 +222,10 @@ nav>div{
width
:
100%
;
padding-left
:
20px
;
}
.wrap
ul
:hover
{
background
:
#ddd
;
border-radius
:
5px
;
}
.member_type
{
display
:
block
;
...
...
@@ -291,12 +298,13 @@ blockquote>p{
font-style
:
italic
;
color
:
#0063a9
;
}
.wrap
>
ul
{
.wrap
ul
{
display
:
block
;
width
:
100%
;
padding-right
:
20px
;
}
.wrap
>
ul
>
li
{
.wrap
ul
>
li
{
display
:
block
;
line-height
:
40px
;
float
:
left
;
...
...
@@ -324,7 +332,7 @@ ul:after{
.cve_big_text
>
a
{
color
:
#306cc5
;
}
.wrap
>
ul
>
li
>
a
:hover
{
.wrap
ul
>
li
>
a
:hover
{
color
:
#3c7fe2
;
font-size
:
18px
;
}
...
...
@@ -451,7 +459,7 @@ footer .copyright a:hover{
line-height
:
45px
;
text-align
:
right
;
}
#edit_content
>
form
>
div
>
input
{
#edit_content
>
div
>
input
{
width
:
65%
;
height
:
45px
;
font-size
:
16px
;
...
...
@@ -509,6 +517,12 @@ footer .copyright a:hover{
padding
:
2px
5px
;
margin-right
:
25px
;
}
#bar
>
.smaller_bottom_bar
>
span
{
width
:
auto
;
float
:
right
;
padding
:
2px
5px
;
margin-right
:
25px
;
}
.smaller_bottom_bar
>
a
:hover
{
font-size
:
16px
;
border-bottom
:
solid
2px
#6e829e
;
...
...
@@ -521,6 +535,7 @@ section > .smaller_box{
.smaller_bar
{
height
:
35px
;
padding
:
0
7px
;
background
:
#dee2ec
;
}
.smaller_bar
span
{
font-size
:
18px
;
...
...
@@ -540,27 +555,35 @@ section > .smaller_box{
font-size
:
18px
;
}
.add_one
{
width
:
100%
;
height
:
40px
;
width
:
10%
;
height
:
35px
;
float
:
right
;
}
.add_one
button
{
width
:
30px
;
height
:
30px
;
float
:
right
;
border-radius
:
15px
;
border
:
none
;
background
:
transparent
;
margin-right
:
15px
;
}
li
svg
{
margin
:
10px
5px
;
}
.right
button
,
.li_right
button
{
background
:
transparent
;
}
.add_one
button
svg
{
margin
:
5px
;
margin
:
8px
5px
;
}
.add_one
button
:hover
svg
{
width
:
30
px
;
height
:
30
px
;
height
:
25
px
;
width
:
25
px
;
border-radius
:
15px
;
margin
:
0
;
}
.myfile
{
float
:
right
;
}
.myfile
>
input
{
background
:
transparent
!important
;
...
...
Hunter_ht/hunter/templates/hunter/index.html
View file @
4f494701
...
...
@@ -66,7 +66,6 @@
</ul>
{% endfor %}
{% endif %}
</div>
{% endfor %}
</div>
...
...
@@ -249,6 +248,14 @@
}
};
function
logout
(){
let
session
=
window
.
sessionStorage
;
session
[
'username'
]
=
""
;
session
[
'password'
]
=
""
;
$
(
'#top_bar'
).
empty
();
$
(
'#top_bar'
).
append
(
"<ul><li onclick='login()'>登录</li></ul>"
);
}
function
click_bar
(
index
){
let
a_list
=
document
.
getElementsByClassName
(
"main_bar"
);
$
(
a_list
[
pre_clicked
]).
removeClass
(
'active'
);
...
...
Hunter_ht/hunter/templates/hunter/user.html
View file @
4f494701
This diff is collapsed.
Click to expand it.
Hunter_ht/hunter/urls.py
View file @
4f494701
from
django.urls
import
path
from
.
import
views
app_name
=
'hunter'
urlpatterns
=
[
path
(
''
,
views
.
index
,
name
=
'index'
),
path
(
'/index/'
,
views
.
index
,
name
=
'index'
),
# path('<int:pk>/', views.UserDetail.as_view(), name='user'),
# path('<int:pk>/article/', views.ArticleDetail.as_view(), name='article'),
path
(
'user/<int:user_id>/'
,
views
.
user
,
name
=
'user'
),
path
(
'article/<int:article_id>/'
,
views
.
article
,
name
=
'article'
),
path
(
'login/'
,
views
.
login
,
name
=
'login'
),
path
(
'delete/publication/<int:pub_id>'
,
views
.
delete_publication
,
name
=
'delete_publication'
),
path
(
'add/publication/'
,
views
.
add_publication
,
name
=
'add_publication'
),
path
(
'delete/publication/'
,
views
.
delete_publication
,
name
=
'delete_publication'
),
path
(
'delete/cve/'
,
views
.
delete_cve
,
name
=
'delete_cve'
),
path
(
'delete/article/'
,
views
.
delete_article
,
name
=
'delete_article'
),
path
(
'add/publication/'
,
views
.
add_publication
,
name
=
'add_publication'
),
path
(
'add/cve/'
,
views
.
add_cve
,
name
=
'add_cve'
),
path
(
'add/article/'
,
views
.
add_article
,
name
=
'add_article'
),
]
\ No newline at end of file
Hunter_ht/hunter/views.py
View file @
4f494701
...
...
@@ -98,9 +98,12 @@ def login(request):
def
user
(
request
,
user_id
):
u
=
User
.
objects
.
get
(
userID
=
user_id
)
print
(
u
.
name_hanzi
)
username
=
u
.
name
try
:
usr
=
User
.
objects
.
get
(
userID
=
user_id
)
except
ObjectDoesNotExist
as
e
:
return
redirect
(
request
,
'hunter/index.html'
)
username
=
usr
.
name
u
=
{
'userID'
:
user_id
,
'name'
:
username
}
my_publication_year_list
=
{}
pub_ids
=
PubToUser
.
objects
.
filter
(
username
=
username
)
.
all
()
.
values
(
"pubID"
)
for
pub_id
in
pub_ids
:
...
...
@@ -108,6 +111,7 @@ def user(request, user_id):
pub
=
get_object_or_404
(
Publications
,
pk
=
pub_id
[
'pubID'
])
year
=
str
(
pub
.
date
)[
0
:
4
]
pub
.
date
=
str
(
pub
.
date
)[
5
:
10
]
pub
.
link
=
pub
.
link
.
split
(
'/'
)[
-
1
]
if
year
in
my_publication_year_list
.
keys
():
my_publication_year_list
[
year
]
.
append
(
pub
)
else
:
...
...
@@ -150,7 +154,9 @@ def article(request, article_id):
return
render
(
request
,
'hunter/article.html'
,
{
'article'
:
art
})
def
delete_publication
(
request
,
pub_id
):
@csrf_exempt
def
delete_publication
(
request
):
pub_id
=
request
.
POST
[
'pub_id'
]
print
(
pub_id
)
try
:
PubToUser
.
objects
.
filter
(
pubID
=
pub_id
)
.
delete
()
...
...
@@ -161,17 +167,47 @@ def delete_publication(request, pub_id):
response
=
JsonResponse
({
"message"
:
1
})
return
response
@csrf_exempt
def
delete_cve
(
request
):
cve_id
=
request
.
POST
[
'cve_id'
]
try
:
Bugs
.
objects
.
filter
(
identifier
=
cve_id
)
.
delete
()
response
=
JsonResponse
({
"message"
:
1
})
return
response
except
ProgrammingError
as
e
:
response
=
JsonResponse
({
"message"
:
0
})
return
response
@csrf_exempt
def
delete_article
(
request
):
cve_id
=
request
.
POST
[
'cve_id'
]
try
:
Bugs
.
objects
.
filter
(
identifier
=
cve_id
)
.
delete
()
response
=
JsonResponse
({
"message"
:
1
})
return
response
except
ProgrammingError
as
e
:
response
=
JsonResponse
({
"message"
:
0
})
return
response
@csrf_exempt
def
add_publication
(
request
):
title
=
request
.
POST
[
'title'
]
print
(
title
)
authors
=
request
.
POST
[
'authors'
]
myfile
=
request
.
FILES
[
'myfile'
]
str
=
','
.
decode
(
'utf-8'
)
authors
=
authors
.
replace
(
str
,
','
)
print
(
authors
)
s
=
','
authors
=
authors
.
replace
(
s
,
','
)
print
(
authors
)
journalname
=
request
.
POST
.
get
(
'journalname'
)
date
=
request
.
POST
.
get
(
'date'
)
print
(
date
)
index
=
request
.
POST
.
get
(
'index'
)
if
Publications
.
objects
.
filter
(
title
=
title
)
.
count
()
>
0
:
return
JsonResponse
({
'message'
:
0
,
"error"
:
"该标题已存在"
})
if
Publications
.
objects
.
last
()
is
None
:
pubID
=
1
else
:
...
...
@@ -184,20 +220,44 @@ def add_publication(request):
for
chunk
in
myfile
.
chunks
():
dest
.
write
(
chunk
)
dest
.
close
()
link
=
os
.
path
.
join
(
'static'
,
'publications'
,
myfile
.
name
)
link
=
myfile
.
name
try
:
Publications
.
objects
.
create
(
pubID
=
pubID
,
title
=
title
,
link
=
link
,
messages
=
'kidding'
,
authors
=
authors
,
journalname
=
journalname
,
date
=
date
,
indexType
=
index
)
Publications
.
objects
.
create
(
pubID
=
pubID
,
title
=
title
,
link
=
link
,
messages
=
'kidding'
,
authors
=
authors
,
journalname
=
journalname
,
date
=
date
,)
except
ProgrammingError
as
e
:
return
render
(
request
,
'user.html'
,
{
'message'
:
'Publications表错误:'
+
e
})
return
JsonResponse
({
"message"
:
0
})
authorArr
=
authors
.
split
(
','
)
print
(
authorArr
)
for
author
in
authorArr
:
try
:
PubToUser
.
objects
.
create
(
pubID
=
pubID
,
username
=
author
)
re
turn
redirect
(
request
,
'index.html'
,
{
'uploadMessage'
:
'文件上传成功'
})
re
sponse
=
JsonResponse
({
"message"
:
1
,
'pubID'
:
pubID
})
except
ProgrammingError
as
e
:
return
render
(
request
,
'index.html'
,
{
'uploadError'
:
'PubToUser数据表错误:'
+
e
})
return
JsonResponse
({
"message"
:
0
})
# message["warning"] = "上传成功"
# return HttpResponse(json.dumps(message), content_type='application/json')
return
re
direct
(
request
,
'index.html'
)
return
re
sponse
@csrf_exempt
def
add_cve
(
request
):
owner
=
request
.
POST
[
'owner'
]
bugType
=
request
.
POST
[
'bugType'
]
identifier
=
request
.
POST
[
'cve_id'
]
datetime
=
request
.
POST
[
'date'
]
software
=
request
.
POST
[
'software'
]
url
=
request
.
POST
[
'url'
]
if
Bugs
.
objects
.
filter
(
identifier
=
identifier
)
.
count
()
>
0
:
return
JsonResponse
({
'message'
:
0
,
"error"
:
"该CVE已存在"
})
try
:
Bugs
.
objects
.
create
(
owner
=
owner
,
bugType
=
bugType
,
identifier
=
identifier
,
datetime
=
datetime
,
software
=
software
,
url
=
url
)
response
=
JsonResponse
({
"message"
:
1
})
return
response
except
ProgrammingError
as
e
:
response
=
JsonResponse
({
"message"
:
0
})
return
response
@csrf_exempt
def
add_article
(
request
):
return
0
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment