in lib/waf-update.py [0:0]
def get_ip_groups_json(url, expected_hash):
logging.debug("Updating from " + url)
response = urllib.request.urlopen(url)
ip_json = response.read()
if expected_hash == 'seed':
logging.info('hash set to seed, bypassing md5 check')
return ip_json
m = hashlib.md5()
m.update(ip_json)
hash = m.hexdigest()
if hash != expected_hash:
raise Exception('MD5 Mismatch: got ' + hash +
' expected ' + expected_hash)
return ip_json