# 福建项目:解析车联网协议GBT32960 | ID | Creation Date | Assignee | Status | |----|----------------|----------|--------| | OMPUB-509 | 2022-06-06T14:10:49.000+0800 | 刘学利 | 完成 | --- 背景: * 近期工程部同事在福建协助工联院人员进行 工业互联网(车联网) 协议的数据分析。 * 分析过程中发现 ,符合 GBT32960 标准的协议,payload中的内容是以文本的形式直接展示出来,并且具有固定含义。 * 用户目前使用TSG系统中自定义APP的功能,将Payload中的内容添加到 自定义APP特征 里,命中策略后,下载对应的pcap文件,通过Python脚本转化pcap文件,提取其中的payload 需求: 用户希望我们的系统可以直接将payload解析成文本,并留存到策略日志中,目的是减少转化pcap文件的步骤,便于获取信息。 备注: 附件是用户提供的车联网相关的 标准 和 技术规范,以及现场配置的特征,对应的pcap数据包 **zhengchao** commented on *2022-06-08T16:29:14.780+0800*: [~yangwei]  评估下 --- **yangwei** commented on *2022-06-13T10:06:35.141+0800*: 抽样查看了下附件中的数据包,现象如下: * TCP负载并非纯文本,而是二进制和ASCII混合的形式,识别后直接将负载写入结构化存储需要转码(如base64) !image-2022-06-13-09-54-45-871.png|width=683,height=311! * 提供的数据包,暂不存在跨包现象 方案 * 方案一:考虑使用AppSketch+lua脚本解决 ** 通过配置二进制特征{*}识别{*}对应协议 ** lua脚本对识别后的会话进行内容抽取和base64编码 ** 问题:目前的设计,lua脚本不支持有状态处理,单个会话上发送多个数据块可能存在问题 * 方案二:独立开发新的协议解析插件,会话日志增加新的schema   问题: * 从issue的描述,没太理解用户的意图,后续是需要对该协议进行详细的解析,还是先识别后,把数据搂回去再说?   --- **zhuwei** commented on *2022-06-13T10:50:57.273+0800*: 目前用户的意图经过上周跟用户的会议,了解了现状:用户对关注的字段目前还没有非常明确的要求。但是与用户达成了共识:一起工作,然后逐步明确所需要的关键字段。 基于上述需求,有没有什么折衷的办法,tsg可以先留存数据(用户可见,了解需求有进度),之后再根据实际需求细化? --- **yangwei** commented on *2022-06-16T20:01:48.393+0800*: 附件中的文档JT-T 808-2019有没有捕获的pcap包? --- **yangwei** commented on *2022-06-17T14:54:51.287+0800*: GB/T 32960通信过程中,特征较为明显(起始2字节为##,2-3字节取值为0x01-0x07),且每个消息头部携带VNI信息,可以考虑使用AppSketch支持的前置特征+lua脚本抽取的方案,先对符合GB/T 32960 特征的会话信息中VNI字段进行抽取。 !image-2022-06-17-14-54-19-632.png|width=657,height=346! 后续抽取其他字段,可以沿用相同方案。   建议[~zhangzhihan] 根据pcap包中的内层服务端IP,在功能端直接捕包,提供更多的完整会话数据 --- **yangwei** commented on *2022-06-17T14:55:05.511+0800*: [^车联网协议.xmind] --- **zhangzhihan** commented on *2022-06-17T14:57:24.753+0800*: 收到 --- **liuxueli** commented on *2022-06-24T09:45:32.873+0800*: * 从福建100G测试环境(34.100)捕包,符合GBT32960的特征,但是不是GBT32960协议。[^GBT32960-62498-20001-10.138.227.202-139.159.185.209.pcap] --- **pengxuanzheng** commented on *2022-06-24T11:43:51.930+0800*: 从现有的福建捕包来看,车联网协议并不一定完全符合GBT32960标准,有以下几种情况: # 符合GBT32960协议(正式实施版) # 符合GBTXXXXX协议(GBT32960 征求意见稿) ## 完全符合,特点是 1,2字节为”##”,第3个字节为 command id, 第4个字节是replay id,第5到22字节是符合GB16735的VIN ## 不完全符合,replay id置后,特点是 1,2字节为”##”,第3个字节为 command id, 第4到21位是符合GB16735的VIN,第22位是replay id(可能出现非标准的0x00, 0x10, 0x11,意义不明) GB16735 简单格式: # 长度17 # 所有字符为大写字母与数字,没有“I“,”O“,”Q”字母 # 最后三位一定是数字 # 第9位是校验位,取值范围是0~9与“X” [GB 16735-2019|http://c.gb688.cn/bzgk/gb/showGb?type=online&hcno=E2EBF667F8C032B1EDFD6DF9C1114E02] --- **liuxueli** commented on *2022-06-27T14:11:03.505+0800*: * 在移动192.168.13.5、6两台机器上做测试,AppSketch读取本地JSON配置,验证功能及稳定性。 * 192.168.32.3机器:GBT32960流量较多 --- **gitlab** commented on *2022-06-28T15:01:18.698+0800*: [刘学利|https://git.mesalab.cn/liuxueli] mentioned this issue in [a commit|https://git.mesalab.cn/tango/tsg_master/-/commit/89966c851a84df62036588bae508c9ec713d6f0d] of [TSG Appliance / tsg_master|https://git.mesalab.cn/tango/tsg_master] on branch [bugfix-OMPUB-509|https://git.mesalab.cn/tango/tsg_master/-/tree/bugfix-OMPUB-509]:{quote}OMPUB-509: 使用bridge模式通知LUA的抽取结果,变更app_extra_info日志字段格式,用JSON数组表示{quote} --- **gitlab** commented on *2022-06-28T15:03:08.914+0800*: [刘学利|https://git.mesalab.cn/liuxueli] mentioned this issue in [a commit|https://git.mesalab.cn/appsketch/app_sketch_local/-/commit/00fa406dcb55df5625395d32827ec9fff7e1a6a5] of [AppSketch / app_sketch_local|https://git.mesalab.cn/appsketch/app_sketch_local] on branch [bugfix-OMPUB-509|https://git.mesalab.cn/appsketch/app_sketch_local/-/tree/bugfix-OMPUB-509]:{quote}OMPUB-509: 使用bridge模式通知LUA的抽取结果,变更LUA库的使用方式{quote} --- **gitlab** commented on *2022-06-28T15:13:34.324+0800*: [刘学利|https://git.mesalab.cn/liuxueli] mentioned this issue in [a merge request|https://git.mesalab.cn/tango/tsg_master/-/merge_requests/242] of [TSG Appliance / tsg_master|https://git.mesalab.cn/tango/tsg_master] on branch [bugfix-OMPUB-509|https://git.mesalab.cn/tango/tsg_master/-/tree/bugfix-OMPUB-509]:{quote}OMPUB-509: 使用bridge模式通知LUA的抽取结果,变更app_extra_info日志字段格式,用JSON数组表示{quote} --- **gitlab** commented on *2022-06-28T15:13:53.976+0800*: [刘学利|https://git.mesalab.cn/liuxueli] mentioned this issue in [a merge request|https://git.mesalab.cn/appsketch/app_sketch_local/-/merge_requests/52] of [AppSketch / app_sketch_local|https://git.mesalab.cn/appsketch/app_sketch_local] on branch [bugfix-OMPUB-509|https://git.mesalab.cn/appsketch/app_sketch_local/-/tree/bugfix-OMPUB-509]:{quote}OMPUB-509: 使用bridge模式通知LUA的抽取结果,变更LUA库的使用方式{quote} --- **liuxueli** commented on *2022-06-29T10:30:55.177+0800*: * [~zhangzhihan] [~niuxiang]   [^parser_GBT32960_plug.lua] 是wireshark的插件,支持解析GBT32960协议,使用方式如下: ** 脚本生效路径查看方式: ***  wireshark 帮助->关于wireshark->文件夹->个人lua插件,放到个人lua插件指定的路径 ** 如果发现符合gbt32960特征的数据包但并未被wireshark解析,可以通过修改lua脚本支持 *** 将port_number替换为数据包中的tcp.port,在lua脚本最后添加一行 DissectorTable.get("tcp.port"):add({color:#de350b}port_number{color}, GBT32960) *** 保存lua脚本,在wireshark上按ctrl + shift + l 重新加载文件就可以看到解析的协议内容 ** 注意,该脚本按照GBT32960官方文档解析,现有pcap文件可能不完全符合GBT32960标准,只做解析参考 --- **yangwei** commented on *2022-06-29T18:11:53.862+0800*: 对于可能的数据包,不一定非得在lua脚本最后添加对应的端口,也可以在wireshark显示的TCP data上右键->decode as GBT32960,强制按GBT32960识别 !image-2022-06-29-18-10-43-494.png|width=581,height=187! !image-2022-06-29-18-11-35-375.png|width=581,height=243! --- **gitlab** commented on *2022-07-01T16:01:45.066+0800*: [刘学利|https://git.mesalab.cn/liuxueli] mentioned this issue in [a commit|https://git.mesalab.cn/appsketch/app_proto_identify/-/commit/87c3b05104e4b504d72ea655280eb775476dae36] of [AppSketch / app_proto_identify|https://git.mesalab.cn/appsketch/app_proto_identify] on branch [bugfix-OMPUB-509|https://git.mesalab.cn/appsketch/app_proto_identify/-/tree/bugfix-OMPUB-509]:{quote}OMPUB-509: 变更bridge通知识别结果的名称{quote} --- **gitlab** commented on *2022-07-01T16:06:19.613+0800*: [刘学利|https://git.mesalab.cn/liuxueli] mentioned this issue in [a merge request|https://git.mesalab.cn/appsketch/app_proto_identify/-/merge_requests/46] of [AppSketch / app_proto_identify|https://git.mesalab.cn/appsketch/app_proto_identify] on branch [bugfix-OMPUB-509|https://git.mesalab.cn/appsketch/app_proto_identify/-/tree/bugfix-OMPUB-509]:{quote}OMPUB-509: 变更bridge通知识别结果的名称{quote} --- **gitlab** commented on *2022-07-01T16:08:10.413+0800*: [刘学利|https://git.mesalab.cn/liuxueli] mentioned this issue in [a commit|https://git.mesalab.cn/tango/tsg_regression_testing/-/commit/0d9953e06bc12e09609eb1f2749a344a84081c89] of [TSG Appliance / tsg_regression_testing|https://git.mesalab.cn/tango/tsg_regression_testing] on branch [feature-OMPUB-509|https://git.mesalab.cn/tango/tsg_regression_testing/-/tree/feature-OMPUB-509]:{quote}OMPUB-509: 增加识别GBT32960的测试用例{quote} --- **gitlab** commented on *2022-07-01T18:44:02.325+0800*: [刘学利|https://git.mesalab.cn/liuxueli] mentioned this issue in [a commit|https://git.mesalab.cn/tsg/tsg-os-buildimage/-/commit/ae3b72d152504714e9650d1e7bec5367cc8387d0] of [TSG / tsg-os-buildimage|https://git.mesalab.cn/tsg/tsg-os-buildimage] on branch [update-22.07-firewall-v1|https://git.mesalab.cn/tsg/tsg-os-buildimage/-/tree/update-22.07-firewall-v1]:{quote}更新tsg_master、app_sketch_local、app_proto_identify、fw_http_plug、fw_mail_plug,修复:{quote} --- **gitlab** commented on *2022-07-01T18:44:10.422+0800*: [刘学利|https://git.mesalab.cn/liuxueli] mentioned this issue in [a merge request|https://git.mesalab.cn/tsg/tsg-os-buildimage/-/merge_requests/821] of [TSG / tsg-os-buildimage|https://git.mesalab.cn/tsg/tsg-os-buildimage] on branch [update-22.07-firewall-v1|https://git.mesalab.cn/tsg/tsg-os-buildimage/-/tree/update-22.07-firewall-v1]:{quote}更新tsg_master、app_sketch_local、app_proto_identify、fw_http_plug、fw_mail_plug,修复:{quote} --- **gitlab** commented on *2022-07-03T22:45:10.339+0800*: [刘学利|https://git.mesalab.cn/liuxueli] mentioned this issue in [a commit|https://git.mesalab.cn/tsg/tsg-os-buildimage/-/commit/5d82683b0a2aab5032f509744cce7397cc4f6963] of [TSG / tsg-os-buildimage|https://git.mesalab.cn/tsg/tsg-os-buildimage] on branch [update-22.07-firewall-v1|https://git.mesalab.cn/tsg/tsg-os-buildimage/-/tree/update-22.07-firewall-v1]:{quote}更新tsg_master、app_sketch_local、app_proto_identify、fw_http_plug、fw_mail_plug,修复:{quote} --- **niuxiang** commented on *2022-07-07T17:14:15.334+0800*: [~yangwei] [~liuxueli]  1、确认下之前在线上测试的GBT32960协议分析脚本效果如何 2、用户想确认下识别分析GBT32960协议的功能预计什么时间可以集成到系统里 3、用户更新了需求,对车联网协议目前只关注GBT32960就可以了,增加了物联网协议:MQTT、COAP、XMPP的识别、分析需求 --- **gitlab** commented on *2022-07-11T18:41:22.047+0800*: [刘学利|https://git.mesalab.cn/liuxueli] mentioned this issue in [a commit|https://git.mesalab.cn/appsketch/app_sketch_local/-/commit/12a988283812928158e6b249188af4d360cdfd3a] of [AppSketch / app_sketch_local|https://git.mesalab.cn/appsketch/app_sketch_local] on branch [bugfix-lua-bool-result-not-in-logs|https://git.mesalab.cn/appsketch/app_sketch_local/-/tree/bugfix-lua-bool-result-not-in-logs]:{quote}OMPUB-509: LUA返回bool类型结果不在app_extra_info日志字段填充展示{quote} --- **gitlab** commented on *2022-07-11T18:41:44.514+0800*: [刘学利|https://git.mesalab.cn/liuxueli] mentioned this issue in [a merge request|https://git.mesalab.cn/appsketch/app_sketch_local/-/merge_requests/53] of [AppSketch / app_sketch_local|https://git.mesalab.cn/appsketch/app_sketch_local] on branch [bugfix-lua-bool-result-not-in-logs|https://git.mesalab.cn/appsketch/app_sketch_local/-/tree/bugfix-lua-bool-result-not-in-logs]:{quote}OMPUB-509: LUA返回bool类型结果不在app_extra_info日志字段填充展示{quote} --- **gitlab** commented on *2022-07-27T13:33:57.539+0800*: [刘学利|https://git.mesalab.cn/liuxueli] mentioned this issue in [a merge request|https://git.mesalab.cn/tango/tsg_regression_testing/-/merge_requests/35] of [TSG Appliance / tsg_regression_testing|https://git.mesalab.cn/tango/tsg_regression_testing] on branch [feature-OMPUB-509|https://git.mesalab.cn/tango/tsg_regression_testing/-/tree/feature-OMPUB-509]:{quote}OMPUB-509: 增加识别GBT32960的测试用例{quote} --- **gitlab** commented on *2022-07-27T13:34:01.679+0800*: [刘学利|https://git.mesalab.cn/liuxueli] mentioned this issue in [a commit|https://git.mesalab.cn/tango/tsg_regression_testing/-/commit/36ae6f6cf3c428dac85a4084b58c40284216f37b] of [TSG Appliance / tsg_regression_testing|https://git.mesalab.cn/tango/tsg_regression_testing] on branch [master|https://git.mesalab.cn/tango/tsg_regression_testing/-/tree/master]:{quote}OMPUB-509: 增加识别GBT32960的测试用例{quote} --- **niuxiang** commented on *2022-09-05T11:28:12.659+0800*: [~yangwei] [~liuxueli]  1、用户在分析GBT32960协议之后,提出分析、结构化显示三个物联网协议:MQTT、COAP、LWM2M 2、已经在系统下载一部分数据包,已上传附件,请查收:物联网数据包.zip,密码:物联网20220905 3、目前数据包出现两个异常:       1- JavaScript Object Notation,学利给出答复这是一个BUG(https://jira.geedge.net/browse/TSG-11583),在22.08版本修复       2- 部分数据包提示:The capture file appears to be damaged or corrupt. (pcapng: total block length 1685021476 is too large (> 134348832)) --- **liuxueli** commented on *2022-12-09T17:30:17.362+0800*: * 已完成开发,待更新现场验证测试。 --- ## Attachments **28417/2016北京公共平台GBT32960标准对接解读.pdf** --- **29095/GBT32960.3-2016电动汽车远程服务与管理系统技术规范—第3部分通信协议及数据格式.pdf** --- **29085/GBT32960-62498-20001-10.138.227.202-139.159.185.209.pcap** --- **28421/GBT32960数据包.zip** --- **28422/GBT32960特征配置情况.PNG** --- **28652/image-2022-06-13-09-54-45-871.png** --- **28922/image-2022-06-17-14-54-19-632.png** --- **29205/image-2022-06-29-18-10-43-494.png** --- **29206/image-2022-06-29-18-11-35-375.png** --- **28416/JT-T+808-2019.pdf** --- **28423/JTT808特征配置情况.PNG** --- **29166/parser_GBT32960_plug.lua** --- **28923/车联网协议.xmind** --- **28415/电动汽车远程服务与管理系统技术规范—第3部分通信协议及数据格式.pdf** --- **30907/物联网数据包.zip** ---