Changes
Page history
update the TCAP-MAP module used in the example
authored
Nov 14, 2019
by
mich
Show whitespace changes
Inline
Side-by-side
Using-the-pycrate-asn1-runtime.md
View page @
d3ce0a6f
...
...
@@ -1184,29 +1184,41 @@ This is exactly what is accomplished with the custom object *TCAP-MAP-Messages.T
It can be used to encode and decode any TCAP-MAP messages.
Here is what happens when decoding the TCAP MAP message containing an USSD request,
as proposed
o
n the
[
Wireshark wiki
](
https://wiki.wireshark.org/SampleCaptures
)
, and
as proposed
i
n the
[
Wireshark wiki
](
https://wiki.wireshark.org/SampleCaptures
)
, and
re-encoding it with a null USSD string:
>>> from pycrate_asn1dir import TCAP_MAP
>>> M = TCAP_MAP.TCAP_MAP_Messages.TCAP_MAP_Message
>>> from pycrate_asn1dir import TCAP_MAP
v2v3
>>> M = TCAP_MAP
v2v3
.TCAP_MAP_Messages.TCAP_MAP_Message
>>> M
<TCAP-MAP-Message ([TCMessage] CHOICE)>
>>> M.get_proto()
{
unidirectional: {
dialoguePortion: {
('CHOICE', {
unidirectional: ('SEQUENCE', {
dialoguePortion: ('SEQUENCE', {
direct-reference: 'OBJECT IDENTIFIER',
indirect-reference: 'INTEGER',
data-value-descriptor: 'ObjectDescriptor',
encoding: ('CHOICE', {
single-ASN1-type: ('OPEN_TYPE', {
DialoguePDU: ('CHOICE', {
dialogueRequest: ('SEQUENCE', {
protocol-version: 'BIT STRING',
application-context-name: 'OBJECT IDENTIFIER',
user-information: ('SEQUENCE OF', ('SEQUENCE', {
direct-reference: 'OBJECT IDENTIFIER',
indirect-reference: 'INTEGER',
data-value-descriptor: 'ObjectDescriptor',
encoding: 'CHOICE'
}))
}),
[...]
single-ASN1-type: 'OPEN_TYPE',
octet-aligned: 'OCTET STRING',
arbitrary: 'BIT STRING'
}
}
}
}
}
})
})
})
})
})
>>> from binascii import hexlify, unhexlify
>>> M.from_ber(unhexlify('626a48042f3b46026b3a2838060700118605010101a02d602b80020780a109060704000001001302be1a2818060704000001010101a00da00b80099656051124006913f66c26a12402010102013b301c04010f040eaa180da682dd6c31192d36bbdd468007917267415827f2'))
>>> print(M.to_asn1())
...
...
...
...