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

Hi, I am using lates wireshark together with lua 5.2 dll and ZeroBrane Master from GIT to debug lua scripts.

I have set the Path to the ZeroBrane EduKit to fix a lua socket problem with lua 5.2.

After copy the lua 5.2 dll into the wireshark folder, fixing the problem with the lua path and socket error I was able to start the script and debug. However the Listener object is not instantiated. The watch expression shows: Listener = "bad argument #1 to ? (userdata expected, got table)" I assume that is related to version missmatch between lua 5.2 dll and debugger mobdeug but I an not able to find a working setup.

Anyone have had the same problem and was able to fix it?

A Zip or portable with running wireshark, lua and ZeroBrane to debug lua scripts for wireshark would be very appreciated.

Thank you,

Markus

Code:

_G.debug = require("debug")
require("mobdebug").start()

local function menuable_tap()
    -- Declare the window we will use
    local tw = TextWindow.new("Address Counter")

    -- This will contain a hash of counters of appearances of a certain address
    local ips = {}

    -- this is our tap
    local tap = Listener.new(nil, "ip")

    function remove()
            -- this way we remove the listener that otherwise will remain running indefinitely
            tap:remove()
    end

    -- we tell the window to call the remove() function when closed
    tw:set_atclose(remove)

    -- this function will be called once for each packet
    function tap.packet(pinfo,tvb)
            local src = ips[tostring(pinfo.src)] or 0
            local dst = ips[tostring(pinfo.dst)] or 0
            ips[tostring(pinfo.src)] = src + 1
            ips[tostring(pinfo.dst)] = dst + 1
    end

    -- this function will be called once every few seconds to update our window
    function tap.draw(t)
            tw:clear()
            for ip,num in pairs(ips) do
                    tw:append(ip .. "\t" .. num .. "\n");
            end
    end

    -- this function will be called whenever a reset is needed
    -- e.g. when reloading the capture file
    function tap.reset()
            tw:clear()
            ips = {}
    end
end

-- using this function we register our function
-- to be called when the user selects the Tools->Test->Packets menu
register_menu("Test/Packets", menuable_tap, MENU_TOOLS_UNSORTED)

asked 09 Apr '15, 06:28

supisupi's gravatar image

supisupi
6224
accept rate: 0%

edited 09 Apr '15, 06:42

grahamb's gravatar image

grahamb ♦
19.8k330206

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:

×431
×23
×16

question asked: 09 Apr '15, 06:28

question was seen: 1,741 times

last updated: 09 Apr '15, 06:42

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