diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..80fc68e Binary files /dev/null and b/.DS_Store differ diff --git a/Chap2/dist/easy-webinfo-0.5.tar.gz b/Chap2/dist/easy-webinfo-0.5.tar.gz new file mode 100644 index 0000000..48e8463 Binary files /dev/null and b/Chap2/dist/easy-webinfo-0.5.tar.gz differ diff --git a/Chap2/easy_webinfo.egg-info/PKG-INFO b/Chap2/easy_webinfo.egg-info/PKG-INFO new file mode 100644 index 0000000..cff3be2 --- /dev/null +++ b/Chap2/easy_webinfo.egg-info/PKG-INFO @@ -0,0 +1,10 @@ +Metadata-Version: 1.0 +Name: easy-webinfo +Version: 0.5 +Summary: Python command line tool to get some basic info about a website/ip or your pc, using ipinfo.io +Home-page: UNKNOWN +Author: Saurabh Chaturvedi +Author-email: saurabh.chaturvedi63@gail.com +License: UNKNOWN +Description: UNKNOWN +Platform: UNKNOWN diff --git a/Chap2/easy_webinfo.egg-info/SOURCES.txt b/Chap2/easy_webinfo.egg-info/SOURCES.txt new file mode 100644 index 0000000..1953d3f --- /dev/null +++ b/Chap2/easy_webinfo.egg-info/SOURCES.txt @@ -0,0 +1,6 @@ +setup.py +webinfo +easy_webinfo.egg-info/PKG-INFO +easy_webinfo.egg-info/SOURCES.txt +easy_webinfo.egg-info/dependency_links.txt +easy_webinfo.egg-info/top_level.txt \ No newline at end of file diff --git a/Chap2/easy_webinfo.egg-info/dependency_links.txt b/Chap2/easy_webinfo.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Chap2/easy_webinfo.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/Chap2/easy_webinfo.egg-info/top_level.txt b/Chap2/easy_webinfo.egg-info/top_level.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Chap2/easy_webinfo.egg-info/top_level.txt @@ -0,0 +1 @@ + diff --git a/Chap2/half_duplex_chat_serv.py b/Chap2/half_duplex_chat_serv.py index d74e67d..f0b146d 100644 --- a/Chap2/half_duplex_chat_serv.py +++ b/Chap2/half_duplex_chat_serv.py @@ -43,6 +43,6 @@ def run(self): self.chatServSock.close() #not really used if __name__ == '__main__': - chatServer = ChatServer('', 3300, 1024) + chatServer = ChatServer('', 33000, 1024) chatServer.run() diff --git a/Chap2/setup.py b/Chap2/setup.py new file mode 100644 index 0000000..11c8ddd --- /dev/null +++ b/Chap2/setup.py @@ -0,0 +1,10 @@ +from setuptools import setup + +setup( +name='easy-webinfo', +version='0.5', +description="Python command line tool to get some basic info about a website/ip or your pc, using ipinfo.io", +scripts=['webinfo'], +author="Saurabh Chaturvedi", +author_email="saurabh.chaturvedi63@gail.com" +) diff --git a/Chap2/webinfo.pyc b/Chap2/webinfo.pyc new file mode 100644 index 0000000..ea06ad9 Binary files /dev/null and b/Chap2/webinfo.pyc differ diff --git a/webinfo b/webinfo new file mode 100755 index 0000000..2ccbcfa --- /dev/null +++ b/webinfo @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +#By Saurabh Chaturvedi +import sys, requests, socket + +def main(): + url = 'http://ipinfo.io' + if len(sys.argv) != 1: + ip = socket.getaddrinfo(sys.argv[1], 80)[1][4][0] #80 is http + url += '/%s' % ip + info = requests.get(url).json() + for key in info: + print "%-10s: %s" % (key, info[key]) +if __name__ == "__main__": + main()