8000 GitHub - ygarasab/pcap-writer: Simple Node.js pcap writer
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ygarasab/pcap-writer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pcap-writer

A simple pcap writer based on the core of node-pcap-writer, from Harsh Raval.

Example

Initialize:

const pcapw = require('pcpa-writer');

const pcapWriter = pcapw.createPcapWriter('file.pcap', 1500, 105);

This will also write global header. Then for writing data packets:

pcapWriter.writePacket(packet, timestamp);

Here packet is a Buffer object of Node JS containig data of packet. Timestamp needs to be in usec, if not set the packet will be written with the current relative timestamp.

And then finally close it:

pcapWriter.close();

This will close the file write stream so the file can be usable.

If you like, you can also add a callback function, to be called as soon as the writer finishes writing the last packet:

pcapWriter.close( (filename, elapsedTime) => {
    
    //your code here

} );

License

MIT

About

Simple Node.js pcap writer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0