Extract Packet Lists

提供数据包列表名称、ID、端点以及 .pcap 和 .ved 文件唯一 ID 的 JSON 内容。

PUT

[基本地址]/shunra/api/analysis/packetlistmetadata

例如: http://localhost:8182/shunra/api/analysis/packetlistmetadata

正文

JSON 定义已分析的仿真结果 (.ved 或 .pcap 文件) ID。它是 NV Analytics 的文件系统路径:

{
"id":"C:\\tmp\\Sample.ved"
 }

响应包括已分析运行结果的 ID 和数据包列表元数据 (名称、ID、端点):

{
	"packetLists":[{
		"endpoints":[{
			"name":"Tokyo Office",
			"id":"6d0652db88c349de9382a54dc350349f"
		}],
		"name":"Packet List 3",
		"id":"c6064d9bf25d405382e374795fef35fe"
	},
	{
		"endpoints":[{
			"name":"London Office",
			"id":"de358779547c4eea8caeef62bfbbb493"
		}],
		"name":"Packet List 2",
		"id":"59220e1cb4d248eba3b89a695918be91"
	},
	{
		"endpoints":[{
			"name":"NY Office",
			"id":"8c95498f7bb04c7598dde1d5e609082a"
		}],
		"name":"Packet List 1",
		"id":"620984c9a31b4ef694a1ac47d61b6a7e"
	}],
	"runResultId":"b80de7f5ffa97428b2324c8b3a9d469b"
}

返回

  • 200“正常”
  • 404“找不到”
  • 500“内部服务器错误”

代码示例

def get_packetlists(inputfilepath):
"""
	Returns a dictionary of the available packet lists in the given file.
	The dictionary keys are the packet lists names, and the dictionary values are the packet lists ids.

	>>> packetlists = get_packetlists(os.path.join(SAMPLE_FOLDER, 'Sample.ved'))
	>>> len(packetlists)
	3
	>>> 'Packet List 1' in packetlists
	True
	"""
	resp = put('/shunra/api/analysis/packetlistmetadata', {'id':inputfilepath})
	return dict([(entry['name'], entry['id']) for entry in resp['packetLists']])

	def get_run_result_id(inputfilepath):
	resp = put('/shunra/api/analysis/packetlistmetadata', {'id':inputfilepath})
	return resp['runResultId']