<p>Okay, so this probably sounds terribly nefarious, but I need such capabilities for my senior project. Essentially I'm tasked with writing something that will cut down outbound spam on a zombified pc through a system of packet interception and evaluation. We have a number of algorithms we'll use on the captured messages, but it's the actual capture -- full on interception rather than just sniffing -- that has me a bit stumped.</p>

<p>The app is being designed for windows, so I can't use IP tables. I could use the winpcap libraries, but I don't want to reinvent the wheel if I don't have to. Ettercap seemed a good option, but a test run on vista using the unofficial binaries resulted in nothing but crashes.</p>

<p>So, any suggestions?</p>

<p>Update: Great suggestions. Ended up scaling back the project a bit, but still received an A. I'm thinking Adam Mintz's answer is probably best, though we used WinPcap and Wireshark for the application.</p>

[{'answer_id': 80398, 'author': 'Ilkka', 'author_id': 15064, 'author_profile': 'https://Stackoverflow.com/users/15064', 'pm_score': 0, 'selected': False, 'text': '<p>One would think <a href="http://www.wireshark.org/" rel="nofollow noreferrer">Wireshark</a> would solve your problem -- no hassle install and pretty easy to use.</p>\n\n<p>Edit: Ah, I see now the interception requirement vs. just sniffing.. in this case Wireshark alone won\'t cut it. Probably whatever\'s the equivalent of iptables on windows would.</p>\n'}, {'answer_id': 80402, 'author': 'Adam Mitz', 'author_id': 2574, 'author_profile': 'https://Stackoverflow.com/users/2574', 'pm_score': 3, 'selected': True, 'text': '<p>Sounds like you need to write a <a href="http://en.wikipedia.org/wiki/Layered_Service_Provider" rel="nofollow noreferrer">Winsock LSP</a>.</p>\n\n<blockquote>\n  <p>Once in the stack, a Layered Service Provider can intercept and modify inbound and outbound Internet traffic. It allows processing all the TCP/IP traffic taking place between the Internet and the applications that are accessing the Internet.</p>\n</blockquote>\n'}, {'answer_id': 80421, 'author': 'Chris de Vries', 'author_id': 3836, 'author_profile': 'https://Stackoverflow.com/users/3836', 'pm_score': 0, 'selected': False, 'text': '<p>The <a href="http://monkey.org/~dugsong/dsniff/" rel="nofollow noreferrer">DSNIFF</a> package has the mailsnarf utility. It can grab POP3 too. There are all sorts of other wonderful sniffing utilities there. Make sure you have the legal right before using these tools (the legal right to intercept other peoples traffic). I beleive the documentation has more information on the legality. According to the web page there are Windows and Mac OS X ports too.</p>\n\n<p>It would not be too hard to analyze the text output of the program.</p>\n'}, {'answer_id': 80426, 'author': 'Gopherkhan', 'author_id': 13825, 'author_profile': 'https://Stackoverflow.com/users/13825', 'pm_score': 0, 'selected': False, 'text': "<p>Ilkka: I was looking at Wireshark, but from what I could tell, that didn't handle the interception aspect -- only the sniffing and logging. The thing the professor's looking for is to prevent the spams from getting out onto the network.</p>\n\n<p>Adam: I'll definitely look into Winsock. I haven't checked that out yet. Only thing is the app's due in about 2 months, so if there are any OS apps that build off the WinSock SPI, I might want to tie into those. Know of any off the top of your head? </p>\n"}, {'answer_id': 80432, 'author': 'Gopherkhan', 'author_id': 13825, 'author_profile': 'https://Stackoverflow.com/users/13825', 'pm_score': 0, 'selected': False, 'text': "<p>Thanks, CDV. I'll look into that as well. Good call about the legality check. I've actually been trying to use gnu public license projects so far.</p>\n"}, {'answer_id': 80461, 'author': 'Jim In Texas', 'author_id': 15079, 'author_profile': 'https://Stackoverflow.com/users/15079', 'pm_score': 0, 'selected': False, 'text': '<p>I agree that Wireshark might be all you need.  If you want to write your own filter application and can use Vista, then check out the <a href="http://www.microsoft.com/whdc/device/network/WFP.mspx" rel="nofollow noreferrer">Windows Filtering Platform</a>. </p>\n'}, {'answer_id': 82017, 'author': 'INS', 'author_id': 13136, 'author_profile': 'https://Stackoverflow.com/users/13136', 'pm_score': 0, 'selected': False, 'text': '<p><a href="http://www.tcpdump.org/" rel="nofollow noreferrer">tcpdump</a> if you need command line or something more visual like <a href="http://www.wireshark.org/" rel="nofollow noreferrer">wireshark</a></p>\n\n<p>If you want to write something on your own use <a href="http://www.tcpdump.org/" rel="nofollow noreferrer">libpcap</a>.</p>\n'}, {'answer_id': 87083, 'author': 'JBB', 'author_id': 12332, 'author_profile': 'https://Stackoverflow.com/users/12332', 'pm_score': 0, 'selected': False, 'text': "<p>Use Snort, stripped down, if this is a long-term thing. It's built to watch for particular packets flying by, examining payload where needed, recording data and launching alerts.</p>\n\n<p>It's intended for intrusion detection, but it makes a surprisingly good network monitor for particular things over long term use.</p>\n"}]
['https://Stackoverflow.com/questions/80341', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/13825/']