pref: 修改添加 gather facts

pull/8970/head
ibuler 2022-10-14 19:40:51 +08:00
parent 10c0cc7abf
commit 4e8e4e4bb7
4 changed files with 34 additions and 6 deletions

View File

@ -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',),
),
]

View File

@ -2,3 +2,4 @@ from .change_secret import *
from .account_discovery import *
from .account_reconcile import *
from .account_verify import *
from .gather_facts import *

View File

@ -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")

View File

@ -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):