Skip to content

Commit

Permalink
Mostly webinfo command stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
schedutron committed Jun 5, 2017
1 parent bae4db6 commit 5244df6
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 1 deletion.
Binary file added .DS_Store
Binary file not shown.
Binary file added Chap2/dist/easy-webinfo-0.5.tar.gz
Binary file not shown.
10 changes: 10 additions & 0 deletions Chap2/easy_webinfo.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -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: [email protected]
License: UNKNOWN
Description: UNKNOWN
Platform: UNKNOWN
6 changes: 6 additions & 0 deletions Chap2/easy_webinfo.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions Chap2/easy_webinfo.egg-info/dependency_links.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions Chap2/easy_webinfo.egg-info/top_level.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 1 addition & 1 deletion Chap2/half_duplex_chat_serv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

10 changes: 10 additions & 0 deletions Chap2/setup.py
Original file line number Diff line number Diff line change
@@ -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="[email protected]"
)
Binary file added Chap2/webinfo.pyc
Binary file not shown.
15 changes: 15 additions & 0 deletions webinfo
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 5244df6

Please sign in to comment.