tcp packet scanner

Posted on 2012-03-29
Last Modified: 2012-03-30

I am creating a kern module that scans the network and displays packet information

I want to display the remote port numbers, however i can only find how to display local port numbers (tcphdr->dest and tcphdr->source) Can anyone help?

also how can i display the packet data in hex?
Question by:codey-06
1 Comment
LVL 53

Accepted Solution

Infinity08 earned 500 total points
ID: 37785966
>> however i can only find how to display local port numbers (tcphdr->dest and tcphdr->source)

One of these is the local port, and the other is the remote port. Which is which depends on the direction the packet travelled.

>> also how can i display the packet data in hex?

The data can be found immediately after the TCP header. Just skip the appropriate amount of bytes (using tcphdr->doff), and display the data found there in hex.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an explanation of a simple data model to help parse a JSON feed
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now