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

<channel>
	<title>Tadek's Blog &#187; New Ideas</title>
	<atom:link href="http://tadek.pietraszek.org/blog/category/new-ideas/feed/" rel="self" type="application/rss+xml" />
	<link>http://tadek.pietraszek.org/blog</link>
	<description>Some random notes about computers, security, cool links and others.</description>
	<lastBuildDate>Fri, 12 Dec 2008 22:49:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Gallery2 plugin &#8211; displaying googlemaps with GPS coordinates from EXIF</title>
		<link>http://tadek.pietraszek.org/blog/2006/08/31/gallery2-plugin-displaying-googlemaps-with-gps-coordinates-from-exif/</link>
		<comments>http://tadek.pietraszek.org/blog/2006/08/31/gallery2-plugin-displaying-googlemaps-with-gps-coordinates-from-exif/#comments</comments>
		<pubDate>Thu, 31 Aug 2006 10:05:27 +0000</pubDate>
		<dc:creator>tadekp</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[New Ideas]]></category>
		<category><![CDATA[Progs/Tools/Libs]]></category>
		<category><![CDATA[Tips&Tricks]]></category>

		<guid isPermaLink="false">http://tadek.pietraszek.org/blog/2006/08/31/gallery2-plugin-displaying-googlemaps-with-gps-coordinates-from-exif/</guid>
		<description><![CDATA[After resuming my geotaggin script (see this post), I decided to do something useful with it. We&#8217;re using gallery2 to store our photos and with a googlemap plugin, but found it useful only for displaying a single pointer per album (see here). For a more fine-grained selection we needed something else.

Therefore, I decided to write [...]]]></description>
			<content:encoded><![CDATA[<p>After resuming my geotaggin script (see this post), I decided to do something useful with it. We&#8217;re using gallery2 to store our photos and with a <a href="http://codex.gallery2.org/index.php/Gallery2:Modules:Map">googlemap plugin</a>, but found it useful only for displaying a single pointer per album (see <a href="http://gallery.ibao.net/Map/">here</a>). For a more fine-grained selection we needed something else.</p>

<p>Therefore, I decided to write my own plugin (yeah, there are already two out there, why not write my own? <img src='http://tadek.pietraszek.org/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> ) and also learn Gallery2 API. The idea is to display a google map at the bottom of each photo, showing exactly where the photo was taken. Yes, it photo-specific and there&#8217;s only one pointer on the map. I find it nonetheless very useful.</p>

<p>Here&#8217;s a <a href="http://gallery.ibao.net/travel/Switzerland/melchsee/IMG_2991.JPG.html">sample output</a> (you can also admire the beautiful scenery of Melchsee <img src='http://tadek.pietraszek.org/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> ). The plugin adds a new &#8220;block&#8221; in the template (therefore can be configured using a standard block management tool in Gallery2).</p>

<p>The position of the current photo is always in the middle (although you can move the map around, change the map type, zoom in and out etc.). The changes you make are stored as session cookies, and preserved between consecutive photo loads. Also, the whole panel can be hidden to speed up load and only shown on demand (show map|hide map).</p>

<p>Any comments? suggestions? ideas?</p>

<p>The plugin is currently in <em>alpha</em> stage, I will release it in a week or two (I want to create a webpage for it as well). In the meantime, if you&#8217;re interested in trying it out, drop me a line <img src='http://tadek.pietraszek.org/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>

<p>BTW: I also found out that when iPhoto edits a photo, it converts Exif from Intel to Motorola (little endian -> big endian). There was a bug in <a href="http://www.offsky.com/software/exif/index.php">exifer</a> used in gallery, which corrpted the tags. The patch is only two lines long and can be found here (I also emailed the author):
<code>
<pre>
--- gps.inc.orig        2006-08-31 10:25:27.000000000 +0200
+++ gps.inc     2006-08-31 10:36:37.000000000 +0200
@@ -116,13 +116,24 @@
                        $minutes = GPSRational(substr($data,16,16),$intel);
                        $hour = GPSRational(substr($data,32,16),$intel);</p>

<ul>
<li>/* now we need a hack, since the whole data has been flipped in :103</li>
<li>
<ul>
<li>the order here is sec:min:hour. However, in the motorla mode the data</li>
</ul></li>
<li>
<ul>
<li>has not been flipped and the order is h:m:s. This breaks compatibility</li>
</ul></li>
<li>
<ul>
<li>with Motorola exif. (Tadek) */</li>
</ul></li>
<li>if($intel==1)
                    $data = $hour+$minutes/60+$seconds/3600;</li>
<li>else</li>
<li><pre><code>                                $data = $seconds+$minutes/60+$hour/3600;
        } else if($tag=="0007") { //Time
                $seconds = GPSRational(substr($data,0,16),$intel);
                $minutes = GPSRational(substr($data,16,16),$intel);
                $hour = GPSRational(substr($data,32,16),$intel);
</code></pre></li>
<li><pre><code>                /* I guess the same HACK as above. Tadek */
</code></pre></li>
<li>if ($intel==1)
                    $data = $hour.":".$minutes.":".$seconds;</li>
<li>else</li>
<li>$data = $seconds.":".$minutes.":".$hour;
            } else {
                    if($bottom!=0) $data=$top/$bottom;
                    else if($top==0) $data = 0;</li>
</ul>

<p></pre>
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://tadek.pietraszek.org/blog/2006/08/31/gallery2-plugin-displaying-googlemaps-with-gps-coordinates-from-exif/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>&quot;Worriors&quot; &#8211; worries outsourced</title>
		<link>http://tadek.pietraszek.org/blog/2006/01/25/worriors-worries-outsourced/</link>
		<comments>http://tadek.pietraszek.org/blog/2006/01/25/worriors-worries-outsourced/#comments</comments>
		<pubDate>Wed, 25 Jan 2006 08:00:25 +0000</pubDate>
		<dc:creator>tadekp</dc:creator>
				<category><![CDATA[New Ideas]]></category>
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://tadek.pietraszek.org/blog/2006/01/25/worriors-worries-outsourced/</guid>
		<description><![CDATA[Everybody has worries, which stay in our minds. For example, Currently, I am worrying about at least a dozen of things (maybe Poles are a worrying nation, or it is just me, don&#8217;t know) and, you must admit, it&#8217;s hard to stay productive being occupied with worrying.

Hence, during our lunch discussion yesterday we came up [...]]]></description>
			<content:encoded><![CDATA[<p>Everybody has worries, which stay in our minds. For example, Currently, I am worrying about at least a dozen of things (maybe Poles are a worrying nation, or it is just me, don&#8217;t know) and, you must admit, it&#8217;s hard to stay productive being occupied with worrying.</p>

<p>Hence, during our lunch discussion yesterday we came up with the idea of <em>worriors</em>, to whom you can outsource your worries. To be completely honest this idea came from <a href="http://www.smartmoney.com/esquire/index.cfm?Story=20050909-outsource">My Outsourced Life</a>, I think the notion of &#8220;worriors&#8221; is ours <img src='http://tadek.pietraszek.org/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>

<p>The idea is to have a website, where you can submit your worries, which a professional worrior (human or automated) can worry about. You can log in and check what they are currently worrying about or maybe even sign up for a comforting e-mail:</p>

<blockquote>
  <p>Don&#8217;t worry.<br />
  We are currently worrying about &lt;> for you.<br />
  Yours professional worriors&#8221;</p>
</blockquote>

<p>This can also be a &#8220;worries outlet&#8221;: discussions, support groups and of course a great chance for advertising.</p>
]]></content:encoded>
			<wfw:commentRss>http://tadek.pietraszek.org/blog/2006/01/25/worriors-worries-outsourced/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Meaningful plots from connection statistics (using conn2db2csv.pl)</title>
		<link>http://tadek.pietraszek.org/blog/2005/11/28/meaningful-plots-from-connection-statistics-using-conn2db2csvpl/</link>
		<comments>http://tadek.pietraszek.org/blog/2005/11/28/meaningful-plots-from-connection-statistics-using-conn2db2csvpl/#comments</comments>
		<pubDate>Mon, 28 Nov 2005 21:50:12 +0000</pubDate>
		<dc:creator>tadekp</dc:creator>
				<category><![CDATA[New Ideas]]></category>
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://tadek.pietraszek.org/blog/?p=210</guid>
		<description><![CDATA[Now that I have the infrastrucutre for asking meaningful queries, here&#8217;s what I could be interesting in. These can be nicely scripted and shown on the webpage using CGI (all these are sliding windows with no input parameters, thus no worries about SQL injections).

BTW: I know this SQL is ugly like hell, but the framwork [...]]]></description>
			<content:encoded><![CDATA[<p>Now that I have the infrastrucutre for asking meaningful queries, here&#8217;s what I could be interesting in. These can be nicely scripted and shown on the webpage using CGI (all these are sliding windows with no input parameters, thus no worries about SQL injections).</p>

<p>BTW: I know this SQL is ugly like hell, but the framwork is really flexible and these queries are very easy to write. Here they go:</p>

<p><span id="more-210"></span>
Last 3 days&#8217;s connections on known ports (hourly):
<code>
./conn2db2csv.pl -q "select date_trunc('hour',time), 
coalesce(sum(case when dport=80 or dport =443 then brecv else NULL end),0) as r80,
coalesce(sum(case when dport=80 or dport = 443 then bsent else NULL end),0) as s80,
coalesce(sum(case when dport=22 or dport=7322 then brecv else NULL end),0) as r22,
coalesce(sum(case when dport=22 or dport=7322 then bsent else NULL end),0) as s22,
coalesce(sum(case when dport=993 then brecv else NULL end),0) as r993,
coalesce(sum(case when dport=993 then bsent else NULL end),0) as s993,
coalesce(sum(case when dport=53 then brecv else NULL end),0) as r53,
coalesce(sum(case when dport=53 then bsent else NULL end),0) as s53,
coalesce(sum(case when dport=25 or dport = 587 then brecv else NULL end),0) as r25,
coalesce(sum(case when dport=25 or dport = 587 then bsent else NULL end),0) as s25
from conn where dip='85.10.194.212' and time > now()-'3 days'::interval group by 1 having(sum(brecv) >0) order by 1" -d "dbi:Pg:dbname=bro;host=localhost;port=54321" -u bro -p &lt;password&gt; -s ' '
</code></p>

<p>Last half year&#8217;s connection on known ports (daily) :
<code>
./conn2db2csv.pl -q "select date_trunc('day',time), 
coalesce(sum(case when dport=80 or dport =443 then brecv else NULL end),0) as r80,
coalesce(sum(case when dport=80 or dport = 443 then bsent else NULL end),0) as s80,
coalesce(sum(case when dport=22 or dport=7322 then brecv else NULL end),0) as r22,
coalesce(sum(case when dport=22 or dport=7322 then bsent else NULL end),0) as s22,
coalesce(sum(case when dport=993 then brecv else NULL end),0) as r993,
coalesce(sum(case when dport=993 then bsent else NULL end),0) as s993,
coalesce(sum(case when dport=53 then brecv else NULL end),0) as r53,
coalesce(sum(case when dport=53 then bsent else NULL end),0) as s53,
coalesce(sum(case when dport=25 or dport = 587 then brecv else NULL end),0) as r25,
coalesce(sum(case when dport=25 or dport = 587 then bsent else NULL end),0) as s25
from conn where dip='85.10.194.212' and time > now()-'6 months'::interval group by 1 having(sum(brecv) >0) order by 1" -d "dbi:Pg:dbname=bro;host=localhost;port=54321" -u bro -p &lt;password&gt; -s ' '
</code></p>

<p>The number of incoming connections and total bytes sent and received on all server ports (in a week):
<code>
./conn2db2csv.pl -q "select dport, count(*), coalesce(sum(bsent),0), coalesce(sum(brecv),0)
from conn where dip='85.10.194.212' and time > now()-'1 week'::interval group by 1 having (sum(brecv)>0) order by 1" -d "dbi:Pg:dbname=bro;host=localhost;port=54321" -u bro -p &lt;password&gt; -s ' '
</code></p>

<p>Similarly, might be interesting what the server contacted:
<code>
./conn2db2csv.pl -q "select dport, count(*), coalesce(sum(bsent),0), coalesce(sum(brecv),0)
from conn where sip='85.10.194.212' and time > now()-'1 week'::interval group by 1 having (sum(brecv)>0) order by 1" -d "dbi:Pg:dbname=bro;host=localhost;port=54321" -u bro -p &lt;password&gt; -s ' '
</code></p>

<p>Finally, scanning attempts:
<code>
./conn2db2csv.pl -q "select dport, count(*), coalesce(sum(bsent),0), coalesce(sum(brecv),0)
from conn where dip='85.10.194.212' and time > now()-'1 month'::interval group by 1 having (sum(brecv)) is null order by 1" -d "dbi:Pg:dbname=bro;host=localhost;port=54321" -u bro -p &lt;password&gt; -s ' ' 
</code></p>

<p>And top port scanners:
<code>
./conn2db2csv.pl -q "select sip, count(dport), count(*)
from conn where dip='85.10.194.212' and time > now()-'1 month'::interval group by 1 having (sum(brecv)) is null order by 2 desc" -d "dbi:Pg:dbname=bro;host=localhost;port=54321" -u bro -p &lt;password&gt; -s ' '
</code></p>

<p>Finally how to print such a thing using gnuplot:
<code>
set timefmt "%Y-%m-%d %H:%M:%S"
set logscale y
plot '&lt;file&gt;' using 1:3 with l t 'P80', '' using 1:4 with l t 'P22', '' using 1:5 with l t 'P53', '' using 1:6 with l t 'P25'
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://tadek.pietraszek.org/blog/2005/11/28/meaningful-plots-from-connection-statistics-using-conn2db2csvpl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Storing and plotting connection summaries in the database</title>
		<link>http://tadek.pietraszek.org/blog/2005/11/28/storing-and-plotting-connection-summaries-in-the-database/</link>
		<comments>http://tadek.pietraszek.org/blog/2005/11/28/storing-and-plotting-connection-summaries-in-the-database/#comments</comments>
		<pubDate>Mon, 28 Nov 2005 00:44:40 +0000</pubDate>
		<dc:creator>tadekp</dc:creator>
				<category><![CDATA[New Ideas]]></category>
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://tadek.pietraszek.org/blog/2005/11/28/storing-and-plotting-connection-summaries-in-the-database/</guid>
		<description><![CDATA[Since a while I have been (experimentally) running Bro on my server collecting connection summaries. This is a very nice feature of Bro, generating really accurate TCP flows (including information whether the connection was terminated correctly or not and others). The big advantage of connection summaries (over e.g. NetFlow)  is their high accuracy and [...]]]></description>
			<content:encoded><![CDATA[<p>Since a while I have been (experimentally) running Bro on my server collecting connection summaries. This is a very nice feature of Bro, generating really accurate TCP flows (including information whether the connection was terminated correctly or not and others). The big advantage of connection summaries (over e.g. NetFlow)  is their high accuracy and yet compact representation (for over 2 months ov data, I have only 21MB (250k lines) of data.</p>

<p>I wrote a simple perl parser parsing Bro&#8217;s connection status and writing it to a relational database (in this case Postgres). The parser can also run in &#8220;query&#8221; mode, producing a comma/space separated data for easy visualization (using <a href="http://sourceforge.net/projects/afterglow">AfterGlow</a> or even GnuPlot).</p>

<p>Here&#8217;s how I run my collection:
<code>
sudo bin/bro -i eth0 -f "host 85.10.194.212" conn
</code></p>

<p>And parsing:
<code>
tail -f conn.log | ../conn2db2csv.pl -i -d "dbi:Pg:dbname=bro;host=localhost" -u bro -p &lt;password&gt;
</code></p>

<p>And plotting:
<code>
 ./conn2db2csv.pl -q "select time::date,dport, sum(brecv) from conn where dip='85.10.194.212' group by 1,2 having(sum(brecv) >0) order by 1,2" -d "dbi:Pg:dbname=bro;host=localhost" -u bro -p &lt;password&gt;
</code></p>

<p>This can be nicely used by gnuplot. For example to plot daily traffic on let&#8217;s say port 22:
<code>
./conn2db2csv.pl -q "select time::date, sum(brecv) from conn where dip='85.10.194.212' and dport = 22 group by 1 having(sum(brecv) &gt;0) order by 1" -d "dbi:Pg:dbname=bro;host=localhost" -u bro -p &lt;password&gt; -s ' ' &gt; testplot</p>

<p>gnuplot
set timefmt "%Y-%m-%d %H:%M:%S"
set xdata time
plot 'testplot' using 1:3
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://tadek.pietraszek.org/blog/2005/11/28/storing-and-plotting-connection-summaries-in-the-database/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>On Image GeoTagging or why I love Image::ExifTool, hate GPS::Garmin and am indifferent to Garmin&#8217;s transfer protocol.</title>
		<link>http://tadek.pietraszek.org/blog/2005/11/01/on-image-geotagging-or-why-i-love-imageexiftools-hate-gpsgarmin-and-am-indifferent-to-garmin-transfer-protocol/</link>
		<comments>http://tadek.pietraszek.org/blog/2005/11/01/on-image-geotagging-or-why-i-love-imageexiftools-hate-gpsgarmin-and-am-indifferent-to-garmin-transfer-protocol/#comments</comments>
		<pubDate>Mon, 31 Oct 2005 23:10:25 +0000</pubDate>
		<dc:creator>tadekp</dc:creator>
				<category><![CDATA[New Ideas]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Progs/Tools/Libs]]></category>

		<guid isPermaLink="false">http://tadek.pietraszek.org/blog/?p=189</guid>
		<description><![CDATA[GeoTagging: This idea has been maturing long enough and last Sunday reached its critical mass. Here&#8217;s my account on the story and a few things I learned.

GeoTagging
The idea is simple: when you go hiking, sightseeing, travelling you put a GPS on top of your backpack. You go and take photos as usual. When you&#8217;re back [...]]]></description>
			<content:encoded><![CDATA[<p><strong>GeoTagging</strong>: This idea has been maturing long enough and last Sunday reached its critical mass. Here&#8217;s my account on the story and a few things I learned.</p>

<p><strong>GeoTagging</strong>
The idea is simple: when you go hiking, sightseeing, travelling you put a GPS on top of your backpack. You go and take photos as usual. When you&#8217;re back home, you connect the GPS to the computer and download the saved track.  You then run a program that correlates the time when the images were taken with your position from the track and encodes this information into EXIF. As a result the images are GeoTagged and their position can be displayed by a GeoTagging-aware software.</p>

<p><strong>Downloading GPS</strong>
After having a look at different options, I chose two candidates for downloading the track: <a href="http://sourceforge.net/projects/gpstrans">gpstrans</a> and <a href="http://search.cpan.org/dist/perl-GPS/Garmin.pm">GPS::Garmin</a>.</p>

<p>Note that these both support only Garmin GPSs. I don&#8217;t know if there is any universal track transfer protocol (probably not). Everything that claims to be cross-GPS typically is limited to reading the current position via NMEA.</p>

<p>GPStrans works ok, although it&#8217;s a bit old and doesn&#8217;t work well with my eTrex. The problems are: waypoints are corrupted, track does not contain the information about new segments and the output format is strange (this can be fixed). Afterall, I must admit that unlike other tools it worked at the first try.</p>

<p>GPS::Garmin gave me much more trouble. First it tunred out that it relied on some undocumented behavior of Device::Serial and at the end it turned out that it was doing a non-blocking read and considered that it would always get data. While this might have been true a couple of years ago, since then computers have gotten faster and it stopped working. After a couple of hours I fixed it by adding:
<code>
   $PortObj-&gt;read_const_time(5000);
   $PortObj-&gt;read_char_time(5000);
</code>
somewhere in GPS::Serial.</p>

<p>The second problem was that the code relied on particular product codes of Garmin deivces and changed its behavoir accordingly. The problem is that it&#8217;s not exactly how Garmin protocol was written (unless you want to encode the behavior of all their products).</p>

<p><strong>Garmin Protocol</strong>
It&#8217;s fairly simple, although implementing it correctly can take a good evening. The problem is that the number of commands is limited (e.g., get waypoints, get track, get route), however the interpretation of data received differs depending on the device. This is a bit strange, but it is the way it is. One way of going around it is to know which devices do what (GPS::Garmins&#8217;s approach). The better way could be to query which protocol version is supported (e.g., A100, A103, A108) and load the correct handler accordingly. Wonder why they didn&#8217;t do it&#8230;</p>

<p><strong>Image::ExifTool</strong>
I really love it. It&#8217;s a well-maintained, and a fully functioned EXIF read and manipulation library. Adding GPS data to an image is virtually 6 lines of code (taking error checking out):
<code>
 $exifTool->ExtractInfo($file);
$exifTool->SetNewValue(GPSLatitudeRef => ($lat > 0)?'N':'S', Group=>'GPS');
$exifTool->SetNewValue(GPSLongitudeRef => ($lon > 0)?'E':"W", Group=>'GPS'); 
$exifTool->SetNewValue(GPSLatitude => abs($lat), Group=>'GPS');
$exifTool->SetNewValue(GPSLongitude => abs($lon),  Group=>'GPS');
$exifTool->WriteInfo($file, $file."-new");
</code></p>

<p>Ok, the real code is more complicated but it&#8217;s what it does:</p>

<ul>
    <li>Read saved GPS track (array of arrays) and sort it by the timestamp</li>
    <li>Process files from the command line: check if they have EXIF, are not already GeoTagged or have some other problems.</li>
    <li>Do the binary search on the sorted timestamps and find the correct two elements.</li>
    <li>If the second one does not start a new segment (or the timestamp difference is not too big) approximate the position from the two points.</li>
    <li>Write the data back to the file, making backup if necessary</li>
</ul>

<p>The program is really simple and works well. What remains to be done now is to add some more runtime options and write a manual. I also need to work a bit more on the garmin transfer program &#8211; I&#8217;m still not happy with GPS::Garmin, even after some basic fixes.</p>
]]></content:encoded>
			<wfw:commentRss>http://tadek.pietraszek.org/blog/2005/11/01/on-image-geotagging-or-why-i-love-imageexiftools-hate-gpsgarmin-and-am-indifferent-to-garmin-transfer-protocol/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>GeoTagging in EXIF</title>
		<link>http://tadek.pietraszek.org/blog/2005/10/28/geotagging-in-exif/</link>
		<comments>http://tadek.pietraszek.org/blog/2005/10/28/geotagging-in-exif/#comments</comments>
		<pubDate>Fri, 28 Oct 2005 13:02:22 +0000</pubDate>
		<dc:creator>tadekp</dc:creator>
				<category><![CDATA[New Ideas]]></category>
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://tadek.pietraszek.org/blog/2005/10/28/geotagging-in-exif/</guid>
		<description><![CDATA[For quite some time now I&#8217;ve been thinking of correlating tracklog GPS data from my GPS with the protos I&#8217;ve taken based on time. It looks such a thing alrady exists here and this blog contains a lot of good pointers.

I will try these out, but I still want something more automated&#8230; maybe I will [...]]]></description>
			<content:encoded><![CDATA[<p>For quite some time now I&#8217;ve been thinking of correlating tracklog GPS data from my GPS with the protos I&#8217;ve taken based on time. It looks such a thing alrady exists <a href="http://www.stuffware.co.uk/articles/00000001.html">here</a> and this <a href="http://kennethhunt.com/archives/000935.html">blog</a> contains a lot of good pointers.</p>

<p>I will try these out, but I still want something more automated&#8230; maybe I will write it one day&#8230; <img src='http://tadek.pietraszek.org/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://tadek.pietraszek.org/blog/2005/10/28/geotagging-in-exif/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monitoring resource usage in Linux</title>
		<link>http://tadek.pietraszek.org/blog/2005/09/14/monitoring-resource-usage-in-linux/</link>
		<comments>http://tadek.pietraszek.org/blog/2005/09/14/monitoring-resource-usage-in-linux/#comments</comments>
		<pubDate>Wed, 14 Sep 2005 15:10:10 +0000</pubDate>
		<dc:creator>tadekp</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[New Ideas]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Tips&Tricks]]></category>

		<guid isPermaLink="false">http://tadek.pietraszek.org/blog/2005/09/14/monitoring-resource-usage-in-linux/</guid>
		<description><![CDATA[Three packages I found in Debian: dstat, ifstat, systat &#8211; allow to show cumulative statistics, but not on per-process basis.

Here&#8217;s an interesting discussion on what can an cannot be done with Linux:
http://mirror.hamakor.org.il/archives/linux-il/01-2005/13574.html

One pointer is laptop-mode (Documentation/laptop-mode), although for different reasons the information there might not be accurate.

A nice summary on linux profiling: http://www.cs.utk.edu/~mucci/latest/pubs/LCSC2004.pdf

Perfsuite: http://perfsuite.sourceforge.net/
IOTrack: http://www.pdc.kth.se/~pek/iotrack/
]]></description>
			<content:encoded><![CDATA[<p>Three packages I found in Debian: dstat, ifstat, systat &#8211; allow to show cumulative statistics, but not on per-process basis.</p>

<p>Here&#8217;s an interesting discussion on what can an cannot be done with Linux:
<a href="http://mirror.hamakor.org.il/archives/linux-il/01-2005/13574.html">http://mirror.hamakor.org.il/archives/linux-il/01-2005/13574.html</a></p>

<p>One pointer is laptop-mode (Documentation/laptop-mode), although for different reasons the information there might not be accurate.</p>

<p>A nice summary on linux profiling: <a href="http://www.cs.utk.edu/~mucci/latest/pubs/LCSC2004.pdf">http://www.cs.utk.edu/~mucci/latest/pubs/LCSC2004.pdf</a></p>

<p>Perfsuite: <a href="http://perfsuite.sourceforge.net/">http://perfsuite.sourceforge.net/</a>
IOTrack: <a href="http://www.pdc.kth.se/~pek/iotrack/">http://www.pdc.kth.se/~pek/iotrack/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tadek.pietraszek.org/blog/2005/09/14/monitoring-resource-usage-in-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Automake/autoconf for Ant</title>
		<link>http://tadek.pietraszek.org/blog/2005/02/15/automakeautoconf-for-ant/</link>
		<comments>http://tadek.pietraszek.org/blog/2005/02/15/automakeautoconf-for-ant/#comments</comments>
		<pubDate>Tue, 15 Feb 2005 15:17:47 +0000</pubDate>
		<dc:creator>tadekp</dc:creator>
				<category><![CDATA[New Ideas]]></category>

		<guid isPermaLink="false">http://tadek.pietraszek.org/blog/2005/02/15/automakeautoconf-for-ant/</guid>
		<description><![CDATA[Yesss, it&#8217;s a good idea. Ant is a substitute for make, designed to be free of make&#8217;s wrinkles. It is, however, only a make substitute, and allows only to write build files.

The reality shows that most of the builtfiles are written ad hoc and are of varied  quality. For example, given the source code [...]]]></description>
			<content:encoded><![CDATA[<p>Yesss, it&#8217;s a good idea. Ant is a substitute for make, designed to be free of make&#8217;s wrinkles. It is, however, only a make substitute, and allows only to write build files.</p>

<p>The reality shows that most of the builtfiles are written ad hoc and are of varied  quality. For example, given the source code application X, there&#8217;s no common way of specifying how to build and install this application in a given path or how to build the documentation.</p>

<p>Wait a second&#8230; haven&#8217;t we had a similar problem with makefiles? <img src='http://tadek.pietraszek.org/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  Yessss, the answer is automake/autoconf. How about a similar tool for Ant, without autocont/automake&#8217;s wrinkles?
<span id="more-71"></span>
How this would work? Well, I don&#8217;t know, but I&#8217;ve got some ideas: <img src='http://tadek.pietraszek.org/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> 
- there&#8217;s a template file (XML?), which specifies which files are in the project and what the dependencies are.</p>

<ul>
<li>AutoAnt (XSL?) generates a build.xml file having the following targets:

<ol>
<li>clean</li>
<li>build</li>
<li>dist</li>
<li>install</li>
</ol></li>
</ul>

<p>It also checks for required modules (e.g. Xerces, COLT, etc) and generates a startup file, which runs the application with required libraries (similar to &#8211;with-xxxx for configure.in).</p>

<p>Note that even if all jar files are in a standard location (/usr/share/java/*.jar) you still need to add these files to a CLASSPATH to be able to run the application. SOmetimes these files are not in the same location, but the application should still be able to run.</p>

<p>Well, that&#8217;s for ideas&#8230; maybe I will write it one day.</p>
]]></content:encoded>
			<wfw:commentRss>http://tadek.pietraszek.org/blog/2005/02/15/automakeautoconf-for-ant/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tracking connection length</title>
		<link>http://tadek.pietraszek.org/blog/2004/10/08/tracking-connection-length/</link>
		<comments>http://tadek.pietraszek.org/blog/2004/10/08/tracking-connection-length/#comments</comments>
		<pubDate>Fri, 08 Oct 2004 07:21:19 +0000</pubDate>
		<dc:creator>tadekp</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[New Ideas]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://tadek.pietraszek.org/blog/2004/10/08/tracking-connection-length/</guid>
		<description><![CDATA[Inspired by discussions with Ashish, here are some thoughts on tracking connections in Linux.

PROBLEM: flag TCP/UDP connections longer than XXX seconds as suspicious.

ORIGINAL SOLUTION: use pcap interface in perl, analyze all the packets, look for SYN and FIN to determine the duration.
PROBLEMS:


Essentailly reimplementing TCP stack
Problems with undefined behaviour, e.g. SYN,ACK,FIN,RST packets, closed ports, timeouts, etc.
Difficult [...]]]></description>
			<content:encoded><![CDATA[<p>Inspired by discussions with Ashish, here are some thoughts on tracking connections in Linux.</p>

<p>PROBLEM: flag TCP/UDP connections longer than XXX seconds as suspicious.
<span id="more-12"></span>
ORIGINAL SOLUTION: use pcap interface in perl, analyze all the packets, look for SYN and FIN to determine the duration.
PROBLEMS:</p>

<ol>
<li>Essentailly reimplementing TCP stack</li>
<li>Problems with undefined behaviour, e.g. SYN,ACK,FIN,RST packets, closed ports, timeouts, etc.</li>
<li>Difficult to implements and no clear advantages.</li>
</ol>

<p>IMPROVED SOLUTION: use ip_conntrack module in iptables and periodically (e.g. every 5 seconds) reread /proc/net/iptables file. Then parse the file, build the connection table and flag  the ones that are longer than XXX.</p>

<p>PROBLEMS:</p>

<ol>
<li>Time granularity of reread time (e.g. 5 seconds). Given a task &#8211; is it a problem???</li>
<li>Therefore completely missing connections shorter than 5 seconds.</li>
</ol>

<p>YET IMPROVED SOLUTION: previous solution plus using iptables LOG traget to mark the <i>begining</i> of each TCP session (something like -m conntrack &#8211;ctstate NEW -j LOG) and then check for the termination with /proc/net/iptables. Advantages &#8211; the tracking of the beginning of the session is easier.</p>

<p>PROBLEMS:
Still no amount of data transfer per session, but, really, it&#8217;s not a problem with task we defined.</p>

<p>IMPROVED IMPROVED SOLUTION: the same as above, but tracking easch TCP packet and tracking its size (LOG does not write the packet sizes, so have to use ULOG target). Determining the end of the connection using the previously defiend methods.</p>

<p>PROBLEMS: probably more usefull is actually looking at the amount of data transferred per source IP address rather than session.</p>

<p>USEFUL LINKS:</p>

<ol>
<li>File::Tail &#8211; useful for reading log files in perl</li>
<li>ULOG &#8211; a really cool logger (better than LOG), but unfortunatelly no perl frontend for libipulog</li>
<li>ulog-acct &#8211; a nice packet logger using ulog &#8211; can be easily tuned to dump packed sizes, etc.</li>
<li>conntrack entries 
<A HREF="http://www.linuxvoodoo.com/resources/howtos/iptables-tutorial/theconntrackentries.html">explained</A>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://tadek.pietraszek.org/blog/2004/10/08/tracking-connection-length/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
