对于下面这样的半结构化数据,需要将中的特定部分转换为结构化数据以供进一步使用
%MOBILE PARSED MESSAGE FILE
%PARX VERSION : PARX 06.30.80 patch 69
%RAYN VERSION : RAYN_9.83
%LOG FILE NAME : C:\Final\Bbi_10-31.11-36.dng
%Somethin Proprietary and Confidential.
2019 Oct 31 04:32:55.139 [02] 0xB0B3 LTE PDCP UL Cipher Data PDU
Subscription ID = 1
Version = 1
Num Subpackets = 1
Subpacket[0]
Subpacket ID = PDCP PDU with Ciphering (0xC3)
Subpacket Version = 26
Subpacket Size = 60 bytes
SRB Ciphering Keys (hex) = 6B 6E 77 04 68 A5 30 D2 E3 68 86 0E 1D 35 8C D1
DRB Ciphering Keys (hex) = 98 1A 2E 33 E6 9A 85 2B C1 1F A2 CC 3D 31 45 8F
SRB Cipher Algo = LTE AES
DRB Cipher Algo = LTE AES
Num PDUs = 1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| | | | | | | | | | | | | | |els | | | | | |
| |cfg| |sn |bearer|valid|pdu |logged| | |count | |compressed| |mini|packet | | | | |
|PDCPUL CIPH DATA |idx|mode|length|id |pdu |size |bytes |sys_fn|sub_fn|(hex) |sn |pdu |pdu type|sign|action |checksum|e |option|log_buffer (hex) |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|PDCPUL CIPH DATA | 4 | AM |12 bit| 3 | Yes | 62 | 4 | 245 | 1 | 0x3A | 58 | No | DEFAULT|n/a | n/a | n/a |n/a| n/a | 80 3A 45 00 |
Cipher Subpacket[0]
PDU[0] Encrypted Data:
Unable to encrypt
2019 Oct 31 04:32:55.169 [B0] 0xB0A3 LTE PDCP DL Cipher Data PDU
Subscription ID = 1
Version = 1
Num Subpackets = 1
Subpacket[0]
Subpacket ID = PDCP PDU with Ciphering (0xC3)
Subpacket Version = 24
Subpacket Size = 60 bytes
PDCP DL Data PDU with Ciphering {
SRB Ciphering Keys (hex) = 6B 6E 77 04 68 A5 30 D2 E3 68 86 0E 1D 35 8C D1
DRB Ciphering Keys (hex) = 98 1A 2E 33 E6 9A 85 2B C1 1F A2 CC 3D 31 45 8F
SRB Cipher Algo = LTE AES
DRB Cipher Algo = LTE AES
Num PDUs = 1
------------------------------------------------------------------------------------------------------------------------
| | | | | | | | | | | | |els | |
| |cfg| |sn |bearer|valid|pdu |logged| | |count | |mini| |
|PDCPDL CIPH DATA|idx|mode|length|id |pdu |size |bytes |sys_fn|sub_fn|(hex) |sn |sign|log_buffer (hex) |
------------------------------------------------------------------------------------------------------------------------
|PDCPDL CIPH DATA| 4 | AM |12 bit| 3 | Yes | 62 | 4 | 248 | 0 | 0x3A | 58 |n/a | 80 3A 2F BC |
}
Cipher Subpacket[0]
PDU[0] Decrypted Data:
Unable to decrypt
2019 Oct 31 04:32:56.168 [4F] 0xB0A3 LTE PDCP DL Cipher Data PDU
Subscription ID = 1
Version = 1
Num Subpackets = 1
Subpacket[0]
Subpacket ID = PDCP PDU with Ciphering (0xC3)
Subpacket Version = 24
Subpacket Size = 60 bytes
PDCP DL Data PDU with Ciphering {
SRB Ciphering Keys (hex) = 6B 6E 77 04 68 A5 30 D2 E3 68 86 0E 1D 35 8C D1
DRB Ciphering Keys (hex) = 98 1A 2E 33 E6 9A 85 2B C1 1F A2 CC 3D 31 45 8F
SRB Cipher Algo = LTE AES
DRB Cipher Algo = LTE AES
Num PDUs = 1
------------------------------------------------------------------------------------------------------------------------
| | | | | | | | | | | | |els | |
| |cfg| |sn |bearer|valid|pdu |logged| | |count | |mini| |
|PDCPDL CIPH DATA|idx|mode|length|id |pdu |size |bytes |sys_fn|sub_fn|(hex) |sn |sign|log_buffer (hex) |
------------------------------------------------------------------------------------------------------------------------
|PDCPDL CIPH DATA| 4 | AM |12 bit| 3 | Yes | 62 | 4 | 348 | 0 | 0x3B | 59 |n/a | 80 3B 86 3B |
}
Cipher Subpacket[0]
PDU[0] Decrypted Data:
Unable to decrypt
%MOBILE PARSED MESSAGE FILE
%PARX VERSION : PARX 06.30.80 patch 69
%RAYN VERSION : RAYN_9.83
%LOG FILE NAME : C:\Final\Abi_10-31.11-39.dng
%Somethin Proprietary and Confidential.
2019 Oct 31 04:36:04.543 [85] 0xB0B3 LTE PDCP UL Cipher Data PDU
Subscription ID = 1
Version = 1
Num Subpackets = 1
Subpacket[0]
Subpacket ID = PDCP PDU with Ciphering (0xC3)
Subpacket Version = 26
Subpacket Size = 60 bytes
SRB Ciphering Keys (hex) = BC 61 5B 1C 05 1F 92 C6 83 F2 68 E6 00 A3 D7 DC
DRB Ciphering Keys (hex) = 6B 25 EE 8D 1C 48 B2 3A 07 9A 9D 22 AA 77 33 76
SRB Cipher Algo = LTE AES
DRB Cipher Algo = LTE AES
Num PDUs = 1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| | | | | | | | | | | | | | |els | | | | | |
| |cfg| |sn |bearer|valid|pdu |logged| | |count | |compressed| |mini|packet | | | | |
|PDCPUL CIPH DATA |idx|mode|length|id |pdu |size |bytes |sys_fn|sub_fn|(hex) |sn |pdu |pdu type|sign|action |checksum|e |option|log_buffer (hex) |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|PDCPUL CIPH DATA | 4 | AM |12 bit| 3 | Yes | 62 | 4 | 135 | 8 | 0xF9 | 249 | No | DEFAULT|n/a | n/a | n/a |n/a| n/a | 80 F9 45 00 |
Cipher Subpacket[0]
PDU[0] Encrypted Data:
Unable to encrypt
2019 Oct 31 04:36:04.568 [58] 0xB0A3 LTE PDCP DL Cipher Data PDU
Subscription ID = 1
Version = 1
Num Subpackets = 1
Subpacket[0]
Subpacket ID = PDCP PDU with Ciphering (0xC3)
Subpacket Version = 24
Subpacket Size = 60 bytes
PDCP DL Data PDU with Ciphering {
SRB Ciphering Keys (hex) = BC 61 5B 1C 05 1F 92 C6 83 F2 68 E6 00 A3 D7 DC
DRB Ciphering Keys (hex) = 6B 25 EE 8D 1C 48 B2 3A 07 9A 9D 22 AA 77 33 76
SRB Cipher Algo = LTE AES
DRB Cipher Algo = LTE AES
Num PDUs = 1
------------------------------------------------------------------------------------------------------------------------
| | | | | | | | | | | | |els | |
| |cfg| |sn |bearer|valid|pdu |logged| | |count | |mini| |
|PDCPDL CIPH DATA|idx|mode|length|id |pdu |size |bytes |sys_fn|sub_fn|(hex) |sn |sign|log_buffer (hex) |
------------------------------------------------------------------------------------------------------------------------
|PDCPDL CIPH DATA| 4 | AM |12 bit| 3 | Yes | 62 | 4 | 138 | 7 | 0xF8 |248 |n/a | 80 F8 23 41 |
}
Cipher Subpacket[0]
PDU[0] Decrypted Data:
Unable to decrypt
我有如下的伪代码来提取数据。我要找的是psedoo代码中标记为#need_help
的特定步骤的帮助—这些步骤主要是围绕识别文本的特定部分并将它们捕获到变量中。你知道吗
intialize a list, data = []
for each text block ( text block starts with time format `yyyy MMM dd hh:mm:ss.mil`) #need_help
if ending with `0xB0B3 LTE PDCP UL Cipher Data PDU` #need_help
if `size pdu` field value `== 62` #need_help
store 62 to variable pdu_size
store 'ulPdu' to variable type
Extract the `yyyy MMM dd hh:mm:ss.mil` and store the value as `datetime` type in a variable `datetime` #need_help
Extract the field `seq` and store as variable `seq` #need_help
store ulPdu = {"datetime": datetime, "pDuType": type, "pDuSize": pdu_size", "seq": seq}
add ulPdu to data
else
pass # try next text block
else if ending with `0xB0A3 LTE PDCP DL Cipher Data PDU`
if `size pdu` field value `== 62`
store 62 to variable pdu_size
store 'dlPdu' to variable type
Extract the `yyyy MMM dd hh:mm:ss.mil` and store the value as `datetime` type in a variable `datetime`
Extract the field `seq` and store as variable `seq`
store dlPdu = {"datetime": datetime, "pDuType": type, "pDuSize": pdu_size", "seq": seq}
add dlPdu to data
else
pass # try next text block
else
pass # try next text block
您可以使用TTP来解析上面的文本,下面是代码:
该代码将产生:
相关问题 更多 >
编程相关推荐