def __init__(self, data=None): Struct.__init__(self, data) if data is not None: pos = self['TargetNameBufferOffset'] self['TargetName'] = data[pos:pos + self['TargetNameLen']] pos = self['TargetInfoBufferOffset'] self['TargetInfo'] = data[pos:pos + self['TargetInfoLen']]
def __init__(self, data=None): Struct.__init__(self, data) if data is not None: pos = self['DomainNameBufferOffset'] self['DomainName'] = data[pos:pos + self['DomainNameLen']] pos = self['WorkstationBufferOffset'] self['WorkstationName'] = data[pos:pos + self['WorkstationLen']]
def __init__(self, data = None, apreq=''): Struct.__init__(self, data) if data is not None: raise RuntimeError, "Not implemented." else: oid = encoder.encode(univ.ObjectIdentifier(GSS_KRB5)) self['Krb5Oid'] = asn1_encode(0x60, oid) self['ApReq'] = apreq
def pack(self): pos = self.calcsize() self['LmChallengeResponseBufferOffset'] = pos self['LmChallengeResponseLen'] = len(self['LmChallengeResponse']) self['LmChallengeResponseMaxLen'] = self['LmChallengeResponseLen'] pos += self['LmChallengeResponseLen'] self['NtChallengeResponseBufferOffset'] = pos self['NtChallengeResponseLen'] = len(self['NtChallengeResponse']) self['NtChallengeResponseMaxLen'] = self['NtChallengeResponseLen'] pos += self['NtChallengeResponseLen'] self['DomainNameBufferOffset'] = pos self['DomainNameLen'] = len(self['DomainName']) self['DomainNameMaxLen'] = self['DomainNameLen'] pos += self['DomainNameLen'] self['UserNameBufferOffset'] = pos self['UserNameLen'] = len(self['UserName']) self['UserNameMaxLen'] = self['UserNameLen'] pos += self['UserNameLen'] self['WorkstationBufferOffset'] = pos self['WorkstationLen'] = len(self['Workstation']) self['WorkstationMaxLen'] = self['WorkstationLen'] pos += self['WorkstationLen'] self['EncryptedRandomSessionKeyBufferOffset'] = pos self['EncryptedRandomSessionKeyLen'] = len( self['EncryptedRandomSessionKey']) self['EncryptedRandomSessionKeyMaxLen'] = self[ 'EncryptedRandomSessionKeyLen'] data = Struct.pack(self) return data + self['LmChallengeResponse'] + self[ 'NtChallengeResponse'] + self['DomainName'] + self[ 'UserName'] + self['Workstation'] + self[ 'EncryptedRandomSessionKey']
def pack(self): data = self['Krb5Oid'] data += Struct.pack(self) data += self['ApReq'] # Mandatory temporary patch! # We need to find a way to do it automatically using pyasn1 d2 = data[0] + '\x82' + struct.pack('>H', len(data[2:])) + data[2:] return d2
def __init__(self, data=None): Struct.__init__(self, data) if data is not None: pos = self['LmChallengeResponseBufferOffset'] self['LmChallengeResponse'] = data[pos:pos + self['LmChallengeResponseLen']] pos = self['NtChallengeResponseBufferOffset'] self['NtChallengeResponse'] = data[pos:pos + self['NtChallengeResponseLen']] pos = self['DomainNameBufferOffset'] self['DomainName'] = data[pos:pos + self['DomainNameLen']] pos = self['UserNameBufferOffset'] self['UserName'] = data[pos:pos + self['UserNameLen']] pos = self['WorkstationBufferOffset'] self['Workstation'] = data[pos:pos + self['WorkstationLen']] pos = self['EncryptedRandomSessionKeyBufferOffset'] self['EncryptedRandomSessionKey'] = data[ pos:pos + self['EncryptedRandomSessionKeyLen']]
def pack(self): pos = self.calcsize() self['TargetNameBufferOffset'] = pos self['TargetNameLen'] = len(self['TargetName']) self['TargetNameMaxLen'] = self['TargetNameLen'] pos += self['TargetNameLen'] self['TargetInfoBufferOffset'] = pos self['TargetInfoLen'] = len(self['TargetInfo']) self['TargetInfoMaxLen'] = self['TargetInfoLen'] data = Struct.pack(self) return data + self['TargetName'] + self['TargetInfo']
def pack(self): pos = self.calcsize() self['DomainNameBufferOffset'] = pos self['DomainNameLen'] = len(self['DomainName']) self['DomainNameMaxLen'] = self['DomainNameLen'] pos += self['DomainNameLen'] self['WorkstationBufferOffset'] = pos self['WorkstationLen'] = len(self['WorkstationName']) self['WorkstationMaxLen'] = self['WorkstationLen'] data = Struct.pack(self) return data + self['DomainName'] + self['WorkstationName']