Created
February 9, 2015 16:09
-
-
Save lanwin/46110a6510230e900e7d to your computer and use it in GitHub Desktop.
Parse tshark (Wireshark) data field capture file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require("fs"); | |
var content = fs.readFileSync("outfile.raw",{encoding:'ascii'}).toString().trim().split(/\r?\n/g); | |
var text = Buffer.concat(content.map(function(line){return new Buffer(line.trim(),'hex');})).toString('ascii').trim(); | |
text.split(/\r\n\r\n/g).forEach(function(line){ | |
var obj = JSON.parse(line); | |
console.log( ' ' ); | |
console.log( JSON.stringify(obj,null,line.length>200?2:0) ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment