pcap

Is there a way to programatically export files using Wireshark's facilities?

Hi everyone. I am trying to automate a repetitive manual process for which I use WireShark: 1) Load a given pcap file 2) Apply a simple filter for a given protocol 3) Use the export dialog box to export the displayed packets to CSV file 4) Use the export dialog box to export the displayed packets in XML PDML form. This is tedious, a...

question about pcap

hi, i have to do a sniffer as an assignment for the security course. i am using c and the pcap library. i got everything working well (since i got a code from the internet and changed it). but i have some questions about the code. u_int ip_len = (ih->ver_ihl & 0xf) * 4; ih is of type ip_header, and its currently pointing the to...

printing sequence number of a sniffed packet

i am using pcap to create a packet sniffer. i have this tcp structure: typedef struct TSP_header{ unsigned short int sport; unsigned short int dport; unsigned int seqnum; unsigned int acknum; unsigned char reserved:4, offset:4; unsigned int tcp_res1:4, //little-endian ...

help using pcap library to sniff packets

i am using pcap sample codes to create my own sniffer. i downloaded their sample sniffer and its working on windows but not on linux. i am using gcc compiler on both machines, and i have only pcap.h included. the error is : dereferencing pointer to incomplete type. the netmask is causing the error. the netmask is the mask of the first ad...

Pypcap for mac on python 2.6?

How do you end up running pypcap for python 2.6 on a mac? It seems that there hasn't been any new releases since 2.5 or am I just looking in the wrong places? I seem to be unable to install the 2.5 binary with the following error: You cannot install pcap 1.1 on this volume. pcap requires System Python 2.5 to install. ...

Issue reading packets from a pcap file. dpkt module. What gives?

I am running the following test script to try to read packets from a sample .pcap file I have downloaded. It won't seem to run. I have all of the modules, but no examples seem to be running. import socket import dpkt import sys pcapReader = dpkt.pcap.Reader(file("test1.pcap", "rb")) for ts, data in pcapReader: ether = dpkt.etherne...

'module' object has no attribute 'pcapObject'

I have the following sample code which doesn't seem to want to run. import pcap pc = pcap.pcapObject() dev = sys.argv[1] pc.open_live(dev, 1600, 0, 100) pc.setfilter("udp port 53", 0, 0) while 1: pc.dispatch(1, p.pcap_dispatch) I'm really not sure why. I'm using pypcap. I'm running this on both 2.5.1 and 2.6 versions of python (...

missing elements from pcap?

When I check the attributes available to the module pcap, I expect to see something like [ ...snip... 'dltvalue', 'findalldevs', 'lookupdev', 'lookupnet', 'ntoa', 'pcapObject', 'pcapObjectPtr'] With note on pcapObject. However, all I get when running dir(pcap) is [ ... snip... 'copyright', 'doc', 'file', 'license',...

SharpPcap - A Packet Capture getting messesge problem.

I trying to capture packets using SharpPcap library. I'm able to return the packets details but I'm having problem to get what the message content inside the packet. the packet using .Data to return the message and when I use it it is returning (System.Byte[]). here is the library website: http://www.codeproject.com/KB/IP/sharppcap.asp...

Capturing network traffic in ruby - pcap related issues

What I need is to write very simple application, which would listen to network traffic, filter out some packets based on various layer 4/5 information and then dump those information into database. I am quite confused on which pcap gem/plugin should I use. The basic pcap implemention seem to be a bit outdated (no changes since 2001) and...

Traceroute Theory

I am toying with trace route, my application send a ICMP echo request with a ttl of 0 every time i receive a time exceeded message i increment the ttl by one and resent the package, but what happens is I have 2 routers on my network i can trace the route through these router but third hop always ends up being one of the open dns servers ...

Anyone had any experience with *.pcap manipulation libs?

I'm using the SharpPcap + PacketDotNet libraries to process some .pcap files and came across a bug in the way the timestamps are calculated. Take this Timeval property, which is something along these lines: PosixTimeval Timeval { DateTime Date; ulong Seconds; ulong MicroSeconds; } The problem is as follows: Suppose you ha...

pcap and iptables tussle

hello, I have setup a DNS server on a machine. I want to capture the DNS replies before the machine sends out, and change some fields in it and then send the packet. I am only able to change fields in the packet my pcap code(written in C) captures, which seems like a copy, as the original packet is also transmitted. I tried iptables t...

PCAP Web Service Usage Logging for Dummies

I've been assigned the task (for work) of working with PCAP for the first time in my life. I've read through the tutorials and have hacked together a real simple capture program which, it turns out, isn't that hard. However, making use of the data is more difficult. My goal is to log incomming and outgoing web service requests. Are t...

How can I edit a js file sent by the server before it gets to my browser?

During a normal browsing session I want to edit a specific javascript file before the browser receives since once it gets there it's impossible to edit. Is there are any tool for this? For what I need it I can't just save it and edit it on my disk. I'm ready to learn how to program it myself but if anyone can point out more or less what...

How do I create a new thread to make pcap_loop() and gtk_main() compatible?

These two functions are both infinite loops, and the programe hangs once called in the same thread. gtk_main(); ... pcap_loop(adhandle, 0, packet_handler, NULL); When I click the "start" button,I want pcap to start working;And if I press the "stop" button,pcap stop. How do I create a child thread and run pcap_loop(adhandle, 0, pack...

Benchmark for a .NET WinPcap wrapper

I'm developing a .NET wrapper for WinPcap called Pcap.Net. I'm trying to make sure this wrapper has high performance and I want to compare it to WinPcap and to other .net wrappers for WinPcap. The features I want to profile are: WinPcap native features (sending packets in different ways, receiving packets in different ways...) Interp...

Where is a good place for a code review?

Hi, all! A few colleagues and I created a simple packet capturing application based on libpcap, GTK+ and sqlite as a project for a Networks Engineering course at our university. While it (mostly) works, I am trying to improve my programming skills and would appreciate it if members of the community could look at what we've put together....

Writing an http sniffer (or any other application level sniffer)

Dear all, I am trying my hands understanding PCAP libraries. I am able to apply a filter and get the TCP payload at port 80. But what next ? How can I read the HTTP data - suppose I want to know the "User Agent" field value in the http header..how should I proceed ? I have searched the website (and googled a lot too), and could find a re...

How restore data from pcap file?

Hi ppl =) I have following file: test_network.pcap: tcpdump capture file (little-endian) - version 2.4 (Ethernet, capture length 65535) I know that in this file are few video streams and i need to extract them. How can i do this? The biggest problem is that size of file ~180 GB )) ...