<?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>/home/shakir &#187; network</title>
	<atom:link href="http://www.mohdshakir.net/tag/network/feed" rel="self" type="application/rss+xml" />
	<link>http://www.mohdshakir.net</link>
	<description>My Piece Of The Web</description>
	<lastBuildDate>Fri, 16 Jul 2010 15:45:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Prefix WhoIs in Python</title>
		<link>http://www.mohdshakir.net/2007/11/10/prefix-whois-in-python</link>
		<comments>http://www.mohdshakir.net/2007/11/10/prefix-whois-in-python#comments</comments>
		<pubDate>Sat, 10 Nov 2007 01:00:09 +0000</pubDate>
		<dc:creator>shakir</dc:creator>
				<category><![CDATA[Information Insemination]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://www.mohdshakir.net/2007/11/10/prefix-whois-in-python</guid>
		<description><![CDATA[Part of a project I&#8217;m into requires me to dig for some details on IP addresses. Normal whois query (default to whois.apnic.net) don&#8217;t give me the information that I really need for, and upon searching I came to the Prefix Whois Project. They have came up with whob, and from the website I get to [...]]]></description>
			<content:encoded><![CDATA[<p>Part of a project I&#8217;m into requires me to dig for some details on IP addresses. Normal <font face="Courier New" color="#99ccff">whois</font> query (default to <font face="Courier New" color="#99ccff">whois.apnic.net</font>) don&#8217;t give me the information that I really need for, and upon searching I came to the <a href="http://pwhois.org">Prefix Whois Projec</a>t. They have came up with <font face="Courier New" color="#99ccff">whob,</font> and from the website I get to know that I can even get part of <font face="Courier New" color="#99ccff">whob</font>&#8216;s functionality by just to query for whois from their server. Let&#8217;s try with our favorite&#8217;s TMNut Screamyx DNS</p>
<p>&nbsp;</p>
<pre>
shakir@herugrim ~ $ whois -h whois.pwhois.org 202.188.0.133
IP: 202.188.0.133
Origin-AS: 4788
Prefix: 202.188.0.0/19
AS-Path: 6079 4788
AS-Org-Name:
Org-Name: Asia Pacific Network Information Centre
Net-Name: APNIC-CIDR-BLK
Cache-Date: 1195082506
Latitude: 3.167000
Longitude: 101.700000
City: -
Region: -
Country: MALAYSIA
</pre>
<p>I&#8217;ve just started to learn, and like Python, and let&#8217;s see  my Python example to extract the whois info;</p>
<pre  lang="python" line="1">import commands

def main():

    whoisServer = "whois.pwhois.org"
    IPAddr = "202.188.0.133"

    status, output = commands.getstatusoutput('whois -h ' + whoisServer + " " + IPAddr)

    result = {}

    for i in output.splitlines():
        stripped = i.split(':')
        result[stripped[0]] = stripped[1]

    print result

if __name__ == "__main__":
    main()
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mohdshakir.net/2007/11/10/prefix-whois-in-python/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
