mirror of https://github.com/jumpserver/jumpserver
pref: 修改添加 gather facts
parent
10c0cc7abf
commit
4e8e4e4bb7
|
@ -0,0 +1,24 @@
|
|||
# Generated by Django 3.2.14 on 2022-10-14 11:40
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('assets', '0109_auto_20221013_1751'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='GatherFactsAutomation',
|
||||
fields=[
|
||||
('baseautomation_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='assets.baseautomation')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Gather asset facts',
|
||||
},
|
||||
bases=('assets.baseautomation',),
|
||||
),
|
||||
]
|
|
@ -2,3 +2,4 @@ from .change_secret import *
|
|||
from .account_discovery import *
|
||||
from .account_reconcile import *
|
||||
from .account_verify import *
|
||||
from .gather_facts import *
|
||||
|
|
|
@ -3,6 +3,9 @@ from django.utils.translation import ugettext_lazy as _
|
|||
from .base import BaseAutomation
|
||||
|
||||
|
||||
__all__ = ['GatherFactsAutomation']
|
||||
|
||||
|
||||
class GatherFactsAutomation(BaseAutomation):
|
||||
class Meta:
|
||||
verbose_name = _("Gather asset facts")
|
||||
|
|
|
@ -8,11 +8,11 @@ class Hasher:
|
|||
block_size = 64
|
||||
digest_size = 32
|
||||
|
||||
def __init__(self, key):
|
||||
self.key = key
|
||||
def __init__(self, data):
|
||||
self.__data = data
|
||||
|
||||
def hexdigest(self):
|
||||
return sm3.sm3_hash(func.bytes_to_list(self.key))
|
||||
return sm3.sm3_hash(func.bytes_to_list(self.__data))
|
||||
|
||||
def digest(self):
|
||||
return bytes.fromhex(self.hexdigest())
|
||||
|
@ -21,11 +21,11 @@ class Hasher:
|
|||
def hash(msg=b''):
|
||||
return Hasher(msg)
|
||||
|
||||
def update(self, msg):
|
||||
self.key += msg
|
||||
def update(self, data):
|
||||
self.__data += data
|
||||
|
||||
def copy(self):
|
||||
return Hasher(self.key)
|
||||
return Hasher(self.__data)
|
||||
|
||||
|
||||
class PBKDF2SM3PasswordHasher(PBKDF2PasswordHasher):
|
||||
|
|
Loading…
Reference in New Issue