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_discovery import *
|
||||||
from .account_reconcile import *
|
from .account_reconcile import *
|
||||||
from .account_verify 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
|
from .base import BaseAutomation
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ['GatherFactsAutomation']
|
||||||
|
|
||||||
|
|
||||||
class GatherFactsAutomation(BaseAutomation):
|
class GatherFactsAutomation(BaseAutomation):
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _("Gather asset facts")
|
verbose_name = _("Gather asset facts")
|
||||||
|
|
|
@ -8,11 +8,11 @@ class Hasher:
|
||||||
block_size = 64
|
block_size = 64
|
||||||
digest_size = 32
|
digest_size = 32
|
||||||
|
|
||||||
def __init__(self, key):
|
def __init__(self, data):
|
||||||
self.key = key
|
self.__data = data
|
||||||
|
|
||||||
def hexdigest(self):
|
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):
|
def digest(self):
|
||||||
return bytes.fromhex(self.hexdigest())
|
return bytes.fromhex(self.hexdigest())
|
||||||
|
@ -21,11 +21,11 @@ class Hasher:
|
||||||
def hash(msg=b''):
|
def hash(msg=b''):
|
||||||
return Hasher(msg)
|
return Hasher(msg)
|
||||||
|
|
||||||
def update(self, msg):
|
def update(self, data):
|
||||||
self.key += msg
|
self.__data += data
|
||||||
|
|
||||||
def copy(self):
|
def copy(self):
|
||||||
return Hasher(self.key)
|
return Hasher(self.__data)
|
||||||
|
|
||||||
|
|
||||||
class PBKDF2SM3PasswordHasher(PBKDF2PasswordHasher):
|
class PBKDF2SM3PasswordHasher(PBKDF2PasswordHasher):
|
||||||
|
|
Loading…
Reference in New Issue