Merge pull request #877 from gpotter2/py3-contrib-1

Python 3: fix GTP
This commit is contained in:
Pierre Lalet 2017-10-24 16:18:46 +02:00 committed by GitHub
commit 125c5ef918
2 changed files with 35 additions and 33 deletions

View File

@ -20,6 +20,7 @@ from scapy.layers.inet import IP, UDP
from scapy.layers.inet6 import IP6Field from scapy.layers.inet6 import IP6Field
from scapy.error import warning from scapy.error import warning
from scapy.modules.six.moves import range from scapy.modules.six.moves import range
from scapy.compat import orb, plain_str
# GTP Data types # GTP Data types
@ -156,7 +157,7 @@ class TBCDByteField(StrFixedLenField):
def m2i(self, pkt, val): def m2i(self, pkt, val):
ret = [] ret = []
for v in val: for v in val:
byte = ord(v) byte = orb(v)
left = byte >> 4 left = byte >> 4
right = byte & 0xf right = byte & 0xf
if left == 0xf: if left == 0xf:
@ -231,11 +232,11 @@ class GTPHeader(Packet):
@classmethod @classmethod
def dispatch_hook(cls, _pkt=None, *args, **kargs): def dispatch_hook(cls, _pkt=None, *args, **kargs):
if _pkt and len(_pkt) >= 1: if _pkt and len(_pkt) >= 1:
if (struct.unpack("B", _pkt[0])[0] >> 5) & 0x7 == 2: if (orb(_pkt[0]) >> 5) & 0x7 == 2:
from . import gtp_v2 from . import gtp_v2
return gtp_v2.GTPHeader return gtp_v2.GTPHeader
if _pkt and len(_pkt) >= 8: if _pkt and len(_pkt) >= 8:
_gtp_type = struct.unpack("!B", _pkt[1:2])[0] _gtp_type = orb(_pkt[1:2])
return GTPforcedTypes.get(_gtp_type, GTPHeader) return GTPforcedTypes.get(_gtp_type, GTPHeader)
return cls return cls
@ -405,9 +406,9 @@ class APNStrLenField(StrLenField):
# Inspired by DNSStrField # Inspired by DNSStrField
def m2i(self, pkt, s): def m2i(self, pkt, s):
ret_s = "" ret_s = ""
tmp_s = s tmp_s = plain_str(s)
while tmp_s: while tmp_s:
tmp_len = struct.unpack("!B", tmp_s[0])[0] + 1 tmp_len = orb(tmp_s[0]) + 1
if tmp_len > len(tmp_s): if tmp_len > len(tmp_s):
warning("APN prematured end of character-string (size=%i, remaining bytes=%i)" % (tmp_len, len(tmp_s))) warning("APN prematured end of character-string (size=%i, remaining bytes=%i)" % (tmp_len, len(tmp_s)))
ret_s += tmp_s[1:tmp_len] ret_s += tmp_s[1:tmp_len]
@ -744,7 +745,7 @@ def IE_Dispatcher(s):
if len(s) < 1: if len(s) < 1:
return Raw(s) return Raw(s)
# Get the IE type # Get the IE type
ietype = ord(s[0]) ietype = orb(s[0])
cls = ietypecls.get(ietype, Raw) cls = ietypecls.get(ietype, Raw)
# if ietype greater than 128 are TLVs # if ietype greater than 128 are TLVs

View File

