Important alert: (current site time 7/15/2013 9:09:20 AM EDT)
 

winzip icon

PackMon.NET / Sniffer.NET (Latest By 5 Oct 2005)

Email
Submitted on: 10/5/2005 2:49:03 PM
By: PipalHub 
Level: Advanced
User Rating: By 17 Users
Compatibility: C#, VB.NET
Views: 33750
author picture
(About the author)
 
     An update to my award winning Sniffer.Net which use my Sniffer.Net Library. I have included support for viewwing the contents of the packet by double clicking any packet from the list view. PackMon was my very first attempt of making a Network Packet Capturing tool in .NET i have created similar tools in vb6 using winpcap library. but this time i have created my own library in .NET which can monitor all network traffic. PackMon.NET is a .NET library is inspired by a similar code from http://www.mentalis.org/ their code was a great help for me i have converted some parts exactly the same from C#.Net to VB.Net but most of the code is entirely written by me. please give me Globes if you really like this code. you can use the library and provided sample application that use the library but please do give me credit for the same. This is still a beta version and i thought that together we can make it a really big and powerful project. This time also i need support from you guys to help make this a really big success. i want to make it plugin based so that as one of user suggested we might use it as Firewall or bandwidth monitoring tool... there is so much that can be done with this but the next big update would be general purpose plugins plus editing the contents of the packet before sending to the target machine.

 
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
//**************************************
// for :PackMon.NET / Sniffer.NET (Latest By 5 Oct 2005)
//**************************************
This code is FREE to use but only for educational purpose. Any commercial use of the code/part of the code requires written permission from v2Softwares.
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 4 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

10/6/2005 1:18:23 AMAndrew Vos

shweet man!

(If this comment was disrespectful, please report it.)

 
10/26/2005 4:20:55 AMLucL

truly excellent code.
(If this comment was disrespectful, please report it.)

 
10/31/2005 12:39:51 PMKidambi

Nice... Very cool. thanks a lot.
Would you also tell me how to display the packets in "readable" manner - in plain english like to see the contents of the package in english that in numbers?

(If this comment was disrespectful, please report it.)

 
10/31/2005 12:40:41 PMKidambi

Forgot to rate it.
(If this comment was disrespectful, please report it.)

 
11/18/2005 11:17:27 AMJTR

This works great on a wired connection but fails on every wireless connection I try. Do you have any feedback on how to correct this. I thought you might want to include this functionality in future releases.
(If this comment was disrespectful, please report it.)

 
11/24/2005 4:43:21 AMemmanuel

hey... simply superb...
(If this comment was disrespectful, please report it.)

 
2/7/2006 8:34:24 AMOri Lahav

Thanks you VERY much! That awsome!
But there is a little problem... What about wireless connection?
What I know, that the program "Ethereal" (for packet monitoring) dosn't working too until you tell the program not to capture in promiscuous mode (from the options), maybe it's could help...
(If this comment was disrespectful, please report it.)

 
2/16/2006 3:48:57 AMv2Softwares

Hi Ori


Thanks for the suggestion and as we are very much busy in our live projects we could not get enough time to update this Open Source Project and need a community to help and enhance it to become more of a product rather being just a program. you can visit our website ie www.v2softwares.com to download the latest code and binaries for both versions of framework 1.1 and 2.0. we need the help of people who can actually part in the development of it and actively provide updates to it and we will make sure they would get enough recognision through our website and in credits section of the program.
(If this comment was disrespectful, please report it.)

 
2/17/2006 4:41:25 PMv2Softwares

Greetings

Download Latest Sniffer.NET
http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=4519&lngWId=10

The new version for Sniffer.NET is finally arrived. The major change in this version is the support of Plugins and the plugin architecture is very generic and every loaded plugin recieve the event on every packet arrive on the TCP stack either its incoming or outgoing packet and the plugin can reject or approve the request of this packet to be showned in the main application's list. the plugin manager is very powerful and a single assembly/DLL can contain more than one plugin. a sample plugin is also provided which act as a HTTP filter and once loaded only allow Tcp Traffic which arrive on port 80 or goes to port 80 of destination address. so you can use this plugin to show only HTTP Protocol's activities. i request you all to extend the funcionality by means of writing plugin for it.

Thanks
v2Softwares Team
(If this comment was disrespectful, please report it.)

 
2/22/2006 6:32:08 PMVorlonS

it is sad you do not mention neither credit where the original code comes from . This is not your own work mostly. Most code is from Mentalis.org and http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=2546&lngWId=10
(If this comment was disrespectful, please report it.)

 
6/3/2006 4:11:05 PMJohn C. H. Fricker

Is it possible to manipulate the messages sent?

Thanks
John
(If this comment was disrespectful, please report it.)

 
6/24/2006 10:03:12 PMCNY_NetTech

I too have a wireless NIC and was able to get this code to work by changing the following line in the Monitor class:

was:

m_Monitor.IOControl(SIO_RCVALL, BitConverter.GetBytes(1), Nothing)

changed to:

m_Monitor.IOControl(SIO_RCVALL, BitConverter.GetBytes(0), Nothing)
(If this comment was disrespectful, please report it.)

 
6/24/2006 10:07:24 PMCNY_NetTech

below is half a function (can only a 1000 character message) to display the packet in a string format:

Public Shadows Function ToString(ByVal RawData As Boolean) As String
Dim sb As StringBuilder = New StringBuilder(raw.Length)

If RawData Then
Dim i As Integer = 0
While i < Raw.Length
If Raw(i) > 31 Then
'sb.Append(CStr(Raw(i)))
sb.Append(Encoding.ASCII.GetString(Raw, i, 1))
Else
sb.Append(".")
End If
System.Math.Min(System.Threading.Interlocked.Increment(i), i - 2)
End While
Else
(If this comment was disrespectful, please report it.)

 
6/24/2006 10:09:50 PMCNY_NetTech

below is the second of 3 messages with the function to display the packet in a readable format:

Else
Dim rawString As String = Me.ToString(True)
Dim i As Integer = 0
While i < Raw.Length
Dim j As Integer = i
While j < Raw.Length AndAlso j < i + 16
sb.Append(Raw(j).ToString("X2") + " ")
System.Math.Min(System.Threading.Interlocked.Increment(j), j - 1)
End While
If rawString.Length < i + 16 Then
sb.Append(" "c, ((16 - (rawString.Length Mod 16)) Mod 16) * 3)
sb.Append(" " + rawString.Substring(i) + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "")
Else
(If this comment was disrespectful, please report it.)

 
6/24/2006 10:10:58 PMCNY_NetTech

Last bit of the function(someone please clean up these posts for me and make public)......Just replace this function with the similar one in the packet class:

sb.Append(" " + rawString.Substring(i, 16) + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "")
End If
i += 16
End While
End If
Return sb.ToString
End Function
(If this comment was disrespectful, please report it.)

 
8/1/2006 3:00:17 AMSam Beydoun

Hi,
I really like your work!
I only using the PackMon.net.dll but my vb.net application only allows local admin users to use the dll.
I have set up all the .net secruity settings but no luck!
Any suggestions?
(If this comment was disrespectful, please report it.)

 
1/29/2007 9:52:13 AMmOm

when i try to start moniter i get this message:

There was a problem starting the packet monitor for interface 10.0.0.5
[The specified procedure could not be found]
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.