<menu id="guoca"></menu>
<nav id="guoca"></nav><xmp id="guoca">
  • <xmp id="guoca">
  • <nav id="guoca"><code id="guoca"></code></nav>
  • <nav id="guoca"><code id="guoca"></code></nav>

    處理分組數據的功能

    ByteArray

    ByteArray.new([hexbytes], [separator])

    創建一個新ByteArray對象。
    如果第二個參數是boolean true,則第一個參數將被視為要使用的原始Lua字節字符串,而不是十六進制字符串。
    例:

      local empty = ByteArray.new()
      local b1 = ByteArray.new("a1 b2 c3 d4")
      local b2 = ByteArray.new("112233")
    Arguments

    hexbytes (optional)
    由十六進制字節組成的字符串,例如“ 00 B1 A2”或“ 1a2b3c4d”。
    separator (optional)
    十六進制字節/字之間的字符串分隔符(默認值=“”),或者如果使用布爾值true,則將第一個參數視為原始二進制數據

    Returns

    The new ByteArray object.

    bytearray:__concat(first, second)

    連接兩個ByteArray

    Arguments

    first

    First array.

    second

    Second array.

    Returns

    The new composite ByteArray.

    bytearray:__eq(first, second)

    比較兩個ByteArray值。

    Arguments

    first

    First array.

    second

    Second array.

    bytearray:prepend(prepended)

    將ByteArray附加到此ByteArray。

    Arguments

    prepended

    ByteArray to be prepended.

    bytearray:append(appended)

    將ByteArray追加到此ByteArray。

    Arguments

    appended

    ByteArray to be appended.

    bytearray:set_size(size)

    設置ByteArray的大小,將其截斷或用零填充。

    Arguments

    size

    New size of the array.

    Errors
    • ByteArray size must be non-negative

      bytearray:set_index(index, value)

      設置ByteArray的索引值。
      Arguments

    index

    The position of the byte to be set.

    value

    The char value to set [0-255].

    bytearray:get_index(index)

    Get the value of a byte in a ByteArray.

    Arguments

    index

    The position of the byte to get.

    Returns

    The value [0-255] of the byte.

    bytearray:len()

    獲取ByteArray的長度。

    Returns

    The length of the ByteArray.

    bytearray:subset(offset, length)

    獲取ByteArray的一段,作為新的ByteArray。

    Arguments

    offset

    The position of the first byte (0=first).

    length

    The length of the segment.

    Returns

    A ByteArray containing the requested segment.

    bytearray:base64_decode()

    獲取Base64解碼的ByteArray。

    Returns

    The created ByteArray.

    bytearray:raw([offset], [length])

    獲取ByteArray中的二進制字節的Lua字符串。

    Arguments

    offset (optional)

    The position of the first byte (default=0/first).

    length (optional)

    The length of the segment to get (default=all).

    Returns

    A Lua string of the binary bytes in the ByteArray.

    bytearray:tohex([lowercase], [separator])

    以十六進制ascii的形式獲取ByteArray中的字節組成的Lua字符串,并使用給定的分隔符。

    Arguments

    lowercase (optional)

    True to use lower-case hex characters (default=false).

    separator (optional)

    A string separator to insert between hex bytes (default=nil).

    Returns

    A hex-ascii string representation of the ByteArray.

    bytearray:__tostring()

    獲取包含ByteArray中的字節的Lua字符串,以便可以在顯示過濾器中使用它(例如“01FE456789AB”)。

    Returns

    A hex-ascii string representation of the ByteArray.

    bytearray:tvb(name)

    Creates a new Tvbfrom a ByteArray. The Tvb will be added to the current frame.
    例:

     function proto_foo.dissector(buf, pinfo, tree)
                -- Create a new tab named "My Tvb" and add some data to it
                local b = ByteArray.new("11223344")
                local tvb = ByteArray.tvb(b, "My Tvb")
    
                -- Create a tree item that, when clicked, automatically shows the tab we just created
                tree:add( tvb(1,2), "Foo" )
        end
    參數

    name

    The name to be given to the new data source.

    Returns

    The created Tvb.

    Tvb

    TVB表示數據包的緩沖區。它作為參數傳遞給偵聽器和解析器,并可用于從數據包的數據中提取信息(通過TvbRange)。

    要創建TvbRange,必須使用偏移量和長度作為可選參數調用TVB;偏移量默認為0,長度為TVB:LEN()。

    tvb:__tostring()

    將TVB的字節轉換為字符串。這主要用于調試目的,因為如果字符串太長,它將被截斷。

    Returns

    The string.

    tvb:reported_len()

    獲取TVB的報告(未捕獲)長度。

    Returns

    The reported length of the Tvb.

    tvb:len()

    獲取TVB的實際(捕獲)長度。

    Returns

    The captured length of the Tvb.

    tvb:reported_length_remaining()

    獲取報告(未捕獲)到TVB末尾的分組數據長度,如果偏移量超過TVB末尾,則獲取-1。

    Returns

    The captured length of the Tvb.

    tvb:bytes([offset], [length])

    Obtain a ByteArrayfrom a Tvb.

    Arguments

    offset (optional)

    The offset (in octets) from the beginning of the Tvb. Defaults to 0.
    length (optional)

    The length (in octets) of the range. Defaults to until the end of the Tvb.

    Returns

    The ByteArray object or nil.

    tvb:offset()

    返回子TVB的原始偏移量(從源TVB開始)。

    Returns

    The raw offset of the Tvb.

    tvb:__call()

    Equivalent to tvb:range(…?)

    tvb:range([offset], [length])

    從此TVB創建TvbRange。

    Arguments

    offset (optional)

    The offset (in octets) from the beginning of the Tvb. Defaults to 0.

    length (optional)

    The length (in octets) of the range. Defaults to -1, which specifies the remaining bytes in the Tvb.

    Returns

    The TvbRange

    tvb:raw([offset], [length])

    Obtain a Lua string of the binary bytes in a Tvb.

    Arguments

    offset (optional)

    The position of the first byte. Default is 0, or the first byte.

    length (optional)

    The length of the segment to get. Default is -1, or the remaining bytes in the Tvb.

    Returns

    A Lua string of the binary bytes in the Tvb.

    tvb:__eq()

    檢查兩個TVBS的內容是否相等。

    TvbRange

    TvbRange表示TVB的可用范圍,并用于從生成它的TVB提取數據。

    Tvb范圍是通過調用TVB(例如‘TVB(Offset,Length)’)創建的。如果TvbRange跨度超出TVB的范圍,則創建將導致運行時錯誤。

    tvbrange:tvb()

    從TvbRange創建新的TVB

    tvbrange:uint()

    從TvbRange獲取大端(網絡順序)無符號整數。范圍必須為1-4個八位字節長度。

    Returns

    The unsigned integer value.

    tvbrange:le_uint()

    從TvbRange獲取小端無符號整數。范圍必須為1-4個八位字節長度。

    Returns

    The unsigned integer value

    tvbrange:uint64()

    從TvbRange獲取大端(網絡順序)無符號64位整數,作為UInt64對象。范圍必須為1-8個八位字節長度。

    Returns

    The UInt64 object.

    tvbrange:le_uint64()

    從TvbRange獲取一個小端無符號64位整數,作為UInt64對象。范圍必須為1-8個八位字節長度。

    Returns

    The UInt64 object.

    tvbrange:int()

    從TvbRange獲取大端(網絡順序)有符號整數。范圍必須為1-4個八位字節長度。

    Returns

    The signed integer value.

    tvbrange:le_int()

    從TvbRange獲取小端有符號整數。范圍必須為1-4個八位字節長度。

    Returns

    The signed integer value.

    tvbrange:int64()

    從TvbRange獲取大端(網絡順序)有符號64位整數,作為Int64對象。范圍必須為1-8個八位字節長度。

    Returns

    The Int64 object.

    tvbrange:le_int64()

    從TvbRange獲取一個小端有符號64位整數,作為Int64對象。范圍必須為1-8個八位字節長度。

    Returns

    The Int64object.

    tvbrange:float()

    從TvbRange獲取大端(網絡順序)浮點數。范圍必須為4或8個八位字節長度。

    Returns

    The floating point value.

    tvbrange:le_float()

    從TvbRange獲取小端浮點數。范圍必須為4或8個八位字節長度。

    Returns

    The floating point value.

    tvbrange:ipv4()

    從TvbRange獲取IPv4地址,作為Address對象。

    Returns

    The IPv4 Address object.

    tvbrange:le_ipv4()

    從TvbRange獲取一個小端IPv4地址,作為Address對象。

    Returns

    The IPv4 Address object.

    tvbrange:ipv6()

    從TvbRange獲取IPv6地址,作為Address對象。

    Returns

    The IPv6 Address object.

    tvbrange:ether()

    從TvbRange獲取以太網地址,作為Address對象。

    Returns

    The Ethernet Addressobject.

    Errors
    • The range must be 6 bytes long

    tvbrange:nstime([encoding])

    Arguments

    encoding (optional)

    An optional ENC_* encoding value to use

    Returns

    參數NSTime表示Object和使用的字節數,如果失敗,則返回nil。

    tvbrange:le_nstime()

    從TvbRange獲取nstime,作為NSTime對象。

    Returns

    The NSTime object.

    Errors
    • The range must be 4 or 8 bytes long

      tvbrange:string([encoding])

      從TvbRange獲取字符串。
      Arguments

    encoding (optional)

    要使用的編碼。默認為ENC_ASCII。

    Returns

    一個字符串,包含TvbRange中的所有字節,包括全零(例如,“a\000bc\000”)。

    tvbrange:ustring()

    從TvbRange獲取大端(網絡順序)UTF-16編碼字符串。

    Returns

    一個字符串,包含TvbRange中的所有字節,包括全零(例如,“a\000bc\000”)。

    tvbrange:le_ustring()

    從TvbRange獲取小端UTF-16編碼字符串。

    Returns

    一個字符串,包含TvbRange中的所有字節,包括全零(例如,“a\000bc\000”)。

    tvbrange:stringz([encoding])

    從TvbRange獲取以零結尾的字符串。
    參數:
    encoding (optional)
    要使用的編碼。默認為ENC_ASCII。
    Returns
    包含TvbRange中直到第一個終止零的所有字節的字符串。

    tvbrange:strsize([encoding])

    從TvbRange中查找以零結尾的字符串的大小。字符串的大小包括終止零。

    Arguments

    encoding (optional)

    The encoding to use. Defaults to ENC_ASCII.

    Returns

    Length of the zero terminated string.

    tvbrange:ustringz()

    從TvbRange獲取大端(網絡順序)UTF-16編碼的以零結尾的字符串。

    Return

    兩個返回值:以零結尾的字符串和長度。

    tvbrange:le_ustringz()

    從TvbRange獲取小端UTF-16編碼的以零結尾的字符串

    Return

    兩個返回值:以零結尾的字符串和長度。

    tvbrange:bytes([encoding])

    從TvbRange獲取ByteArray。

    從1.11.4開始,該函數還接受一個可選的編碼參數,該參數可以設置為ENC_STR_HEX以將十六進制字符串從TvbRange解碼為返回的ByteArray。編碼可以使用一個或多個分隔符編碼(如ENC_SEP_COLON)進行位或,以允許在每對十六進制字符之間出現分隔符。

    返回值現在還返回用作第二個返回值的字節數。

    如果出現故障或錯誤,則兩個返回值都返回nil。

    Arguments

    encoding (optional)

    An optional ENC_* encoding value to use

    Returns

    The ByteArray object or nil, and number of bytes consumed or nil.

    tvbrange:bitfield([position], [length])

    Get a bitfield from a TvbRange.

    Arguments

    position (optional)

    從TvbRange開始的位偏移量(MSB 0位編號)。默認值為0。

    length (optional)

    字段的長度(以位為單位)。默認為1。

    Returns

    The bitfield value

    tvbrange:range([offset], [length])

    從此TvbRange創建子TvbRange。

    參數

    offset (optional)
    距TvbRange開頭的偏移量(以八位字節為單位)。默認值為0。
    length (optional)
    范圍的長度(以八位字節為單位)。默認為直到TvbRange結束。

    Returns

    The TvbRange.

    tvbrange:uncompress(name)

    從TvbRange獲取未壓縮的TvbRange

    Arguments

    name

    The name to be given to the new data-source.

    Returns

    The TvbRange.

    tvbrange:len()

    獲取TvbRange的長度。

    tvbrange:offset()

    獲取TvbRange中的偏移。

    tvbrange:raw([offset], [length])

    獲取TvbRange中的二進制字節的Lua字符串。

    Arguments

    offset (optional)

    The position of the first byte. Default is 0, or first byte.

    length (optional)

    The length of the segment to get. Default is -1, Default is -1, or the remaining bytes.

    Returns

    A Lua string of the binary bytes in the TvbRange.

    tvbrange:__eq()

    Checks whether the contents of two TvbRange are equal.

    tvbrange:__tostring()

    將TvbRange轉換為字符串。字符串可以截斷,因此這主要用于調試或首選截斷的情況,例如“67:89:ab:…?”。

    Return

    截斷為24字節的TvbRange的Lua十六進制字符串。

    本文章首發在 網安wangan.com 網站上。

    上一篇 下一篇
    討論數量: 0
    只看當前版本


    暫無話題~
    亚洲 欧美 自拍 唯美 另类