Click here to Skip to main content
Click here to Skip to main content

Network Sniffer

, 19 Jul 2004 CPOL
Rate this:
Please Sign up or sign in to vote.
Network Sniffer

Sample Image - Sniffer.jpg


A "Packet Sniffer" is a utility that sniffs without modifying the network's packets in any way. By comparison, a firewall sees all of a computer's packet traffic as well, but it has the ability to block and drop any packets that its programming dictates. Packet sniffers merely watch, display, and log this traffic.

One disturbingly powerful aspect of packet sniffers is their ability to place the hosting machine's network adapter into "promiscuous mode." Network adapters running in promiscuous mode receive not only the data directed to the machine hosting the sniffing software, but also ALL of the traffic on the physically connected local network.

I hope that this piece of code will help you understand the network better.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Eran Aharonovich
Software Developer
Australia Australia
Been a programmer since 1999.
Experience in:
.Net, C++, C#, VB, VB.NET, ASP, ASP.NET, DLLs, COM etc.

Comments and Discussions

QuestionNetwork Sniffer in another language PinmemberAdamsonn14-Aug-14 1:43 
BugMemory leaking Pinmemberruiwng4-Mar-13 1:34 
Questionaccess permissions Pinmemberyudaavni18-Feb-13 5:01 
AnswerRe: access permissions Pinmemberruiwng4-Mar-13 1:39 
QuestionNetwork problems PinmemberAJMAL SHAHZAD10-Dec-12 19:48 
QuestionI've got problem with commpiling on VS 2008 Pinmember1nbveh24-Apr-12 5:21 
AnswerRe: I've got problem with commpiling on VS 2008 Pinmemberlakshmanakumar_varada7-Nov-12 23:58 
GeneralMy vote of 1 Pinmemberrobmar8-Nov-11 13:08 
AnswerRe: My vote of 1 Pinmemberboris.pong18-Jun-12 22:23 
Questioncan't build in visual 2010 + MS SDK 7.0 PinmemberYohanes Pradono23-Jul-11 20:11 
AnswerRe: can't build in visual 2010 + MS SDK 7.0 Pinmembermla15427-Sep-11 7:26 
Questionhey how to run this project ............... Pinmembersilverkali13-Oct-10 3:53 
AnswerRe: hey how to run this project ............... PinmemberYohanes Pradono23-Jul-11 16:26 
GeneralMy vote of 1 Pinmemberdheeraj_jun218-Dec-08 18:34 
Generalpacket sniffer Pinmembersatheesh.S28-Oct-08 20:39 
GeneralRe: packet sniffer Pinmemberpriyanka,oberoi110-Aug-09 2:33 
GeneralGood Project, what is the format to save? does it support Packetbone Pinmemberjerrysmith2222-Jul-08 18:50 
GeneralWhich compiler? Visual C++ .NET? (=Version 7) Pinmembergerspeece28-Mar-08 6:16 
GeneralRe: Which compiler? Visual C++ .NET? (=Version 7) PinmemberEran Aharonovich29-Mar-08 1:33 
Questionhelp me how to compile and execute the project.... Pinmemberrahul.csit28-Feb-08 18:36 
QuestionIt works in visual c++ 6.0?? Pinmemberuriel_slp24-Oct-07 11:23 
AnswerRe: It works in visual c++ 6.0?? Pinmemberuriel_slp24-Oct-07 11:27 
QuestionPlease I Need Help Pinmembermustafa_kh_200710-Sep-07 5:03 
QuestionWe can catch the TCP packet only? PinmemberMD8414-May-07 22:57 
AnswerRe: We can catch the TCP packet only? PinmemberEran Aharonovich14-May-07 23:03 
GeneralRe: We can catch the TCP packet only? Pinmemberpriyanka,oberoi110-Aug-09 2:37 
Generalgetting IP address PinmemberAYcoder7-Aug-06 10:08 
QuestionOutbound traffic is not catched PinmemberJohn Ashraf24-Jul-06 13:22 
Generalrunning the network sniffer Pinmemberujal13-Jul-06 8:18 
GeneralRe: running the network sniffer PinmemberEran Aharonovich13-Jul-06 8:27 
GeneralRe: running the network sniffer Pinmemberujal14-Jul-06 6:33 
Generaldisplay number of packets PinmemberdReAmWoNderS5-Jul-06 5:48 
QuestionMore fragments problem PinmemberWouter Dhondt18-Jun-06 6:06 
GeneralXP SP2 Problem Pinmemberjopus22-Jul-05 12:31 
GeneralI Get Inbound traffic only Pinmemberjopus28-Apr-05 21:23 
GeneralPlease help me! PinmemberdSolariuM29-Mar-05 5:45 
GeneralRe: Please help me! PinmemberEran Aharonovich30-Mar-05 7:32 
QuestionAnd the environment is? Pinmemberabica1-Mar-05 5:42 
AnswerRe: And the environment is? PinmemberEran Aharonovich25-Jul-05 2:07 
QuestionHow top begin writing a packet sniffer? Pinmembergrace4raghu227-Dec-04 5:42 
GeneralFeeto Pinsussfeeto27-Dec-04 4:46 
GeneralRe: Feeto PinsussAnonymous27-Dec-04 5:45 
GeneralHi PinmemberSanjit Rath1-Nov-04 5:21 
I have downloaded your article and given 5/5. I have understood most of them, but it would be quite good if you can elaborate on the following functions.

bool CSnifferDlg::ParseTCPPacket(const CString& source, const CString& destination, TCP_HDR* pTCPHeader, char* pData, unsigned long len )

and structure

struct Session
unsigned int sourcePort, destPort;
CString sourceIP, destIP;

Session* pOtherSide;

tcp_seq ISN;
DWORD len;

I will be grateful if you can give some links on the content. I am currently working on such a project. I am finding it hard to get information about the IP data grams and other headers. Also if any book on the subject that you can suggest will be helpful.

Thanking you,
Smile | :)
GeneralRe: Hi PinmemberEran Aharonovich25-Jul-05 2:22 
GeneralThe article Location Pinmembersergeyv20028-Sep-04 11:26 
GeneralRe: The article Location PinmemberEran Aharonovich30-Mar-05 7:33 
GeneralNice sniffer.. but.. PinmemberMichael Hendrickx21-Aug-04 4:49 
GeneralRe: Nice sniffer.. but.. PinmemberEran Aharonovich21-Aug-04 8:43 
GeneralRe: Nice sniffer.. but.. PinmemberMichael Hendrickx21-Aug-04 21:37 
GeneralRe: Nice sniffer.. but.. PinmemberThatsAlok10-Nov-04 23:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150414.1 | Last Updated 20 Jul 2004
Article Copyright 2004 by Eran Aharonovich
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid