This is our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

I am writing a lua dissector for a propietary protocol. The packets include embedded .png files that I would like to write to an output folder named "ImageDump_<capturefilename>". Is there a way in lua to query the name of the current capture file being loaded?

asked 04 Aug '15, 18:42

mfbaker's gravatar image

mfbaker
16448
accept rate: 0%

edited 04 Aug '15, 18:44


Not that I know of.

Are you doing this in tshark, or wireshark, or both?

If you're doing this in Wireshark, then you should probably not do it automatically but instead only when the user tells you to, like through a menu command - in which case you could have them type a folder name to use in a dialog window when they select that menu item. (i.e., have the Lua script add a menu item called "Export PNG...", and have that create a window for text input of the folder name)

If you're doing this in tshark, then you should probably still not do it automatically, but only if they load your script with the "tshark -r [capture_filename] -X lua_script:png_export.lua" command switch - in which case you can have an argument passed to your script as well, by doing "tshark -r [capture_filename] -X lua_script:png_export.lua -X lua_script1:[folder_name]".

permanent link

answered 04 Aug '15, 19:09

Hadriel's gravatar image

Hadriel
2.7k2939
accept rate: 18%

It is only for wireshark. I did add a menu item to only write the image files if a menu item is selected to do so:

local ImageDumpOn = false
local ImageDumpMenuText = "Toggle RFBTV Image Dump"

local function toggleImageDump() 
    if ImageDumpOn then 
        ImageDumpOn = false
    else 
        ImageDumpOn = true
    end
end

register_menu(ImageDumpMenuText, toggleImageDump, MENU_TOOLS_UNSORTED)
(04 Aug '15, 19:18) mfbaker

I am writing a wireshark lua dissector for a propietary protocol, and am still looking for an answer to the question I posted about a month ago. Is there a way in lua to query the name of the current capture file being loaded? The packets include embedded .png files that I would like to write to an output folder named "ImageDump_<capturefilename>".

(27 Aug '15, 17:07) mfbaker
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×637
×549
×431
×3

question asked: 04 Aug '15, 18:42

question was seen: 2,209 times

last updated: 27 Aug '15, 17:07

p​o​w​e​r​e​d by O​S​Q​A