Ask Your Question

Revision history [back]

Lua - Get hex value of a field

I use this code to retrieve the hex value of "wlan.ssid", as I understood from 11.2.2.15. fieldinfo.range

local wlan_ssid_f = Field.new("wlan.ssid")
if (wlan_ssid_f() ~= nil) then
    wlan_ssid = tostring(wlan_ssid_f())
    wlan_ssid_hex = tostring(wlan_ssid_f().range)
end

Today I realized that if SSID is longer than 24 chars, then the hex value is fixed to 24 + "..." string:

Ex:
SSID : "DIRECT-b7-HP M118 LaserJet"
HexString : "4449524543542d62372d4850204d313138204c617365724a…"

Is it a restriction of .range or tostring ?

How can I get the whole hexa no matter the length ?

Lua - Get hex value of a field

I use this code to retrieve the hex value of "wlan.ssid", as I understood from 11.2.2.15. fieldinfo.range (ping @cmaynard whol helped me also on this thing back years ago !)

local wlan_ssid_f = Field.new("wlan.ssid")
if (wlan_ssid_f() ~= nil) then
    wlan_ssid = tostring(wlan_ssid_f())
    wlan_ssid_hex = tostring(wlan_ssid_f().range)
end

Today I realized that if SSID is longer than 24 chars, then the hex value is fixed to 24 + "..." string:

Ex:
SSID : "DIRECT-b7-HP M118 LaserJet"
HexString : "4449524543542d62372d4850204d313138204c617365724a…"

Is it a restriction of .range or tostring ?

How can I get the whole hexa no matter the length ?

Lua - Get hex value of a field

I use this code to retrieve the hex value of "wlan.ssid", as I understood from 11.2.2.15. fieldinfo.range (ping @cmaynard whol helped me also on this thing back years ago !)

local wlan_ssid_f = Field.new("wlan.ssid")
if (wlan_ssid_f() ~= nil) then
    wlan_ssid = tostring(wlan_ssid_f())
    wlan_ssid_hex = tostring(wlan_ssid_f().range)
end

Today I realized that if SSID is longer than 24 chars, then the hex value is fixed to 24 + "..." string:

Ex:
SSID : "DIRECT-b7-HP M118 LaserJet"
HexString : "4449524543542d62372d4850204d313138204c617365724a…"

Is it a restriction of .range or tostring ?

How can I get the whole hexa no matter the length ?

(Ping @cmaynard whol helped me also on this thing back years ago !)