Skip to content

Commit

Permalink
Add src and dst mac address to http session
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Kunkle committed Nov 28, 2011
1 parent 884430d commit 1bc0328
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pcap.js
Original file line number Diff line number Diff line change
Expand Up @@ -1510,21 +1510,25 @@ TCP_tracker.prototype.track_next = function (key, packet) {
};

TCP_tracker.prototype.track_packet = function (packet) {
var ip, tcp, src, dst, key, session, self = this;
var ip, tcp, src, src_mac, dst, dst_mac, key, session, self = this;

if (packet.link && packet.link.ip && packet.link.ip.tcp) {
ip = packet.link.ip;
tcp = ip.tcp;
src = ip.saddr + ":" + tcp.sport;
src_mac = packet.link.shost;
dst = ip.daddr + ":" + tcp.dport;
dst_mac = packet.link.dhost;
key = this.make_session_key(src, dst);
session = this.sessions[key];

if (tcp.flags.syn && !tcp.flags.ack) {
if (session === undefined) {
this.sessions[key] = {
src: src, // the side the sent the initial SYN
src_mac: src_mac,
dst: dst, // the side that the initial SYN was sent to
dst_mac: dst_mac,
syn_time: packet.pcap_header.time_ms,
state: "SYN_SENT",
key: key, // so we can easily remove ourselves
Expand Down

0 comments on commit 1bc0328

Please sign in to comment.