Closed sohel1119 closed 2 years ago
There was a bug with decoding the Cause
IE, fixed in https://github.com/P1sec/pycrate/commit/0630cc425d5fbd579678aecb13e89f22ecb9f294. A fresh checkout should solve your issue.
Moreover I just completed and published a Wiki page on GTPv2-C: https://github.com/P1sec/pycrate/wiki/Working-with-GTPC. That may be of help.
Python version 3.8.10 PyCrate version 0.5.3
#Client.py\ import socket import binascii from pycrate_mobile.TS29274_GTPC import * m=binascii.unhexlify('48210088000000060000060002000200100057001901c7000000067f000004000000000000000000000000000000014f000500010a2d00027f000100004e0027008080211002000010810608080808830608080404000d0408080808000d040808040400100205785d00200049000100055700090285000000027f0000070200020010005e00040000000006') bytesToSend = m serverAddressPort = ("127.0.0.1", 2123) bufferSize = 1024 UDPClientSocket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM) UDPClientSocket.sendto(bytesToSend, serverAddressPort)
#server.py\ from ast import While from operator import gt import socket from configparser import ConfigParser from pycrate_mobile.TS29274_GTPC import * localIP = "127.0.0.1" localPort = 2123 bufferSize = 1024 msgFromServer = "Hello UDP Client" bytesToSend = str.encode(msgFromServer)
UDPServerSocket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM) UDPServerSocket.bind((localIP, localPort)) while(True): bytesAddressPair = UDPServerSocket.recvfrom(bufferSize) message = bytesAddressPair[0] address = bytesAddressPair[1] UDPServerSocket.sendto(message, address)
#error\ python/messages/server.py CreateSessionResponse Traceback (most recent call last): File "/home/python-developer/python/messages/server.py", line 54, in
m.from_bytes(message)
File "/home/python-developer/.local/lib/python3.8/site-packages/pycrate_core/elt.py", line 616, in from_bytes
self._from_char(char)
File "/home/python-developer/.local/lib/python3.8/site-packages/pycrate_mobile/TS29274_GTPC.py", line 4033, in _from_char
self[1]._from_char(char)
File "/home/python-developer/.local/lib/python3.8/site-packages/pycrate_mobile/TS29274_GTPC.py", line 3961, in _from_char
raise(PycrateErr('{0}: missing mandatory IE(s), {1}'\
pycrate_core.utils_py3.PycrateErr: CreateSessionResponseIEs: missing mandatory IE(s), BearerContextcreated, Cause