如何 运行 pycrate corenet

How to run pycrate corenet

我想要 运行 https://github.com/P1sec/pycrate 的核心模拟器。 我只想运行 SERVER_ENB,所以像下面这样配置并创建一个服务器。

from pycrate_corenet import Server

Server.CorenetServer.SERVER_HNB = {}
Server.CorenetServer.SERVER_ENB['IP'] = '127.0.0.1'
Server.CorenetServer.SERVER_ENB['GTPU'] = '127.0.0.1'

epc = Server.CorenetServer()

但是,我遇到了以下错误。

$ sudo /usr/local/anaconda3/bin/python EPC.py 
CorenetServer: loading all ASN.1 and NAS modules, be patient...
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/local/anaconda3/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/local/anaconda3/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/anaconda3/lib/python3.6/site-packages/pycrate-0.3-py3.6.egg/pycrate_corenet/Server.py", line 345, in start
    self.GTPUd = self.__class__.GTPUd()
  File "/usr/local/anaconda3/lib/python3.6/site-packages/pycrate-0.3-py3.6.egg/pycrate_corenet/ServerGTPU.py", line 466, in __init__
    sk.bind((gtpip, self.GTP_PORT))
OSError: [Errno 99] Cannot assign requested address

我如何运行服务器? 你能给出这个pycrate corenet的用法吗?

此端口可能被其他东西占用(包括此服务器上的其他实例)。 如果您在 Linux - 您可以使用 netstat -anp | grep 36412 检查它是否已经在收听。然后,如果那里列出了某些内容,您必须终止应用程序或更改 SERVER_ENB 结构中的服务器端口

我找到了解决方案。

from pycrate.pycrate_corenet import Server, ServerGTPU

Server.CorenetServer.SERVER_HNB = {}
Server.CorenetServer.SERVER_ENB['IP'] = '127.0.0.1'
Server.CorenetServer.SERVER_ENB['GTPU'] = '127.0.0.1'

ServerGTPU.GTPUd.GTP_IF = ['127.0.0.1']  # set GTP IP

epc = Server.CorenetServer()