If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Packet Sniffer/Firewall

Anyone know of some ways to program a packet sniffer or decent firewall in VB? Possible some API's? So Far I have found nothing worthwhile in API Guide. I think I heard awhile back that VB isnt lowlevel enough to intercept the TCP/IP packets. If its not possible, maybe so other languages that would be good to program one in.

[gloworange]And then it happened... a door opened to a world... rushing through the phone line like heroin through an addict\'s veins, an electronic pulse is sent out, a refuge from the day-to-day incompetencies is sought... a board is found. \"This is it... this is where I belong...\" I know everyone here... even if I\'ve never met them, never talked to them, may never hear from them again... I know you all...[/gloworange]

Although programming a packet sniffer or a firewall is possible using VB, I think there would be
better languages suited to this task. Like you said, VB really isn't low-level enough to handle these things, but there are various addin technologies that make this possible (DLL's, COM's, OCX's just to name a few). Using controls like mswinsck.ocx, libpcab, or even packages like dart tcp / server (Just to name a few) make authoring TCP apps easier then coding all the rudimentary packet stuff yourself. It's even possible to write using scipting ; (vb, java, wscript).
When your coding for sniffing and firewalls, your talking about TCP/IP socket manipulation.
I'm gonna assume that since your thinking about programming these, you already have atleast a general idea of tcp/ip. If not, you should definatly google for it to learn more.

These addin's will give you access to some important elements by exposing some higher level functions. Programming a sniffer would basically involve putting the interface into promiscuos mode so that it will read all network traffic (Not just the data meant for you). On anything but a small network there will be a lot of traffic, so adding some kinda of packet filtering would be important. My advice would be to use the libpcap library for working with sockets, it's a great collection of code and should have everything you need for a decent network app. All good network addin's have some method of binding to ports. This would be usefull for a firewall. you should also look at the various hook functions in the Win32 API. These will help when
dealing with and enforcing and networking policy's your firewall might have to implement. I know my information wasn't to specific, but I tried to give you just an overview and maybe maybe a place to start. If you have anymore questions let me know...

We are a generation without a middle. We have no great war or depression. Our war is a spiritual one, our depression is our lives. We were all raised to believe that we\'ll all be millionaires and rockstars - But we won\'t.
And we are slowly learning this fact...And we are VERY pissed off about it!

Thanks, both posts were helpful. Ive seen a few examples in VB using the winpcap lib. Thanks for the info.

[gloworange]And then it happened... a door opened to a world... rushing through the phone line like heroin through an addict\'s veins, an electronic pulse is sent out, a refuge from the day-to-day incompetencies is sought... a board is found. \"This is it... this is where I belong...\" I know everyone here... even if I\'ve never met them, never talked to them, may never hear from them again... I know you all...[/gloworange]