Click here to Skip to main content
15,896,453 members
Articles / Desktop Programming / MFC

Internet Traffic Firewall and Sniffer

Rate me:
Please Sign up or sign in to vote.
4.91/5 (26 votes)
23 Oct 2007GPL33 min read 101.2K   9.1K   133  
The article demonstrates internet packets interception with firewall capabilities based on IpFilterDriver driver and sending TCP/UDP/ICMP packets using raw sockets with IP spoofing support.
// SnifferView.h : interface of the CSnifferView class
//


#pragma once


class CSnifferView : public CListView
{
protected: // create from serialization only
        CSnifferView();
        DECLARE_DYNCREATE(CSnifferView)

// Attributes
public:
        CSnifferDoc* GetDocument() const;

// Operations
public:

// Overrides
public:
        virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
        virtual void OnInitialUpdate(); // called first time after construct

// Implementation
public:
        virtual ~CSnifferView();
#ifdef _DEBUG
        virtual void AssertValid() const;
        virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
        DECLARE_MESSAGE_MAP()





private:
        CListCtrl *m_cList;
        int itemindex;
        CMenu *cmenu;
        CPoint point;
        int m_widths[COLUMNS];

        void AddListData(BYTE *data, int size, bool drop = false);

        afx_msg LRESULT Packet(WPARAM, LPARAM);
        afx_msg LRESULT Filter(WPARAM, LPARAM);

protected:
        virtual void OnUpdate(CView* /*pSender*/, LPARAM /*lHint*/, CObject* /*pHint*/);


public:
        afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
        afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
};




#ifndef _DEBUG  // debug version in SnifferView.cpp
inline CSnifferDoc* CSnifferView::GetDocument() const
{
        return reinterpret_cast<CSnifferDoc*>(m_pDocument);
}
#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Engineer
Russian Federation Russian Federation
Highly skilled Engineer with 14 years of experience in academia, R&D and commercial product development supporting full software life-cycle from idea to implementation and further support. During my academic career I was able to succeed in MIT Computers in Cardiology 2006 international challenge, as a R&D and SW engineer gain CodeProject MVP, find algorithmic solutions to quickly resolve tough customer problems to pass product requirements in tight deadlines. My key areas of expertise involve Object-Oriented
Analysis and Design OOAD, OOP, machine learning, natural language processing, face recognition, computer vision and image processing, wavelet analysis, digital signal processing in cardiology.

Comments and Discussions