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

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 = io.open("Test.txt", "w")

local function make_tap(filter)
    local tap = Listener.new(nil, filter)

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

    return tap   end

Thanks

asked 18 Dec '14, 03:54

Shark's gravatar image

Shark
11113
accept rate: 0%

edited 19 Dec '14, 14:46

Guy%20Harris's gravatar image

Guy Harris ♦♦
17.4k335196

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

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

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

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:

×1,620
×431

question asked: 18 Dec '14, 03:54

question was seen: 3,205 times

last updated: 23 Dec '14, 00:59

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