Changeset 5191
- Timestamp:
- 13 May 2010, 10:30:43 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/WAeUPTool.py
r5188 r5191 2045 2045 2046 2046 2047 security.declarePublic('web_sniffer') ###( 2048 def web_sniffer(self,domain=None,params=None): 2049 "web sniffer based on http://python-dev.blogspot.com/2008/06/python-websniffer.html" 2050 2051 import httplib 2052 import string 2053 import os 2054 2055 opera = {"User-Agent":"Opera/9.20 (Windows NT 6.0; U; en)", "Accept-Charset":"ISO-8859-1,UTF-8;q=0.7,*;q=0.7", "Cache-Control":"no", "Accept-Language":"de,en;q=0.7,en-us;q=0.3", "Referer":"http://fake_referer.net"} 2056 2057 path = '/' 2058 method = 'GET' 2059 profile = opera 2060 #import pdb;pdb.set_trace() 2061 conn = httplib.HTTPSConnection(domain) 2062 conn.request(method, path, params, profile) 2063 stat = conn.getresponse() 2064 headers = stat.getheaders() 2065 version = stat.version 2066 status = stat.status 2067 reason = stat.reason 2068 data = stat.read() 2069 conn.close() 2070 2071 #file_name = domain.replace(".", "-") 2072 #file_object = open(file_name, "w") 2073 #file_object.write(data) 2074 #file_object.close() 2075 2076 print "\n" 2077 print "WEBSNIFFER 0.1" 2078 print "+++++++++++++++++" 2079 print "\n" 2080 print "Header (Client)" 2081 print "-----------------" 2082 for key, value in profile.iteritems(): 2083 print "%s \t %s" % (key, value) 2084 print "-----------------" 2085 print "\n" 2086 print "Header (Server)" 2087 print "-----------------" 2088 print "HTTP \t %s" % (version) 2089 print "Status \t %s (%s)" % (status, reason) 2090 for key, value in headers: 2091 print "%s \t %s" % (key, value) 2092 print "-----------------" 2093 print "\n" 2094 #print "Quelltext" 2095 #print "-----------------" 2096 #print "Quelltext geschrieben in File:" 2097 #print file_name 2098 #print "-----------------" 2099 #print "\n" 2100 2101 2102 2047 2103 InitializeClass(WAeUPTool)
Note: See TracChangeset for help on using the changeset viewer.