diff options
author | Nico Golde <nion@debian.org> | 2008-06-07 09:12:39 +0000 |
---|---|---|
committer | Nico Golde <nion@debian.org> | 2008-06-07 09:12:39 +0000 |
commit | 8dd3d5b26af16ba0effd884f8268da501d8f7e75 (patch) | |
tree | 5b123e0abf3dfaf55a26dd6c34551e4848885ceb /bin/report-vuln | |
parent | 660b84497d62d5b25b2270671942eefdb0a9e98b (diff) |
use urllib instead of httplib as it takes care of http_proxy by itself
git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@9011 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'bin/report-vuln')
-rwxr-xr-x | bin/report-vuln | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/bin/report-vuln b/bin/report-vuln index 08d5e0a7d9..3e495667f4 100755 --- a/bin/report-vuln +++ b/bin/report-vuln @@ -13,7 +13,7 @@ # } # export http_proxy if you need to use an http proxy to report bugs -import sys, re, httplib, os +import sys, re, urllib, os def gen_index(ids): ret = '' @@ -23,24 +23,16 @@ def gen_index(ids): return ret -def do_httpconnect(id): - proxy = os.getenv('http_proxy') - if proxy: - if proxy.lower().startswith('http://'): - proxy = proxy.replace('http://', '') - - url = '/cgi-bin/cvename.cgi?name=' + id - host = 'cve.mitre.org' - if proxy != None: - host = proxy - url = 'http://cve.mitre.org' + url - +def http_get(id): + param = urllib.urlencode({'name' : id}) + resp = '' try: - conn = httplib.HTTPConnection(host) - conn.request('GET', url) - resp = conn.getresponse() + f = urllib.urlopen('http://cve.mitre.org/cgi-bin/cvename.cgi?%s' % param) + resp = f.read() except Exception, e: error('on doing HTTP request' + str(e)) + + f.close() return resp @@ -50,9 +42,9 @@ def get_cve(id): r = re.compile('.*<th\ colspan=.*>Description<.*') tag = re.compile('.*</?tr>.*') ret = '' - resp = do_httpconnect(id) + resp = http_get(id) - for line in resp.read().rsplit('\n'): + for line in resp.rsplit('\n'): if r.match(line): desc = True continue |