Politecnico di Torino

Protocolli e Architetture di Routing

Capture and Parsing of HTTP Packets

Fulvio Risso

May 1, 2013

Introduction Given a personal computer equipped with a packet capture library, write a program in C language that: • Captures all the packets generated and received by the host • Writes, per each packet, a single line on screen reporting the following information (in case some information are not available, such as the PORT in case of a packet that is neither UDP nor TCP, please leave the field blank): timestamp

MAC_src -> MAC_dst

IP_src -> IP_dst

Protocol

PORTsrc -> PORTdst

• Check if the TCP the destination port of the packet is equal to ‘80’; in this case: – Check if the packet contains an HTTP request (e.g., a POST/GET command) – In this case, extract the URL contained in the packet (e.g., http://www.cnn.com) and print it on screen, after the data mentioned before.

Hints Capture library In order to capture the packets on your host, you need to have a packet capture library. e.g., either libpcap on Unix or WinPcap on Windows. However, if you want to develop some software based on this library, you need to install also the development libraries, e.g. libpcap-dev on Linux or the WinPcap Developer’s Pack on Windows. Please check the the instructions related to your operating system in order to install those packages. For instance, Linux lists them in its software repository, while in Windows you have to download (and install) both packages (the run-time library and the Developer’s Pack) from http://www.winpcap.org.

Documentation A rather complete documentation of the capture library (either libpcap on WinPcap) is available on the WinPcap website, http://www.winpcap.org, including programming samples. Since libpcap and WinPcap share the same API, the documentation that you can find on the WinPcap website applies also to libpcap, excluding some OS-specific topics such as how to compile/link your software under different operating systems. If you operate on Windows, please note that the WinPcap Developer’s Pack includes also some working examples, complete with source and project files (for Microsoft Visual Studio). It is strongly suggested to start with those files in order to avoid compilation/linking issues (e.g., due to required files located in the wrong folder).

Reading the packet data The packet capture library exports a set of primitives that allow the user software to receive the full packet, as it is received by the network interface card. This data is formatted as a plain buffer; you need to know the format of each protocol in order to parse the packet and check what is written inside.

2

Please refer to the proper documentation (e.g., RFCs) for the protocol you need; a brief summary is available at the following website: http://www.networksorcery.com/.

Byte ordering Please note that the information contained in the packet buffer is written in network byte order (which is big-endian), while Intel machines work the opposite way (little-endian). Therefore, all the fields that need to be read as numbers (e.g., TCP/UDP ports) need to be translated in the proper byte order before being able to operate on them (e.g., checking their value). In this case, it is stongly suggested to use the functions ntoh() (available in the C standard library) in order to convert numbers in the right format. More information on byte ordering is available at http://en.wikipedia.org/wiki/Endiannes.

3

Capture and Parsing of HTTP Packets

Given a personal computer equipped with a packet capture library, write a program in C language that: • Captures all the packets generated and received by the host. • Writes, per each packet, a single line on screen reporting the following information (in case some information are not available, such as the PORT in case of ...

132KB Sizes 1 Downloads 178 Views

Recommend Documents

System for signatureless transmission and reception of data packets ...
Aug 19, 1998 - between sites on the Internet or other networks of computer networks. ..... This approach has certain advantages, namely that it eliminates the need to “name” or ..... Wireless LANs”, IEEE Personal Communications, Feb. 1994.

System for signatureless transmission and reception of data packets ...
Aug 19, 1998 - CONNECTION. NETWORK ..... connection with IP data transfers is discussed in some detail ..... the disadvantage of having to carry the packet encryption ..... Wireless LANs”, IEEE Personal Communications, Feb. 1994.

PartBook for Image Parsing
effective in handling inter-class selectivity in object detec- tion tasks [8, 11, 22]. ... intra-class variations and other distracted regions from clut- ...... learning in computer vision, ECCV, 2004. ... super-vector coding of local image descripto

algebraic construction of parsing schemata
Abstract. We propose an algebraic method for the design of tabular parsing algorithms which uses parsing schemata [7]. The parsing strategy is expressed in a tree algebra. A parsing schema is derived from the tree algebra by means of algebraic operat

http://vustudents.ning.com http://vustudents.ning.com -
If a company possess higher required rate of return, the justified P/E will be. Lower ... In top-down approach of fundamental analysis, investors begin their analysis with: ... Interest sensitive industry ... Shares in mutual savings banks only.

Lightroom and Capture One
What happens when you push the boundaries of your imagination? The answer is obvious. ..... Lightroom aims for a standardized result where the tone and color rendering is deliberately made more conservative. This reminds me of the time I spent at art

Robust Learning-Based Parsing and Annotation of ...
Feb 2, 2011 - *X. S. Zhou is with the Siemens Medical Solutions USA, Inc., Malvern, PA. 19355 USA (e-mail: ...... In ad- dition, the algorithm removed on average 941 and 486 false pos- .... The authors would like to express their gratitude to.

On the Complexity and Performance of Parsing with ... - GitHub
seconds to parse only 31 lines of Python. ... Once these are fixed, PWD's performance improves to match that of other ...... usr/ftp/scan/CMU-CS-68-earley.pdf.

http://pdfbooksfree.blogspot.com http://pdfbooksfree ...
Page 1. http://pdfbooksfree.blogspot.com http://pdfbooksfree.blogspot.com. Page 2. http://pdfbooksfree.blogspot.com http://pdfbooksfree.blogspot.com. Page 3 ...

http://www.nepalspiritualtrekking.com/nepal/travel-info.html http ...
http://www.nepalspiritualtrekking.com/nepal/special-tour-programs/private-tour-program.html.

Robust Learning-Based Parsing and Annotation of ...
Feb 2, 2011 - Our algorithm was used to enhance advanced image visualization workflows by ... THE amount of medical image data produced nowadays.

January FHE packets - LDS Living
Make Family Home Evening a priority; learn to say no to other activities. 3. Involvement. Involve everyone ... Then came the distinct and clear message: “You have faith. You know what to do.” I climbed ... at 2:00 in the morning that night with a

Partnership Packets - NCMGA Annual Conference.pdf
muscadine industry. Page 3 of 6. Partnership Packets - NCMGA Annual Conference.pdf. Partnership Packets - NCMGA Annual Conference.pdf. Open. Extract.

Parsing words - GitHub
which access sequence elements without bounds checking (Unsafe sequence operations). ...... This feature changes the semantics of literal object identity.

Pfff: Parsing PHP - GitHub
Feb 23, 2010 - II pfff Internals. 73 ... 146. Conclusion. 159. A Remaining Testing Sample Code. 160. 2 ..... OCaml (see http://caml.inria.fr/download.en.html).

algebraic construction of parsing schemata
matics of Language (MOL 6), pages 143–158, Orlando, Florida, USA, July 1999. ... In Masaru Tomita, editor, Current Issues in Parsing Technology, pages ...

http://islamicbookshub.wordpress.com/
Page 1. http://islamicbookshub.wordpress.com/. Page 2. http://islamicbookshub.wordpress.com/. Page 3. http://islamicbookshub.wordpress.com/. Page 4 ...

http://islamicbookshub.wordpress.com/
Page 1. http://islamicbookshub.wordpress.com/. Page 2. http://islamicbookshub.wordpress.com/. Page 3. http://islamicbookshub.wordpress.com/. Page 4 ...

PartBook for Image Parsing
effective in handling inter-class selectivity in object detec- tion tasks [8, 11, 22]. ... automatically aligning real-world images of a generic cate- gory is still an open ...

Money Packets by IMS.pdf
Money Packets by IMS.pdf. Money Packets by IMS.pdf. Open. Extract. Open with. Sign In. Main menu. Displaying Money Packets by IMS.pdf. Page 1 of 1.

(hi-speed) software packets - Semantic Scholar
HIGHLY SPECIFIC BUT EDGILY EFFECTIVE DATA-. PROCESSING ... *For software request, please send email to C.G. Koay at [email protected]. Information about the software ... image domain [6]. 6. SNR Analysis of MR Signals [7].

STRIPING DELAY-SENSITIVE PACKETS OVER ...
the ARQ, the FEC, and the hybrid FEC/ARQ case. 1. ... and retransmissions (ARQ) — to optimize end-to-end packet delivery. Clearly ... for m = 0 and n ≥ 0 n−m. X i=0 p(i)R(m − 1, n − i − 1) for 1 ≤ m ≤ n. (5). We additionaly define r(m

Scheduling with pairwise XORing of packets under ...
Apr 5, 2012 - of all native packets that they overhear from the common medium. Second ... There is an important difference from the classical framework, however, the ..... to design a dynamic list of such size. Many of ...... [2] NCRAWL experiments.