Commit 45898932 authored by GuangHongwei's avatar GuangHongwei

[Bugfix] 修改bug,使用py3编程

parent 3c8d6fbe
......@@ -22,3 +22,4 @@ host_rsa_key
*.bat
tags
tmp/*
jumpserver.iml
......@@ -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 %}
......
......@@ -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:
......
# -*- 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:
......
......@@ -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):
......
......@@ -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 = {
......
@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;*/
/*}*/
......
@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
......
......@@ -5,7 +5,7 @@
// Load the fonts
Highcharts.createElement('link', {
href: 'http://fonts.googleapis.com/css?family=Unica+One',
href: 'https://fonts.css.network/css?family=Unica+One',
rel: 'stylesheet',
type: 'text/css'
}, null, document.getElementsByTagName('head')[0]);
......
......@@ -5,7 +5,7 @@
// Load the fonts
Highcharts.createElement('link', {
href: 'http://fonts.googleapis.com/css?family=Dosis:400,600',
href: 'https://fonts.css.network/css?family=Dosis:400,600',
rel: 'stylesheet',
type: 'text/css'
}, null, document.getElementsByTagName('head')[0]);
......
......@@ -5,7 +5,7 @@
// Load the fonts
Highcharts.createElement('link', {
href: 'http://fonts.googleapis.com/css?family=Signika:400,700',
href: 'https://fonts.css.network/css?family=Signika:400,700',
rel: 'stylesheet',
type: 'text/css'
}, null, document.getElementsByTagName('head')[0]);
......
......@@ -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)
......
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment