Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
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
ops
jumpserver
Commits
45898932
Commit
45898932
authored
May 15, 2017
by
GuangHongwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] 修改bug,使用py3编程
parent
3c8d6fbe
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
37 additions
and
47 deletions
+37
-47
.gitignore
.gitignore
+1
-0
user_asset_list.html
apps/assets/templates/assets/user_asset_list.html
+0
-2
views.py
apps/audits/views.py
+1
-1
utils.py
apps/common/utils.py
+5
-14
models.py
apps/ops/models.py
+1
-4
views.py
apps/perms/views.py
+1
-0
inputTags.css
apps/static/css/plugins/inputTags.css
+2
-2
style.css
apps/static/css/style.css
+2
-2
dark-unica.js
apps/static/js/plugins/highcharts/themes/dark-unica.js
+1
-1
grid-light.js
apps/static/js/plugins/highcharts/themes/grid-light.js
+1
-1
sand-signika.js
apps/static/js/plugins/highcharts/themes/sand-signika.js
+1
-1
utils.py
apps/users/utils.py
+4
-2
requirements.txt
requirements/requirements.txt
+17
-17
No files found.
.gitignore
View file @
45898932
...
...
@@ -22,3 +22,4 @@ host_rsa_key
*.bat
tags
tmp/*
jumpserver.iml
apps/assets/templates/assets/user_asset_list.html
View file @
45898932
...
...
@@ -43,8 +43,6 @@
<tbody>
</tbody>
</table>
{% include 'assets/_asset_import_modal.html' %}
{% include 'assets/_asset_bulk_update_modal.html' %}
{% endblock %}
{% block custom_foot_js %}
...
...
apps/audits/views.py
View file @
45898932
...
...
@@ -55,7 +55,7 @@ class ProxyLogListView(AdminUserRequiredMixin, ListView):
if
self
.
username
:
filter_kwargs
[
'user'
]
=
self
.
username
if
self
.
ip
:
filter_kwargs
[
'
ip
'
]
=
self
.
ip
filter_kwargs
[
'
asset
'
]
=
self
.
ip
if
self
.
system_user
:
filter_kwargs
[
'system_user'
]
=
self
.
system_user
if
self
.
keyword
:
...
...
apps/common/utils.py
View file @
45898932
# -*- coding: utf-8 -*-
#
from
__future__
import
unicode_literals
from
collections
import
OrderedDict
from
six
import
string_types
import
base64
...
...
@@ -15,9 +15,9 @@ import hashlib
from
email.utils
import
formatdate
import
calendar
import
threading
from
io
import
StringIO
import
paramiko
from
passlib.hash
import
sha512_crypt
import
sshpubkeys
from
itsdangerous
import
TimedJSONWebSignatureSerializer
,
JSONWebSignatureSerializer
,
\
BadSignature
,
SignatureExpired
...
...
@@ -25,10 +25,6 @@ from django.shortcuts import reverse as dj_reverse
from
django.conf
import
settings
from
django.utils
import
timezone
try
:
from
io
import
StringIO
except
ImportError
:
from
StringIO
import
StringIO
from
.compat
import
to_bytes
,
to_string
...
...
@@ -281,6 +277,7 @@ _ISO8601_FORMAT = "%Y-%m-%dT%H:%M:%S.000Z"
def
to_unixtime
(
time_string
,
format_string
):
time_string
=
time_string
.
decode
(
"ascii"
)
with
_STRPTIME_LOCK
:
return
int
(
calendar
.
timegm
(
time
.
strptime
(
time_string
,
format_string
)))
...
...
@@ -305,15 +302,9 @@ def iso8601_to_unixtime(time_string):
return
to_unixtime
(
time_string
,
_ISO8601_FORMAT
)
# def http_to_unixtime(time_string):
# """把HTTP Date格式的字符串转换为UNIX时间(自1970年1月1日UTC零点的秒数)。
#
# HTTP Date形如 `Sat, 05 Dec 2015 11:10:29 GMT` 。
# """
# return to_unixtime(time_string, "%a, %d %b %Y %H:%M:%S GMT")
def
make_signature
(
access_key_secret
,
date
=
None
):
if
isinstance
(
date
,
bytes
):
date
=
bytes
.
decode
(
date
)
if
isinstance
(
date
,
int
):
date_gmt
=
http_date
(
date
)
elif
date
is
None
:
...
...
apps/ops/models.py
View file @
45898932
...
...
@@ -40,10 +40,7 @@ class Task(models.Model):
@property
def
assets_json
(
self
):
from
assets.models
import
Asset
return
[
Asset
.
objects
.
get
(
id
=
int
(
id_
))
.
_to_secret_json
()
for
id_
in
self
.
total_assets
if
Asset
.
objects
.
filter
(
id
=
int
(
id_
))]
return
[
asset
.
_to_secret_json
()
for
asset
in
self
.
total_assets
]
@property
def
module_args
(
self
):
...
...
apps/perms/views.py
View file @
45898932
...
...
@@ -105,6 +105,7 @@ class AssetPermissionUpdateView(AdminUserRequiredMixin, UpdateView):
success_message
=
_
(
'Update asset permission <a href="{url}"> {name} </a> successfully.'
)
success_url
=
reverse_lazy
(
"perms:asset-permission-list"
)
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
...
...
apps/static/css/plugins/inputTags.css
View file @
45898932
@import
url("https://fonts.
googleapis.com
/css?family=Open+Sans:300,400,600,700")
;
@import
url("https://fonts.
googleapis.com
/css?family=Roboto:400,300,500,700")
;
@import
url("https://fonts.
css.network
/css?family=Open+Sans:300,400,600,700")
;
@import
url("https://fonts.
css.network
/css?family=Roboto:400,300,500,700")
;
/** {*/
/*box-sizing: border-box;*/
/*}*/
...
...
apps/static/css/style.css
View file @
45898932
@import
url("https://fonts.
googleapis.com
/css?family=Open+Sans:300,400,600,700")
;
@import
url("https://fonts.
googleapis.com
/css?family=Roboto:400,300,500,700")
;
@import
url("https://fonts.
css.network
/css?family=Open+Sans:300,400,600,700")
;
@import
url("https://fonts.
css.network
/css?family=Roboto:400,300,500,700")
;
/*
*
* INSPINIA - Responsive Admin Theme
...
...
apps/static/js/plugins/highcharts/themes/dark-unica.js
View file @
45898932
...
...
@@ -5,7 +5,7 @@
// Load the fonts
Highcharts
.
createElement
(
'link'
,
{
href
:
'http
://fonts.googleapis.com
/css?family=Unica+One'
,
href
:
'http
s://fonts.css.network
/css?family=Unica+One'
,
rel
:
'stylesheet'
,
type
:
'text/css'
},
null
,
document
.
getElementsByTagName
(
'head'
)[
0
]);
...
...
apps/static/js/plugins/highcharts/themes/grid-light.js
View file @
45898932
...
...
@@ -5,7 +5,7 @@
// Load the fonts
Highcharts
.
createElement
(
'link'
,
{
href
:
'http
://fonts.googleapis.com
/css?family=Dosis:400,600'
,
href
:
'http
s://fonts.css.network
/css?family=Dosis:400,600'
,
rel
:
'stylesheet'
,
type
:
'text/css'
},
null
,
document
.
getElementsByTagName
(
'head'
)[
0
]);
...
...
apps/static/js/plugins/highcharts/themes/sand-signika.js
View file @
45898932
...
...
@@ -5,7 +5,7 @@
// Load the fonts
Highcharts
.
createElement
(
'link'
,
{
href
:
'http
://fonts.googleapis.com
/css?family=Signika:400,700'
,
href
:
'http
s://fonts.css.network
/css?family=Signika:400,700'
,
rel
:
'stylesheet'
,
type
:
'text/css'
},
null
,
document
.
getElementsByTagName
(
'head'
)[
0
]);
...
...
apps/users/utils.py
View file @
45898932
...
...
@@ -161,10 +161,12 @@ def refresh_token(token, user, expiration=3600):
def
generate_token
(
request
,
user
):
expiration
=
settings
.
CONFIG
.
TOKEN_EXPIRATION
or
3600
remote_addr
=
request
.
META
.
get
(
'REMOTE_ADDR'
,
''
)
remote_addr
=
base64
.
b16encode
(
remote_addr
)
.
replace
(
'='
,
''
)
if
not
isinstance
(
remote_addr
,
bytes
):
remote_addr
=
remote_addr
.
encode
(
"utf-8"
)
remote_addr
=
base64
.
b16encode
(
remote_addr
)
#.replace(b'=', '')
token
=
cache
.
get
(
'
%
s_
%
s'
%
(
user
.
id
,
remote_addr
))
if
not
token
:
token
=
uuid
.
uuid4
()
.
get_hex
()
token
=
uuid
.
uuid4
()
.
hex
print
(
'Set cache:
%
s'
%
token
)
cache
.
set
(
token
,
user
.
id
,
expiration
)
cache
.
set
(
'
%
s_
%
s'
%
(
user
.
id
,
remote_addr
),
token
,
expiration
)
...
...
requirements/requirements.txt
View file @
45898932
Django
=
=1.11
django-bootstrap3
=
=8.2.2
Pillow
=
=4.1.0
djangorestframework
=
=3.6.2
Django
>
=1.11
django-bootstrap3
>
=8.2.2
Pillow
>
=4.1.0
djangorestframework
>
=3.6.2
ForgeryPy
openpyxl
=
=2.4.0
celery
=
=4.0.2
paramiko
=
=2.1.2
ansible
=
=2.2.2.0
django-simple-captcha
=
=0.5.5
django-formtools
=
=2.0
sshpubkeys
=
=2.2.0
djangorestframework-bulk
=
=0.2.1
django-redis-cache
=
=1.7.1
requests
=
=2.13.0
itsdangerous
=
=0.24
openpyxl
>
=2.4.0
celery
>
=4.0.2
paramiko
>
=2.1.2
ansible
>
=2.2.2.0
django-simple-captcha
>
=0.5.5
django-formtools
>
=2.0
sshpubkeys
>
=2.2.0
djangorestframework-bulk
>
=0.2.1
django-redis-cache
>
=1.7.1
requests
>
=2.13.0
itsdangerous
>
=0.24
eventlet
django-filter
=
=1.0.2
passlib
=
=1.7.1
django-filter
>
=1.0.2
passlib
>
=1.7.1
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