def __init__(self): """ For URL parsing refer to RFC 2396 http://www.ietf.org/rfc/rfc2396.txt For the url http://a.b.c.d.e.f.g/1.html?param=1#Tag the client will try these possible strings: a.b.c.d.e.f.g/1.html?param=1#Tag a.b.c.d.e.f.g/1.html?param=1 a.b.c.d.e.f.g/1.html a.b.c.d.e.f.g/ c.d.e.f.g/1.html?param=1#Tag c.d.e.f.g/1.html?param=1 c.d.e.f.g/1.html c.d.e.f.g/ d.e.f.g/1.html?param=1#Tag d.e.f.g/1.html?param=1 d.e.f.g/1.html d.e.f.g/ e.f.g/1.html?param=1#Tag e.f.g/1.html?param=1 e.f.g/1.html e.f.g/ f.g/1.html?param=1#Tag f.g/1.html?param=1 f.g/1.html f.g/ Refer to http://code.google.com/apis/safebrowsing/ for more details. """ self.backend = DbObj().backend
def __init__(self, badware_type="malware"): """ The constructor initializes the module. """ self.backend = DbObj().backend self.url = self._get_URL() badware_dict = {"malware": "M", "black": "B"} self.badware_type = badware_type if not badware_type in badware_dict: raise KeyError("Invalid Badware Type") self.badware_code = badware_dict[badware_type] self.remove_row_regexp = re.compile("^-\w+")