Ask Your Question

leelli's profile - activity

2023-12-27 08:46:41 +0000 received badge  Popular Question (source)
2023-12-11 15:05:01 +0000 received badge  Notable Question (source)
2023-12-11 15:05:01 +0000 received badge  Popular Question (source)
2022-07-14 06:12:20 +0000 marked best answer Is there any difference in the way tshark and wireshark execute lua?

I want to print some needed logs through lua, the code is as follows.

The result obtained when tshark executes is correct.

When I open redis.pcap with wireshark I get a result that is repeated many times.

I would like to understand the reason for this difference and how should I modify my code for wireshark to work correctly

thank you very much

windows tshark : tshark -X lua_Script:hello.lu -r redis.pcap

lu.log:

2 0.000299000
3 0.000019000
5 0.000442000

wireshark lu.log:

2 0.000299000
3 0.000019000
5 0.000442000
2 0.000299000
3 0.000019000
5 0.000442000
2 0.000299000
3 0.000019000
5 0.000442000
2 0.000299000
3 0.000019000
5 0.000442000

hello.lua:

 T_gre_proto = Proto("test_pro","Test ")    
      tcp_ack = Field.new("tcp.analysis.ack_rtt")
      frame_num = Field.new("frame.number")
      file = io.open("C:\\Program Files\\Wireshark\\lu.log", 'w')

 function T_gre_proto.dissector(buffer,pinfo,tree)
     if tcp_ack() then
      frame_v = frame_num().value
      ttcp_v = tcp_ack().value

       file:write(string.format("%s %s\n",frame_v,ttcp_v) )

       file:flush()  

      end

  end

  register_postdissector(T_gre_proto)
2022-07-07 12:54:37 +0000 commented answer Is there any difference in the way tshark and wireshark execute lua?

hi Chuckc I found that no matter where I write file:close(), it will report an error or write less data. Where should I

2022-07-07 12:54:24 +0000 commented answer Is there any difference in the way tshark and wireshark execute lua?

hi Chuckc I found that no matter where I write file:close(), it will report an error or write less data. Where should I

2022-07-07 12:53:34 +0000 commented answer Is there any difference in the way tshark and wireshark execute lua?

hi Chuckc I found that no matter where I write file:close(), it will report an error or write less data. Where should I

2022-07-07 01:56:23 +0000 commented answer Is there any difference in the way tshark and wireshark execute lua?

Problem solved, thank you very much for your guidance

2022-07-06 17:21:19 +0000 commented answer Is there any difference in the way tshark and wireshark execute lua?

thank you very much for your reply But I still don't understand how to solve it, can I modify the hello.lua to solve it

2022-07-06 17:20:49 +0000 edited question Is there any difference in the way tshark and wireshark execute lua?

Is there any difference in the way tshark and wireshark execute lua? I want to print some needed logs through lua, the c

2022-07-06 02:03:26 +0000 received badge  Editor (source)
2022-07-06 02:03:26 +0000 edited question Is there any difference in the way tshark and wireshark execute lua?

Is there any difference in the way tshark and wireshark execute lua? I want to print some needed logs through lua, the c

2022-07-06 02:01:52 +0000 asked a question Is there any difference in the way tshark and wireshark execute lua?

Is there any difference in the way tshark and wireshark execute lua? I want to print some needed logs through lua, the c

2022-07-05 14:35:54 +0000 marked best answer How to get the dissector of GRE

Dissector name can be obtained through Dissector.list(),One of the names is ip.Then you can obtained the ipv4 Dissector through Dissector.get("ip").

now I want to get the Dissector of GRE, but I don't know the name of the GRE Dissector

The output of Dissector.list() also has no name like GRE or Generic Routing Encapsulation

2022-07-05 14:35:54 +0000 received badge  Scholar (source)
2022-07-05 14:28:35 +0000 commented answer How to get the dissector of GRE

thank you very much

2022-07-05 13:13:21 +0000 answered a question How to get the dissector of GRE

I already know: dissectortable:get_dissector(pattern)

2022-07-05 13:13:21 +0000 asked a question How to get the dissector of GRE

How to get the dissector of GRE Dissector name can be obtained through Dissector.list(),One of the names is ip.Then you

2022-07-05 13:13:20 +0000 asked a question How to get the dissector of GRE

How to get the dissector of GRE Dissector name can be obtained through Dissector.list(),One of the names is ip.Then you

2022-07-05 13:04:09 +0000 received badge  Rapid Responder