<?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>Hungry Hacker &#187; Software</title>
	<atom:link href="http://www.hungryhacker.com/topics/sw/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hungryhacker.com</link>
	<description>The Hungry Hacker&#039;s Explanation of Everything</description>
	<lastBuildDate>Mon, 05 Sep 2011 03:44:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Super-caching with TimThumb</title>
		<link>http://www.hungryhacker.com/sw/super-caching-with-timthumb/</link>
		<comments>http://www.hungryhacker.com/sw/super-caching-with-timthumb/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 20:26:12 +0000</pubDate>
		<dc:creator>fwaggle</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.hungryhacker.com/?p=165</guid>
		<description><![CDATA[This website doesn&#8217;t actually use TimThumb &#8211; our hack of the Arthemia theme instead uses Flickr for all it&#8217;s image hosting, so it&#8217;s just easier to hack the theme to understand how to pull different sizes of Flickr images instead.
However, we have another site that my wife&#8217;s internet services company hosts that needed to be optimized for Digg/Slashdot-style surges, and it does use TimThumb &#8211; extensively in fact.
The Problem
TimThumb does have a caching engine built in which will, if your permissions are set up correctly, prevent the thumbnail from having ...]]></description>
			<content:encoded><![CDATA[<p>This website doesn&#8217;t actually use <a href="http://code.google.com/p/timthumb/">TimThumb</a> &#8211; our hack of the <a href="http://michaelhutagalung.com/2008/05/arthemia-magazine-blog-wordpress-theme-released/">Arthemia</a> theme instead uses <a href="http://flickr.com/">Flickr</a> for all it&#8217;s image hosting, so it&#8217;s just easier to hack the theme to understand how to pull different sizes of Flickr images instead.</p>
<p>However, we have another site that my wife&#8217;s internet services company hosts that needed to be optimized for Digg/Slashdot-style surges, and it does use TimThumb &#8211; extensively in fact.</p>
<h2>The Problem</h2>
<p>TimThumb does have a caching engine built in which will, if your permissions are set up correctly, prevent the thumbnail from having to be re-generated each request. However, it does require the PHP script to run each time to return the cached file (in fact, the PHP script simply takes all the arguments, concatenates them together, generates an MD5 hash, then looks for that file).</p>
<p>If you&#8217;re using mod_php, this probably isn&#8217;t a huge deal&#8230; it&#8217;s not going to be the bottleneck for surges of traffic &#8211; mod_php and your heavy-weight Apache processes will be. If you&#8217;re using php-cgi or php-fcgi, however, having quite a few thumbnails on the page (such as themes like Arthemia) is going to cause you quite a headache. You could have at least 10 or 15 extra php processes per page load&#8230; even required to just answer an If-Modified-Since request!</p>
<h2>Proposed Solution: Hack TimThumb</h2>
<p>I don&#8217;t know if this is the greatest idea, but it seems to work. Our idea was simply to make TimThumb cache files in the same manner that Donncha&#8217;s WP-Super-Cache plugin does, and then the web server can simply fling out pre-thumbnailed images all day long without invoking php at all.</p>
<p>The first thing we had to do was modify TimThumb to save cached thumbnails in this manner, for which you can find a rough patch here:</p>
<ul>
<li><a href="/downloads/patches/timthumb.supercache.diff">Patch for  TimThumb to enable path-based caching</a></li>
</ul>
<p>It&#8217;s not perfect, because it requires you to edit the script and point it at your thumbnails directory. We made ours /thumbs in the website&#8217;s root directory, and you have to point it at the<em> operating system&#8217;s fully-qualified</em> path to that directory. We then saved the modified version of the script into our /thumbs/ directory so we could access it easily.</p>
<p>The format is then /thumbs/&lt;width&gt;/&lt;height&gt;/&lt;path/to/image&gt;. A quick check of the file system shows it&#8217;s caching the files properly and finding the cached versions okay. Now to remove PHP from the equation.</p>
<h2>Rewrite Rules</h2>
<p><code>%cat .htaccess<br />
RewriteEngine On<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteCond %{REQUEST_FILENAME} !-d<br />
RewriteRule ^([0-9]+)/([0-9]+)/(.+)$ /thumbs/timthumb.php?src=$3&amp;w=$1&amp;h=$2&amp;zc=1&amp;q=100 [L]</code></p>
<p>I stole this rewrite rule from WP-Super-Cache, basically it just checks if the file isn&#8217;t a file, and it isn&#8217;t a directory, and then passes it in an argument to TimThumb. You can edit the zoom/crop and quality settings globally here &#8211; if you want them adjustable on a per-image basis you&#8217;ll need to hack the script to include those in the cache path instead.</p>
<p>If the file exists (which it will, if it&#8217;s been cached) Apache can simply pass that file out as a static file, PHP is never invoked for that image. When combined with nginx as a reverse proxy, we&#8217;ve found this resulted in a dramatic increase in performance for just one page-view alone. Because of our WP-Super-Cache rules for nginx will also work for these cached images, nginx can hand out upwards of around 7,000 thumbnails a second &#8211; more than enough to saturate a gigabit pipe on reasonable hardware.</p>
<h2>Editing the Theme</h2>
<p>Next up is editing the theme to call our new thumbnail URL &#8211; unfortunately, there&#8217;s no way around this process&#8230; it&#8217;s tedious. Replace:</p>
<p><code>&lt;p&gt;&lt;img src="&lt;?php echo bloginfo('template_url'); ?&gt;/scripts/timthumb.php?src=&lt;?php echo get_option('home'); ?&gt;/&lt;?php<br />
$values = get_post_custom_values("Image"); echo $values[0]; ?&gt;&amp;amp;w=&lt;?php echo $width; ?&gt;&amp;amp;h=&lt;?php echo $height; ?&gt;&amp;amp;zc=1&amp;amp;q=100"<br />
alt="&lt;?php the_title(); ?&gt;" width="&lt;?php echo $width; ?&gt;px" height="&lt;?php echo $height; ?&gt;px"  /&gt;&lt;/p&gt;</code></p>
<p>with:</p>
<p><code>&lt;p&gt;&lt;img src="/thumbs/&lt;?php echo $width; ?&gt;/&lt;?php echo $height; ?&gt;/&lt;?php<br />
$values = get_post_custom_values("Image"); echo $values[0]; ?&gt;"<br />
alt="&lt;?php the_title(); ?&gt;" width="&lt;?php echo $width; ?&gt;px" height="&lt;?php echo $height; ?&gt;px"  /&gt;&lt;/p&gt;</code></p>
<h2>Caveats</h2>
<p>There are a couple of downsides to this&#8230; first of all, there&#8217;s no automatic garbage collection. I don&#8217;t suppose it&#8217;s that big of a deal, because realistically you&#8217;re probably going to want to keep the thumbnailed images around anyway.</p>
<p>As mentioned above, unless you want to hack your URL scheme to include those arguments &#8211; you lose the ability to control the quality and the zoom/crop arguments on a per-image basis.</p>
<h2>Related Links</h2>
<ul>
<li><a href="/downloads/patches/timthumb.supercache.diff">Patch for TimThumb to enable path-based caching</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.hungryhacker.com/sw/super-caching-with-timthumb/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Parsing XML in Visual Basic 6</title>
		<link>http://www.hungryhacker.com/sw/parsing-xml-in-visual-basic-6/</link>
		<comments>http://www.hungryhacker.com/sw/parsing-xml-in-visual-basic-6/#comments</comments>
		<pubDate>Sun, 20 Jul 2008 04:21:32 +0000</pubDate>
		<dc:creator>fwaggle</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[vb]]></category>

		<guid isPermaLink="false">http://www.hungryhacker.com/?p=123</guid>
		<description><![CDATA[I&#8217;d been toying with this idea for a while, and never really got  around to doing it. Windows Vista includes a widget that gets the  weather for a given location, but what if you wanted to make your own?  What if you wanted to do it using a stone-age tool such as Visual Basic  6? Not to worry, it can be done.
You will need:

Visual Basic 6 (there&#8217;s probably better ways to do this in newer  versions)
Microsoft XML (I used v6, who knows what they&#8217;re up ...]]></description>
			<content:encoded><![CDATA[<p>I&#8217;d been toying with this idea for a while, and never really got  around to doing it. Windows Vista includes a widget that gets the  weather for a given location, but what if you wanted to make your own?  What if you wanted to do it using a stone-age tool such as Visual Basic  6? Not to worry, it can be done.</p>
<p>You will need:</p>
<ul>
<li>Visual Basic 6 (there&#8217;s probably better ways to do this in newer  versions)</li>
<li>Microsoft XML (I used v6, who knows what they&#8217;re up to now)</li>
<li>Microsoft Internet Transport Control</li>
<li>Google&#8217;s Cooperation</li>
</ul>
<p>First thing you need to do is dig up some data you want to use.  Google provides XML access to it&#8217;s weather data which you can select by  passing it a zip code, for example the weather for Sacramento, CA is  available from <a href="http://www.google.com/ig/api?weather=95820">http://www.google.com/ig/api?weather=95820</a>.</p>
<p>Now start a VB6 project. In the Project menu, select &#8220;References&#8221;  and select the newest Microsoft XML library you can find. Right click on  the controls toolbox and pick components, and add the Microsoft  Internet Transport Control. Drag one onto your project, I named mine  <code>inet</code>.</p>
<p>Create a new textbox, I named mine <code>debugXML</code>, and made it multiline and stretched it out a bit so I could see the data. You&#8217;ll need to  declare the following:</p>
<p><code>Dim xml_document As New DOMDocument<br />
Dim xml_node As IXMLDOMNode</code></p>
<p>You can name them something a little more appropriate to your  project, I just picked names out of the sky. <code>xml_document</code> holds the  entire XML document, parsed and unparsed. <code>xml_node</code> is used for picking  out nodes by their path (more on that later).</p>
<p>Now, in a timer or whatever you think is best, put the following:</p>
<p><code>' download xml from server<br />
debugXML.Text =  inet.OpenURL("http://www.google.com/ig/api?weather=95820", icString)<br />
' parse as xml<br />
xml_document.loadXML debugXML.Text</code></p>
<p>We should now be able to download and parse the XML that Google  spits out. You can check <code>xml_document.parseError</code> to see if it&#8217;s valid  XML, I didn&#8217;t bother for the purposes of my playing. If <code>parseError</code> is  non-zero and you try to use any of the XML functions VB will throw an  exception.</p>
<p>Next up, let&#8217;s show the user where we&#8217;re looking at the weather. We  use the XML path to dig up the city tag. If you cut out all the  irrelevant crap, you&#8217;ll see the structure is something like:</p>
<p><code>&lt;xml_api_reply&gt;&lt;weather&gt;&lt;forecast_information&gt;&lt;city  data="Sacramento, CA" /&gt;</code></p>
<p>So we can use <code>selectSingleNode()</code> method, passing it an XML path which  will give us a node. We then drag the text property of the attribute  &#8220;data&#8221; and stuff it in the form&#8217;s caption:</p>
<p><code>Set xml_node =  xml_document.documentElement.selectSingleNode("//xml_api_reply/weather/forecast_information/city")<br />
Form1.Caption  = "Weather Report: " + xml_node.Attributes.getNamedItem("data").Text</code></p>
<p>The same exact method can be used to extract the current conditions  temperature:</p>
<p><code>Set xml_node =  xml_document.documentElement.selectSingleNode("//xml_api_reply/weather/current_conditions/temp_f")<br />
txtTemp.Caption  = xml_node.Attributes.getNamedItem("data").Text</code></p>
<p>Going through the forecast days is a little tougher, because as far as I  know XML paths won&#8217;t allow you to distinguish between multiple elements  who are siblings and have the same names. You&#8217;ll probably have to walk  through the nodes using <code>nextNode</code> and keep looking for the data you want.  For this reason, and my own laziness, it&#8217;s left as an exercise for the  reader.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hungryhacker.com/sw/parsing-xml-in-visual-basic-6/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Hitting back at spammers with OpenBSD and spamd</title>
		<link>http://www.hungryhacker.com/sw/hitting-back-at-spammers-with-openbsd-and-spamd/</link>
		<comments>http://www.hungryhacker.com/sw/hitting-back-at-spammers-with-openbsd-and-spamd/#comments</comments>
		<pubDate>Thu, 20 Sep 2007 02:24:57 +0000</pubDate>
		<dc:creator>Strykar</dc:creator>
				<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[openbsd]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://www.hungryhacker.com/?p=96</guid>
		<description><![CDATA[OpenBSD&#8217;s spamd &#8211; A lightweight spam-deferral daemon. Spamd works  directly with SMTP connections, and supports features such as  gray-listing. It minimizes false positives compared to a system that does  full-body analysis. It is not a replacement for spam-filters, but an  elegant method of segregating the spammers.
This HOWTO is distributed in the hope that it will  be useful, but WITHOUT ANY WARRANTY; without even the implied warranty  of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU  General Public License for more details. ...]]></description>
			<content:encoded><![CDATA[<p>OpenBSD&#8217;s spamd &#8211; A lightweight spam-deferral daemon. Spamd works  directly with SMTP connections, and supports features such as  gray-listing. It minimizes false positives compared to a system that does  full-body analysis. It is not a replacement for spam-filters, but an  elegant method of segregating the spammers.</p>
<p>This HOWTO is distributed in the hope that it will  be useful, but WITHOUT ANY WARRANTY; without even the implied warranty  of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU  General Public License for more details. ©2008 <a href="mailto:strykar@hackerzlair.org">Strykar</a></p>
<h2>The lowdown</h2>
<p>I hate spammers; I mean I really hate their kind. It stems from a  crevasse deep inside me since Sabir Bhatia sold Hotmail.</p>
<p>There are plenty of excellent methods for spam-control, none of them  fool-proof, and almost all the good ones need you to &#8216;train&#8217; the filters  to differentiate between what&#8217;s spam and what&#8217;s not.</p>
<p>I am not going to delve into this here, suffice to say, that I use the  same RBLs that sendmail.org does and some selective country/host based  filtering keeps out most of the spam from my mail-servers. If you use  Windows, try this: <a href="http://www.cloudmark.com/desktop/">www.cloudmark.com/desktop</a> &#8211; it&#8217;s by the author of Vipul&#8217;s Razor.</p>
<p>The subject of today&#8217;s rant is the burning desire we all have to smack a  spammer, or bludgeon his gonads with a 9 Iron. We all wanna get back at  spammers, and let&#8217;s face it, there&#8217;s very little chance that we  actually will.</p>
<h2>Here&#8217;s why YOU and I won&#8217;t:</h2>
<ul>
<li>They hijack misconfigured mail-servers shifting identity and  location.</li>
<li>Tracking them takes time and effort and isn&#8217;t trivial, ask  Spamhaus.</li>
<li>It gets boring unlike watching Mplayer compile in Linux.</li>
<li>The enemy only knows the system because Bruce Schneier wants  him to know the system.</li>
</ul>
<p>We typically secure our mail servers to relay using AUTH or whatever  else takes your fancy. They still bombard us nagging your MTA to send  email, VRFY email addresses and bloat our logs with useless details.</p>
<p>That&#8217;s in the past &#8211; It&#8217;s payback time.</p>
<p>Well, a start at least, remember that the concept of RBLs started with a  bunch of SF email administrators sharing spammer host IP lists. I have  no illusions that this will kick off like that, but take a gander, if it  brings you the same joy it has brought me; follow the simple  instructions to set it up yourself. At the end of the article, take a  minute and imagine a 100&#8217;000 people running spamd and slowing spammers.  Who would mind getting back at spammers?</p>
<p>This will only work on *BSD, the few Linux hacks floating around simply  don&#8217;t work. This is NOT a method to prevent SPAM. This is NOT a How-to  on using <code>spamd</code> and <code>relaydb</code> to gray-list  spammers. This is intended for machines that have a public IP address  and receive no external mail. You can be running Sendmail/Postfix/Exim  locally for system mails etc. This typically means your MTA listens only  on localhost.</p>
<p>If you&#8217;re not familiar with spamd, read these and come back:</p>
<p><a href="http://www.benzedrine.cx/relaydb.html">All about spamd from the  horse&#8217;s mouth &#8211; Daniel Hartmeier</a></p>
<p><a href="http://en.wikipedia.org/wiki/Spamd">Wikipedia &#8211; spamd</a></p>
<p>Read the <code>spamd</code> and <code>spamd.conf</code> manuals and my  setup below will make sense to you. Edit <code>spamd.conf</code> to use  your own blacklist file. If you&#8217;re not listed as an MX record anywhere,  the ONLY people speaking to your SMTP port are spammers and zombies.</p>
<p><code>$ cat /etc/mail/spamd.conf<br />
# spamd.conf for machine having no MX record.<br />
#<br />
all:\<br />
:myblack:</p>
<p># List everyone specifying 0.0.0.0/0 in /var/db/myblack.txt<br />
#<br />
myblack:\<br />
:black:\<br />
:msg="I'm not listed as an MX record anywhere. You are a zombie\n\<br />
or a spammer. Die a slow stuttered death %A":\<br />
:method=file:\<br />
:file=/var/db/myblack.txt:<br />
</code></p>
<p>We ensure every IP address is included by using this CIDR notation.</p>
<p><code> $ cat /var/db/myblack.txt<br />
0.0.0.0/0 </code></p>
<p>Setup spamd to run from <code>/etc/rc.conf</code> The switches <code>-bvh</code> mean blacklist, log verbose and &#8216;display hostname as&#8217;.</p>
<p><code> $ cat /etc/rc.conf|grep spam<br />
spamd_flags="-b -v -h tarpit.spamtrap.host" # for normal use: "" and see spamd-setup(8)<br />
spamd_black=YES         # set to YES to run spamd without greylisting<br />
spamlogd_flags=""       # use eg. "-i interface" and see spamlogd(8)<br />
</code></p>
<p>Now comes the easiest part. We tell <code>pf</code> not to send anything  from our public/external interface to the SMTP port at localhost. This  is a fail-safe for those running a mailserver locally. We also tell <code>pf</code> to route incoming connections to our SMTP port on the public interface  to <code>spamd</code> running on localhost.</p>
<p><code>$ cat /etc/pf.conf|grep smtp -A 1<br />
no rdr on $ext_if proto tcp from any to 127.0.0.1 port smtp<br />
rdr pass log on $ext_if proto tcp from any to any port smtp \<br />
-&gt; 127.0.0.1 port spamd<br />
</code></p>
<p>Setup <code>syslog</code> to log <code>spamd</code> to <code>/var/log/spamd</code> so we have one log to rule them all.</p>
<p><code> $ touch /var/log/spamd<br />
$ cat /etc/syslog.conf|grep spamd<br />
!!spamd<br />
daemon.err;daemon.warn;daemon.info;daemon.debug         /var/log/spamd<br />
</code></p>
<p>Now you&#8217;re all set to waste spammer processor cycles. kill -HUP spamd  and syslog; reload pf rules. Watch with unabated joy as the bastards get  stuck in your tarpit by: <code>$ tail -f /var/log/spamd</code></p>
<h2>Conclusion</h2>
<p>Here are some snipped results from my /var/log/spamd:</p>
<p><code>$ tail -f /var/log/spamd<br />
Sep 17 18:22:27 barge spamd[14558]: listening for incoming connections.<br />
Sep 18 11:24:04 barge spamd[14558]: 218.167.76.111: connected (1/0)<br />
Sep 18 11:24:07 barge spamd[14558]: 218.167.76.111: disconnected after 3<br />
seconds.<br />
Sep 18 15:00:15 barge spamd[14558]: 211.74.105.53: connected (1/0)<br />
Sep 18 15:04:35 barge spamd[14558]: (GREY) 211.74.105.53: gdnrpt@289.95.17.232<br />
- abcc.1234@gmail.com<br />
Sep 18 15:06:20 barge spamd[14558]: 211.74.105.53: From: gdnrpt@289.95.17.232<br />
gdnrpt@59.95.17.232<br />
Sep 18 15:06:20 barge spamd[14558]: 211.74.105.53: Subject:<br />
289.95.17.232,25,webmaster,webmaster,,-SMTP-Dx1784E<br />
Sep 18 15:06:20 barge spamd[14558]: 211.74.105.53: To: abcc.1234@gmail.com<br />
Sep 18 15:06:20 barge spamd[14558]: 211.74.105.53: Body:<br />
ULHs9076819R%webmaster#webmaster%289$95$17$232%PAVO5204412G<br />
Sep 18 15:07:09 barge spamd[14558]: 211.74.105.53: disconnected after 414<br />
seconds.<br />
</code></p>
<p>Now let&#8217;s see what and by how much.</p>
<p><code> # grep disconnected /var/log/spamd | awk '{print $9}' \<br />
&gt;   | sort -rn | uniq -c | head<br />
1 55574<br />
1 40390<br />
1 8888<br />
1 909<br />
1 898<br />
1 872<br />
7 805<br />
1 803<br />
2 801<br />
1 800<br />
</code></p>
<p>The first at 55574 seconds took over 15.43 hours trying to finish  delivering a single email! The second at 11 hours.</p>
<p>Hah haaa, bastards! Say EHLO to my personal spam decelerator.</p>
<p>Lookup my <a href="../articles/misc/sendmail_howto.html"> sendmail article</a> for its default SMTP protocol timers. By seeing how  much time each attempt took to finish the SMTP dialogue, we can make  educated guesses as to which mailserver the spammer machine is running.  Most run dowdy FreeSMTP or SmartSMTP on Windows.  The rest are  misconfigured *NIX SMTP servers being abused as open relays. Of course,  you need to know the default configuations that they ship with.</p>
<p>All of the above is on a P-200Mhz with 32MB of EDO RAM and repeated <code>top</code> / <code>vmstat</code> runs with and without <code>spamd</code> showed  absolutely no extra resources used. That&#8217;s how well it&#8217;s written. For  those of you running BSD on a machine not as archaic as mine, you&#8217;ll  have zero worries running spamd and resource hogging. You&#8217;ll forget you  have it running, I have.</p>
<p>To sum up, just watch one spammer connect and waste time. The pleasure  of watching is almost, ahem, anal. 50 bucks says you&#8217;ll keep it running.</p>
<p>All this is for personal machines. You definitely want to use spamd in  front of mailservers, it doesn&#8217;t matter what it&#8217;s running, yes, even  Exchange. The links at the bottom will get you up and doing that in no  time.</p>
<p>Read <a href="http://marc.info/?l=openbsd-misc&amp;m=116136841831550&amp;w=2">Steve  Williams&#8217; October 20th, 2006 message to the OpenBSD-misc mailing list</a> where he reports that a pure greylisting configuration immediately rid  his company of approximately 95% of their spam load.</p>
<h2>Video of OpenBSD spamd in action</h2>
<p>(AVI 15m:19s 4.38MB)</p>
<p><a href="http://hackerzlair.org/strykar/images/spamd.avi"></a></p>
<div><a href="http://hackerzlair.org/strykar/images/spamd.avi"><img src="http://www.hackerzlair.org/members/strykar/images/spamd_grab.png" alt="" /></a></div>
<p>The video shows you how spamd stutters the conversation with the  spammer, backing up his mail queue. Spamd sets its socket receive buffer  size to one character, forcing the sender to send one TCP packet for  each byte of data, even if it&#8217;s a non-compliant &#8220;dump and disconnect&#8221;  mailer, so the spammer wastes CPU cycles and network bandwidth in  addition to a delayed queue.</p>
<p>The video link is me telnetted into a spamd install. The SMTP  transaction is recorded at real-time speeds to show what a tarpitted,  stuttered, SMTP conversation looks like. Download it and scroll ahead &#8211;  you get the drift.</p>
<p>If the video seems dodgy, and you use Windows, download the <a href="http://www.compression.ru/video/ls-codec/screen_capture_codec_en.html"> MSU screen capture codec</a>. Alternatively, you can download <a href="http://hackerzlair.org/strykar/images/spamd_web.divx"> the larger  DivX here</a>.</p>
<h3>TODO:</h3>
<p>1. Use addresses logged by spamd to setup my own RBL. Have sendmail use  it from our DNS servers as a private and guaranteed spammer-only list.  Nobody should be talking SMTP to a dynamic home IP netblock!</p>
<p>2. Document the process to setup and test a private RBL with the  required steps for BIND so this writeup can be a walkthrough for the  process.</p>
<p>Additional reading:</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Tarpit_%28networking%29">Wikipedia  &#8211; Tarpitting</a></li>
<li><a href="http://home.nuug.no/%7Epeter/pf/en/spamd.html">Peter  N. M. Hansteen &#8211; PF and spamd</a></li>
<li><a href="http://www.onlamp.com/pub/a/bsd/2007/01/18/greylisting-with-pf.html">ONLamp.com  &#8211; Greylisting with PF and spamd </a></li>
<li><a href="http://www.vsta.org/spam/Traveler.html">Andy  Valencia&#8217;s ghetto method of fooling spammers.</a></li>
<li><a href="http://www.projecthoneypot.org/">Project Honey Pot</a> &#8211; No response to my registration. If anyone works with them, please <a href="mailto:strykar@hackerzlair.org">drop me a line</a>.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.hungryhacker.com/sw/hitting-back-at-spammers-with-openbsd-and-spamd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

