<?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>[blog.rayfoo] &#187; DNS</title>
	<atom:link href="http://blog.rayfoo.info/tag/dns/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.rayfoo.info</link>
	<description>Infosec, DFIR, tech geekery, thoughts and whatnot</description>
	<lastBuildDate>Wed, 25 Jan 2012 00:36:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>DNS tracking with Python</title>
		<link>http://blog.rayfoo.info/2010/08/dns-tracking-with-python</link>
		<comments>http://blog.rayfoo.info/2010/08/dns-tracking-with-python#comments</comments>
		<pubDate>Sun, 01 Aug 2010 18:14:30 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[CC]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[DNS tracking]]></category>
		<category><![CDATA[GPL]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://blog.rayfoo.info/?p=690</guid>
		<description><![CDATA[For those who have need to keep track of changes (IP address changes and "status") of a list of DNS hosts/addresses, I wrote a Python script to help with this task. Please help by providing comments/ideas for improvement/thanks/death-threats in the comments section below.  Ok, maybe not the death-threats. Download and License The current version of [...]]]></description>
			<content:encoded><![CDATA[<p>For those who have need to keep track of changes (IP address changes and "status") of a  list of DNS hosts/addresses, I wrote a Python script to help with this task.</p>
<p>Please help by <a href="#respond">providing comments</a>/ideas for improvement/thanks/death-threats in the <a href="#respond">comments section</a> below.  Ok, maybe not the death-threats. <img src='http://blog.rayfoo.info/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h2>Download and License</h2>
<p>The current version of this script is <strong>v1.03</strong>, released under the GPL license.  <a href="http://blog.rayfoo.info/wp-content/uploads/2010/08/dns_tracker-v1.03.zip">Click here to download it</a>.<br />
<!-- Creative Commons License --><br />
<a href="http://creativecommons.org/licenses/GPL/2.0/"><img src="http://creativecommons.org/images/public/cc-GPL-a.png" border="0" alt="CC-GNU GPL" /></a><br />
This software is licensed under the <a href="http://creativecommons.org/licenses/GPL/2.0/">CC-GNU GPL</a> version 2.0 or later.<br />
<!-- /Creative Commons License --></p>
<h2>What it can do/Features:</h2>
<ul>
<li>Keep track of changes (IP addresses, status: existent/gone) to a list of specified domains</li>
<li>Resolve many many many domains into a greppable format for you!</li>
<li>Multithreaded in Python</li>
<li>Does logging to a logfile, and to console at the same time</li>
<li>Configurable to a certain extent</li>
</ul>
<h2>How to get and use:</h2>
<ul>
<li>Install the PyDNS library found in the <a href="http://pypi.python.org/pypi/pydns/">Python Package Index</a>, hosted at <a href="http://pydns.sourceforge.net/">SourceForge</a></li>
<li>Grab a copy from the download section above and extract the script out</li>
<li>Configure the script if you need to (see below)</li>
<li>Create a text file named <em>dns-list.txt</em> in the same folder as the <em>dns_tracker.py</em> script, list the DNS hosts that you want to track in the dns-list.txt file, one host per line</li>
<li>Run the script from command line: <span style="color: #339966;">python dns_tracker.py</span>.  The log file written to would be called <em>dns-track.log</em></li>
<li>Profit!</li>
<li>You can stop the script by pressing Ctrl-C in the console ONCE.  It will attempt to kill off the waiting threads and exit gracefully.</li>
</ul>
<h2>What you can configure:</h2>
<ul>
<li>All the editable options are in the section marked <span style="color: #00ccff;">##Editable options</span>.  Some of the options are...</li>
<li>Use system configured resolvers: set<span style="color: #00ff00;"> 'use_server': False,</span></li>
<li>Use a DNS resolver of your choice: set <span style="color: #00ff00;">'use_server': True,</span> and also <span style="color: #00ff00;">'server': '&lt;your resolver&gt;',</span></li>
<li>The logfile name can be changed too <span style="color: #00ff00;"> 'logfile': 'dns-track.log',</span></li>
</ul>
<h2>Changelog:</h2>
<ul>
<li>v1.03 (15 Aug 2010)</li>
<blockquote>
<li>fixed logging hierarchy!  now we can control console and file log levels!</li>
</blockquote>
<li>v1.02 (10 Aug 2010)</li>
<blockquote>
<li>added SERVFAIL to recognise as possible status</li>
<li>changed DNS resolving fail behaviour: retry 1min later</li>
<li> changed monitoring start behaviour (faster by using threads)</li>
<li>orphaned threads will also stop themselves if the main thread's killed</li>
</blockquote>
<li>v1.01 (3 Aug 2010)</li>
<blockquote>
<li>demarcated editable options section ("##Editable options")</li>
<li>changed logging to append instead of overwriting existing log</li>
<li>remember that CNAMEs are also extracted for comparison of changes</li>
<li>added in minimum delay checks to account for CNAMEs' TTL being 0</li>
<li>adjusted logging levels for logfile, console still outputs everything</li>
</blockquote>
<li>v1.00 (2 Aug 2010)</li>
<blockquote>
<li>initial release!</li>
</blockquote>
</ul>
<h2>TODO:</h2>
<ul>
<li>Perhaps migrating configurable options out to command line parameters<br />
or a separate config file?</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.rayfoo.info/2010/08/dns-tracking-with-python/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DNS lookups using Python</title>
		<link>http://blog.rayfoo.info/2010/07/dns-lookups-using-python</link>
		<comments>http://blog.rayfoo.info/2010/07/dns-lookups-using-python#comments</comments>
		<pubDate>Sat, 31 Jul 2010 03:14:12 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://blog.rayfoo.info/?p=683</guid>
		<description><![CDATA[Using the PyDNS library found in Python Package Index and hosted at SourceForge, some code snippets for usage:]]></description>
			<content:encoded><![CDATA[<p>Using the PyDNS library found in <a href="http://pypi.python.org/pypi/pydns/">Python Package Index</a> and hosted at <a href="http://pydns.sourceforge.net/">SourceForge</a>, some code snippets for usage:</p>
<pre class="brush: python; title: ; notranslate">import DNS
DNS.DiscoverNameServers()
reqobj = DNS.Request(name=&quot;blog.rayfoo.info&quot;)
resp = reqobj.req()

for i in resp.answers: print i
...
{'name': 'blog.rayfoo.info', 'data': '74.207.229.183',
'typename': 'A', 'classstr': 'IN', 'ttl': 1790, 'type': 1,
'class': 1, 'rdlength': 4}

resp.show();
PDG.py 1.0 - blog.rayfoo.info 1
;; options: recurs
;; got answer:
;; -HEADER- opcode 0, status NOERROR, id 60299
;; flags: qr rd ra; Ques: 1, Ans: 1, Auth: 0, Addit: 0
;; QUESTIONS:
;;      blog.rayfoo.info, type = A, class = IN

;; ANSWERS:
blog.rayfoo.info        1790    A       74.207.229.183

;; AUTHORITY RECORDS:

;; ADDITIONAL RECORDS:

;; Total query time: 367 msec
;; To SERVER: &lt;sanitized&gt;
;; WHEN: Sat Jul 31 11:06:24 2010

&gt;&gt;&gt; resp.args
{'protocol': 'udp', 'name': 'blog.rayfoo.info',
'server': 'sanitized', 'rd': 1, 'opcode': 0,
'timeout': 30, 'timing': 1, 'elapsed': 367.52486228942871,
'qtype': 1, 'port': 53}</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.rayfoo.info/2010/07/dns-lookups-using-python/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Converting IDNs in Ubuntu</title>
		<link>http://blog.rayfoo.info/2010/07/converting-idns-in-ubuntu</link>
		<comments>http://blog.rayfoo.info/2010/07/converting-idns-in-ubuntu#comments</comments>
		<pubDate>Wed, 07 Jul 2010 15:56:06 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[APT]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[ICANN]]></category>
		<category><![CDATA[IDN]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[punycode]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.rayfoo.info/?p=613</guid>
		<description><![CDATA[With the start of Internationalized domain names (IDNs) it sparked my interest since it requires conversion to punycode in order to continue working with existing DNS systems/applications, which work with ASCII. Taking a search through Ubuntu's APT system, to see whether any IDN related tools are available... There's the idn package!  Which allows encoding of IDNs [...]]]></description>
			<content:encoded><![CDATA[<p>With the start of <a href="http://en.wikipedia.org/wiki/Internationalized_domain_name">Internationalized domain names</a> (<a href="http://www.icann.org/en/topics/idn/">IDNs</a>) it sparked my interest since it requires conversion to <a href="http://en.wikipedia.org/wiki/Punycode">punycode</a> in order to continue working with existing DNS systems/applications, which work with ASCII.</p>
<p>Taking a search through Ubuntu's APT system, to see whether any IDN related tools are available...</p>
<pre class="brush: plain; title: ; notranslate">$ apt-cache search punycode

libidn11 - GNU Libidn library, implementation of IETF IDN specifications
libidn11-dev - Development files for GNU Libidn, an IDN library
idn - Command line and Emacs interface to GNU Libidn
libidn11-java - Java port of the GNU Libidn library, an IDN implementation
libidna-punycode-perl - encodes Unicode string in Punycode</pre>
<p>There's the idn package!  Which allows encoding of IDNs in punycode in the command line...</p>
<p>Doing an install...</p>
<pre class="brush: bash; title: ; notranslate">$ sudo apt-get install idn -y</pre>
<p>And trying it out!</p>
<pre class="brush: plain; title: ; notranslate">$ idn правительство.рф

libidn 1.15
Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Simon Josefsson.
GNU Libidn comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Libidn under the terms of
the GNU Lesser General Public License.  For more information
about these matters, see the file named COPYING.LIB.
xn--80aealotwbjpid2k.xn--p1ai</pre>
<p>And resolving the domain...</p>
<pre class="brush: plain; title: ; notranslate">$ nslookup xn--80aealotwbjpid2k.xn--p1ai

Non-authoritative answer:
Name:	xn--80aealotwbjpid2k.xn--p1ai
Address: 95.173.135.62</pre>
<p>Note that resolving the domain directly results in rubbish!</p>
<pre class="brush: plain; title: ; notranslate">$ nslookup правительство.рф

Non-authoritative answer:
Name:	\208\191\209\128\208\176\208\178\208\184\209\130\208\181\208\187\209\140\209\129\209\130\208\178\208\190.\209\128\209\132
Address: 67.215.65.132</pre>
<p>So, basically from this we understand that applications will need to use the punycode encoded version of the IDN, NOT the original IDN, when resolving.  And there're tools out there already can do that for us.</p>
<p>Since Ubuntu has these <a href="http://packages.ubuntu.com/search?keywords=idn">packages</a>, Debian would also have the corresponding <a href="http://packages.debian.org/search?keywords=idn">packages</a> available too.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rayfoo.info/2010/07/converting-idns-in-ubuntu/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>(How to) Signup for SecureMe</title>
		<link>http://blog.rayfoo.info/2010/02/how-to-signup-for-secureme</link>
		<comments>http://blog.rayfoo.info/2010/02/how-to-signup-for-secureme#comments</comments>
		<pubDate>Thu, 25 Feb 2010 17:41:23 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[OpenVPN]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[signup]]></category>

		<guid isPermaLink="false">http://blog.rayfoo.info/?p=448</guid>
		<description><![CDATA[If you wish to have a safe and private way to surf the internets while you're at a public wifi hotspot, or somewhere like a hotel "free" network or whatnot, why not consider using a VPN + proxy + DNS resolver combination? SecureMe is a project I started to try out and get some experience [...]]]></description>
			<content:encoded><![CDATA[<p>If you wish to have a safe and private way to surf the internets while you're at a public wifi hotspot, or somewhere like a hotel "free" network or whatnot, why not consider using a VPN + proxy + DNS resolver combination?</p>
<p>SecureMe is a project I started to try out and get some experience from running an operational combination like this, and I have been using it without much issues for the past quarter year to date.</p>
<p>I'm opening this as a service to people who'd like to make use of this service too, and for no minimum cost!  I only ask for the following:<br />
1. feedback/suggestions/complaints/compliments!<br />
2. (if you're feeling generous) donations to help me upkeep my server at least (I don't intend to strike it rich with this anyway) <img src='http://blog.rayfoo.info/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>If you wish to use this, email me at <strong>secureme{@T}rayfoo[dot]info</strong> to enquire on availability.  Alternatively you could <a href="http://twitter.com/MeNotBot">tweet</a> or <a href="http://www.facebook.com/rayyyfoo">FB</a> me...</p>
<p>I'll support this as much as possible where time/resources permits, but for now I'd suggest that (at least) the slightly more technically inclined try this.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rayfoo.info/2010/02/how-to-signup-for-secureme/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SecureMe so far&#8230;</title>
		<link>http://blog.rayfoo.info/2010/02/secureme-so-far</link>
		<comments>http://blog.rayfoo.info/2010/02/secureme-so-far#comments</comments>
		<pubDate>Sun, 21 Feb 2010 09:16:07 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Google Chrome]]></category>
		<category><![CDATA[OpenVPN]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[wifi]]></category>

		<guid isPermaLink="false">http://blog.rayfoo.info/?p=436</guid>
		<description><![CDATA[Have been using my VPN + proxy + dns resolver combination (or the so-called SecureMe project) for a while to date, and it has served my pretty well so far.. I primarily use this at public wifi hotspots like Wireless@SG, where the network is not trusted.  Of course this could be extended to apply in [...]]]></description>
			<content:encoded><![CDATA[<p>Have been using my VPN + proxy + dns resolver combination (or the so-called <a href="http://blog.rayfoo.info/tag/secureme">SecureMe</a> project) for a while to date, and it has served my pretty well so far.. I primarily use this at public wifi hotspots like <a href="http://en.wikipedia.org/wiki/Wireless@SG">Wireless@SG</a>, where the network is not trusted.  Of course this could be extended to apply in networks which aren't necessarily private or trusted, which works very well for people running in paranoia mode (like me).</p>
<p>A short review on the different parts of this system so far...</p>
<p><span id="more-436"></span></p>
<h2>1. Automatic starting</h2>
<p>The <a href="http://en.wikipedia.org/wiki/OpenVPN">OpenVPN</a> client installed can be made to autostart and run as a background service, (re-)connecting to the VPN automatically whenever there's network connectivity to the OpenVPN server.  Coupled with automatic configuration of the client's DNS resolver list this allows for automatic protection/privacy of the DNS queries sent out.  The automatic configuration of the DNS resolver can be disabled too if need be.</p>
<h2>2. Ease of use</h2>
<p>Connecting to the proxy afterward is a "simple" proxy configuration change in the browser of choice.  This can be conveniently done (and undone) with extensions like <a href="https://chrome.google.com/extensions/detail/caehdcpeofiiigpdhbabniblemipncjj">Proxy Switchy!</a> for Google Chrome, or <a href="http://foxyproxy.mozdev.org/">FoxyProxy</a> for Firefox.</p>
<h2>3. Initial setup efforts needed</h2>
<p>All this is working nice and dandy for me now, with little inconvenience involved in activating SecureMe. Now one of the problems faced in making this user-friendly/"idiot-proof" would be the high setup efforts needed (really plenty of hoops to jump through, especially for the no-so-technically-inclined user).  One way would be to come up with some sort of "portable" package that has been preconfigured as much as possible, or an installer that helps you to do most of the work.</p>
<h2>4. DNS requests leakage</h2>
<p>Another issue is the small possibility of DNS request leaks.  For example, the behaviour of the OpenVPN client in linux is to add the DNS resolver at the top of the resolver list (/etc/resolv.conf), but if the DNS query is deemed to take "too long", the request goes out to the next DNS resolver in the list, which usually is the DNS resolver for the public wifi hotspot.  Though this won't cause things to break, it does allow some queries to go out in the open network.  One of the ways I know of to solve this would be to configure a SOCKS proxy, so that it would be possible for browsers like Firefox to <a href="http://kb.mozillazine.org/Network.proxy.socks_remote_dns">send all DNS queries to the SOCKS proxy</a>.</p>
<h2>Conclusion:</h2>
<p>This seems to be working well so far, with Linode's rare downtime the past months.  More work could be done to make this simpler for others to setup, but I guess I will only do this sparingly in my free time.  No one seems to be geeky/interested enough to want to have this available to them for free so far, heh.</h2>
]]></content:encoded>
			<wfw:commentRss>http://blog.rayfoo.info/2010/02/secureme-so-far/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

