DomainClassifier/index.html

146 lines
37 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
<meta name="description" content="Domainclassifier : DomainClassifier is a simple Python library to extract and classify Internet domains/hostnames/IP addresses from raw text files following their existence, localization or attributes." />
<link rel="stylesheet" type="text/css" media="screen" href="stylesheets/stylesheet.css">
<title>Domainclassifier</title>
</head>
<body>
<!-- HEADER -->
<div id="header_wrap" class="outer">
<header class="inner">
<a id="forkme_banner" href="https://github.com/adulau/DomainClassifier">View on GitHub</a>
<h1 id="project_title">Domainclassifier</h1>
<h2 id="project_tagline">DomainClassifier is a simple Python library to extract and classify Internet domains/hostnames/IP addresses from raw text files following their existence, localization or attributes.</h2>
<section id="downloads">
<a class="zip_download_link" href="https://github.com/adulau/DomainClassifier/zipball/master">Download this project as a .zip file</a>
<a class="tar_download_link" href="https://github.com/adulau/DomainClassifier/tarball/master">Download this project as a tar.gz file</a>
</section>
</header>
</div>
<!-- MAIN CONTENT -->
<div id="main_content_wrap" class="outer">
<section id="main_content" class="inner">
<h1>
<a name="domainclassifier" class="anchor" href="#domainclassifier"><span class="octicon octicon-link"></span></a>DomainClassifier</h1>
<p>DomainClassifier is a simple Python library to extract and classify Internet
domains/hostnames/IP addresses from raw text files following their existence,
localization or attributes.</p>
<p>DomainClassifier can be used to extract Internet hosts from any free texts.</p>
<p><img src="https://raw.github.com/adulau/DomainClassifier/master/doc/domainclassifier-flow.png" alt="An overview of the DomainClassifier methods"></p>
<h2>
<a name="how-to-use-it" class="anchor" href="#how-to-use-it"><span class="octicon octicon-link"></span></a>How To Use It</h2>
<div class="highlight"><pre><span class="kn">import</span> <span class="nn">domainclassifier</span>
<span class="n">c</span> <span class="o">=</span> <span class="n">domainclassifier</span><span class="o">.</span><span class="n">Extract</span><span class="p">(</span> <span class="n">rawtext</span> <span class="o">=</span> <span class="s">"www.xxx.com this is a text with a domain called test@foo.lu another test abc.lu something a.b.c.d.e end of 1.2.3.4 foo.be www.belnet.be ht</span>
<span class="n">tp</span><span class="p">:</span><span class="o">//</span><span class="n">www</span><span class="o">.</span><span class="n">cert</span><span class="o">.</span><span class="n">be</span><span class="o">/</span> <span class="n">www</span><span class="o">.</span><span class="n">public</span><span class="o">.</span><span class="n">lu</span> <span class="n">www</span><span class="o">.</span><span class="n">allo</span><span class="o">.</span><span class="n">lu</span> <span class="n">quuxtest</span> <span class="n">www</span><span class="o">.</span><span class="n">eurodns</span><span class="o">.</span><span class="n">com</span> <span class="n">something</span><span class="o">-</span><span class="n">broken</span><span class="o">-</span><span class="n">www</span><span class="o">.</span><span class="n">google</span><span class="o">.</span><span class="n">com</span> <span class="n">www</span><span class="o">.</span><span class="n">google</span><span class="o">.</span><span class="n">lu</span> <span class="n">trailing</span> <span class="n">test</span> <span class="n">www</span><span class="o">.</span><span class="n">facebook</span><span class="o">.</span><span class="n">com</span> <span class="n">www</span><span class="o">.</span><span class="n">nic</span><span class="o">.</span><span class="n">ru</span> <span class="n">www</span><span class="o">.</span><span class="n">youporn</span><span class="o">.</span><span class="n">com</span> <span class="mf">8.8</span><span class="o">.</span><span class="mf">8.</span>
<span class="mi">8</span> <span class="mf">201.1</span><span class="o">.</span><span class="mf">1.1</span><span class="s">")</span>
<span class="c"># extracting potentially valid domains from rawtext</span>
<span class="k">print</span> <span class="n">c</span><span class="o">.</span><span class="n">domain</span><span class="p">()</span>
<span class="c"># reduce set of potentially valid domains to existing domains</span>
<span class="c"># (based on SOA,A,AAAA,CNAME,MX records)</span>
<span class="k">print</span> <span class="n">c</span><span class="o">.</span><span class="n">validdomain</span><span class="p">(</span><span class="n">extended</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="c"># reduce set of valid domains with DNS records associated to a</span>
<span class="c"># specified country</span>
<span class="k">print</span> <span class="s">"US:"</span>
<span class="k">print</span> <span class="n">c</span><span class="o">.</span><span class="n">localizedomain</span><span class="p">(</span><span class="n">cc</span><span class="o">=</span><span class="s">'US'</span><span class="p">)</span>
<span class="k">print</span> <span class="s">"LU:"</span>
<span class="k">print</span> <span class="n">c</span><span class="o">.</span><span class="n">localizedomain</span><span class="p">(</span><span class="n">cc</span><span class="o">=</span><span class="s">'LU'</span><span class="p">)</span>
<span class="k">print</span> <span class="s">"BE:"</span>
<span class="k">print</span> <span class="n">c</span><span class="o">.</span><span class="n">localizedomain</span><span class="p">(</span><span class="n">cc</span><span class="o">=</span><span class="s">'BE'</span><span class="p">)</span>
<span class="k">print</span> <span class="s">"Ranking:"</span>
<span class="k">print</span> <span class="n">c</span><span class="o">.</span><span class="n">rankdomain</span><span class="p">()</span>
<span class="c"># extract valid IPv4 addresses (using the potential list of valid domains)</span>
<span class="k">print</span> <span class="s">"List of ip addresses:"</span>
<span class="k">print</span> <span class="n">c</span><span class="o">.</span><span class="n">ipaddress</span><span class="p">(</span><span class="n">extended</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="c"># some more filtering</span>
<span class="k">print</span> <span class="s">"Include dot.lu:"</span>
<span class="k">print</span> <span class="n">c</span><span class="o">.</span><span class="n">include</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="s">r'\.lu$'</span><span class="p">)</span>
<span class="k">print</span> <span class="s">"Exclude dot.lu:"</span>
<span class="k">print</span> <span class="n">c</span><span class="o">.</span><span class="n">exclude</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="s">r'\.lu$'</span><span class="p">)</span>
</pre></div>
<h3>
<a name="sample-output" class="anchor" href="#sample-output"><span class="octicon octicon-link"></span></a>Sample output</h3>
<div class="highlight"><pre><span class="p">[</span><span class="s">'www.xxx.com'</span><span class="p">,</span> <span class="s">'foo.lu'</span><span class="p">,</span> <span class="s">'abc.lu'</span><span class="p">,</span> <span class="s">'a.b.c.d.e'</span><span class="p">,</span> <span class="s">'1.2.3.4'</span><span class="p">,</span> <span class="s">'foo.be'</span><span class="p">,</span> <span class="s">'www.belnet.be'</span><span class="p">,</span> <span class="s">'www.cert.be'</span><span class="p">,</span> <span class="s">'www.public.lu'</span><span class="p">,</span> <span class="s">'www.allo.lu'</span><span class="p">,</span> <span class="s">'www.eurodns.com'</span><span class="p">,</span> <span class="s">'something-broken-www.google.com'</span><span class="p">,</span> <span class="s">'www.google.lu'</span><span class="p">,</span> <span class="s">'www.facebook.com'</span><span class="p">,</span> <span class="s">'www.nic.ru'</span><span class="p">,</span> <span class="s">'www.youporn.com'</span><span class="p">,</span> <span class="s">'8.8.8.8'</span><span class="p">,</span> <span class="s">'201.1.1.1'</span><span class="p">]</span>
<span class="p">[(</span><span class="s">'www.xxx.com'</span><span class="p">,</span> <span class="s">'A'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">A</span> <span class="n">rdata</span><span class="p">:</span> <span class="mf">67.23</span><span class="o">.</span><span class="mf">112.226</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'abc.lu'</span><span class="p">,</span> <span class="s">'SOA'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">SOA</span> <span class="n">rdata</span><span class="p">:</span> <span class="n">neptun</span><span class="o">.</span><span class="n">vo</span><span class="o">.</span><span class="n">lu</span><span class="o">.</span> <span class="n">Administrator</span><span class="o">.</span><span class="n">vo</span><span class="o">.</span><span class="n">lu</span><span class="o">.</span> <span class="mi">2006063001</span> <span class="mi">86400</span> <span class="mi">7200</span> <span class="mi">2419200</span> <span class="mi">3600</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'abc.lu'</span><span class="p">,</span> <span class="s">'MX'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">MX</span> <span class="n">rdata</span><span class="p">:</span> <span class="mi">10</span> <span class="n">proteus</span><span class="o">.</span><span class="n">vo</span><span class="o">.</span><span class="n">lu</span><span class="o">.&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'foo.be'</span><span class="p">,</span> <span class="s">'A'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">A</span> <span class="n">rdata</span><span class="p">:</span> <span class="mf">188.65</span><span class="o">.</span><span class="mf">217.78</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'foo.be'</span><span class="p">,</span> <span class="s">'AAAA'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">AAAA</span> <span class="n">rdata</span><span class="p">:</span> <span class="mi">2001</span><span class="p">:</span><span class="mi">6</span><span class="n">f8</span><span class="p">:</span><span class="mi">202</span><span class="p">:</span><span class="mi">2</span><span class="n">df</span><span class="p">::</span><span class="mi">2</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'foo.be'</span><span class="p">,</span> <span class="s">'SOA'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">SOA</span> <span class="n">rdata</span><span class="p">:</span> <span class="n">ka</span><span class="o">.</span><span class="n">quuxlabs</span><span class="o">.</span><span class="n">com</span><span class="o">.</span> <span class="n">adulau</span><span class="o">.</span><span class="n">foo</span><span class="o">.</span><span class="n">be</span><span class="o">.</span> <span class="mi">2010121901</span> <span class="mi">21600</span> <span class="mi">3600</span> <span class="mi">604800</span> <span class="mi">86400</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'foo.be'</span><span class="p">,</span> <span class="s">'MX'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">MX</span> <span class="n">rdata</span><span class="p">:</span> <span class="mi">10</span> <span class="n">mail</span><span class="o">.</span><span class="n">foo</span><span class="o">.</span><span class="n">be</span><span class="o">.&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.belnet.be'</span><span class="p">,</span> <span class="s">'A'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">A</span> <span class="n">rdata</span><span class="p">:</span> <span class="mf">193.190</span><span class="o">.</span><span class="mf">130.15</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.belnet.be'</span><span class="p">,</span> <span class="s">'AAAA'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">AAAA</span> <span class="n">rdata</span><span class="p">:</span> <span class="mi">2001</span><span class="p">:</span><span class="mi">6</span><span class="n">a8</span><span class="p">:</span><span class="mi">3</span><span class="n">c80</span><span class="p">:</span><span class="mi">8300</span><span class="p">::</span><span class="mi">15</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.belnet.be'</span><span class="p">,</span> <span class="s">'CNAME'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">CNAME</span> <span class="n">rdata</span><span class="p">:</span> <span class="n">fiorano</span><span class="o">.</span><span class="n">belnet</span><span class="o">.</span><span class="n">be</span><span class="o">.&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.cert.be'</span><span class="p">,</span> <span class="s">'A'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">A</span> <span class="n">rdata</span><span class="p">:</span> <span class="mf">193.190</span><span class="o">.</span><span class="mf">198.61</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.cert.be'</span><span class="p">,</span> <span class="s">'AAAA'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">AAAA</span> <span class="n">rdata</span><span class="p">:</span> <span class="mi">2001</span><span class="p">:</span><span class="mi">6</span><span class="n">a8</span><span class="p">:</span><span class="mi">3</span><span class="n">c80</span><span class="p">::</span><span class="mi">61</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.cert.be'</span><span class="p">,</span> <span class="s">'SOA'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">SOA</span> <span class="n">rdata</span><span class="p">:</span> <span class="n">ns</span><span class="o">.</span><span class="n">belnet</span><span class="o">.</span><span class="n">be</span><span class="o">.</span> <span class="n">hostmaster</span><span class="o">.</span><span class="n">belnet</span><span class="o">.</span><span class="n">be</span><span class="o">.</span> <span class="mi">2013053039</span> <span class="mi">360</span> <span class="mi">180</span> <span class="mi">1209600</span> <span class="mi">3600</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.cert.be'</span><span class="p">,</span> <span class="s">'MX'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">MX</span> <span class="n">rdata</span><span class="p">:</span> <span class="mi">10</span> <span class="n">asp</span><span class="o">-</span><span class="n">mxa</span><span class="o">.</span><span class="n">belnet</span><span class="o">.</span><span class="n">be</span><span class="o">.&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.cert.be'</span><span class="p">,</span> <span class="s">'CNAME'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">CNAME</span> <span class="n">rdata</span><span class="p">:</span> <span class="n">cert</span><span class="o">.</span><span class="n">be</span><span class="o">.&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.public.lu'</span><span class="p">,</span> <span class="s">'A'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">A</span> <span class="n">rdata</span><span class="p">:</span> <span class="mf">194.154</span><span class="o">.</span><span class="mf">200.74</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.allo.lu'</span><span class="p">,</span> <span class="s">'A'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">A</span> <span class="n">rdata</span><span class="p">:</span> <span class="mf">80.90</span><span class="o">.</span><span class="mf">47.69</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.eurodns.com'</span><span class="p">,</span> <span class="s">'A'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">A</span> <span class="n">rdata</span><span class="p">:</span> <span class="mf">80.92</span><span class="o">.</span><span class="mf">65.165</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.google.lu'</span><span class="p">,</span> <span class="s">'A'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">A</span> <span class="n">rdata</span><span class="p">:</span> <span class="mf">173.194</span><span class="o">.</span><span class="mf">66.94</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.google.lu'</span><span class="p">,</span> <span class="s">'AAAA'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">AAAA</span> <span class="n">rdata</span><span class="p">:</span> <span class="mi">2</span><span class="n">a00</span><span class="p">:</span><span class="mi">1450</span><span class="p">:</span><span class="mi">400</span><span class="n">c</span><span class="p">:</span><span class="n">c03</span><span class="p">::</span><span class="mi">5</span><span class="n">e</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.facebook.com'</span><span class="p">,</span> <span class="s">'A'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">A</span> <span class="n">rdata</span><span class="p">:</span> <span class="mf">31.13</span><span class="o">.</span><span class="mf">64.1</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.facebook.com'</span><span class="p">,</span> <span class="s">'AAAA'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">AAAA</span> <span class="n">rdata</span><span class="p">:</span> <span class="mi">2</span><span class="n">a03</span><span class="p">:</span><span class="mi">2880</span><span class="p">:</span><span class="mi">10</span><span class="p">:</span><span class="mi">8</span><span class="n">f07</span><span class="p">:</span><span class="n">face</span><span class="p">:</span><span class="n">b00c</span><span class="p">::</span><span class="mi">1</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.facebook.com'</span><span class="p">,</span> <span class="s">'MX'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">MX</span> <span class="n">rdata</span><span class="p">:</span> <span class="mi">10</span> <span class="n">msgin</span><span class="o">.</span><span class="n">t</span><span class="o">.</span><span class="n">facebook</span><span class="o">.</span><span class="n">com</span><span class="o">.&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.facebook.com'</span><span class="p">,</span> <span class="s">'CNAME'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">CNAME</span> <span class="n">rdata</span><span class="p">:</span> <span class="n">star</span><span class="o">.</span><span class="n">c10r</span><span class="o">.</span><span class="n">facebook</span><span class="o">.</span><span class="n">com</span><span class="o">.&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.nic.ru'</span><span class="p">,</span> <span class="s">'A'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">A</span> <span class="n">rdata</span><span class="p">:</span> <span class="mf">194.85</span><span class="o">.</span><span class="mf">61.42</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.nic.ru'</span><span class="p">,</span> <span class="s">'MX'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">MX</span> <span class="n">rdata</span><span class="p">:</span> <span class="mi">0</span> <span class="n">nomail</span><span class="o">.</span><span class="n">nic</span><span class="o">.</span><span class="n">ru</span><span class="o">.&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.youporn.com'</span><span class="p">,</span> <span class="s">'A'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">A</span> <span class="n">rdata</span><span class="p">:</span> <span class="mf">31.192</span><span class="o">.</span><span class="mf">116.24</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.youporn.com'</span><span class="p">,</span> <span class="s">'SOA'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">SOA</span> <span class="n">rdata</span><span class="p">:</span> <span class="n">pdns1</span><span class="o">.</span><span class="n">ultradns</span><span class="o">.</span><span class="n">net</span><span class="o">.</span> <span class="n">dns</span><span class="o">.</span><span class="n">manwin</span><span class="o">.</span><span class="n">com</span><span class="o">.</span> <span class="mi">2012041840</span> <span class="mi">86400</span> <span class="mi">86400</span> <span class="mi">86400</span> <span class="mi">86400</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.youporn.com'</span><span class="p">,</span> <span class="s">'MX'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">MX</span> <span class="n">rdata</span><span class="p">:</span> <span class="mi">20</span> <span class="n">smtp</span><span class="o">-</span><span class="n">scan01</span><span class="o">.</span><span class="n">mx</span><span class="o">.</span><span class="n">reflected</span><span class="o">.</span><span class="n">net</span><span class="o">.&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.youporn.com'</span><span class="p">,</span> <span class="s">'CNAME'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">CNAME</span> <span class="n">rdata</span><span class="p">:</span> <span class="n">youporn</span><span class="o">.</span><span class="n">com</span><span class="o">.&gt;</span><span class="p">)]</span>
<span class="n">US</span><span class="p">:</span>
<span class="p">[(</span><span class="s">'www.xxx.com'</span><span class="p">,</span> <span class="s">'A'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">A</span> <span class="n">rdata</span><span class="p">:</span> <span class="mf">67.23</span><span class="o">.</span><span class="mf">112.226</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.google.lu'</span><span class="p">,</span> <span class="s">'A'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">A</span> <span class="n">rdata</span><span class="p">:</span> <span class="mf">173.194</span><span class="o">.</span><span class="mf">66.94</span><span class="o">&gt;</span><span class="p">)]</span>
<span class="n">LU</span><span class="p">:</span>
<span class="p">[(</span><span class="s">'www.public.lu'</span><span class="p">,</span> <span class="s">'A'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">A</span> <span class="n">rdata</span><span class="p">:</span> <span class="mf">194.154</span><span class="o">.</span><span class="mf">200.74</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.allo.lu'</span><span class="p">,</span> <span class="s">'A'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">A</span> <span class="n">rdata</span><span class="p">:</span> <span class="mf">80.90</span><span class="o">.</span><span class="mf">47.69</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.eurodns.com'</span><span class="p">,</span> <span class="s">'A'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">A</span> <span class="n">rdata</span><span class="p">:</span> <span class="mf">80.92</span><span class="o">.</span><span class="mf">65.165</span><span class="o">&gt;</span><span class="p">)]</span>
<span class="n">BE</span><span class="p">:</span>
<span class="p">[(</span><span class="s">'foo.be'</span><span class="p">,</span> <span class="s">'A'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">A</span> <span class="n">rdata</span><span class="p">:</span> <span class="mf">188.65</span><span class="o">.</span><span class="mf">217.78</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.belnet.be'</span><span class="p">,</span> <span class="s">'A'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">A</span> <span class="n">rdata</span><span class="p">:</span> <span class="mf">193.190</span><span class="o">.</span><span class="mf">130.15</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.belnet.be'</span><span class="p">,</span> <span class="s">'CNAME'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">CNAME</span> <span class="n">rdata</span><span class="p">:</span> <span class="n">fiorano</span><span class="o">.</span><span class="n">belnet</span><span class="o">.</span><span class="n">be</span><span class="o">.&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.cert.be'</span><span class="p">,</span> <span class="s">'A'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">A</span> <span class="n">rdata</span><span class="p">:</span> <span class="mf">193.190</span><span class="o">.</span><span class="mf">198.61</span><span class="o">&gt;</span><span class="p">),</span> <span class="p">(</span><span class="s">'www.cert.be'</span><span class="p">,</span> <span class="s">'CNAME'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">CNAME</span> <span class="n">rdata</span><span class="p">:</span> <span class="n">cert</span><span class="o">.</span><span class="n">be</span><span class="o">.&gt;</span><span class="p">)]</span>
<span class="n">Ranking</span><span class="p">:</span>
<span class="p">[(</span><span class="mf">1.0</span><span class="p">,</span> <span class="s">'www.youporn.com'</span><span class="p">),</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">,</span> <span class="s">'www.youporn.com'</span><span class="p">),</span> <span class="p">(</span><span class="mf">1.0000120563271599</span><span class="p">,</span> <span class="s">'www.belnet.be'</span><span class="p">),</span> <span class="p">(</span><span class="mf">1.0000120563271599</span><span class="p">,</span> <span class="s">'www.belnet.be'</span><span class="p">),</span> <span class="p">(</span><span class="mf">1.0000120563271599</span><span class="p">,</span> <span class="s">'www.cert.be'</span><span class="p">),</span> <span class="p">(</span><span class="mf">1.0000120563271599</span><span class="p">,</span> <span class="s">'www.cert.be'</span><span class="p">),</span> <span class="p">(</span><span class="mf">1.0000372023809501</span><span class="p">,</span> <span class="s">'foo.be'</span><span class="p">),</span> <span class="p">(</span><span class="mf">1.0001395089285701</span><span class="p">,</span> <span class="s">'www.public.lu'</span><span class="p">),</span> <span class="p">(</span><span class="mf">1.00015419407895</span><span class="p">,</span> <span class="s">'www.allo.lu'</span><span class="p">),</span> <span class="p">(</span><span class="mf">1.0003662109375</span><span class="p">,</span> <span class="s">'www.eurodns.com'</span><span class="p">),</span> <span class="p">(</span><span class="mf">1.0004111842105301</span><span class="p">,</span> <span class="s">'www.xxx.com'</span><span class="p">),</span> <span class="p">(</span><span class="mf">1.0005944293478299</span><span class="p">,</span> <span class="s">'www.nic.ru'</span><span class="p">),</span> <span class="p">(</span><span class="mf">1.0024646577381</span><span class="p">,</span> <span class="s">'www.facebook.com'</span><span class="p">),</span> <span class="p">(</span><span class="mf">1.0024646577381</span><span class="p">,</span> <span class="s">'www.facebook.com'</span><span class="p">),</span> <span class="p">(</span><span class="mf">1.002635288165</span><span class="p">,</span> <span class="s">'www.google.lu'</span><span class="p">)]</span>
<span class="n">List</span> <span class="n">of</span> <span class="n">ip</span> <span class="n">addresses</span><span class="p">:</span>
<span class="p">(</span><span class="s">'15169'</span><span class="p">,</span> <span class="s">'AU'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">TXT</span> <span class="n">rdata</span><span class="p">:</span> <span class="s">"15169 | 1.2.3.0/24 | AU | apnic | 2011-08-11"</span><span class="o">&gt;</span><span class="p">)</span>
<span class="p">(</span><span class="s">'15169'</span><span class="p">,</span> <span class="s">'US'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">TXT</span> <span class="n">rdata</span><span class="p">:</span> <span class="s">"15169 | 8.8.8.0/24 | US | arin | 1992-12-01"</span><span class="o">&gt;</span><span class="p">)</span>
<span class="p">(</span><span class="s">'27699'</span><span class="p">,</span> <span class="s">'BR'</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">DNS</span> <span class="n">IN</span> <span class="n">TXT</span> <span class="n">rdata</span><span class="p">:</span> <span class="s">"27699 | 201.1.0.0/17 | BR | lacnic | 2003-12-08"</span><span class="o">&gt;</span><span class="p">)</span>
<span class="nb">set</span><span class="p">([(</span><span class="s">'201.1.1.1'</span><span class="p">,</span> <span class="s">'(</span><span class="se">\'</span><span class="s">27699</span><span class="se">\'</span><span class="s">, </span><span class="se">\'</span><span class="s">BR</span><span class="se">\'</span><span class="s">, &lt;DNS IN TXT rdata: "27699 | 201.1.0.0/17 | BR | lacnic | 2003-12-08"&gt;)'</span><span class="p">),</span> <span class="p">(</span><span class="s">'8.8.8.8'</span><span class="p">,</span> <span class="s">'(</span><span class="se">\'</span><span class="s">15169</span><span class="se">\'</span><span class="s">, </span><span class="se">\'</span><span class="s">US</span><span class="se">\'</span><span class="s">, &lt;DNS IN TXT rdata: "15169 | 8.8.8.0/24 | US | arin | 1992-12-01"&gt;)'</span><span class="p">),</span> <span class="p">(</span><span class="s">'1.2.3.4'</span><span class="p">,</span> <span class="s">'(</span><span class="se">\'</span><span class="s">15169</span><span class="se">\'</span><span class="s">, </span><span class="se">\'</span><span class="s">AU</span><span class="se">\'</span><span class="s">, &lt;DNS IN TXT rdata: "15169 | 1.2.3.0/24 | AU | apnic | 2011-08-11"&gt;)'</span><span class="p">)])</span>
<span class="n">Include</span> <span class="n">dot</span><span class="o">.</span><span class="n">lu</span><span class="p">:</span>
<span class="p">[</span><span class="s">'abc.lu'</span><span class="p">,</span> <span class="s">'abc.lu'</span><span class="p">,</span> <span class="s">'www.public.lu'</span><span class="p">,</span> <span class="s">'www.allo.lu'</span><span class="p">,</span> <span class="s">'www.google.lu'</span><span class="p">,</span> <span class="s">'www.google.lu'</span><span class="p">]</span>
<span class="n">Exclude</span> <span class="n">dot</span><span class="o">.</span><span class="n">lu</span><span class="p">:</span>
<span class="p">[</span><span class="s">'www.xxx.com'</span><span class="p">,</span> <span class="s">'foo.be'</span><span class="p">,</span> <span class="s">'foo.be'</span><span class="p">,</span> <span class="s">'foo.be'</span><span class="p">,</span> <span class="s">'foo.be'</span><span class="p">,</span> <span class="s">'www.belnet.be'</span><span class="p">,</span> <span class="s">'www.belnet.be'</span><span class="p">,</span> <span class="s">'www.belnet.be'</span><span class="p">,</span> <span class="s">'www.cert.be'</span><span class="p">,</span> <span class="s">'www.cert.be'</span><span class="p">,</span> <span class="s">'www.cert.be'</span><span class="p">,</span> <span class="s">'www.cert.be'</span><span class="p">,</span> <span class="s">'www.cert.be'</span><span class="p">,</span> <span class="s">'www.eurodns.com'</span><span class="p">,</span> <span class="s">'www.facebook.com'</span><span class="p">,</span> <span class="s">'www.facebook.com'</span><span class="p">,</span> <span class="s">'www.facebook.com'</span><span class="p">,</span> <span class="s">'www.facebook.com'</span><span class="p">,</span> <span class="s">'www.nic.ru'</span><span class="p">,</span> <span class="s">'www.nic.ru'</span><span class="p">,</span> <span class="s">'www.youporn.com'</span><span class="p">,</span> <span class="s">'www.youporn.com'</span><span class="p">,</span> <span class="s">'www.youporn.com'</span><span class="p">,</span> <span class="s">'www.youporn.com'</span><span class="p">]</span>
</pre></div>
<h3>
<a name="software-required" class="anchor" href="#software-required"><span class="octicon octicon-link"></span></a>Software Required</h3>
<ul>
<li>Python (tested successfully on version 2.6)</li>
<li>dnspython library - <a href="http://www.dnspython.org/">http://www.dnspython.org/</a>
</li>
<li>IPy library</li>
</ul><h3>
<a name="license" class="anchor" href="#license"><span class="octicon octicon-link"></span></a>License</h3>
<p>Copyright (C) 2012-2013 Alexandre Dulaunoy - a(at)foo.be</p>
<p>This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.</p>
<p>This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.</p>
<p>You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.</p>
</section>
</div>
<!-- FOOTER -->
<div id="footer_wrap" class="outer">
<footer class="inner">
<p class="copyright">Domainclassifier maintained by <a href="https://github.com/adulau">adulau</a></p>
<p>Published with <a href="http://pages.github.com">GitHub Pages</a></p>
</footer>
</div>
</body>
</html>