Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
g.setComponentByName(
'gocbRef',
'DENNY_11F_13_100CFG/LLN0$GO$Dset_SubnetCtrl'
)
g.setComponentByName('timeAllowedtoLive', 2000)
g.setComponentByName('datSet', 'DENNY_11F_13_100CFG/LLN0$G_NetCtrl')
g.setComponentByName('goID', '11F_13_100Dset_SubnetCtrl')
g.setComponentByName('t', b'\x5a\xaa\xe0\xa4\x6f\xf3\x5e\x92')
g.setComponentByName('stNum', 96)
g.setComponentByName('sqNum', 16192)
g.setComponentByName('test', False)
g.setComponentByName('confRev', 2)
g.setComponentByName('ndsCom', False)
g.setComponentByName('numDatSetEntries', 5)
all_data = AllData().subtype(
implicitTag=tag.Tag(
tag.tagClassContext,
tag.tagFormatConstructed,
11
)
)
inner1 = univ.SequenceOf(componentType=Data()).subtype(
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)
)
inner1.setComponentByPosition(0, Data().setComponentByName("boolean", False))
inner1.setComponentByPosition(1, Data().setComponentByName("bit-string", "'0000000000000'B"))
inner1.setComponentByPosition(2, Data().setComponentByName('utc-time', b'\x5a\xaa\xe0\xa4\x6f\xf3\x5e\x92'))
data1 = Data()
data1.setComponentByName('structure', inner1)
inner2 = univ.SequenceOf(componentType=Data()).subtype(
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)
)
tag.tagFormatConstructed, 0))
signed['ecuIdentifier'] = json_signed['ecu_serial']
signed['previousTime'] = calendar.timegm(datetime.strptime(
json_signed['previous_timeserver_time'], "%Y-%m-%dT%H:%M:%SZ").timetuple())
signed['currentTime'] = calendar.timegm(datetime.strptime(
json_signed['timeserver_time'], "%Y-%m-%dT%H:%M:%SZ").timetuple())
# Optional bit.
if 'attacks_detected' in json_signed and json_signed['attacks_detected']:
attacks_detected = json_signed['attacks_detected']
assert len(attacks_detected) > 0,\
'attacks_detected cannot be an empty string!'
signed['securityAttack'] = attacks_detected
target = Target().subtype(implicitTag=tag.Tag(tag.tagClassContext,
tag.tagFormatConstructed, 4))
filename = json_signed['installed_image']['filepath']
filemeta = json_signed['installed_image']['fileinfo']
target['filename'] = filename
target['length'] = filemeta['length']
hashes = Hashes().subtype(implicitTag=tag.Tag(tag.tagClassContext,
tag.tagFormatSimple, 3))
numberOfHashes = 0
# We're going to generate a list of hashes from the dictionary of hashes.
# The DER will contain this list, and the order of items in this list will
# affect hashing of the DER, and therefore signature verification.
# We have to make the order deterministic.
sorted_hash_functions = sorted(filemeta['hashes'])
recipientInfos RecipientInfos,
macAlgorithm MessageAuthenticationCodeAlgorithm,
digestAlgorithm [1] DigestAlgorithmIdentifier OPTIONAL,
encapContentInfo EncapsulatedContentInfo,
authAttrs [2] IMPLICIT AuthAttributes OPTIONAL,
mac MessageAuthenticationCode,
unauthAttrs [3] IMPLICIT UnauthAttributes OPTIONAL }
"""
componentType = namedtype.NamedTypes(
namedtype.NamedType('version', CMSVersion()),
namedtype.OptionalNamedType('originatorInfo', OriginatorInfo().subtype(
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
namedtype.NamedType('recipientInfos', RecipientInfos()),
namedtype.NamedType('macAlgorithm', MessageAuthenticationCodeAlgorithm()),
namedtype.OptionalNamedType('digestAlgorithm', DigestAlgorithmIdentifier().subtype(
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
namedtype.NamedType('encapContentInfo', EncapsulatedContentInfo()),
namedtype.OptionalNamedType('authAttrs', AuthAttributes().subtype(
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))),
namedtype.NamedType('mac', MessageAuthenticationCode()),
namedtype.OptionalNamedType('unauthAttrs', UnauthAttributes().subtype(
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3)))
)
# -- The CMS Attributes
class MessageDigest(univ.OctetString):
"""
MessageDigest ::= OCTET STRING
"""
pass
namedtype.NamedType('printable', char.PrintableString().subtype(
subtypeSpec=constraint.ValueSizeConstraint(0, ub_domain_name_length)))
)
class PresentationAddress(univ.Sequence):
pass
PresentationAddress.componentType = namedtype.NamedTypes(
namedtype.OptionalNamedType('pSelector', univ.OctetString().subtype(
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
namedtype.OptionalNamedType('sSelector', univ.OctetString().subtype(
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
namedtype.OptionalNamedType('tSelector', univ.OctetString().subtype(
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
namedtype.NamedType('nAddresses', univ.SetOf(componentType=univ.OctetString()).subtype(
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
)
class ExtendedNetworkAddress(univ.Choice):
pass
ExtendedNetworkAddress.componentType = namedtype.NamedTypes(
namedtype.NamedType(
'e163-4-address', univ.Sequence(
componentType=namedtype.NamedTypes(
namedtype.NamedType('number', char.NumericString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_e163_4_number_length)).subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
namedtype.OptionalNamedType('sub-address', char.NumericString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_e163_4_sub_address_length)).subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
)
namedtype.NamedType('array', univ.SequenceOf(componentType=Data()).subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
namedtype.NamedType('structure', univ.SequenceOf(componentType=Data()).subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))),
namedtype.NamedType('boolean', univ.Boolean().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
namedtype.NamedType('bit-string', univ.BitString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4))),
namedtype.NamedType('integer', univ.Integer().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 5))),
namedtype.NamedType('unsigned', univ.Integer().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 6))),
namedtype.NamedType('floating-point', FloatingPoint().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 7))),
namedtype.NamedType('real', univ.Real().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 8))),
namedtype.NamedType('octet-string', univ.OctetString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 9))),
namedtype.NamedType('visible-string', char.VisibleString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 10))),
namedtype.NamedType('binary-time', TimeOfDay().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 12))),
namedtype.NamedType('bcd', univ.Integer().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 13))),
namedtype.NamedType('booleanArray', univ.BitString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 14))),
namedtype.NamedType('objId', univ.ObjectIdentifier().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 15))),
namedtype.NamedType('mMSString', MMSString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 16))),
namedtype.NamedType('utc-time', UtcTime().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 17)))
)
class AllData(univ.SequenceOf):
componentType = Data()
class IECGoosePDU(univ.Sequence):
componentType = namedtype.NamedTypes(
namedtype.NamedType(
'gocbRef',
char.VisibleString().subtype(
implicitTag=tag.Tag(
tag.tagClassContext,
tag.tagFormatSimple,
0
tagSet = self._tagSet.tagExplicitly(explicitTag)
else:
tagSet = self._tagSet
if subtypeSpec is None:
subtypeSpec = self._subtypeSpec
else:
subtypeSpec = subtypeSpec + self._subtypeSpec
if namedValues is None:
namedValues = self.__namedValues
else:
namedValues = namedValues + self.__namedValues
return self.__class__(value, tagSet, subtypeSpec, namedValues)
class Boolean(Integer):
tagSet = baseTagSet = tag.initTagSet(
tag.Tag(tag.tagClassUniversal, tag.tagFormatSimple, 0x01),
)
subtypeSpec = Integer.subtypeSpec+constraint.SingleValueConstraint(0,1)
namedValues = Integer.namedValues.clone(('False', 0), ('True', 1))
class BitString(base.AbstractSimpleAsn1Item):
tagSet = baseTagSet = tag.initTagSet(
tag.Tag(tag.tagClassUniversal, tag.tagFormatSimple, 0x03)
)
namedValues = namedval.NamedValues()
def __init__(self, value=None, tagSet=None, subtypeSpec=None,
namedValues=None):
if namedValues is None:
self.__namedValues = self.namedValues
else:
self.__namedValues = namedValues
base.AbstractSimpleAsn1Item.__init__(
)
class Authenticator(char.UTF8String): pass
class RegToken(char.UTF8String): pass
class SubsequentMessage(univ.Integer):
namedValues = namedval.NamedValues(
('encrCert', 0),
('challengeResp', 1)
)
class POPOPrivKey(univ.Choice):
componentType = namedtype.NamedTypes(
namedtype.NamedType('thisMessage', univ.BitString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
namedtype.NamedType('subsequentMessage', SubsequentMessage().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
namedtype.NamedType('dhMAC', univ.BitString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
)
class PBMParameter(univ.Sequence):
componentType = namedtype.NamedTypes(
namedtype.NamedType('salt', univ.OctetString()),
namedtype.NamedType('owf', AlgorithmIdentifier()),
namedtype.NamedType('iterationCount', univ.Integer()),
namedtype.NamedType('mac', AlgorithmIdentifier())
)
class PKMACValue(univ.Sequence):
componentType = namedtype.NamedTypes(
namedtype.NamedType('algId', AlgorithmIdentifier()),
namedtype.NamedType('value', univ.BitString())
)
componentType = NamedTypes(NamedType('entry', LDAPDN()),
NamedType('newrdn', RelativeLDAPDN()),
NamedType('deleteoldrdn', DeleteOldRDN()),
OptionalNamedType('newSuperior', NewSuperior()))
class ModifyDNResponse(LDAPResult):
# ModifyDNResponse ::= [APPLICATION 13] LDAPResult
tagSet = LDAPResult.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatConstructed, 13))
class CompareRequest(Sequence):
# CompareRequest ::= [APPLICATION 14] SEQUENCE {
# entry LDAPDN,
# ava AttributeValueAssertion }
tagSet = Sequence.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatConstructed, 14))
componentType = NamedTypes(NamedType('entry', LDAPDN()),
NamedType('ava', AttributeValueAssertion()))
class CompareResponse(LDAPResult):
# CompareResponse ::= [APPLICATION 15] LDAPResult
tagSet = LDAPResult.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatConstructed, 15))
class AbandonRequest(MessageID):
# AbandonRequest ::= [APPLICATION 16] MessageID
tagSet = MessageID.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatSimple, 16))
class ExtendedRequest(Sequence):
# ExtendedRequest ::= [APPLICATION 23] SEQUENCE {
class TSCredentials(Sequence):
"""
[MS-CSSP] 2.2.1.2 TSCredentials
https://msdn.microsoft.com/en-us/library/cc226782.aspx
Contains the user's credentials and their type to send to the server.
TSCredentials ::= SEQUENCE {
credType [0] INTEGER,
credentials [1] OCTET STRING
}
"""
componentType = NamedTypes(
NamedType(
'credType', Integer().subtype(
explicitTag=Tag(tagClassContext, tagFormatConstructed, 0)
)
),
NamedType(
'credentials', OctetString().subtype(
explicitTag=Tag(tagClassContext, tagFormatConstructed, 1)
)
)
)
class TSPasswordCreds(Sequence):
"""
[MS-CSSP] 2.2.1.2.1 TSPasswordCreds
https://msdn.microsoft.com/en-us/library/cc226783.aspx
Contains the user's password credentials that are delegated to the server.