diff options
author | Laurent Ghigonis <laurent@p1sec.com> | 2012-12-11 21:19:01 +0100 |
---|---|---|
committer | Laurent Ghigonis <laurent@p1sec.com> | 2012-12-11 21:19:01 +0100 |
commit | 8aa586f75cff47db6fe408713f7b2eb8aedaedce (patch) | |
tree | dffaf0d775f7d18f50b6499485f45d608b8e16ac /gg_sniff/pcap.c | |
parent | correctly encode packet size and response type (diff) | |
download | glouglou-8aa586f75cff47db6fe408713f7b2eb8aedaedce.tar.xz glouglou-8aa586f75cff47db6fe408713f7b2eb8aedaedce.zip |
better packet encode / decode and size display, and colorisation of blobs
depending on connection id.
Diffstat (limited to 'gg_sniff/pcap.c')
-rw-r--r-- | gg_sniff/pcap.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gg_sniff/pcap.c b/gg_sniff/pcap.c index 0f95dad..8485eff 100644 --- a/gg_sniff/pcap.c +++ b/gg_sniff/pcap.c @@ -463,9 +463,9 @@ ip_handle(struct ip *ip, const u_char *pend, u_int wirelen) if (!close) { pkt.type = PACKET_DATA; pkt.data_connid = conn->id; - pkt.data_size = size / GG_PKTDATA_SIZE_FACTOR | (response << 7); + GG_PKTDATA_SIZE_ENCODE(pkt.data_size, ip->ip_len, response); gg_client_send(_cap.ggcli, &pkt); - ggnet_conn_data(_cap.net, conn, size, response); + ggnet_conn_data(_cap.net, conn, ip->ip_len, response); } else { pkt.type = PACKET_DELCONN; pkt.delconn_id = conn->id; @@ -474,13 +474,14 @@ ip_handle(struct ip *ip, const u_char *pend, u_int wirelen) } } else { if (!close) { - conn = ggnet_conn_add(_cap.net, &src, src_port, &dst, dst_port, proto, size, -1); + conn = ggnet_conn_add(_cap.net, &src, src_port, &dst, dst_port, proto, + ip->ip_len, -1); pkt.type = PACKET_NEWCONN; pkt.newconn_id = conn->id; pkt.newconn_src = src.s_addr; pkt.newconn_dst = dst.s_addr; pkt.newconn_proto = proto; - pkt.newconn_size = size << 8; + GG_PKTDATA_SIZE_ENCODE(pkt.newconn_size, ip->ip_len, response); gg_client_send(_cap.ggcli, &pkt); } else { gg_log_warn("user: captured connection close w/o open !"); |