-1

I can read any field from a pcap file by using lua script.I want to edit some fields,for example,the ack numbers and ip address.Can lua script handler this and how?

peter
  • 17
  • 1

1 Answers1

0

You can read and write files using Lua's Input and Output Facilities

For simple examples search the web and read https://www.lua.org/pil/21.2.html

For many common file formats you'll find specific io modules online. If not you have to write your own code, implementing the file format specificiation.

Piglet
  • 27,501
  • 3
  • 20
  • 43
  • I just want to use the wireshark api of lua to fill this ,not the lua io modules.Now I find the way to solve this,here https://www.wireshark.org/docs/wsdg_html_chunked/wsluarm_modules.html#lua_class_Dumper ,using api dumper:dump(timestamp, pseudoheader, bytearray),just modify bytearray,then it will work. – peter Aug 16 '17 at 08:33
  • @peter First of all Lua does not have a Wireshark API, Wireshark has a Lua API. Second you could have added this information to your question instead of waiting for people to waste their time.... Please read [ask] – Piglet Aug 16 '17 at 12:51
  • Ok,first,it is my fault.No clear expression about the lua api of wireshark.Second,my question is eidt a pcap file,people who knows this will know what i am talking about.Since you have not clear understanding of this,please do not answer.Your time is precious,so am I. – peter Aug 17 '17 at 06:35
  • @peter I answered your question properly as is. You cannot expect people to read your minds. You asked how to read a pcap file in Lua and I told you how to read any file in Lua. You did not mention that you wanted to read it using Wireshark's Lua API so don't blame me for not telling you. and If you would have read [ask] as I told you you wouldn't think that way. – Piglet Aug 17 '17 at 09:29