Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to save in a variable a specific value from masked bytes

The variable YEAR, has got an offset of 2000. This means, that I need to add 2000 to the taken value:

local Year_proto = ProtoField.uint16("Variable_Year", "This is the transmitted year", base.DEC, nil)

Before adding it to the shown values of my Wireshark-Parser, I need to save the LITTLE-ENDIAN 7 bits long number. The bit mask should be 0x07f0 = 0000 0111 1111 0000. The start byte is the 77 (buffer(77,2).

Can you please tell me how can I save the mentioned LITTLE-ENDIAN 7 bits number? Let's say that the name of the saved number is year_test and the variable "year" is the corrected value:

offset=2000.0
year=year_test+offset //for example year_test=0x15=21 --> 2021

Afterwards I would list the corrected year value as follows:

subtree:add(Year_proto, year)

Many thanks for your help!

How to save in a variable a specific value from masked bytes

The variable YEAR, has got an offset of 2000. This means, that I need to add 2000 to the taken value:

local Year_proto = ProtoField.uint16("Variable_Year", "This is the transmitted year", base.DEC, nil)

Before adding it to the shown values of my Wireshark-Parser, I need to save the LITTLE-ENDIAN 7 bits long number. The bit mask should be 0x07f0 = 0000 0111 1111 0000. The start byte is the 77 (buffer(77,2).

Can you please tell me how can I save the mentioned LITTLE-ENDIAN 7 bits number? Let's say that the name of the saved number is year_test and the variable "year" is the corrected value:

offset=2000.0
year=year_test+offset //for example year_test=0x15=21 --> 2021

Afterwards I would list the corrected year value as follows:

subtree:add(Year_proto, year)

Many thanks for your help!

How to save in a variable a specific value from masked bytesbytes?

The variable YEAR, has got an offset of 2000. This means, that I need to add 2000 to the taken value:

local Year_proto = ProtoField.uint16("Variable_Year", "This is the transmitted year", base.DEC, nil)

Before adding it to the shown values of my Wireshark-Parser, I need to save the LITTLE-ENDIAN 7 bits long number. The bit mask should be 0x07f0 = 0000 0111 1111 0000. The start byte is the 77 (buffer(77,2).

Can you please tell me how can I save the mentioned LITTLE-ENDIAN 7 bits number? Let's say that the name of the saved number is year_test and the variable "year" is the corrected value:

offset=2000.0
year=year_test+offset //for example year_test=0x15=21 --> 2021

Afterwards I would list the corrected year value as follows:

subtree:add(Year_proto, year)

Many thanks for your help!

How to save in a variable a specific value from masked bytes?

The variable YEAR, has got an offset of 2000. This means, that I need to add 2000 to the taken value:value. Here I create my "ProtoField":

local Year_proto = ProtoField.uint16("Variable_Year", "This is the transmitted year", base.DEC, nil)

Before adding it to the shown values of my Wireshark-Parser, I need to save the LITTLE-ENDIAN 7 bits long number. The bit mask should be 0x07f0 = 0000 0111 1111 0000. The start byte is the 77 (buffer(77,2).

Can you please tell me how can I save the mentioned LITTLE-ENDIAN 7 bits number? Let's say that the name of the saved number is year_test saved in "year_test" and the variable "year" is the corrected value:

offset=2000.0
year=year_test+offset //for example year_test=0x15=21 --> 2021

Afterwards I would list the corrected year value as follows:

subtree:add(Year_proto, year)

Many thanks for your help!

How to save in a variable a specific value from masked bytes?

The variable YEAR, has got an offset of 2000. This means, that I need to add 2000 to the taken value. Here I create my "ProtoField":

local Year_proto = ProtoField.uint16("Variable_Year", "This is the transmitted year", base.DEC, nil)

Before adding it to the shown values of my Wireshark-Parser, I need to save the LITTLE-ENDIAN 7 bits long number. The bit mask should be 0x07f0 = 0000 0111 1111 0000. 0000 - so the only intersting bits here are the "1". The start byte is the 77 and the information is found in two bytes (buffer(77,2).

Can you please tell me how can I save the mentioned LITTLE-ENDIAN 7 bits number? Let's say that the name of the saved number is saved in "year_test" and the variable "year" is the corrected value:

offset=2000.0
year=year_test+offset //for example year_test=0x15=21 --> 2021

Afterwards I would list the corrected year value as follows:

subtree:add(Year_proto, year)

Many thanks for your help!