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

Hi, I am new to wireshark, tshark and lua.

try to capture all uri which contains "abc" to text file automatically. the following code does work and i can hear beep when tshark find a filtered uri.

BUT, writing to text file part IS NOT working.

could anyone please help me?

local _filter = 'http.request.uri contains "abc"' 
local file ="Test.txt", "w")

local function make_tap(filter)
    local tap =, filter)

    function tap.packet()
        for i=1,3 do print '\007' end                       file:write("Testing....")       

    return tap   end


asked 18 Dec '14, 03:54

Shark's gravatar image

accept rate: 0%

edited 19 Dec '14, 14:46

Guy%20Harris's gravatar image

Guy Harris ♦♦

It works for me. Or at least, in my script I use:

local file ="Test.txt", "w")
function myproto.dissector(tvb, pinfo, tree)
    file:write("Packet: " .. pinfo.number .. "\n")

and it does write out to the file, both using tshark and wireshark.

(23 Dec '14, 00:59) Hadriel
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 18 Dec '14, 03:54

question was seen: 3,281 times

last updated: 23 Dec '14, 00:59

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