<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Andrew Healey's Blog &#187; tutorial</title>
	<atom:link href="http://halfloaded.com/blog/tag/tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://halfloaded.com</link>
	<description>Smash forehead on keyboard to continue...</description>
	<lastBuildDate>Tue, 20 Jul 2010 18:11:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Part 3: Blocking Bad Hosts &#8211; Blocking Them, Easily (CLI Edition)</title>
		<link>http://halfloaded.com/blog/part-3-blocking-bad-hosts-blocking-them-easily-cli-edition/</link>
		<comments>http://halfloaded.com/blog/part-3-blocking-bad-hosts-blocking-them-easily-cli-edition/#comments</comments>
		<pubDate>Fri, 25 Dec 2009 19:13:57 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[ipsec]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://halfloaded.com/?p=349</guid>
		<description><![CDATA[In part two, I showed you how to use the Local Security Policy GUI to block the bad guys. There were a lot of pretty pictures for those that prefer the GUI. In this version, I’ll show you how to accomplish the same thing from the command line. This is my preferred method.  It is [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://halfloaded.com/blog/part-2-blocking-bad-hosts-blocking-them-easily-gui-edition/">part two</a>, I showed you how to use the Local Security Policy GUI to block the bad guys.  There were a lot of pretty pictures for those tha<a href="http://halfloaded.com/wp-content/uploads/2009/12/command-line-big.png"><img class="alignright size-full wp-image-388" title="command-line-big" src="http://halfloaded.com/wp-content/uploads/2009/12/command-line-big.png" alt="" width="130" height="101" /></a>t prefer the GUI.  In this version, I’ll show you how to accomplish the same thing from the command line.  This is my preferred method.  It is much simpler to automate and explain.</p>
<p>By following the steps below, you will be able to create a new policy and manage the filter lists and actions.  The goal here will be to put all these pieces together into a nice tidy package that is fully automated.<span id="more-349"></span></p>
<p>The policy you create in this tutorial will not be applied to the system until you &#8220;Assign&#8221; the policy in Step 6.  As long as the policy is not assigned, you can safely edit, add, remove, etc. rules and sets to the policy without affecting the system.  <span style="color: #ff0000;"><em>Note: double and triple check your sets to ensure you do not block legitimate traffic before assigning the policy.</em></span></p>
<p>To begin this tutorial, open the command prompt. <span style="text-decoration: underline;"> If you don’t know how, you probably shouldn’t be doing this</span>.  All commands meant to be typed are in <em>italics</em>.</p>
<h3>Step 1: Create IP Security Policy</h3>
<p><em>netsh ipsec static add policy description=&#8221;This policy blocks all traffic to hosts/nets associated with it.&#8221;</em></p>
<h3>Step 2: Create an IP Filter List</h3>
<p><em>netsh ipsec static add filterlist description=&#8221;This filter list contains hosts and networks known to host malware, criminal activity, etc.&#8221;</em></p>
<h3>Step 3: Create IP Filters and Associate them with the Filter List (Repeat this step until all hosts you wish to block have been entered)</h3>
<p>Single IP (<strong>10.254.254.254/32</strong>)</p>
<p style="padding-left: 30px;"><em>netsh ipsec static add filter filterlist=&#8221;Bad Hosts&#8221; <strong>srcaddr=10.254.254.254</strong> dstaddr=any description=&#8221;John Smith. 12/31/2015. Brute force logon attempts to: SERVER01&#8243;</em></p>
<p>Subnet (<strong>10.254.254.0/24</strong>)</p>
<p style="padding-left: 30px;"><em>netsh ipsec static add filter filterlist=&#8221;Bad Hosts&#8221; <strong>srcaddr=10.254.254.0</strong> dstaddr=any <strong>srcmask=24</strong> description=&#8221;John Smith. 12/31/2015. Brute force logon attempts to: SERVER01&#8243;</em></p>
<p>Network Range (<strong>10.254.254.2-10</strong>)</p>
<p style="padding-left: 30px;"><em>netsh ipsec static add filter filterlist=&#8221;Bad Hosts&#8221; <strong>srcaddr=10.254.254.2-10.254.254.15</strong> dstaddr=any description=&#8221;John Smith. 12/31/2015. Brute force logon attempts to: SERVER01&#8243;</em></p>
<h3>Step 4: Create a Filter Action</h3>
<p><em>netsh ipsec static add filteraction description=&#8221;This action blocks all traffic.&#8221; action=block</em></p>
<h3>Step 5: Create Policy Rule to apply Filter Action to Filter List</h3>
<p><em>netsh ipsec static add rule policy=&#8221;Blocked Traffic&#8221; filterlist=&#8221;Bad Hosts&#8221; filteraction=&#8221;Block All Traffic&#8221; activate=yes</em></p>
<h3>Step 6: Assigning (and un-assigning) the Policy</h3>
<p>This step will apply all the settings you have created up to this point.  <span style="color: #ff0000;">Double and triple check that you did not enter a valid host or network or it will be blocked.  If fact, if you have any doubts in your mind, do not do this step until another person (who knows what they are doing) looks over your work too!  Note: This is one place MS will not give you a little &#8220;are you sure you want to do this&#8221; type of warning.  As soon as you assign the policy, it is done.</span></p>
<p><strong>Assign</strong></p>
<p style="padding-left: 30px;"><em>netsh ipsec static set policy name=&#8221;Blocked Traffic&#8221; assign=yes</em></p>
<p><strong>Un-assign</strong></p>
<p style="padding-left: 30px;"><em>netsh ipsec static set policy assign=no</em></p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge">
<ul class="socials">
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://halfloaded.com/blog/part-3-blocking-bad-hosts-blocking-them-easily-cli-edition/&amp;t=Part+3%3A+Blocking+Bad+Hosts+-+Blocking+Them%2C+Easily+%28CLI+Edition%29" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://halfloaded.com/blog/part-3-blocking-bad-hosts-blocking-them-easily-cli-edition/&amp;title=Part+3%3A+Blocking+Bad+Hosts+-+Blocking+Them%2C+Easily+%28CLI+Edition%29&amp;summary=In%20part%20two%2C%20I%20showed%20you%20how%20to%20use%20the%20Local%20Security%20Policy%20GUI%20to%20block%20the%20bad%20guys.%20%20There%20were%20a%20lot%20of%20pretty%20pictures%20for%20those%20that%20prefer%20the%20GUI.%20%20In%20this%20version%2C%20I%E2%80%99ll%20show%20you%20how%20to%20accomplish%20the%20same%20thing%20from%20the%20command%20line.%20%20This%20is%20my%20preferred%20method.%C2%A0%20It%20is%20much%20simpler%20t&amp;source=Andrew Healey's Blog" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Part+3%3A+Blocking+Bad+Hosts+-+Blocking+Them%2C+Easily+%28CLI+Edition%29+-+http://b2l.me/b792r&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-orkut">
			<a href="http://promote.orkut.com/preview?nt=orkut.com&amp;tt=Part+3%3A+Blocking+Bad+Hosts+-+Blocking+Them%2C+Easily+%28CLI+Edition%29&amp;du=http://halfloaded.com/blog/part-3-blocking-bad-hosts-blocking-them-easily-cli-edition/&amp;cn=In%20part%20two%2C%20I%20showed%20you%20how%20to%20use%20the%20Local%20Security%20Policy%20GUI%20to%20block%20the%20bad%20guys.%20%20There%20were%20a%20lot%20of%20pretty%20pictures%20for%20those%20that%20prefer%20the%20GUI.%20%20In%20this%20version%2C%20I%E2%80%99ll%20show%20you%20how%20to%20accomplish%20the%20same%20thing%20from%20the%20command%20line.%20%20This%20is%20my%20preferred%20method.%C2%A0%20It%20is%20much%20simpler%20t" rel="nofollow" class="external" title="Promote this on Orkut">Promote this on Orkut</a>
		</li>
		<li class="shr-slashdot">
			<a href="http://slashdot.org/bookmark.pl?url=http://halfloaded.com/blog/part-3-blocking-bad-hosts-blocking-them-easily-cli-edition/&amp;title=Part+3%3A+Blocking+Bad+Hosts+-+Blocking+Them%2C+Easily+%28CLI+Edition%29" rel="nofollow" class="external" title="Submit this to SlashDot">Submit this to SlashDot</a>
		</li>
		<li class="shr-yahoobuzz">
			<a href="http://buzz.yahoo.com/submit/?submitUrl=http://halfloaded.com/blog/part-3-blocking-bad-hosts-blocking-them-easily-cli-edition/&amp;submitHeadline=Part+3%3A+Blocking+Bad+Hosts+-+Blocking+Them%2C+Easily+%28CLI+Edition%29&amp;submitSummary=In%20part%20two%2C%20I%20showed%20you%20how%20to%20use%20the%20Local%20Security%20Policy%20GUI%20to%20block%20the%20bad%20guys.%20%20There%20were%20a%20lot%20of%20pretty%20pictures%20for%20those%20that%20prefer%20the%20GUI.%20%20In%20this%20version%2C%20I%E2%80%99ll%20show%20you%20how%20to%20accomplish%20the%20same%20thing%20from%20the%20command%20line.%20%20This%20is%20my%20preferred%20method.%C2%A0%20It%20is%20much%20simpler%20t&amp;submitCategory=science&amp;submitAssetType=text" rel="nofollow" class="external" title="Buzz up!">Buzz up!</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://halfloaded.com/blog/part-3-blocking-bad-hosts-blocking-them-easily-cli-edition/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-comfeed">
			<a href="http://halfloaded.com/blog/part-3-blocking-bad-hosts-blocking-them-easily-cli-edition/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-mail">
			<a href="mailto:?subject=%22Part%203%3A%20Blocking%20Bad%20Hosts%20-%20Blocking%20Them%2C%20Easily%20%28CLI%20Edition%29%22&amp;body=Link: http://halfloaded.com/blog/part-3-blocking-bad-hosts-blocking-them-easily-cli-edition/ (sent via shareaholic)%0D%0A%0D%0A----%0D%0A In%20part%20two%2C%20I%20showed%20you%20how%20to%20use%20the%20Local%20Security%20Policy%20GUI%20to%20block%20the%20bad%20guys.%20%20There%20were%20a%20lot%20of%20pretty%20pictures%20for%20those%20that%20prefer%20the%20GUI.%20%20In%20this%20version%2C%20I%E2%80%99ll%20show%20you%20how%20to%20accomplish%20the%20same%20thing%20from%20the%20command%20line.%20%20This%20is%20my%20preferred%20method.%C2%A0%20It%20is%20much%20simpler%20t" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://halfloaded.com/blog/part-3-blocking-bad-hosts-blocking-them-easily-cli-edition/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Part 2: Blocking Bad Hosts &#8211; Blocking Them, Easily (GUI Edition)</title>
		<link>http://halfloaded.com/blog/part-2-blocking-bad-hosts-blocking-them-easily-gui-edition/</link>
		<comments>http://halfloaded.com/blog/part-2-blocking-bad-hosts-blocking-them-easily-gui-edition/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 09:13:58 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[ipsec]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://halfloaded.com/?p=344</guid>
		<description><![CDATA[In part two, I want to show how you can quickly setup an ipsec policy to block the bad hosts you identified in part one. While many methods can be used to block hosts, using the Local Security Policy (secpol.msc) and ipsec is a simple method which can be fully automated. By following the steps [...]]]></description>
			<content:encoded><![CDATA[<p>In part two, I want to show how you can quickly setup an ipsec policy to block the bad hosts you identified in <a href="../blog/part-1-blocking-bad-hosts-finding-them-easily/">part one</a>. While many methods can be used to block hosts, using the Local Security Policy (secpol.msc) and ipsec is a simple method which can be fully automated.</p>
<p>By following the steps below, you will be able to create a new policy and manage the filter lists and actions. In part three, I will explain how this can be done from the command line for all you CLI warriors. This tutorial should be accurate for: Windows XP, Vista, 7 and Server 2003, 2008, 2008R2 (possibly even 2000)<span id="more-344"></span></p>
<p>The policy you create in this tutorial will not be applied to the system until you &#8220;Assign&#8221; the policy in Step 6. As long as the policy is not assigned, you can safely edit, add, remove, etc. rules and sets to the policy without affecting the system. <span style="color: #ff0000;"><em>Note: double and triple check your sets to ensure you do not block legitimate traffic before assigning the policy.</em></span></p>
<p>To begin this tutorial, open the Local Security Policy by:</p>
<ul>
<li>Control Panel → Administrative Tools → Local Security Policy</li>
<li>Start → Run → secpol.msc</li>
</ul>
<h3>Step 1: Create IP Security Policy</h3>
<ol>
<li>Right click &#8220;IP Security Policies on Local Computer&#8221;</li>
<li>Select &#8220;Create IP Security Policy&#8230;&#8221;</li>
<li>IP Security Policy Wizard
<ul>
<li>Welcome Screen → Next</li>
<li>IP Security Policy Name → Give a descriptive name and description → Next</li>
<li>Requests for Secure Communication → Do Not Check &#8220;Activate the default response rule&#8221; → Next</li>
<li>Wizard Completion → Do Not Check &#8220;Edit Properties&#8221; → Finish</li>
</ul>
</li>
</ol>
<p><a href="http://halfloaded.com/wp-content/uploads/2009/12/lsp-1.png"><img class="size-thumbnail wp-image-358 alignnone" title="lsp-1" src="http://halfloaded.com/wp-content/uploads/2009/12/lsp-1-150x150.png" alt="" width="150" height="150" /></a><a href="http://halfloaded.com/wp-content/uploads/2009/12/lsp-3.png"> <img class="alignnone size-thumbnail wp-image-360" title="lsp-3" src="http://halfloaded.com/wp-content/uploads/2009/12/lsp-3-150x150.png" alt="" width="150" height="150" /></a><a href="http://halfloaded.com/wp-content/uploads/2009/12/lsp-4.png"> <img class="alignnone size-thumbnail wp-image-361" title="lsp-4" src="http://halfloaded.com/wp-content/uploads/2009/12/lsp-4-150x150.png" alt="" width="150" height="150" /></a> <a href="http://halfloaded.com/wp-content/uploads/2009/12/lsp-5.png"><img class="alignnone size-thumbnail wp-image-362" title="lsp-5" src="http://halfloaded.com/wp-content/uploads/2009/12/lsp-5-150x150.png" alt="" width="150" height="150" /></a></p>
<h3>Step 2: Create an IP Filter List</h3>
<ol>
<li>Double click your new policy (or, right click and select properties)</li>
<li>On the Rules Tab → Uncheck &#8220;Use Add Wizard&#8221; → Click &#8220;Add&#8230;&#8221;</li>
<li>Create an IP Filter List
<ul>
<li>On the &#8220;IP Filter List&#8221; Tab → Click &#8220;Add&#8230;&#8221;</li>
<li>In the &#8220;IP Filter List&#8221; Window → Enter a descriptive name and description → Uncheck &#8220;Use Add Wizard&#8221; → Click &#8220;Add&#8230;&#8221;</li>
</ul>
</li>
</ol>
<p><a href="http://halfloaded.com/wp-content/uploads/2009/12/rules-1.png"><img class="alignnone size-thumbnail wp-image-363" title="rules-1" src="http://halfloaded.com/wp-content/uploads/2009/12/rules-1-150x150.png" alt="" width="150" height="150" /></a> <a href="http://halfloaded.com/wp-content/uploads/2009/12/rules-2.png"><img class="alignnone size-thumbnail wp-image-364" title="rules-2" src="http://halfloaded.com/wp-content/uploads/2009/12/rules-2-150x150.png" alt="" width="150" height="150" /></a> <a href="http://halfloaded.com/wp-content/uploads/2009/12/rules-3.png"><img class="alignnone size-thumbnail wp-image-365" title="rules-3" src="http://halfloaded.com/wp-content/uploads/2009/12/rules-3-150x150.png" alt="" width="150" height="150" /></a> <a href="http://halfloaded.com/wp-content/uploads/2009/12/rules-4.png"><img class="alignnone size-thumbnail wp-image-366" title="rules-4" src="http://halfloaded.com/wp-content/uploads/2009/12/rules-4-150x150.png" alt="" width="150" height="150" /></a></p>
<h3>Step 3: Create IP Filters and Associate them with the Filter List (Repeat this step until all hosts you wish to block have been entered)</h3>
<ol>
<li>Address Tab
<ul>
<li>Change Source Address to → &#8220;A specific IP Address or Subnet&#8221;</li>
<li>Enter the IP Address and/or subnet in the text box (Use <a href="http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">CIDR syntax</a> for defining subnets (e.g. 10.10.10.0/24)</li>
<li>Check &#8220;Mirrored&#8221;</li>
</ul>
</li>
<li>Protocol Tab → Ensure protocol type is set to &#8220;Any&#8221;</li>
<li>Description Tab → Enter a description. It is typically useful to identify the creator of the rule, why it was added and a date/time when the rule was created.</li>
<li>Click &#8220;OK&#8221;</li>
<li>Repeat step 3 until all the hosts/networks you wish to block are entered. Once completed, press &#8220;OK&#8221;.</li>
</ol>
<p><a href="http://halfloaded.com/wp-content/uploads/2009/12/rules-51.png"><img class="alignnone size-thumbnail wp-image-379" title="rules-5" src="http://halfloaded.com/wp-content/uploads/2009/12/rules-51-150x150.png" alt="" width="150" height="150" /></a> <a href="http://halfloaded.com/wp-content/uploads/2009/12/rules-6.png"><img class="alignnone size-thumbnail wp-image-368" title="rules-6" src="http://halfloaded.com/wp-content/uploads/2009/12/rules-6-150x150.png" alt="" width="150" height="150" /></a> <a href="http://halfloaded.com/wp-content/uploads/2009/12/rules-7.png"><img class="alignnone size-thumbnail wp-image-369" title="rules-7" src="http://halfloaded.com/wp-content/uploads/2009/12/rules-7-150x150.png" alt="" width="150" height="150" /></a></p>
<h3>Step 4: Create a Filter Action</h3>
<ol>
<li>On the &#8220;Filter Action&#8221; Tab → Uncheck &#8220;Use Add Wizard&#8221; → Click &#8220;Add&#8230;&#8221;</li>
<li>On the &#8220;Security Methods&#8221; Tab → Select the &#8220;Block&#8221; radio button (All other options on this tab will become greyed out)</li>
<li>On the &#8220;General&#8221; Tab → Enter a descriptive name and description → Press &#8220;OK&#8221;</li>
</ol>
<p><a href="http://halfloaded.com/wp-content/uploads/2009/12/rules-8.png"><img class="alignnone size-thumbnail wp-image-370" title="rules-8" src="http://halfloaded.com/wp-content/uploads/2009/12/rules-8-150x150.png" alt="" width="150" height="150" /></a> <a href="http://halfloaded.com/wp-content/uploads/2009/12/rules-9.png"><img class="alignnone size-thumbnail wp-image-371" title="rules-9" src="http://halfloaded.com/wp-content/uploads/2009/12/rules-9-150x150.png" alt="" width="150" height="150" /></a> <a href="http://halfloaded.com/wp-content/uploads/2009/12/rules-10.png"><img class="alignnone size-thumbnail wp-image-372" title="rules-10" src="http://halfloaded.com/wp-content/uploads/2009/12/rules-10-150x150.png" alt="" width="150" height="150" /></a></p>
<h3>Step 5: Create Policy Rule to apply Filter Action to Filter List</h3>
<ol>
<li>On the &#8220;Filter Action&#8221; Tab, ensure the new filter action you created is selected.</li>
<li>On the &#8220;IP Filter List&#8221; Tab, ensure the new filter list you created is selected.</li>
<li>Press &#8220;OK&#8221;</li>
<li>On the new policy properties window, ensure the new list and action are enabled.</li>
<li>Press &#8220;OK&#8221;</li>
</ol>
<p><a href="http://halfloaded.com/wp-content/uploads/2009/12/rules-11.png"><img class="alignnone size-thumbnail wp-image-373" title="rules-11" src="http://halfloaded.com/wp-content/uploads/2009/12/rules-11-150x17.png" alt="" width="150" height="17" /></a><a href="http://halfloaded.com/wp-content/uploads/2009/12/rules-12.png"> <img class="alignnone size-thumbnail wp-image-374" title="rules-12" src="http://halfloaded.com/wp-content/uploads/2009/12/rules-12-150x15.png" alt="" width="150" height="15" /></a> <a href="http://halfloaded.com/wp-content/uploads/2009/12/rules-13.png"><img class="alignnone size-thumbnail wp-image-375" title="rules-13" src="http://halfloaded.com/wp-content/uploads/2009/12/rules-13-150x88.png" alt="" width="150" height="88" /></a></p>
<h3>Step 6: Assigning (and un-assigning) the Policy</h3>
<p>This step will apply all the settings you have created up to this point. <span style="color: #ff0000;"><em>Double and triple check that you did not enter a valid host or network or it will be blocked. If fact, if you have any doubts in your mind, do not do this step until another person (who knows what they are doing) looks over your work too! Note: This is one place MS will not give you a little &#8220;are you sure you want to do this&#8221; type of warning. As soon as you assign the policy, it is done.</em></span></p>
<ol>
<li>Right click your new policy → Select &#8220;Assign&#8221; → Done (It really is that easy)
<ul>
<li>To un-assign, just do the same thing except select &#8220;Un-assign&#8221; instead.</li>
</ul>
</li>
</ol>
<p><a href="http://halfloaded.com/wp-content/uploads/2009/12/assign-1.png"><img class="alignnone size-thumbnail wp-image-356" title="assign-1" src="http://halfloaded.com/wp-content/uploads/2009/12/assign-1-150x150.png" alt="" width="150" height="150" /></a></p>
<p>In part 3, I will cover how to do all this directly from the command line.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge">
<ul class="socials">
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://halfloaded.com/blog/part-2-blocking-bad-hosts-blocking-them-easily-gui-edition/&amp;t=Part+2%3A+Blocking+Bad+Hosts+-+Blocking+Them%2C+Easily+%28GUI+Edition%29" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://halfloaded.com/blog/part-2-blocking-bad-hosts-blocking-them-easily-gui-edition/&amp;title=Part+2%3A+Blocking+Bad+Hosts+-+Blocking+Them%2C+Easily+%28GUI+Edition%29&amp;summary=In%20part%20two%2C%20I%20want%20to%20show%20how%20you%20can%20quickly%20setup%20an%20ipsec%20policy%20to%20block%20the%20bad%20hosts%20you%20identified%20in%20part%20one.%20While%20many%20methods%20can%20be%20used%20to%20block%20hosts%2C%20using%20the%20Local%20Security%20Policy%20%28secpol.msc%29%20and%20ipsec%20is%20a%20simple%20method%20which%20can%20be%20fully%20automated.%0D%0A%0D%0ABy%20following%20the%20steps%20be&amp;source=Andrew Healey's Blog" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Part+2%3A+Blocking+Bad+Hosts+-+Blocking+Them%2C+Easily+%28GUI+Edition%29+-+http://b2l.me/b4ge7&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-orkut">
			<a href="http://promote.orkut.com/preview?nt=orkut.com&amp;tt=Part+2%3A+Blocking+Bad+Hosts+-+Blocking+Them%2C+Easily+%28GUI+Edition%29&amp;du=http://halfloaded.com/blog/part-2-blocking-bad-hosts-blocking-them-easily-gui-edition/&amp;cn=In%20part%20two%2C%20I%20want%20to%20show%20how%20you%20can%20quickly%20setup%20an%20ipsec%20policy%20to%20block%20the%20bad%20hosts%20you%20identified%20in%20part%20one.%20While%20many%20methods%20can%20be%20used%20to%20block%20hosts%2C%20using%20the%20Local%20Security%20Policy%20%28secpol.msc%29%20and%20ipsec%20is%20a%20simple%20method%20which%20can%20be%20fully%20automated.%0D%0A%0D%0ABy%20following%20the%20steps%20be" rel="nofollow" class="external" title="Promote this on Orkut">Promote this on Orkut</a>
		</li>
		<li class="shr-slashdot">
			<a href="http://slashdot.org/bookmark.pl?url=http://halfloaded.com/blog/part-2-blocking-bad-hosts-blocking-them-easily-gui-edition/&amp;title=Part+2%3A+Blocking+Bad+Hosts+-+Blocking+Them%2C+Easily+%28GUI+Edition%29" rel="nofollow" class="external" title="Submit this to SlashDot">Submit this to SlashDot</a>
		</li>
		<li class="shr-yahoobuzz">
			<a href="http://buzz.yahoo.com/submit/?submitUrl=http://halfloaded.com/blog/part-2-blocking-bad-hosts-blocking-them-easily-gui-edition/&amp;submitHeadline=Part+2%3A+Blocking+Bad+Hosts+-+Blocking+Them%2C+Easily+%28GUI+Edition%29&amp;submitSummary=In%20part%20two%2C%20I%20want%20to%20show%20how%20you%20can%20quickly%20setup%20an%20ipsec%20policy%20to%20block%20the%20bad%20hosts%20you%20identified%20in%20part%20one.%20While%20many%20methods%20can%20be%20used%20to%20block%20hosts%2C%20using%20the%20Local%20Security%20Policy%20%28secpol.msc%29%20and%20ipsec%20is%20a%20simple%20method%20which%20can%20be%20fully%20automated.%0D%0A%0D%0ABy%20following%20the%20steps%20be&amp;submitCategory=science&amp;submitAssetType=text" rel="nofollow" class="external" title="Buzz up!">Buzz up!</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://halfloaded.com/blog/part-2-blocking-bad-hosts-blocking-them-easily-gui-edition/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-comfeed">
			<a href="http://halfloaded.com/blog/part-2-blocking-bad-hosts-blocking-them-easily-gui-edition/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-mail">
			<a href="mailto:?subject=%22Part%202%3A%20Blocking%20Bad%20Hosts%20-%20Blocking%20Them%2C%20Easily%20%28GUI%20Edition%29%22&amp;body=Link: http://halfloaded.com/blog/part-2-blocking-bad-hosts-blocking-them-easily-gui-edition/ (sent via shareaholic)%0D%0A%0D%0A----%0D%0A In%20part%20two%2C%20I%20want%20to%20show%20how%20you%20can%20quickly%20setup%20an%20ipsec%20policy%20to%20block%20the%20bad%20hosts%20you%20identified%20in%20part%20one.%20While%20many%20methods%20can%20be%20used%20to%20block%20hosts%2C%20using%20the%20Local%20Security%20Policy%20%28secpol.msc%29%20and%20ipsec%20is%20a%20simple%20method%20which%20can%20be%20fully%20automated.%0D%0A%0D%0ABy%20following%20the%20steps%20be" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://halfloaded.com/blog/part-2-blocking-bad-hosts-blocking-them-easily-gui-edition/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Part 1: Blocking Bad Hosts &#8211; Finding Them, Easily</title>
		<link>http://halfloaded.com/blog/part-1-blocking-bad-hosts-finding-them-easily/</link>
		<comments>http://halfloaded.com/blog/part-1-blocking-bad-hosts-finding-them-easily/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 07:19:13 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[event log]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[vbScript]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://halfloaded.com/?p=335</guid>
		<description><![CDATA[Download Script: get-bad-hosts.zip While troubleshooting some issues on an OWA Front-End server, I went over to the security log to see if the authentication attempts were getting past this box. The problem I found was the log was so full of failed logon attempts it was difficult to filter out what I was looking for. [...]]]></description>
			<content:encoded><![CDATA[<p>Download Script: <a href="http://halfloaded.com/wp-content/uploads/2009/12/get-bad-hosts.zip">get-bad-hosts.zip</a></p>
<p>While troubleshooting some issues on an OWA Front-End server, I went over to the security log to see if the authentication attempts were getting past this box.  The problem I found was the log was so full of failed logon attempts it was difficult to filter out what I was looking for.  In a twelve hour period, there were thousands of 529 events in the security log.  Now, I know this is nothing new, but I found a few patterns.  I manually exported the log to a CSV, parsed out all the source ip addresses and opened it up in Excel.  What I found was that 98.7% of failed logon attempts were made by just four different ip addresses.  (I recommend using <a href="http://www.maxmind.com/app/locate_ip" target="_blank">MaxMind&#8217;s GeoIP Address Locator</a> for help in determining where the source addresses are located.)<span id="more-335"></span></p>
<p>The easy fix is to setup an IPSec policy to block all traffic coming from those addresses.  And I did just that.  There are many different methods to blocking bad hosts.  And, anybody who has dealt with this knows, they will come back.  Just from different addresses.</p>
<p>One other piece I was able to get from this is that there are several of our users whom have fat fingered their passwords within ActiveSync (or they just have it setup wrong).  And then there are those users who have forgotten their domain, e-mail address, username, etc.</p>
<p>This is step one in my project to automate the blocking of bad hosts.  My goal is to build an automated method for blocking hosts with a high percentage of bad logon attempts within <em>n</em> hours.  And, even if I can&#8217;t get it 100% automated, this first whack at it took my bad logon attempts from 800 per hour to 25 per hour; nearly a 97% improvement!  And, a lot less crap to sift through when troubleshooting real issues.</p>
<p>So, my first goal is to automate a method of extracting the data I want from the event log.  (The script can be found below.)  The most important piece of data is the source ip address.  However, the other pieces of data I decided to extract could be helpful in determining the legitimacy of the logon failure.</p>
<p>To get the data, simply download the script and run &#8220;cscript /nologo get-bad-hosts.vbs &gt; bad-hosts.csv&#8221; (w/o the quotes).  You can then open the file in Excel, do a quick pivot-table and identify the source addresses with the most hits.  At that point, you can add the host (or address block) to an ipsec policy to block all traffic from that address.</p>
<p>In my next post, I&#8217;ll explain the details in setting up a quick ipsec policy to block the bad guys.  Cheers!</p>

<div class="wp_syntax"><div class="code"><pre class="vbnet" style="font-family:monospace;"><span style="color: #008080; font-style: italic;">'==========================================================================</span>
<span style="color: #008080; font-style: italic;">' VBScript Source File</span>
<span style="color: #008080; font-style: italic;">' NAME: get-bad-hosts.vbs</span>
<span style="color: #008080; font-style: italic;">' AUTHOR: Andrew J Healey</span>
<span style="color: #008080; font-style: italic;">' WEB: http://halfloaded.com/</span>
<span style="color: #008080; font-style: italic;">' DATE  : Dec 21 2009</span>
<span style="color: #008080; font-style: italic;">' COMMENT: This script will return data in csv format for use in determining</span>
<span style="color: #008080; font-style: italic;">'	hack, lockout or bad logon attempts</span>
<span style="color: #008080; font-style: italic;">' PROCESS: 1) query event log for event id 529; 2) parse data to return</span>
<span style="color: #008080; font-style: italic;">'	useful data; 3) output to screen</span>
<span style="color: #008080; font-style: italic;">' USAGE: cscript /nologo get-bad-hosts.vbs c:\bad-hosts.csv</span>
<span style="color: #008080; font-style: italic;">'==========================================================================</span>
&nbsp;
<span style="color: #FF8000;">Option</span> Explicit
<span style="color: #FF8000;">On</span> <span style="color: #FF8000;">Error</span> <span style="color: #FF8000;">Resume</span> <span style="color: #FF8000;">Next</span>
&nbsp;
<span style="color: #0600FF;">Dim</span> strComputer, objWMIService, colLoggedEvents
<span style="color: #0600FF;">Dim</span> objEvent, objRegEx, colMatches, strMatch
<span style="color: #0600FF;">Dim</span> strUserName, strWorkstation, strIPAddress, strDomain
&nbsp;
<span style="color: #008080; font-style: italic;">'Change to name of computer to query remote machine</span>
strComputer <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;.&quot;</span>
<span style="color: #FF8000;">Set</span> objWMIService <span style="color: #008000;">=</span> GetObject<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;winmgmts:&quot;</span> _
    <span style="color: #008000;">&amp;</span>amp; <span style="color: #808080;">&quot;{impersonationLevel=impersonate}!\\&quot;</span> <span style="color: #008000;">&amp;</span>amp; strComputer <span style="color: #008000;">&amp;</span>amp; <span style="color: #808080;">&quot;\root\cimv2&quot;</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">'Event 529 in the security log are &quot;Failure Audit&quot; for a &quot;Logon/Logoff&quot;</span>
<span style="color: #FF8000;">Set</span> colLoggedEvents <span style="color: #008000;">=</span> objWMIService.<span style="color: #0000FF;">ExecQuery</span> _
        <span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Select * from Win32_NTLogEvent Where Logfile = 'Security' and &quot;</span> _
            <span style="color: #008000;">&amp;</span>amp; <span style="color: #808080;">&quot;EventCode = '529'&quot;</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">'Write header to screen</span>
wscript.<span style="color: #0000FF;">echo</span> <span style="color: #0600FF;">chr</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">34</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #808080;">&quot;User Name&quot;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #0600FF;">chr</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">34</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #808080;">&quot;,&quot;</span> <span style="color: #008000;">&amp;</span>amp; _
			 <span style="color: #0600FF;">chr</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">34</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #808080;">&quot;Workstation&quot;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #0600FF;">chr</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">34</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #808080;">&quot;,&quot;</span> <span style="color: #008000;">&amp;</span>amp; _
			 <span style="color: #0600FF;">chr</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">34</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #808080;">&quot;Source IP&quot;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #0600FF;">chr</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">34</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #808080;">&quot;,&quot;</span> <span style="color: #008000;">&amp;</span>amp; _
			 <span style="color: #0600FF;">chr</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">34</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #808080;">&quot;Windows Domain&quot;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #0600FF;">chr</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">34</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #808080;">&quot;,&quot;</span> <span style="color: #008000;">&amp;</span>amp; _
			 <span style="color: #0600FF;">chr</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">34</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #808080;">&quot;Date/Time&quot;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #0600FF;">chr</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">34</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">'Loop through all events matching criteria above: 529 in sec log</span>
<span style="color: #FF8000;">For</span> <span style="color: #0600FF;">Each</span> objEvent in colLoggedEvents
	<span style="color: #008080; font-style: italic;">'Use regex to parse any ip addresses from event</span>
	<span style="color: #008080; font-style: italic;">' if no address found, goto next record</span>
	<span style="color: #FF8000;">Set</span> objRegEx <span style="color: #008000;">=</span> <span style="color: #0600FF;">CreateObject</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;VBScript.RegExp&quot;</span><span style="color: #000000;">&#41;</span>
	objRegEx.<span style="color: #0000FF;">Global</span> <span style="color: #008000;">=</span> <span style="color: #0600FF;">True</span>
	objRegEx.<span style="color: #0000FF;">IgnoreCase</span> <span style="color: #008000;">=</span> <span style="color: #0600FF;">True</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">'Will return the line of the user name that was used</span>
	objRegEx.<span style="color: #0000FF;">Pattern</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;(\tUser Name:.*\n)&quot;</span>
	<span style="color: #FF8000;">Set</span> colMatches <span style="color: #008000;">=</span> objRegEx.<span style="color: #0000FF;">Execute</span><span style="color: #000000;">&#40;</span>objEvent.<span style="color: #0000FF;">Message</span><span style="color: #000000;">&#41;</span>
	<span style="color: #FF8000;">For</span> <span style="color: #0600FF;">Each</span> strMatch in colMatches
	   strUserName <span style="color: #008000;">=</span> strMatch.<span style="color: #0000FF;">Value</span>
	<span style="color: #FF8000;">Next</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">'Will return the line of the workstation name that was used</span>
	objRegEx.<span style="color: #0000FF;">Pattern</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;(\tWorkstation Name:.*\n)&quot;</span>
	<span style="color: #FF8000;">Set</span> colMatches <span style="color: #008000;">=</span> objRegEx.<span style="color: #0000FF;">Execute</span><span style="color: #000000;">&#40;</span>objEvent.<span style="color: #0000FF;">Message</span><span style="color: #000000;">&#41;</span>
	<span style="color: #FF8000;">For</span> <span style="color: #0600FF;">Each</span> strMatch in colMatches
	   strWorkstation <span style="color: #008000;">=</span> strMatch.<span style="color: #0000FF;">Value</span>
	<span style="color: #FF8000;">Next</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">'Will return the line of the source ip address</span>
	objRegEx.<span style="color: #0000FF;">Pattern</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;(\tSource Network Address:.*\n)&quot;</span>
	<span style="color: #FF8000;">Set</span> colMatches <span style="color: #008000;">=</span> objRegEx.<span style="color: #0000FF;">Execute</span><span style="color: #000000;">&#40;</span>objEvent.<span style="color: #0000FF;">Message</span><span style="color: #000000;">&#41;</span>
	<span style="color: #FF8000;">For</span> <span style="color: #0600FF;">Each</span> strMatch in colMatches
	   strIPAddress <span style="color: #008000;">=</span> strMatch.<span style="color: #0000FF;">Value</span>
	<span style="color: #FF8000;">Next</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">'Will return the line of the domain that was used</span>
	objRegEx.<span style="color: #0000FF;">Pattern</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;\tDomain:(.*\n)&quot;</span>
	<span style="color: #FF8000;">Set</span> colMatches <span style="color: #008000;">=</span> objRegEx.<span style="color: #0000FF;">Execute</span><span style="color: #000000;">&#40;</span>objEvent.<span style="color: #0000FF;">Message</span><span style="color: #000000;">&#41;</span>
	<span style="color: #FF8000;">For</span> <span style="color: #0600FF;">Each</span> strMatch in colMatches
	   strDomain <span style="color: #008000;">=</span> strMatch.<span style="color: #0000FF;">Value</span>
	<span style="color: #FF8000;">Next</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">'Output clean csv line for easy reading in spreadsheet program</span>
	wscript.<span style="color: #0000FF;">echo</span> <span style="color: #0600FF;">chr</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">34</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; GetCleanText<span style="color: #000000;">&#40;</span>strUserName<span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #0600FF;">chr</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">34</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #808080;">&quot;,&quot;</span> <span style="color: #008000;">&amp;</span>amp; _
				 <span style="color: #0600FF;">chr</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">34</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; GetCleanText<span style="color: #000000;">&#40;</span>strWorkstation<span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #0600FF;">chr</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">34</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #808080;">&quot;,&quot;</span> <span style="color: #008000;">&amp;</span>amp; _
				 <span style="color: #0600FF;">chr</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">34</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; GetCleanText<span style="color: #000000;">&#40;</span>strIpAddress<span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #0600FF;">chr</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">34</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #808080;">&quot;,&quot;</span> <span style="color: #008000;">&amp;</span>amp; _
				 <span style="color: #0600FF;">chr</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">34</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; GetCleanText<span style="color: #000000;">&#40;</span>strDomain<span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #0600FF;">chr</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">34</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #808080;">&quot;,&quot;</span> <span style="color: #008000;">&amp;</span>amp; _
				 <span style="color: #0600FF;">chr</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">34</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; WMIDateStringToDate<span style="color: #000000;">&#40;</span>objEvent.<span style="color: #0000FF;">TimeWritten</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #0600FF;">chr</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">34</span><span style="color: #000000;">&#41;</span>
<span style="color: #FF8000;">Next</span>
&nbsp;
<span style="color: #FF8000;">Private</span> <span style="color: #0600FF;">Function</span> GetCleanText<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">byVal</span> strText<span style="color: #000000;">&#41;</span>
	<span style="color: #008080; font-style: italic;">'This will cleanup the text and return only necessary data</span>
	<span style="color: #008080; font-style: italic;">' I'm sure there is a better way to do this :)</span>
	<span style="color: #0600FF;">dim</span> tmp,txt
	tmp <span style="color: #008000;">=</span> <span style="color: #0600FF;">Split</span><span style="color: #000000;">&#40;</span>strText,<span style="color: #808080;">&quot;:&quot;</span><span style="color: #000000;">&#41;</span>
	txt <span style="color: #008000;">=</span> tmp<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">1</span><span style="color: #000000;">&#41;</span>
	txt <span style="color: #008000;">=</span> <span style="color: #0600FF;">Replace</span><span style="color: #000000;">&#40;</span>txt,vbTab,<span style="color: #808080;">&quot;&quot;</span><span style="color: #000000;">&#41;</span>
	txt <span style="color: #008000;">=</span> <span style="color: #0600FF;">Replace</span><span style="color: #000000;">&#40;</span>txt,vbCrLf,<span style="color: #808080;">&quot;&quot;</span><span style="color: #000000;">&#41;</span>
	txt <span style="color: #008000;">=</span> <span style="color: #0600FF;">Trim</span><span style="color: #000000;">&#40;</span>txt<span style="color: #000000;">&#41;</span>
	GetCleanText <span style="color: #008000;">=</span> txt
<span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span>
&nbsp;
<span style="color: #FF8000;">Private</span> <span style="color: #0600FF;">Function</span> WMIDateStringToDate<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">byVal</span> dtmEventDate<span style="color: #000000;">&#41;</span>
	<span style="color: #008080; font-style: italic;">'Borrowed from the &quot;Hey, Scripting Guy! BLOG&quot;</span>
	<span style="color: #008080; font-style: italic;">' --&amp;gt; Search: WMIDateStringToDate</span>
    WMIDateStringToDate <span style="color: #008000;">=</span> <span style="color: #0600FF;">CDate</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">Mid</span><span style="color: #000000;">&#40;</span>dtmEventDate, <span style="color: #FF0000;">5</span>, <span style="color: #FF0000;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #808080;">&quot;/&quot;</span> <span style="color: #008000;">&amp;</span>amp; _
        <span style="color: #FF8000;">Mid</span><span style="color: #000000;">&#40;</span>dtmEventDate, <span style="color: #FF0000;">7</span>, <span style="color: #FF0000;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #808080;">&quot;/&quot;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #0600FF;">Left</span><span style="color: #000000;">&#40;</span>dtmEventDate, <span style="color: #FF0000;">4</span><span style="color: #000000;">&#41;</span> _
            <span style="color: #008000;">&amp;</span>amp; <span style="color: #808080;">&quot; &quot;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #FF8000;">Mid</span> <span style="color: #000000;">&#40;</span>dtmEventDate, <span style="color: #FF0000;">9</span>, <span style="color: #FF0000;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #808080;">&quot;:&quot;</span> <span style="color: #008000;">&amp;</span>amp; _
                <span style="color: #FF8000;">Mid</span><span style="color: #000000;">&#40;</span>dtmEventDate, <span style="color: #FF0000;">11</span>, <span style="color: #FF0000;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #808080;">&quot;:&quot;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #FF8000;">Mid</span><span style="color: #000000;">&#40;</span>dtmEventDate, _
                    <span style="color: #FF0000;">13</span>, <span style="color: #FF0000;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
<span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span></pre></div></div>



<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge">
<ul class="socials">
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://halfloaded.com/blog/part-1-blocking-bad-hosts-finding-them-easily/&amp;t=Part+1%3A+Blocking+Bad+Hosts+-+Finding+Them%2C+Easily" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://halfloaded.com/blog/part-1-blocking-bad-hosts-finding-them-easily/&amp;title=Part+1%3A+Blocking+Bad+Hosts+-+Finding+Them%2C+Easily&amp;summary=Download%20Script%3A%20get-bad-hosts.zip%0D%0A%0D%0AWhile%20troubleshooting%20some%20issues%20on%20an%20OWA%20Front-End%20server%2C%20I%20went%20over%20to%20the%20security%20log%20to%20see%20if%20the%20authentication%20attempts%20were%20getting%20past%20this%20box.%20%20The%20problem%20I%20found%20was%20the%20log%20was%20so%20full%20of%20failed%20logon%20attempts%20it%20was%20difficult%20to%20filter%20out%20w&amp;source=Andrew Healey's Blog" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Part+1%3A+Blocking+Bad+Hosts+-+Finding+Them%2C+Easily+-+http://b2l.me/b4ge9&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-orkut">
			<a href="http://promote.orkut.com/preview?nt=orkut.com&amp;tt=Part+1%3A+Blocking+Bad+Hosts+-+Finding+Them%2C+Easily&amp;du=http://halfloaded.com/blog/part-1-blocking-bad-hosts-finding-them-easily/&amp;cn=Download%20Script%3A%20get-bad-hosts.zip%0D%0A%0D%0AWhile%20troubleshooting%20some%20issues%20on%20an%20OWA%20Front-End%20server%2C%20I%20went%20over%20to%20the%20security%20log%20to%20see%20if%20the%20authentication%20attempts%20were%20getting%20past%20this%20box.%20%20The%20problem%20I%20found%20was%20the%20log%20was%20so%20full%20of%20failed%20logon%20attempts%20it%20was%20difficult%20to%20filter%20out%20w" rel="nofollow" class="external" title="Promote this on Orkut">Promote this on Orkut</a>
		</li>
		<li class="shr-slashdot">
			<a href="http://slashdot.org/bookmark.pl?url=http://halfloaded.com/blog/part-1-blocking-bad-hosts-finding-them-easily/&amp;title=Part+1%3A+Blocking+Bad+Hosts+-+Finding+Them%2C+Easily" rel="nofollow" class="external" title="Submit this to SlashDot">Submit this to SlashDot</a>
		</li>
		<li class="shr-yahoobuzz">
			<a href="http://buzz.yahoo.com/submit/?submitUrl=http://halfloaded.com/blog/part-1-blocking-bad-hosts-finding-them-easily/&amp;submitHeadline=Part+1%3A+Blocking+Bad+Hosts+-+Finding+Them%2C+Easily&amp;submitSummary=Download%20Script%3A%20get-bad-hosts.zip%0D%0A%0D%0AWhile%20troubleshooting%20some%20issues%20on%20an%20OWA%20Front-End%20server%2C%20I%20went%20over%20to%20the%20security%20log%20to%20see%20if%20the%20authentication%20attempts%20were%20getting%20past%20this%20box.%20%20The%20problem%20I%20found%20was%20the%20log%20was%20so%20full%20of%20failed%20logon%20attempts%20it%20was%20difficult%20to%20filter%20out%20w&amp;submitCategory=science&amp;submitAssetType=text" rel="nofollow" class="external" title="Buzz up!">Buzz up!</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://halfloaded.com/blog/part-1-blocking-bad-hosts-finding-them-easily/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-comfeed">
			<a href="http://halfloaded.com/blog/part-1-blocking-bad-hosts-finding-them-easily/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-mail">
			<a href="mailto:?subject=%22Part%201%3A%20Blocking%20Bad%20Hosts%20-%20Finding%20Them%2C%20Easily%22&amp;body=Link: http://halfloaded.com/blog/part-1-blocking-bad-hosts-finding-them-easily/ (sent via shareaholic)%0D%0A%0D%0A----%0D%0A Download%20Script%3A%20get-bad-hosts.zip%0D%0A%0D%0AWhile%20troubleshooting%20some%20issues%20on%20an%20OWA%20Front-End%20server%2C%20I%20went%20over%20to%20the%20security%20log%20to%20see%20if%20the%20authentication%20attempts%20were%20getting%20past%20this%20box.%20%20The%20problem%20I%20found%20was%20the%20log%20was%20so%20full%20of%20failed%20logon%20attempts%20it%20was%20difficult%20to%20filter%20out%20w" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://halfloaded.com/blog/part-1-blocking-bad-hosts-finding-them-easily/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
