Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 28th, 2003, 03:39 PM
Gerardoj's Avatar
Gerardoj Gerardoj is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Somewhere over the Rainbow
Posts: 128 Gerardoj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 54 m 28 sec
Reputation Power: 10
Python Scanner

Hi, I would like to know how can I detect what server is using some web site?, what OS?, version? and all that kind of info. Im trying something like:

Code:
import asyncore, socket

class AsyncGet(asyncore.dispatcher):
    def __init__(self, host):
        asyncore.dispatcher.__init__(self)
        self.host = host
        
        self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
        self.connect((host,80))
                     
        self.request = 'GET /index.html HTTP/1.0\r\n\r\n'
        self.outf = None
        print 'Requesting server from',host


Is that correct?

Last edited by Gerardoj : November 28th, 2003 at 04:14 PM.

Reply With Quote
  #2  
Old November 28th, 2003, 05:35 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,537 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 17 m 47 sec
Reputation Power: 68
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Way, pretty low level thing you got going on there.. you can get quite allot of info about a webpage very easily with the urllib module..

>>> import urllib
>>> urllib.urlopen('http://www.python.org/').info()
<httplib.HTTPMessage instance at 0x01074558>
>>> print urllib.urlopen('http://www.python.org/').info()
Age: 7
Accept-Ranges: bytes
Date: Fri, 28 Nov 2003 23:25:38 GMT
Content-Length: 10611
Content-Type: text/html
Server: Apache/1.3.26 (Unix)
Last-Modified: Sat, 22 Nov 2003 18:48:15 GMT
ETag: "5a7599-2973-3fbfaf6f"
Via: 1.1 webcacheB10 (NetCache NetApp/5.3.1D2)

>>> print urllib.urlopen('http://www.python.org/').info()['Server']
Apache/1.3.26 (Unix)
>>> >>> d = dict(urllib.urlopen('http://www.python.org/').info())
>>> d
{'content-length': '10611', 'via': '1.1 webcacheB10 (NetCache NetApp/5.3.1D2)', 'age': '255', 'server': 'Apache/1.3.26 (Unix)', 'last-modified': 'Sat, 22 Nov 2003 18:48:15 GMT', 'etag': '"5a7599-2973-3fbfaf6f"', 'date': 'Fri, 28 Nov 2003 23:25:38 GMT', 'content-type': 'text/html', 'accept-ranges': 'bytes'}
>>>

You have Server type, version and platform all in one key! What other info are you trying to get here?

Mark.
__________________
programming language development: www.netytan.com Hula


Reply With Quote
  #3  
Old November 28th, 2003, 05:45 PM
Gerardoj's Avatar
Gerardoj Gerardoj is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Somewhere over the Rainbow
Posts: 128 Gerardoj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 54 m 28 sec
Reputation Power: 10
hey thanks man, now works perfectly for me. One more question how can I know which ports are open? Thanks again

Reply With Quote
  #4  
Old November 28th, 2003, 06:04 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,537 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 17 m 47 sec
Reputation Power: 68
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
as far as i know your can't.. or not with a spacific module, if you had SSH/telnet access you should connect to the server and check what ports are open from there using the telnetlib module..

My best bet would be to try and connect to each port one by one (i dont know how fast this will be) and return only the open ports..

If i think of another way i'll let you know!

Mark.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Python Scanner

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap