Wireshark mailing list archives
Re: Lua Tvb and escape caracter
From: didier <dgautheron () magic fr>
Date: Mon, 29 Mar 2010 13:19:30 +0200
Hi, Le mardi 16 juin 2009 à 15:34 +0200, cyril leguienne a écrit :
function netx_proto.dissector(buffer,pinfo,tree) pinfo.cols.protocol = "NetX" packetnum = pinfo.number local subtree_packet = tree:add(netx_proto,buffer(),"NetX Protocol ("..buffer:len()..")") local msgbufferarray = buffer(1,buffer:len()-2):bytes()--Here I get a byte array containing the data section from the frame local temparray=ByteArray.new()--allocation for a buffering byte array local offset=0 for i=0,msgbufferarray:len()-2 do -- I go through the array if (msgbufferarray:get_index(i+1)==0x5C or msgbufferarray:get_index(i+1)==0x10 or msgbufferarray:get_index(i+1)==0x13) and msgbufferarray:get_index(i)==0x5C then--here I m looking for escape sequences temparray.append(msgbufferarray:subset(offset,i+1))--if found I get a subset for the array that I append to the buffering array offset=offset+i+1 end end msgbuffer = Tvb.new_real(temparray)--Here I try to create a new tvb without escape sequence from the temporary bytearray
Is this stuff working with SVN HEAD? I'm trying something like: local msgbufferarray = buffer(ofs, plen):bytes() local temparray=ByteArray.new() temparray.append(msgbufferarray:subset(0,plen)) But get the following error: Lua Error: [string "/tmp/eris.lua"]:307: bad argument #2 to 'append' (userdata expected, got no value) Thanks Didier ___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
Current thread:
- Re: Lua Tvb and escape caracter didier (Mar 29)