Closed cang233 closed 4 years ago
ok,i guess i know how to do.
newp,err := packet.NewPacket()
if err != nil{
fmt.Println("New packet Error:,",err.Error())
return
}
packet.GeneratePacketFromByte(newp,p.RawBytes)
If all you want to do is to read a PCAP file, you can also use SetReceiverFile
function which produces packets from a packet dump file. There are also ReadPcapGlobalHdr
and ReadPcapOnePacket
which allow reading packets from PCAP file.
I want to save some payloads from the packet in the handle function,and use this payload to new a packet.Packet then output it to a .pcap file,what should I do? I tried some codes but all failed with this error:
code: