| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/python | |
| 2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 import urllib,sys | |
| 7 | |
| 8 | |
| 9 url = 'http://safebrowsing.clients.google.com/safebrowsing/downloads?client=goog
leclient&appver=1.0&pver=2.1' | |
| 10 | |
| 11 if len(sys.argv) == 1: | |
| 12 data = 'goog-phish-shavar;\ngoog-malware-shavar;\n' | |
| 13 else: | |
| 14 post_data_file = sys.argv[1] | |
| 15 file = open(post_data_file, "r") | |
| 16 data = file.read() | |
| 17 file.close | |
| 18 | |
| 19 response = urllib.urlopen(url, data) | |
| 20 | |
| 21 response_file = open("response", "r+") | |
| 22 response_file.write(response.read()) | |
| 23 response_file.seek(0) | |
| 24 | |
| 25 counter = 0 | |
| 26 | |
| 27 for line in response_file: | |
| 28 if not line.startswith('u:'): | |
| 29 continue | |
| 30 | |
| 31 chunk_url = 'http://' + line[2:] | |
| 32 filename = chunk_url[chunk_url.rfind('/') + 1:] | |
| 33 filename = "%03d" % counter + filename[0:filename.rfind('_')] | |
| 34 counter += 1 | |
| 35 | |
| 36 urllib.urlretrieve(chunk_url, filename) | |
| 37 | |
| 38 response_file.close() | |
| OLD | NEW |