MCPcopy
hub / github.com/fortra/impacket / fromString

Method fromString

impacket/spnego.py:118–141  ·  view source on GitHub ↗
(self, data = None)

Source from the content-addressed store, hash-verified

116 return len(self.getData())
117
118 def fromString(self, data = None):
119 # Manual parse of the GSSAPI Header Format
120 # It should be something like
121 # AID = 0x60 TAG, BER Length
122 # OID = 0x06 TAG
123 # GSSAPI OID
124 # UUID data (BER Encoded)
125 # Payload
126 next_byte = unpack('B',data[:1])[0]
127 if next_byte != ASN1_AID:
128 raise Exception('Unknown AID=%x' % next_byte)
129 data = data[1:]
130 decode_data, total_bytes = asn1decode(data)
131 # Now we should have a OID tag
132 next_byte = unpack('B',decode_data[:1])[0]
133 if next_byte != ASN1_OID:
134 raise Exception('OID tag not found %x' % next_byte)
135 decode_data = decode_data[1:]
136 # Now the OID contents, should be SPNEGO UUID
137 uuid, total_bytes = asn1decode(decode_data)
138 self['OID'] = uuid
139 # the rest should be the data
140 self['Payload'] = decode_data[total_bytes:]
141 #pass
142
143 def dump(self):
144 for i in list(self.fields.keys()):

Callers 15

__init__Method · 0.95
listPathMethod · 0.45
fromStringMethod · 0.45
smbTransactionMethod · 0.45
smbComWriteAndXMethod · 0.45
smbComTreeConnectAndXMethod · 0.45
__processDataBlocksMethod · 0.45
test_1Method · 0.45
test_2Method · 0.45
test_3Method · 0.45
test_4Method · 0.45

Calls 1

asn1decodeFunction · 0.85

Tested by 15

test_1Method · 0.36
test_2Method · 0.36
test_3Method · 0.36
test_4Method · 0.36
test_5Method · 0.36
test_6Method · 0.36
test_8Method · 0.36
test_88Method · 0.36
test_9Method · 0.36
test_11Method · 0.36
test_13Method · 0.36
test_15Method · 0.36