@ -13,7 +13,7 @@ assert a.E == a.S == a.PN == 0
= GTP_U_Header detection = GTP_U_Header detection
a = GTPHeader(str(GTP_U_Header()/GTPErrorIndication())) a = GTPHeader(raw(GTP_U_Header()/GTPErrorIndication()))
assert isinstance(a, GTP_U_Header) assert isinstance(a, GTP_U_Header)
= GTPCreatePDPContextRequest(), basic instanciation = GTPCreatePDPContextRequest(), basic instanciation
@ -22,22 +22,23 @@ gtp.dport == 2123 and gtp.teid == 2807 and len(gtp.IE_list) == 5
= GTPCreatePDPContextRequest(), basic dissection = GTPCreatePDPContextRequest(), basic dissection
random.seed(0x2807) random.seed(0x2807)
assert raw(gtp) == b"E\x00\x00K\x00\x01\x00\x00@\x11|\x9f\x7f\x00\x00\x01\x7f\x00\x00\x01\x08K\x08K\x007\x1c\xdb0\x10\x00'\x00\x00\n\xf7\x10A\xb77-\x14\x0f\x85\x00\x04\xd6!-b\x85\x00\x04\xbf\xf8\xc9Z\x87\x00\x0faWdWRWX0qEAXLPE" assert raw(gtp) in [b"E\x00\x00K\x00\x01\x00\x00@\x11|\x9f\x7f\x00\x00\x01\x7f\x00\x00\x01\x08K\x08K\x007\x1c\xdb0\x10\x00'\x00\x00\n\xf7\x10A\xb77-\x14\x0f\x85\x00\x04\xd6!-b\x85\x00\x04\xbf\xf8\xc9Z\x87\x00\x0faWdWRWX0qEAXLPE",
b"E\x00\x00K\x00\x01\x00\x00@\x11|\x9f\x7f\x00\x00\x01\x7f\x00\x00\x01\x08K\x08K\x007J\r0\x10\x00'\x00\x00\n\xf7\x10\xab\xec\x14Y\x14\n\x85\x00\x04\xbb((,\x85\x00\x04V*\xe0\xff\x87\x00\x0f0eQSJUqm06eIP1Q"]
= GTPV1UpdatePDPContextRequest(), dissect = GTPV1UpdatePDPContextRequest(), dissect
h = "3333333333332222222222228100a38408004588006800000000fd1134820a2a00010a2a00024aa5084b005408bb32120044ed99aea9386f0000100000530514058500040a2a00018500040a2a000187000c0213921f739680fe74f2ffff94000130970001019800080112f41004d204d29900024000b6000101" h = "3333333333332222222222228100a38408004588006800000000fd1134820a2a00010a2a00024aa5084b005408bb32120044ed99aea9386f0000100000530514058500040a2a00018500040a2a000187000c0213921f739680fe74f2ffff94000130970001019800080112f41004d204d29900024000b6000101"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
assert gtp.gtp_type == 18 assert gtp.gtp_type == 18
assert gtp.next_ex == 0 assert gtp.next_ex == 0
= GTPV1UpdatePDPContextResponse(), dissect = GTPV1UpdatePDPContextResponse(), dissect
h = "3333333333332222222222228100838408004588005400000000fd1182850a2a00010a2a0002084b084b00406b46321300305843da17f07300000180100000032c7f4a0f58108500040a2a00018500040a2a000187000f0213921f7396d1fe7482ffff004a00f7a71e0a" h = "3333333333332222222222228100838408004588005400000000fd1182850a2a00010a2a0002084b084b00406b46321300305843da17f07300000180100000032c7f4a0f58108500040a2a00018500040a2a000187000f0213921f7396d1fe7482ffff004a00f7a71e0a"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
gtp.gtp_type == 19 gtp.gtp_type == 19
= IE_Cause(), dissect = IE_Cause(), dissect
h = "3333333333332222222222228100838408004588005400000000fd1182850a2a00010a2a0002084b084b00406b4632130030f15422be19ed0000018010000046a97f4a0f58108500040a2a00018500040a2a000187000f0213921f7396d1fe7482ffff004a00f7a71e0a" h = "3333333333332222222222228100838408004588005400000000fd1182850a2a00010a2a0002084b084b00406b4632130030f15422be19ed0000018010000046a97f4a0f58108500040a2a00018500040a2a000187000f0213921f7396d1fe7482ffff004a00f7a71e0a"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[0] ie = gtp.IE_list[0]
ie.ietype == 1 and ie.CauseValue == 128 ie.ietype == 1 and ie.CauseValue == 128
@ -47,7 +48,7 @@ ie.ietype == 1 and ie.CauseValue == 194
= IE_IMSI(), dissect = IE_IMSI(), dissect
h = "333333333333222222222222810083840800458800ba00000000fc1185060a2a00010a2a00024ace084b00a68204321000960eeec43e99ae00000202081132547600000332f42004d27b0ffc102c0787b611b2f9023914051a0400800002f1218300070661616161616184001480802110010100108106000000008306000000008500040a2a00018500040a2a00018600079111111111111187000d0213621f7396737374f2ffff0094000120970001029800080032f42004d204d299000240009a00081111111111110000d111193b" h = "333333333333222222222222810083840800458800ba00000000fc1185060a2a00010a2a00024ace084b00a68204321000960eeec43e99ae00000202081132547600000332f42004d27b0ffc102c0787b611b2f9023914051a0400800002f1218300070661616161616184001480802110010100108106000000008306000000008500040a2a00018500040a2a00018600079111111111111187000d0213621f7396737374f2ffff0094000120970001029800080032f42004d204d299000240009a00081111111111110000d111193b"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[0] ie = gtp.IE_list[0]
ie.ietype == 2 and ie.imsi == '2080112345670000' ie.ietype == 2 and ie.imsi == '2080112345670000'
@ -57,7 +58,7 @@ ie.ietype == 2 and ie.imsi == '208103397660354'
= IE_Routing(), dissect = IE_Routing(), dissect
h = "33333333333322222222222281008384080045880072647100003e11dcf60a2a00010a2a0002084b084b005e78d93212004ef51a4ac3a291ff000332f42004d27b10eb3981b414058500040a2a00018500040a2a000187000f0213921f7396d1fe7482ffff004a0094000110970001019800080132f42004d204d299000240fcb60001015bf2090f" h = "33333333333322222222222281008384080045880072647100003e11dcf60a2a00010a2a0002084b084b005e78d93212004ef51a4ac3a291ff000332f42004d27b10eb3981b414058500040a2a00018500040a2a000187000f0213921f7396d1fe7482ffff004a0094000110970001019800080132f42004d204d299000240fcb60001015bf2090f"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[0] ie = gtp.IE_list[0]
ie.ietype == 3 and ie.MCC == '234' and ie.MNC == '02' and ie.LAC == 1234 and ie.RAC == 123 ie.ietype == 3 and ie.MCC == '234' and ie.MNC == '02' and ie.LAC == 1234 and ie.RAC == 123
@ -67,7 +68,7 @@ ie.ietype == 3 and ie.MCC == '234' and ie.MNC == '02' and ie.LAC == 1234 and ie.
= IE_Recovery(), dissect = IE_Recovery(), dissect
h = "3333333333332222222222228100038408004500002ac6e60000fd11ccbc0a2a00010a2a0002084b084b001659db32020006c192a26c8cb400000e0e00000000f4b40b31" h = "3333333333332222222222228100038408004500002ac6e60000fd11ccbc0a2a00010a2a0002084b084b001659db32020006c192a26c8cb400000e0e00000000f4b40b31"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[0] ie = gtp.IE_list[0]
ie.ietype == 14 and ie.restart_counter == 14 ie.ietype == 14 and ie.restart_counter == 14
@ -77,7 +78,7 @@ ie.ietype == 14 and ie.restart_counter == 14
= IE_SelectionMode(), dissect = IE_SelectionMode(), dissect
h = "333333333333222222222222810083840800458800c500000000fc1184df0a2a00010a2a00024a55084b00b1f62a321000a11c025b77dccc00000202081132547600000332f42004d27b0ffc1055080923117c347b6a14051a0a00800002f1218300070661616161616184001d8080211001000010810600000000830600000000000d00000a000005008500040a2a00018500040a2a00018600079111111111111187000f0213921f7396d3fe74f2ffff00640094000120970001019800080132f42004d204d299000240009a00081111111111110000eea69220" h = "333333333333222222222222810083840800458800c500000000fc1184df0a2a00010a2a00024a55084b00b1f62a321000a11c025b77dccc00000202081132547600000332f42004d27b0ffc1055080923117c347b6a14051a0a00800002f1218300070661616161616184001d8080211001000010810600000000830600000000000d00000a000005008500040a2a00018500040a2a00018600079111111111111187000f0213921f7396d3fe74f2ffff00640094000120970001019800080132f42004d204d299000240009a00081111111111110000eea69220"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[2] ie = gtp.IE_list[2]
ie.ietype == 15 and ie.SelectionMode == 252 ie.ietype == 15 and ie.SelectionMode == 252
@ -87,7 +88,7 @@ ie.ietype == 15 and ie.SelectionMode == 252
= IE_TEIDI(), dissect = IE_TEIDI(), dissect
h = "3333333333332222222222228100838408004588005400000000fd1182850a2a00010a2a0002084b084b00406b46321300303f0ff4fb966f00000180109a0f08ef7f3af826978500040a2a00018500040a2a000187000f0213921f7396d1fe7482ffff004a00f7a71e0a" h = "3333333333332222222222228100838408004588005400000000fd1182850a2a00010a2a0002084b084b00406b46321300303f0ff4fb966f00000180109a0f08ef7f3af826978500040a2a00018500040a2a000187000f0213921f7396d1fe7482ffff004a00f7a71e0a"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[1] ie = gtp.IE_list[1]
ie.ietype == 16 and ie.TEIDI == 0x9a0f08ef ie.ietype == 16 and ie.TEIDI == 0x9a0f08ef
@ -97,7 +98,7 @@ ie.ietype == 16 and ie.TEIDI == 0x9a0f08ef
= IE_TEICP(), dissect = IE_TEICP(), dissect
h = "333333333333222222222222810083840800458800c500000000fc1184df0a2a00010a2a00024a55084b00b1f62a321000a1b75eb617464800000202081132547600000332f42004d27b0ffc10db5c765711ba5d87ba14051a0a00800002f1218300070661616161616184001d8080211001000010810600000000830600000000000d00000a000005008500040a2a00018500040a2a00018600079111111111111187000f0213921f7396d3fe74f2ffff00640094000120970001019800080132f42004d204d299000240009a00081111111111110000eea69220" h = "333333333333222222222222810083840800458800c500000000fc1184df0a2a00010a2a00024a55084b00b1f62a321000a1b75eb617464800000202081132547600000332f42004d27b0ffc10db5c765711ba5d87ba14051a0a00800002f1218300070661616161616184001d8080211001000010810600000000830600000000000d00000a000005008500040a2a00018500040a2a00018600079111111111111187000f0213921f7396d3fe74f2ffff00640094000120970001019800080132f42004d204d299000240009a00081111111111110000eea69220"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[4] ie = gtp.IE_list[4]
ie.ietype == 17 and ie.TEICI == 0xba5d87ba ie.ietype == 17 and ie.TEICI == 0xba5d87ba
@ -107,7 +108,7 @@ ie.ietype == 17 and ie.TEICI == 0xba5d87ba
= IE_Teardown(), dissect = IE_Teardown(), dissect
h = "3333333333332222222222228100838408004588002c00000000fd1184640a2a00010a2a00023d66084b00184c2232140008ba66ce5b6efe000013ff14050000c309006c" h = "3333333333332222222222228100838408004588002c00000000fd1184640a2a00010a2a00023d66084b00184c2232140008ba66ce5b6efe000013ff14050000c309006c"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[0] ie = gtp.IE_list[0]
ie.ietype == 19 and ie.indicator == 255 ie.ietype == 19 and ie.indicator == 255
@ -117,7 +118,7 @@ ie.ietype == 19 and ie.indicator == 255
= IE_NSAPI(), dissect = IE_NSAPI(), dissect
h = "3333333333332222222222228100838408004588002c00000000fd1184640a2a00010a2a00023d66084b00184c2232140008dafc273ee7ab000013ff14050000c309006c" h = "3333333333332222222222228100838408004588002c00000000fd1184640a2a00010a2a00023d66084b00184c2232140008dafc273ee7ab000013ff14050000c309006c"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[1] ie = gtp.IE_list[1]
ie.ietype == 20 and ie.NSAPI == 5 ie.ietype == 20 and ie.NSAPI == 5
@ -127,7 +128,7 @@ ie.ietype == 20 and ie.NSAPI == 5
= IE_ChargingCharacteristics(), dissect = IE_ChargingCharacteristics(), dissect
h = "333333333333222222222222810083840800458800bc00000000fc1184c90a2a00010a2a00024acf084b00a87bbb32100098a3e2565004a400000202081132547600000332f42004d27b0ffc10b87f17ad11c53c5e1b14051a0400800002f1218300070661616161616184001480802110010000108106000000008306000000008500040a2a00018500040a2a00018600079111111111111187000f0213921f7396d3fe74f2ffff004a0094000120970001019800080132f42004d204d299000240009a00081111111111110000951c5bbe" h = "333333333333222222222222810083840800458800bc00000000fc1184c90a2a00010a2a00024acf084b00a87bbb32100098a3e2565004a400000202081132547600000332f42004d27b0ffc10b87f17ad11c53c5e1b14051a0400800002f1218300070661616161616184001480802110010000108106000000008306000000008500040a2a00018500040a2a00018600079111111111111187000f0213921f7396d3fe74f2ffff004a0094000120970001019800080132f42004d204d299000240009a00081111111111110000951c5bbe"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[6] ie = gtp.IE_list[6]
ie.ietype == 26 and ie.normal_charging == 0 and ie.prepaid_charging == 1 and ie.flat_rate_charging == 0 ie.ietype == 26 and ie.normal_charging == 0 and ie.prepaid_charging == 1 and ie.flat_rate_charging == 0
@ -146,7 +147,7 @@ ie.ietype == 28 and ie.Trace_type == 0x1212
= IE_ChargingId(), dissect = IE_ChargingId(), dissect
h = "3333333333332222222222228100838408004588005400000000fd1182850a2a00010a2a0002084b084b00406b4632130030e77ffb7e30410000018010ed654ff37fff1bc3f28500040a2a00018500040a2a000187000f0213921f7396d1fe7482ffff004a00f7a71e0a" h = "3333333333332222222222228100838408004588005400000000fd1182850a2a00010a2a0002084b084b00406b4632130030e77ffb7e30410000018010ed654ff37fff1bc3f28500040a2a00018500040a2a000187000f0213921f7396d1fe7482ffff004a00f7a71e0a"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[2] ie = gtp.IE_list[2]
ie.ietype == 127 and ie.Charging_id == 0xff1bc3f2 ie.ietype == 127 and ie.Charging_id == 0xff1bc3f2
@ -156,7 +157,7 @@ ie.ietype == 127 and ie.Charging_id == 0xff1bc3f2
= IE_EndUserAddress(), dissect = IE_EndUserAddress(), dissect
h = "3333333333332222222222228100838408004588008500000000fd11840b0a2a00010a2a0002084b4a6c00717c8a32110061c1b9728f356a0000018008fe10af709e9011e3cb6a4b7fb60e1b28800006f1210a2a00038400218080210a0301000a03060ab0aa93802110030100108106ac14020a8306ac1402278500040a2a00018500040a2a000187000c0213621f7396486874f2ffff44ded108" h = "3333333333332222222222228100838408004588008500000000fd11840b0a2a00010a2a0002084b4a6c00717c8a32110061c1b9728f356a0000018008fe10af709e9011e3cb6a4b7fb60e1b28800006f1210a2a00038400218080210a0301000a03060ab0aa93802110030100108106ac14020a8306ac1402278500040a2a00018500040a2a000187000c0213621f7396486874f2ffff44ded108"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[5] ie = gtp.IE_list[5]
ie.ietype == 128 and ie.length == 6 and ie.PDPTypeOrganization == 1 and ie.PDPTypeNumber == 0x21 and ie.PDPAddress == '10.42.0.3' ie.ietype == 128 and ie.length == 6 and ie.PDPTypeOrganization == 1 and ie.PDPTypeNumber == 0x21 and ie.PDPAddress == '10.42.0.3'
@ -167,7 +168,7 @@ ie.ietype == 128 and ie.length == 6 and ie.PDPTypeOrganization == 1 and ie.PDPTy
= IE_AccessPointName(), dissect = IE_AccessPointName(), dissect
h = "333333333333222222222222810083840800458800bc00000000fc1184c90a2a00010a2a00024acf084b00a87bbb3210009867fe972185e800000202081132547600000332f42004d27b0ffc1093b20c3f11940eb2bf14051a0400800002f1218300070661616161616184001480802110010000108106000000008306000000008500040a2a00018500040a2a00018600079111111111111187000f0213921f7396d3fe74f2ffff004a0094000120970001019800080132f42004d204d299000240009a000811111111111100001b1212951c5bbe" h = "333333333333222222222222810083840800458800bc00000000fc1184c90a2a00010a2a00024acf084b00a87bbb3210009867fe972185e800000202081132547600000332f42004d27b0ffc1093b20c3f11940eb2bf14051a0400800002f1218300070661616161616184001480802110010000108106000000008306000000008500040a2a00018500040a2a00018600079111111111111187000f0213921f7396d3fe74f2ffff004a0094000120970001019800080132f42004d204d299000240009a000811111111111100001b1212951c5bbe"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[8] ie = gtp.IE_list[8]
ie.ietype == 131 and ie.APN == 'aaaaaa' ie.ietype == 131 and ie.APN == 'aaaaaa'
@ -177,7 +178,7 @@ ie.ietype == 131 and ie.APN == 'aaaaaa'
= IE_ProtocolConfigurationOptions(), dissect = IE_ProtocolConfigurationOptions(), dissect
h = "333333333333222222222222810083840800458800c300000000fc1184e50a2a00010a2a00024a4d084b00af41993210009fdef90e15440900000202081132547600000332f42004d27b0ffc10c29998b81145c6c9ee14051a0a00800002f1218300070661616161616184001d80c02306010100060000802110010100108106000000008306000000008500040a2a00018500040a2a00018600079111111111111187000d0213621f73967373741affff0094000120970001029800080032f42004d204d299000240009a0008111111111111000081182fb2" h = "333333333333222222222222810083840800458800c300000000fc1184e50a2a00010a2a00024a4d084b00af41993210009fdef90e15440900000202081132547600000332f42004d27b0ffc10c29998b81145c6c9ee14051a0a00800002f1218300070661616161616184001d80c02306010100060000802110010100108106000000008306000000008500040a2a00018500040a2a00018600079111111111111187000d0213621f73967373741affff0094000120970001029800080032f42004d204d299000240009a0008111111111111000081182fb2"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[9] ie = gtp.IE_list[9]
ie.ietype == 132 and ie.Protocol_Configuration == b'\x80\xc0#\x06\x01\x01\x00\x06\x00\x00\x80!\x10\x01\x01\x00\x10\x81\x06\x00\x00\x00\x00\x83\x06\x00\x00\x00\x00' ie.ietype == 132 and ie.Protocol_Configuration == b'\x80\xc0#\x06\x01\x01\x00\x06\x00\x00\x80!\x10\x01\x01\x00\x10\x81\x06\x00\x00\x00\x00\x83\x06\x00\x00\x00\x00'
@ -188,7 +189,7 @@ ie.ietype == 132 and ie.Protocol_Configuration == b'\x80\xc0#\x06\x01\x01\x00\x0
= IE_GSNAddress(), dissect = IE_GSNAddress(), dissect
h = "3333333333332222222222228100838408004588005400000000fd1182850a2a00010a2a0002084b084b00406b463213003031146413c18000000180109181ba027fcf701a8c8500040a2a00018500040a2a000187000f0213921f7396d1fe7482ffff004a00f7a71e0a" h = "3333333333332222222222228100838408004588005400000000fd1182850a2a00010a2a0002084b084b00406b463213003031146413c18000000180109181ba027fcf701a8c8500040a2a00018500040a2a000187000f0213921f7396d1fe7482ffff004a00f7a71e0a"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[3] ie = gtp.IE_list[3]
ie.ietype == 133 and ie.address == '10.42.0.1' ie.ietype == 133 and ie.address == '10.42.0.1'
@ -198,7 +199,7 @@ ie.ietype == 133 and ie.address == '10.42.0.1'
= IE_MSInternationalNumber(), dissect = IE_MSInternationalNumber(), dissect
h = "333333333333222222222222810083840800458800c300000000fc1184e50a2a00010a2a00024a4d084b00af41993210009f79504a3e048e00000202081132547600000332f42004d27b0ffc10a692773d1158da9e2214051a0a00800002f1218300070661616161616184001d80c02306010100060000802110010100108106000000008306000000008500040a2a00018500040a2a00018600079111111111111187000d0213621f73967373741affff0094000120970001029800080032f42004d204d299000240009a0008111111111111000081182fb2" h = "333333333333222222222222810083840800458800c300000000fc1184e50a2a00010a2a00024a4d084b00af41993210009f79504a3e048e00000202081132547600000332f42004d27b0ffc10a692773d1158da9e2214051a0a00800002f1218300070661616161616184001d80c02306010100060000802110010100108106000000008306000000008500040a2a00018500040a2a00018600079111111111111187000d0213621f73967373741affff0094000120970001029800080032f42004d204d299000240009a0008111111111111000081182fb2"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[12] ie = gtp.IE_list[12]
ie.ietype == 134 and ie.flags == 145 and ie.digits == '111111111111' ie.ietype == 134 and ie.flags == 145 and ie.digits == '111111111111'
@ -208,7 +209,7 @@ ie.ietype == 134 and ie.flags == 145 and ie.digits == '111111111111'
= IE_QoS(), dissect = IE_QoS(), dissect
h = "3333333333332222222222228100838408004588005400000000fd1182850a2a00010a2a0002084b084b00406b4632130030afe9d3a3317e0000018010bd82f3997f9febcaf58500040a2a00018500040a2a000187000f0213921f7396d1fe7482ffff004a00f7a71e0a" h = "3333333333332222222222228100838408004588005400000000fd1182850a2a00010a2a0002084b084b00406b4632130030afe9d3a3317e0000018010bd82f3997f9febcaf58500040a2a00018500040a2a000187000f0213921f7396d1fe7482ffff004a00f7a71e0a"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[5] ie = gtp.IE_list[5]
ie.ietype == 135 and ie.allocation_retention_prioiry == 2 and ie.delay_class == 2 and ie.traffic_class == 3 ie.ietype == 135 and ie.allocation_retention_prioiry == 2 and ie.delay_class == 2 and ie.traffic_class == 3
@ -219,7 +220,7 @@ ie.ietype == 135 and ie.allocation_retention_prioiry == 2 and ie.delay_class ==
= IE_CommonFlags(), dissect = IE_CommonFlags(), dissect
h = "3333333333332222222222228100a38408004588006800000000fd1134820a2a00010a2a00024aa5084b005408bb32120044623f97e3ac610000104d82c69214058500040a2a00018500040a2a000187000c0213921f739680fe74f2ffff94000130970001019800080132f42004d204d29900024000b6000101" h = "3333333333332222222222228100a38408004588006800000000fd1134820a2a00010a2a00024aa5084b005408bb32120044623f97e3ac610000104d82c69214058500040a2a00018500040a2a000187000c0213921f739680fe74f2ffff94000130970001019800080132f42004d204d29900024000b6000101"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[5] ie = gtp.IE_list[5]
ie.ietype == 148 and ie.nrsn == 1 and ie.no_qos_nego == 1 and ie.prohibit_payload_compression == 0 ie.ietype == 148 and ie.nrsn == 1 and ie.no_qos_nego == 1 and ie.prohibit_payload_compression == 0
@ -233,7 +234,7 @@ ie.ietype == 149 and ie.restriction_type_value == 12
= IE_RATType(), dissect = IE_RATType(), dissect
h = "3333333333332222222222228100a38408004588006800000000fd1134820a2a00010a2a00024aa5084b005408bb321200442f686a89d33c000010530ec20a14058500040a2a00018500040a2a000187000c0213921f739680fe74f2ffff94000130970001019800080132f42004d204d29900024000b6000101" h = "3333333333332222222222228100a38408004588006800000000fd1134820a2a00010a2a00024aa5084b005408bb321200442f686a89d33c000010530ec20a14058500040a2a00018500040a2a000187000c0213921f739680fe74f2ffff94000130970001019800080132f42004d204d29900024000b6000101"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[6] ie = gtp.IE_list[6]
ie.ietype == 151 and ie.RAT_Type == 1 ie.ietype == 151 and ie.RAT_Type == 1
@ -243,7 +244,7 @@ ie.ietype == 151 and ie.RAT_Type == 1
= IE_UserLocationInformation(), dissect = IE_UserLocationInformation(), dissect
h = "3333333333332222222222228100a38408004588006800000000fd1134820a2a00010a2a00024aa5084b005408bb32120044981eb5dcb29400001016e85d9f14058500040a2a00018500040a2a000187000c0213921f739680fe74f2ffff94000130970001019800080132f42004d204d29900024000b6000101" h = "3333333333332222222222228100a38408004588006800000000fd1134820a2a00010a2a00024aa5084b005408bb32120044981eb5dcb29400001016e85d9f14058500040a2a00018500040a2a000187000c0213921f739680fe74f2ffff94000130970001019800080132f42004d204d29900024000b6000101"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[7] ie = gtp.IE_list[7]
ie.MCC == '234' and ie.MNC == '02' and ie.LAC == 1234 and ie.SAC == 1234 ie.MCC == '234' and ie.MNC == '02' and ie.LAC == 1234 and ie.SAC == 1234
@ -253,7 +254,7 @@ ie.ietype == 152 and ie.MCC == '234' and ie.MNC == '02' and ie.LAC == 1234 and i
= IE_MSTimeZone(), dissect = IE_MSTimeZone(), dissect
h = "3333333333332222222222228100a38408004588006800000000fd1134820a2a00010a2a00024aa5084b005408bb32120044f24a4d5825290000102ca9c8c314058500040a2a00018500040a2a000187000c0213921f739680fe74f2ffff94000130970001019800080132f42004d204d29900024000b6000101" h = "3333333333332222222222228100a38408004588006800000000fd1134820a2a00010a2a00024aa5084b005408bb32120044f24a4d5825290000102ca9c8c314058500040a2a00018500040a2a000187000c0213921f739680fe74f2ffff94000130970001019800080132f42004d204d29900024000b6000101"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[8] ie = gtp.IE_list[8]
ie.ietype == 153 and ie.timezone == 64 and ie.daylight_saving_time == 0 ie.ietype == 153 and ie.timezone == 64 and ie.daylight_saving_time == 0
@ -263,7 +264,7 @@ ie.ietype == 153 and ie.timezone == 64 and ie.daylight_saving_time == 0
= IE_IMEI(), dissect = IE_IMEI(), dissect
h = "333333333333222222222222810083840800458800c300000000fc1184e50a2a00010a2a00024a4d084b00af41993210009f2f3ae0eb7b9c00000202081132547600000332f42004d27b0ffc10424a10c8117ca21aba14051a0a00800002f1218300070661616161616184001d80c02306010100060000802110010100108106000000008306000000008500040a2a00018500040a2a00018600079111111111111187000d0213621f73967373741affff0094000120970001029800080032f42004d204d299000240009a0008111111111111000081182fb2" h = "333333333333222222222222810083840800458800c300000000fc1184e50a2a00010a2a00024a4d084b00af41993210009f2f3ae0eb7b9c00000202081132547600000332f42004d27b0ffc10424a10c8117ca21aba14051a0a00800002f1218300070661616161616184001d80c02306010100060000802110010100108106000000008306000000008500040a2a00018500040a2a00018600079111111111111187000d0213621f73967373741affff0094000120970001029800080032f42004d204d299000240009a0008111111111111000081182fb2"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[18] and ie.ietype == 154 and ie.IMEI == '0132750094080322' ie = gtp.IE_list[18] and ie.ietype == 154 and ie.IMEI == '0132750094080322'
= IE_IMEI(), basic instantiation = IE_IMEI(), basic instantiation
@ -276,7 +277,7 @@ ie.ietype == 181 and ie.Action == 12
= IE_DirectTunnelFlags(), dissect = IE_DirectTunnelFlags(), dissect
h = "3333333333332222222222228100a38408004588006800000000fd1134820a2a00010a2a00024aa5084b005408bb32120044d2a7dffabfb70000108caa6b0b14058500040a2a00018500040a2a000187000c0213921f739680fe74f2ffff94000130970001019800080132f42004d204d29900024000b6000101" h = "3333333333332222222222228100a38408004588006800000000fd1134820a2a00010a2a00024aa5084b005408bb32120044d2a7dffabfb70000108caa6b0b14058500040a2a00018500040a2a000187000c0213921f739680fe74f2ffff94000130970001019800080132f42004d204d29900024000b6000101"
gtp = Ether(h.decode('hex')) gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[9] ie = gtp.IE_list[9]
ie.ietype == 182 and ie.EI == 0 and ie.GCSI == 0 and ie.DTI == 1 ie.ietype == 182 and ie.EI == 0 and ie.GCSI == 0 and ie.DTI == 1