<?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>Avi :)</title>
	<atom:link href="http://b.avi.co/feed/" rel="self" type="application/rss+xml" />
	<link>http://b.avi.co</link>
	<description></description>
	<lastBuildDate>Fri, 03 Feb 2012 11:03:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Finding exploited wordpress pages</title>
		<link>http://b.avi.co/finding-exploited-wordpress-pages/</link>
		<comments>http://b.avi.co/finding-exploited-wordpress-pages/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 23:02:37 +0000</pubDate>
		<dc:creator>avi</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[donotwant]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://b.avi.co/?p=847</guid>
		<description><![CDATA[WordPress seems to be hilariously easy to compromise (this might be a bad place to write that) and the general form of an exploit is to inject code like this &#60; ?php $a = base64_decode&#40;YSBsb25nIHN0cmluZyBvZiBiYXNlNjQgdGV4dAo=.......&#41;; right at the top of a script. base64_decode is rarely used by the Good Guys outside of mailers and doing <a href='http://b.avi.co/finding-exploited-wordpress-pages/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>WordPress seems to be hilariously easy to compromise (this might be a bad place to write that) and the general form of an exploit is to inject code like this</p>
<pre class="php">&lt; ?php <span style="color: #0000ff;">$a</span> = <a href="http://www.php.net/base64_decode"><span style="color: #000066;">base64_decode</span></a><span style="color: #66cc66;">&#40;</span>YSBsb25nIHN0cmluZyBvZiBiYXNlNjQgdGV4dAo=.......<span style="color: #66cc66;">&#41;</span>;</pre>
<p>right at the top of a script. <tt>base64_decode</tt> is rarely used by the Good Guys outside of mailers and doing tricks with images, but it's almost never found right at the top of a script. I did write a really convoluted script that found calls to <tt>base64_decode</tt> and <tt>exec</tt> and guessed whether they were nefarious (generally, for example, <tt>base64_decode</tt> is called with a variable (<tt>base4_decode($mailBody)</tt>), not just a string (<tt>base64_decode(dGV4dAo=)</tt>) but that just ate all my I/O and didn't really work.</p>
<p>So I came up with a much cruder way of doing it. Have a script called <tt>~/bin/base64_in_head</tt>
</pre>
<pre lang=bash>#! /bin/bash
file=$1
head $file | grep base64 || exit 1;
echo $file
exit 0;</pre>
<p>And then run it like this:</p>
<pre>$ ionice -c3 find /home/user/public_html/ -name \*.php -exec ~/bin/base64_in_head {} \;</pre>
<p>I've not yet had a situation where that's missed a file that later manual greps has found.</p>
]]></content:encoded>
			<wfw:commentRss>http://b.avi.co/finding-exploited-wordpress-pages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unattended Virtualmin installs</title>
		<link>http://b.avi.co/unattended-virtualmin-installs/</link>
		<comments>http://b.avi.co/unattended-virtualmin-installs/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 16:55:26 +0000</pubDate>
		<dc:creator>avi</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[virtualmin]]></category>

		<guid isPermaLink="false">http://b.avi.co/?p=834</guid>
		<description><![CDATA[A while ago I was asked to concoct a fire-and forget script to install Virtualmin without prompting. It's really easy: #!/bin/bash if [ -z $1 ]; then echo "Usage"; echo " $0 "; echo ""; exit fi wget http://software.virtualmin.com/gpl/scripts/install.sh export VIRTUALMIN_NONINTERACTIVE="" bash install.sh -f -host $1 rm install.sh And then you call it like so: <a href='http://b.avi.co/unattended-virtualmin-installs/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>A while ago I was asked to concoct a fire-and forget script to install Virtualmin without prompting.</p>
<p>It's really easy:</p>
<pre lang=bash>#!/bin/bash
if [ -z $1 ]; then
        echo "Usage"; echo "  $0 <hostname>"; echo ""; exit
fi
wget http://software.virtualmin.com/gpl/scripts/install.sh
export VIRTUALMIN_NONINTERACTIVE=""
bash install.sh -f -host $1
rm install.sh</hostname></pre>
<p>And then you call it like so:</p>
<pre>
./virtualmin.sh virtualmin.vm.avi.co
</pre>
<p>That was almost a disappointment.</p>
]]></content:encoded>
			<wfw:commentRss>http://b.avi.co/unattended-virtualmin-installs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Per-extension logging in MediaWiki</title>
		<link>http://b.avi.co/per-extension-logging-in-mediawiki/</link>
		<comments>http://b.avi.co/per-extension-logging-in-mediawiki/#comments</comments>
		<pubDate>Sun, 11 Dec 2011 17:02:53 +0000</pubDate>
		<dc:creator>avi</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[mediawiki]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://b.avi.co/?p=822</guid>
		<description><![CDATA[This is another of those things that took me rather longer to work out than I would have liked, so hopefully this'll appear in the sorts of searches I should have done. MediaWiki has this nifty feature where you can split the logging for particular extensions out into individual files by doing things like this: <a href='http://b.avi.co/per-extension-logging-in-mediawiki/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>This is another of those things that took me rather longer to work out than I would have liked, so hopefully this'll appear in the sorts of searches I should have done.</p>
<p>MediaWiki has this nifty feature where you can split the logging for particular extensions out into individual files by doing things like this:</p>
<pre class="php">&nbsp;
<span style="color: #0000ff;">$wgDebugLogGroups</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span>
        <span style="color: #ff0000;">'SomeExtension'</span>     =&gt; <span style="color: #ff0000;">'../logs/wiki_SomeExtension.log'</span>,
<span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p>What's not made overly clear (well, with hindsight, it is implied by the <a href="http://www.mediawiki.org/wiki/Manual:How_to_debug#Logging">manual</a>) is that the keys of the hash don't necessarily have anything to do with the name of the extension. I assumed that, in debugging SimpleCaptcha, what I wanted was</p>
<pre class="php">&nbsp;
<span style="color: #0000ff;">$wgDebugLogGroups</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span>
        <span style="color: #ff0000;">'SimpleCaptcha'</span>     =&gt; <span style="color: #ff0000;">'../logs/wiki_SimpleCaptcha.log'</span>,
<span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p>But not so! What I actually wanted was</p>
<pre class="php">&nbsp;
<span style="color: #0000ff;">$wgDebugLogGroups</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span>
        <span style="color: #ff0000;">'captcha'</span>     =&gt; <span style="color: #ff0000;">'../logs/wiki_confirmedit.log'</span>,
<span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p>And, as far as I can find, this isn't documented *anywhere*. For other extensions lacking in documentation so, you can find this out by poking around in the code, and looking for where the extension does this sort of thing:</p>
<pre class="php">&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> <a href="http://www.php.net/log"><span style="color: #000066;">log</span></a><span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$message</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
      wfDebugLog<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'captcha'</span>, <span style="color: #ff0000;">'ConfirmEdit: '</span> . <span style="color: #0000ff;">$message</span> . <span style="color: #ff0000;">'; '</span> .  <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">trigger</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p>That first argument to <tt>wfDebugLog</tt> is what you want as the key in the hash. Why it can't just use the name of the class invoking it, which is the name used to configure the rest of the extension, I've no idea - it seems, from the perspective of a non-developer who doesn't do OOP, like the obvious way to do it.</p>
]]></content:encoded>
			<wfw:commentRss>http://b.avi.co/per-extension-logging-in-mediawiki/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Allowing uploads of arbitrary files in MediaWiki</title>
		<link>http://b.avi.co/allowing-uploads-of-arbitrary-files-in-mediawiki/</link>
		<comments>http://b.avi.co/allowing-uploads-of-arbitrary-files-in-mediawiki/#comments</comments>
		<pubDate>Sun, 20 Nov 2011 03:21:46 +0000</pubDate>
		<dc:creator>avi</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[config]]></category>
		<category><![CDATA[donotwant]]></category>
		<category><![CDATA[mediawiki]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://b.avi.co/?p=794</guid>
		<description><![CDATA[I did RTFM and I did what it said, and still my Mediawiki complained when I tried to upload executable files and things with funny file extensions or mime types. if $wgFileExtensions is empty but $wgEnableUploads = true and $wgStrictFileExtensions = false it should just let me upload anything. I can't think what other behaviour <a href='http://b.avi.co/allowing-uploads-of-arbitrary-files-in-mediawiki/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>I did <a href="http://www.mediawiki.org/wiki/File_upload#Setting_uploads_on.2Foff">RTFM</a> and I did what it said, and still my Mediawiki complained when I tried to upload executable files and things with funny file extensions or mime types. if <tt>$wgFileExtensions</tt> is empty but <tt>$wgEnableUploads = true</tt> and <tt>$wgStrictFileExtensions = false</tt> it should just let me upload anything. I can't think what other behaviour one would expect there, but set like that I can't upload my dodgy files.</p>
<p>So I've removed the code it uses to check. </p>
<p>Here's a pair of diffs if you'd also like to do this. These are on version 1.17.0 but I suspect it's not changed very much.</p>
<p>This just comments out the two blocks of code in UploadBase.php which check whether files are considered safe and warn if they're not - it prevents the checking and the warning:</p>
<pre class="diff">wiki:/home/wiki/public_html# diff includes/upload/UploadBase.php includes/upload/UploadBase.php.bak
<span style="color: #440088;"><span style="">447</span>,455c447,<span style="">454</span></span>
<span style="color: #991111;">&lt; // ## Avi Commented this out so that we can upload whatever we like to our server. That was nice of him</span>
<span style="color: #991111;">&lt; //            // Check whether the file extension is on the unwanted list</span>
<span style="color: #991111;">&lt; //            global $wgCheckFileExtensions, $wgFileExtensions;</span>
<span style="color: #991111;">&lt; //            if <span style="">&#40;</span> $wgCheckFileExtensions <span style="">&#41;</span> <span style="">&#123;</span></span>
<span style="color: #991111;">&lt; //                    if <span style="">&#40;</span> !$this-&gt;checkFileExtension<span style="">&#40;</span> $this-&gt;mFinalExtension, $wgFileExtensions <span style="">&#41;</span> <span style="">&#41;</span> <span style="">&#123;</span></span>
<span style="color: #991111;">&lt; //                            $warnings<span style="">&#91;</span>'filetype-unwanted-type'<span style="">&#93;</span> = $this-&gt;mFinalExtension;</span>
<span style="color: #991111;">&lt; //                    <span style="">&#125;</span></span>
<span style="color: #991111;">&lt; //            <span style="">&#125;</span></span>
<span style="color: #991111;">&lt; //</span>
<span style="color: #888822;">---
<span style="color: #00b000;">&gt;               // Check whether the file extension is on the unwanted list</span></span>
<span style="color: #00b000;">&gt;               global $wgCheckFileExtensions, $wgFileExtensions;</span>
<span style="color: #00b000;">&gt;               if <span style="">&#40;</span> $wgCheckFileExtensions <span style="">&#41;</span> <span style="">&#123;</span></span>
<span style="color: #00b000;">&gt;                       if <span style="">&#40;</span> !$this-&gt;checkFileExtension<span style="">&#40;</span> $this-&gt;mFinalExtension, $wgFileExtensions <span style="">&#41;</span> <span style="">&#41;</span> <span style="">&#123;</span></span>
<span style="color: #00b000;">&gt;                               $warnings<span style="">&#91;</span>'filetype-unwanted-type'<span style="">&#93;</span> = $this-&gt;mFinalExtension;</span>
<span style="color: #00b000;">&gt;                       <span style="">&#125;</span></span>
<span style="color: #00b000;">&gt;               <span style="">&#125;</span></span>
<span style="color: #00b000;">&gt;</span>
<span style="color: #440088;"><span style="">557</span>,570c556,<span style="">569</span></span>
<span style="color: #991111;">&lt; // ## Avi Commented this out so that we can upload whatever we like to our server. That was nice of him</span>
<span style="color: #991111;">&lt; //            /* Don't allow users to override the blacklist <span style="">&#40;</span>check file extension<span style="">&#41;</span> */</span>
<span style="color: #991111;">&lt; //            global $wgCheckFileExtensions, $wgStrictFileExtensions;</span>
<span style="color: #991111;">&lt; //            global $wgFileExtensions, $wgFileBlacklist;</span>
<span style="color: #991111;">&lt; //            if <span style="">&#40;</span> $this-&gt;mFinalExtension == '' <span style="">&#41;</span> <span style="">&#123;</span></span>
<span style="color: #991111;">&lt; //                    $this-&gt;mTitleError = self::FILETYPE_MISSING;</span>
<span style="color: #991111;">&lt; //                    return $this-&gt;mTitle = null;</span>
<span style="color: #991111;">&lt; //            <span style="">&#125;</span> elseif <span style="">&#40;</span> $this-&gt;checkFileExtensionList<span style="">&#40;</span> $ext, $wgFileBlacklist <span style="">&#41;</span> ||</span>
<span style="color: #991111;">&lt; //                            <span style="">&#40;</span> $wgCheckFileExtensions &amp;&amp; $wgStrictFileExtensions &amp;&amp;</span>
<span style="color: #991111;">&lt; //                                    !$this-&gt;checkFileExtension<span style="">&#40;</span> $this-&gt;mFinalExtension, $wgFileExtensions <span style="">&#41;</span> <span style="">&#41;</span> <span style="">&#41;</span> <span style="">&#123;</span></span>
<span style="color: #991111;">&lt; //                    $this-&gt;mTitleError = self::FILETYPE_BADTYPE;</span>
<span style="color: #991111;">&lt; //                    return $this-&gt;mTitle = null;</span>
<span style="color: #991111;">&lt; //            <span style="">&#125;</span></span>
<span style="color: #991111;">&lt; //</span>
<span style="color: #888822;">---
<span style="color: #00b000;">&gt;</span></span>
<span style="color: #00b000;">&gt;               /* Don't allow users to override the blacklist <span style="">&#40;</span>check file extension<span style="">&#41;</span> */</span>
<span style="color: #00b000;">&gt;               global $wgCheckFileExtensions, $wgStrictFileExtensions;</span>
<span style="color: #00b000;">&gt;               global $wgFileExtensions, $wgFileBlacklist;</span>
<span style="color: #00b000;">&gt;               if <span style="">&#40;</span> $this-&gt;mFinalExtension == '' <span style="">&#41;</span> <span style="">&#123;</span></span>
<span style="color: #00b000;">&gt;                       $this-&gt;mTitleError = self::FILETYPE_MISSING;</span>
<span style="color: #00b000;">&gt;                       return $this-&gt;mTitle = null;</span>
<span style="color: #00b000;">&gt;               <span style="">&#125;</span> elseif <span style="">&#40;</span> $this-&gt;checkFileExtensionList<span style="">&#40;</span> $ext, $wgFileBlacklist <span style="">&#41;</span> ||</span>
<span style="color: #00b000;">&gt;                               <span style="">&#40;</span> $wgCheckFileExtensions &amp;&amp; $wgStrictFileExtensions &amp;&amp;</span>
<span style="color: #00b000;">&gt;                                       !$this-&gt;checkFileExtension<span style="">&#40;</span> $this-&gt;mFinalExtension, $wgFileExtensions <span style="">&#41;</span> <span style="">&#41;</span> <span style="">&#41;</span> <span style="">&#123;</span></span>
<span style="color: #00b000;">&gt;                       $this-&gt;mTitleError = self::FILETYPE_BADTYPE;</span>
<span style="color: #00b000;">&gt;                       return $this-&gt;mTitle = null;</span>
<span style="color: #00b000;">&gt;               <span style="">&#125;</span></span>
<span style="color: #00b000;">&gt; </span></pre>
<p>And this just stops Setup.php making-safe the <tt>$wgFileExtensions</tt> array by removing whatever's in <tt>$wgFileBlacklist</tt> from it, which I think wouldn't complain had I not already done Bad Things to those two variables, but it's late and it can't hurt to turn this off, too:</p>
<pre class="diff">wiki:/home/wiki/public_html# diff includes/Setup.php includes/Setup.php.bak
<span style="color: #440088;"><span style="">296</span>,298c296,<span style="">297</span></span>
<span style="color: #991111;">&lt; // ## Avi Commented this out so we can upload whatever we like to our server. That was nice of him</span>
<span style="color: #991111;">&lt; //# Blacklisted file extensions shouldn't appear on the &quot;allowed&quot; list</span>
<span style="color: #991111;">&lt; //$wgFileExtensions = array_diff <span style="">&#40;</span> $wgFileExtensions, $wgFileBlacklist <span style="">&#41;</span>;</span>
<span style="color: #888822;">---
<span style="color: #00b000;">&gt; # Blacklisted file extensions shouldn't appear on the &quot;allowed&quot; list</span></span>
<span style="color: #00b000;">&gt; $wgFileExtensions = array_diff <span style="">&#40;</span> $wgFileExtensions, $wgFileBlacklist <span style="">&#41;</span>;</span>
&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://b.avi.co/allowing-uploads-of-arbitrary-files-in-mediawiki/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tagging images by path in Shotwell</title>
		<link>http://b.avi.co/tagging-images-by-path-in-shotwell/</link>
		<comments>http://b.avi.co/tagging-images-by-path-in-shotwell/#comments</comments>
		<pubDate>Thu, 27 Oct 2011 21:36:18 +0000</pubDate>
		<dc:creator>avi</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[*buntu]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[photos]]></category>

		<guid isPermaLink="false">http://b.avi.co/?p=782</guid>
		<description><![CDATA[I've finally decided to use an image manager, and since it comes with Ubuntu this week I've gone with Shotwell. I've got a directory hierarchy containing most of my images which is sort-of sorted already, and I'm probably going to keep adding to it, if for no other reason than force of habit. I know <a href='http://b.avi.co/tagging-images-by-path-in-shotwell/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>I've finally decided to use an image manager, and since it comes with Ubuntu this week I've gone with Shotwell. I've got a directory hierarchy containing most of my images which is sort-of sorted already, and I'm probably going to keep adding to it, if for no other reason than force of habit.</p>
<p>I know that one of the wonderful features of these photo managers is that you can tag photos, and obviously a photo can be in more than one tag rather more easily than it can be in several directories. That said, all photo managers seem to have decided that an easy, fast way to tag photos isn't what's needed. </p>
<p>Additionally, shotwell's got this weird thing for hiding the fact that there's a filesystem from you, and I can't find any way to tag files by directory. So I've poked around the database and written a script to do it, which is below and <a href="http://avi.co/stuff/shotwell-tag">here</a> and pasted below in case I change my mind about file hierarchies later.</p>
<p>The oddest bit is the way the filenames are linked to the tags. The <tt>TagTable</tt> table has a field `<tt>photo_id_list</tt>` which contains a list of photo IDs in a format that I've not found anywhere else in the (admittedly not very extensive) db. </p>
<p>They're created by taking the id of the image (its value in the `<tt>id</tt>` field of the <tt>PhotoTable</tt> table), converting it to a hex value, padding it out to 16 characters with leading zeroes, and then concatenating it onto the string 'thumb':</p>
<pre class="perl"><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$hexPhotoId</span> = <a href="http://perldoc.perl.org/functions/sprintf.html"><span style="color: #000066;">sprintf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;%x&quot;</span>, <span style="color: #0000ff;">$photoId</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$thumbString</span> = <span style="color: #ff0000;">&quot;thumb&quot;</span>.<a href="http://perldoc.perl.org/functions/sprintf.html"><span style="color: #000066;">sprintf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'%016s'</span>, <span style="color: #0000ff;">$hexPhotoId</span><span style="color: #66cc66;">&#41;</span>;</pre>
<p>Anyway, the script's a bit simple because bash is quite good at handling loads of files; usage is like this to tag the contents of ~/Pictures/2011-france/ with the tag 'morzine':</p>
<pre>avi@brilliant:~$ find ~/Pictures/2011-france/ -type f -exec ./shotwell-tag {} morzine \;
Creating tag morzine
tagged /home/avi/Pictures/2011-france/R0012810.JPG with morzine
tagged /home/avi/Pictures/2011-france/R0012850.JPG with morzine
tagged /home/avi/Pictures/2011-france/R0012911.JPG with morzine
tagged /home/avi/Pictures/2011-france/R0012931.JPG with morzine
tagged /home/avi/Pictures/2011-france/R0012921.JPG with morzine
tagged /home/avi/Pictures/2011-france/R0012794.JPG with morzine
tagged /home/avi/Pictures/2011-france/R0012883.JPG with morzine
tagged /home/avi/Pictures/2011-france/R0012881.JPG with morzine
</pre>
<p>I've no idea if it breaks anything - I wrote it about an hour ago, have tagged ~500 photos with it since, and Shotwell doesn't seem to be annoyed. YMMV. Here's the script:</p>
<pre class="perl">&nbsp;
<span style="color: #808080; font-style: italic;">#! /usr/bin/perl</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># shotwell-tag</span>
<span style="color: #808080; font-style: italic;">#</span>
<span style="color: #808080; font-style: italic;"># Tags files specified by filename in shotwell. Handy for</span>
<span style="color: #808080; font-style: italic;"># getting round shotwell's attempts at hiding the filesystem.</span>
<span style="color: #808080; font-style: italic;">#</span>
<span style="color: #808080; font-style: italic;"># Avi 2011</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> strict;
<span style="color: #000000; font-weight: bold;">use</span> DBI;
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$file</span> = <a href="http://perldoc.perl.org/functions/shift.html"><span style="color: #000066;">shift</span></a>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$tag</span> = <a href="http://perldoc.perl.org/functions/shift.html"><span style="color: #000066;">shift</span></a>;
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$tag</span> !~ /.+/<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
        <a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;Usage:<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span>shotwell-tag [file] [tag]<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
        <a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;Tags [file] with [tag] in shotwell's db<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
        <a href="http://perldoc.perl.org/functions/exit.html"><span style="color: #000066;">exit</span></a> <span style="color: #cc66cc;">1</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$dbfile</span> = <span style="color: #0000ff;">$ENV</span><span style="color: #66cc66;">&#123;</span><span style="color: #ff0000;">'HOME'</span><span style="color: #66cc66;">&#125;</span>.<span style="color: #ff0000;">&quot;/.shotwell/data/photo.db&quot;</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$dbh</span> = DBI-&gt;<span style="color: #006600;">connect</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;dbi:SQLite:dbname=$dbfile&quot;</span>,<span style="color: #ff0000;">&quot;&quot;</span>,<span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;"># Each tag has a string of photo 'ids'. These are generated</span>
<span style="color: #808080; font-style: italic;"># by taking the ID of the photo from PhotoTable, representing</span>
<span style="color: #808080; font-style: italic;"># it in hex, padding that out to 16 characters with leading</span>
<span style="color: #808080; font-style: italic;"># zeroes and then appending it to the string 'thumb'</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$sth</span> = <span style="color: #0000ff;">$dbh</span>-&gt;<span style="color: #006600;">prepare</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;select id from PhotoTable where filename='$file'&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$sth</span>-&gt;<span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$row</span> = <span style="color: #0000ff;">$sth</span>-&gt;<span style="color: #006600;">fetch</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$photoId</span> = <span style="color: #0000ff;">$row</span>-&gt;<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>;
<span style="color: #b1b100;">unless</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$photoId</span> =~ /\d+/<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;$file is not in shotwell library<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>; <a href="http://perldoc.perl.org/functions/exit.html"><span style="color: #000066;">exit</span></a> <span style="color: #cc66cc;">0</span>;<span style="color: #66cc66;">&#125;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$hexPhotoId</span> = <a href="http://perldoc.perl.org/functions/sprintf.html"><span style="color: #000066;">sprintf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;%x&quot;</span>, <span style="color: #0000ff;">$photoId</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$thumbString</span> = <span style="color: #ff0000;">&quot;thumb&quot;</span>.<a href="http://perldoc.perl.org/functions/sprintf.html"><span style="color: #000066;">sprintf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'%016s'</span>, <span style="color: #0000ff;">$hexPhotoId</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #0000ff;">$sth</span> = <span style="color: #0000ff;">$dbh</span>-&gt;<span style="color: #006600;">prepare</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;select id from TagTable where name='$tag'&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$sth</span>-&gt;<span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$row</span> = <span style="color: #0000ff;">$sth</span>-&gt;<span style="color: #006600;">fetch</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$tagId</span> = <span style="color: #0000ff;">$row</span>-&gt;<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>;
<span style="color: #b1b100;">unless</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$tagId</span> =~ /\d+/<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
	<a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;Creating tag $tag<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
	<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$sth</span> = <span style="color: #0000ff;">$dbh</span>-&gt;<span style="color: #006600;">prepare</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;insert into TagTable (name) values('$tag')&quot;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #0000ff;">$sth</span>-&gt;<span style="color: #006600;">execute</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">$sth</span> = <span style="color: #0000ff;">$dbh</span>-&gt;<span style="color: #006600;">prepare</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Select photo_id_list from TagTable where name='$tag'&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$sth</span>-&gt;<span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$row</span> = <span style="color: #0000ff;">$sth</span>-&gt;<span style="color: #006600;">fetch</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$photoList</span> = <span style="color: #0000ff;">$row</span>-&gt;<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>;
<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$photoList</span> !~ /,$/ &amp;&amp; <span style="color: #0000ff;">$photoList</span> =~ /._/<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
	<span style="color: #0000ff;">$photoList</span>.=<span style="color: #ff0000;">','</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$photoList</span> =~ /<span style="color: #0000ff;">$thumbString</span>/<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
	<a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;$file is already tagged with $tag<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
	<a href="http://perldoc.perl.org/functions/exit.html"><span style="color: #000066;">exit</span></a> <span style="color: #cc66cc;">0</span>;
<span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span>
	<span style="color: #0000ff;">$photoList</span>.=<span style="color: #0000ff;">$thumbString</span>.<span style="color: #ff0000;">','</span>;
	<span style="color: #0000ff;">$sth</span> = <span style="color: #0000ff;">$dbh</span>-&gt;<span style="color: #006600;">prepare</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;update TagTable set photo_id_list = '$photoList' where name='$tag'&quot;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #0000ff;">$sth</span>-&gt;<span style="color: #006600;">execute</span>;
	<a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;tagged $file with $tag<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
	<a href="http://perldoc.perl.org/functions/exit.html"><span style="color: #000066;">exit</span></a> <span style="color: #cc66cc;">0</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://b.avi.co/tagging-images-by-path-in-shotwell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Postfixadmin with clear-text passwords</title>
		<link>http://b.avi.co/postfixadmin-with-clear-text-passwords/</link>
		<comments>http://b.avi.co/postfixadmin-with-clear-text-passwords/#comments</comments>
		<pubDate>Sat, 17 Sep 2011 12:27:04 +0000</pubDate>
		<dc:creator>avi</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[insecurity]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[postfixadmin]]></category>

		<guid isPermaLink="false">http://b.avi.co/?p=775</guid>
		<description><![CDATA[One of my projects at the minute is converting vpopmail mail servers to postfixadmin. One _really_ handy thing about some of these vpopmail machines is that they store a cleartext copy of all the users' passwords, so I can feed them straight into the new system. So, I've now got a postfixadmin system that stores <a href='http://b.avi.co/postfixadmin-with-clear-text-passwords/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>One of my projects at the minute is converting vpopmail mail servers to postfixadmin. One _really_ handy thing about some of these vpopmail machines is that they store a cleartext copy of all the users' passwords, so I can feed them straight into the new system.</p>
<p>So, I've now got a postfixadmin system that stores cleartext passwords, and in case you want to do it, too, I've put <a href="http://avi.co/stuff/postfixadmin_plaintext-passwords.txt">a patch up</a>. It gives you an extra couple of options in the <tt>config.inc.php</tt> file, which I hope are well enough explained by the comments:</p>
<pre class="php">&nbsp;
<span style="color: #808080; font-style: italic;">// cleartext</span>
<span style="color: #808080; font-style: italic;">// Do you want to store cleartext passwords for email accounts?</span>
<span style="color: #808080; font-style: italic;">// true = store cleartext passwords (need to have a password_clear column in the mailbox table)</span>
<span style="color: #808080; font-style: italic;">// false = don't store cleartext passwords</span>
<span style="color: #0000ff;">$CONF</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'cleartext'</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #000000; font-weight: bold;">false</span>;
<span style="color: #808080; font-style: italic;">// and the same for admins:</span>
<span style="color: #0000ff;">$CONF</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'cleartext_admin'</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #000000; font-weight: bold;">false</span>;
&nbsp;</pre>
<p>If you do want this (and are aware of the problems with storing cleartext passwords) it's quite easy to do. First, add a couple of columns to the MySQL db:</p>
<pre class="sql">&nbsp;
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> mailbox <span style="color: #993333; font-weight: bold;">ADD</span> <span style="color: #ff0000;">`password_clear`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> admin <span style="color: #993333; font-weight: bold;">ADD</span> <span style="color: #ff0000;">`password_clear`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p>Next, apply my patch:</p>
<pre>
avi@amazing:/var/www/postfixadmin$ wget -q http://avi.co/stuff/postfixadmin_plaintext-passwords.txt
avi@amazing:/var/www/postfixadmin$ patch < postfixadmin_plaintext-passwords.txt
</pre>
<p>Lastly, configure it; my patch sets both the config variables to 'false' because I like safeguards like that :)</p>
<p>It's worth noting that if you're using cleartext passwords, and then turn it off, the cleartext columns wont be affected - you'll need to update them with nulls or something if you want to get rid of the data in them.</pre>
]]></content:encoded>
			<wfw:commentRss>http://b.avi.co/postfixadmin-with-clear-text-passwords/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fail2Ban and date formats</title>
		<link>http://b.avi.co/fail2ban-and-date-formats/</link>
		<comments>http://b.avi.co/fail2ban-and-date-formats/#comments</comments>
		<pubDate>Tue, 04 Jan 2011 16:53:56 +0000</pubDate>
		<dc:creator>avi</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[config]]></category>
		<category><![CDATA[donotwant]]></category>
		<category><![CDATA[fail2ban]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[network]]></category>

		<guid isPermaLink="false">http://b.avi.co/?p=735</guid>
		<description><![CDATA[Fail2Ban is utterly daft in at least one respect. Here's me testing a regex on a date format it doesn't recognise: # fail2ban-regex '2010-12-14 15:12:31 - 80.87.131.48' ' - &#60;HOST&#62;$' Found a match but no valid date/time found for 2010-12-14 15:12:31 - 80.87.131.48. Please contact the author in order to get support for this format <a href='http://b.avi.co/fail2ban-and-date-formats/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Fail2Ban is utterly daft in at least one respect. Here's me testing a regex on a date format it doesn't recognise:</p>
<pre># fail2ban-regex '2010-12-14 15:12:31 - 80.87.131.48' ' - &lt;HOST&gt;$'
Found a match but no valid date/time found for 2010-12-14 15:12:31 - 80.87.131.48. Please contact the author in order to get support for this format
Sorry, no match
</pre>
<p>And on one that it does:
<pre>fail2ban-regex '2010/12/14 15:12:31 - 80.87.131.48' ' - &lt;HOST&gt;$'

Success, the following data were found:
Date: Tue Dec 14 15:12:31 2010
IP  : 80.87.131.48

Date template hits:
0 hit: Month Day Hour:Minute:Second
0 hit: Weekday Month Day Hour:Minute:Second Year
1 hit: Year/Month/Day Hour:Minute:Second
0 hit: Day/Month/Year:Hour:Minute:Second
0 hit: TAI64N
0 hit: Epoch

Benchmark. Executing 1000...
Performance
Avg: 0.10257935523986816 ms
Max: 0.125885009765625 ms (Run 8)
Min: 0.10085105895996094 ms (Run 780)</pre>
<p>Ignoring for the moment the fact that it doesn't recognise 2010-12-14 15:12:31 (Seriously?)<sup>1</sup> , the only way to get that list of date formats is by happening to pick a correct one. As soon as you no longer need a list of date formats you may use, it presents you with one.</p>
<p>What?</p>
<p>So, as an attempted fix for this situation, see above for a list of compatible date formats.</p>
<ol class="footnotes"><li id="footnote_0_735" class="footnote">It's worth noting, too, that the author is of the opinion that specifying your own date format is too much like hard work, so if you want support for any date format other than those already supported, you've to patch it yourself. Which is obviously way easier than just having a date regex in the config file</li></ol>]]></content:encoded>
			<wfw:commentRss>http://b.avi.co/fail2ban-and-date-formats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why I won&#8217;t be mirroring Wikileaks</title>
		<link>http://b.avi.co/why-i-wont-be-mirroring-wikileaks/</link>
		<comments>http://b.avi.co/why-i-wont-be-mirroring-wikileaks/#comments</comments>
		<pubDate>Thu, 09 Dec 2010 22:09:36 +0000</pubDate>
		<dc:creator>Avi</dc:creator>
				<category><![CDATA[Tracts]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[wikileaks]]></category>

		<guid isPermaLink="false">http://b.avi.co/?p=732</guid>
		<description><![CDATA[I have a fair amount of 'spare' server space, and some very understanding service providers, and so it makes sense for me to mirror things in general, which I do. So when Wikileaks went down, mirroring it seemed quite a natural response. They need mirrors, and I have a mirror. I've been looking for something <a href='http://b.avi.co/why-i-wont-be-mirroring-wikileaks/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>I have a fair amount of 'spare' server space, and some very understanding service providers, and so it makes sense for me to mirror things in general, which I do. So when Wikileaks went down, mirroring it seemed quite a natural response. They need mirrors, and I have a mirror. I've been looking for something to do with my youcanstickitupyourarse.com domain for a while, and this seemed like a good bet.</p>
<p>Also in favour is the fact that Wikileaks is being a bit of a pain to a few institutions (well, governments) that annoy the crap out of me; I'd not mind being part of that. In addition, the huge majority of the released cables appear to be of no interest whatsoever, and the large governmental opposition to them has only served to increase the perception of their importance. I'd like as many people as possible to be able to read them such that they can judge for themselves how interesting they are. The point appears to be less what's been found out and more that anything has at all.</p>
<p>But I have concernes, too. Firstly, these cables were all sent on the basis they were confidential, so they naturally contain the sort of information that neither end wants made public. I'm already livid at the apparent acceptance of just anybody being able to subject me to surveillance, and I don't see why embassy staff should necessarily be treated differently. The argument that they work for the government is moot - millions of privately-employed people do work for the government, and they also should have a right to an expectation of privacy. I honestly have no problem at all with governments talking to each other in privacy, it seems to be quite a natural way of working and is not at all contrary to the idea of an open government.</p>
<p>Second, and of more concern than that, is the sort of things these people are likely to be sticking down encrypted tunnels. I don't want to inadvertently find myself hosting a document that results in an informant being tortured or killed. I don't really want to be party to releasing information that only serves to embarras or otherwise compromise someone. I don't want *anyone* to do that, but I've only got control over my servers.</p>
<p>That's all well and good, you say. Wikileaks are sifting through these and specifically redacting anything they deem not fit for release. That's some hubris right there.</p>
<p>And here's the difference. I trust the Debian project, and Canonical, the Perl foundation, Zend and the like, to not put things I disagree with on my server. I do not trust Wikileaks in this respect at all.</p>
<p>The whole '<a href="http://avi.co/doc/CollateralMurder.html">Collateral Murder</a>' release is a great example of Wikileaks not releasing information for the sake of it being free, but releasing specifically compromising information, with a decidedly skewed context, in order to further some particular viewpoint. That video, or perhaps its commentary, removed the bulk of my respect for Wikileaks. Why on earth would I assume they're not going to similarly skew the releases here also? Wikileaks does have a stated aim they're pursuing with all the leaking; it's not just because they feel information should be free.</p>
<p>So, it's not that I've got some opposition to the leaking, or feel that it shouldn't be mirrored. It's just that I don't feel I can trust Wikileaks to only publish what I think should be published, and picking-and-choosing which bits to host is not how a mirror works.</p>
]]></content:encoded>
			<wfw:commentRss>http://b.avi.co/why-i-wont-be-mirroring-wikileaks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting root on a UK T-Mobile Galaxy S</title>
		<link>http://b.avi.co/getting-root-on-a-uk-t-mobile-galaxy-s/</link>
		<comments>http://b.avi.co/getting-root-on-a-uk-t-mobile-galaxy-s/#comments</comments>
		<pubDate>Mon, 13 Sep 2010 20:41:27 +0000</pubDate>
		<dc:creator>Avi</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[config]]></category>

		<guid isPermaLink="false">http://blog.avi.co/?p=721</guid>
		<description><![CDATA[It's a bit weird. The process was really easy, but none of the tutorials I found worked; each stopped working at one point or another. So, assuming other people will hit the same barriers and want a Just Works way to get root, I've gone through my terminal history for the bits that worked. Obviously, <a href='http://b.avi.co/getting-root-on-a-uk-t-mobile-galaxy-s/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>It's a bit weird. The process was really easy, but none of the tutorials I found worked; each stopped working at one point or another. So, assuming other people will hit the same barriers and want a Just Works way to get root, I've gone through my terminal history for the bits that worked. Obviously, this is just what worked for me; I can't guarantee it'll work anywhere else though if you're at all familiar with the process it'll probably look right. The only real stumbling blocks I hit were getting a recovery menu (unfamiliarity with adb) and picking a ROM that I could trust. There was nowhere near enough diligence in that bit of the process, though. Bad Avi. Also, for those still expecting disclaimers, this voids warranties.</p>
<p>I can't find a reboot-and-hold-down-X-key method of rebooting into recovery mode (the boot menu) that works, and it seems to be different for each variant of this device in any case. Using adb, the Android debugger, does work, and contrary to several scare stories doesn't require proprietary Samsung drivers.</p>
<p>adb's really easy to make work. First, install a jdk. You might do this differently if you're not running Debian:</p>
<pre>root@debian:~# apt-get install sun-java6-jdk</pre>
<p>While we're here, if you want to suggest a more interesting hostname, go for it. I'm having a bit of an imagination failure in that department.</p>
<p>Next, you need to grab the tarball of the Android SDK, extract it somewhere and make its <tt>tools</tt> subdir part of your <tt>$PATH</tt>. You probably should do most of this as some user that isn't root, but I was rather excited at the time:</p>
<pre>
root@debian:~# mkdir adb && cd adb
root@debian:~/#wget -q http://dl.google.com/android/android-sdk_r07-linux_x86.tgz
root@debian:~/# tar -xzf android-sdk_r07-linux_x86.tgz
root@debian:~/adb# ls android-sdk-linux_x86
add-ons  platforms  SDK Readme.txt  tools
root@debian:~/adb# export PATH=${PATH}:/root/android-sdk-linux_x86/tools
</pre>
<p>Now (or perhaps while you're waiting for the tarball to arrive), enable USB debugging on your phone. It's under Settings -> Applications -> Development for some reason. Check the box next to "USB debugging". You'll need to have the USB cable unplugged. Plug it back in again, then, returning to your shell with adb in its path, check for the presence of your device:</p>
<pre>root@debian:~/adb# adb devices
List of devices attached
90006e8ba84e    device</pre>
<p>If yours doesn't show up, I'm not really sure what to do. Google?</p>
<p>Now, you need to have the update.zip somewhere. I've uploaded the one I've used to <a href="http://aviswebsite.co.uk/stuff/galaxys_root/update.zip">here</a> but this'll work for any of them.</p>
<pre>root@debian~/adb# wget -q http://aviswebsite.co.uk/stuff/galaxys_root/update.zip</pre>
<p>If UMS works on yours, copy update.zip with your favourite file copying method. Mine didn't, so I used adb. There are two sdcards in the Galaxy, an internal one and an external (removable) one. The internal one is mounted at <tt>/sdcard</tt>, the traditional location of removable ones, and the external one at <tt>/sdcard/sd</tt>. You want to put update.zip in <tt>/sdcard</tt>, not <tt>/sdcard/sd</tt>.</p>
<pre>root@debian:~/adb# adb push update.zip /sdcard/update.zip

You then use adb to reboot into the recovery menu:
</pre>
<pre>root@debian:~/adb# adb reboot recovery</pre>
<p>Select "Apply sdcard:update.zip" and wait while it installs it, then "reboot system now". You now have root. The quickest way I can think to test it is to download and install the 'superuser' application from the market, then test it with adb:</p>
<pre>root@debian:~/adb# adb shell
$ su
#
</pre>
<p>You'll get prompted (on the phone) to allow an unknown application root access, and then you'll have root. Congratulations, your phone is now yours. :)</p>
<p>Now, I'm off to follow the rest of <a href="http://forum.cyanogenmod.com/topic/4055-howto-make-the-vibrant-software-not-suck/">How to make the vibrant software not suck</a>, 'cause it's shocking out of the box.</p>
]]></content:encoded>
			<wfw:commentRss>http://b.avi.co/getting-root-on-a-uk-t-mobile-galaxy-s/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Browser Ballot</title>
		<link>http://b.avi.co/windows-browser-ballot/</link>
		<comments>http://b.avi.co/windows-browser-ballot/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 11:57:39 +0000</pubDate>
		<dc:creator>Avi</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[MS]]></category>
		<category><![CDATA[UI Fail]]></category>

		<guid isPermaLink="false">http://aviswebsite.co.uk/blog/?p=699</guid>
		<description><![CDATA[Mildly controversially, MS have found themselves compelled to offer Windows users in the EU a 'browser ballot' screen in an effort to make IE a less default choice, which is fairly understandable (if perhaps not understandably fair). But MS have decided for some reason that the best way to do this is is render it <a href='http://b.avi.co/windows-browser-ballot/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Mildly controversially, MS have found themselves compelled to offer Windows users in the EU a 'browser ballot' screen in an effort to make IE a less default choice, which is fairly understandable (if perhaps not understandably fair).</p>
<p>But MS have decided for some reason that the best way to do this is is render it as a web page in IE8. So before making an unbiased decision with no leading questions, you've already had to configure IE8.</p>
<p><a href="http://aviswebsite.co.uk/wordpress/wp-content/uploads/ui-fail-windows-browser-ballot/browser_choice.png"><img src="http://aviswebsite.co.uk/wordpress/wp-content/uploads/ui-fail-windows-browser-ballot/browser_choice.png" alt="MS Windows Browser Chooser" title="browser_choice" class="aligncenter size-full wp-image-700" /></a></p>
<p>I was going to post about the crapness of IE8's multiple configuration dialogues, but this is more amusing.</p>
]]></content:encoded>
			<wfw:commentRss>http://b.avi.co/windows-browser-ballot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

