def scan_sbg(self): print "UMO is searching in Google Safebrowsing Database ... waiting" l = Lookup() try: outfile = open(self.config["p_write"], "w") except IOError: self.config["p_logger"].error("UMO module malwareScan - Error open file:"+ self.config["p_write"]) sys.exit(1) try: outfileurls = open(self.config["p_umourls"], "w") except IOError: self.config["p_logger"].error("UMO module malwareScan - Error open file:"+ self.config["p_urlsumo"]) sys.exit(1) outfileurls.write("\n"+strftime('%Y-%m-%d %H:%M:%S') + " : New Google SafeBrowsing Search started\n") count = 0 self.config["p_logger"].info('UMO module malwareScan - Searching URLs in Local Google Safebrowsing Database...') for url in self.config["p_enlaces"]: malware = l.lookup_by_url(url) outfileurls.write(url.encode('utf8') + "\n") if malware == 'M': count = count + 1 outfile.write(url + "\n") outfile.close() outfileurls.close() if count > 0: print "Url Malware OWNED, look at report: " + self.config["p_write"] self.config["p_logger"].info("umo module malwareScan - Url Malware Owned in Google Safebrowsing Databases, look at report: " + self.config["p_write"] + "\n") else: self.config["p_logger"].info("umo module malwareScan - Malware not found in Google Safebrowsing Database")
def main(): # too lazy for optparse if len(sys.argv) == 1: return config = ConfigParser.ConfigParser() config.readfp(open(os.path.expanduser('~/.boombot.cfg'))) safebrowsing_db_path = config.get('safebrowsing', 'db_path') L = Lookup(safebrowsing_db_path) for x in sys.argv[1:]: lkup = L.lookup_by_url(x) if lkup: print lkup, x
def main(): # too lazy for optparse if len(sys.argv) == 1: return config = ConfigParser.ConfigParser() config.readfp(open(os.path.expanduser("~/.boombot.cfg"))) safebrowsing_db_path = config.get("safebrowsing", "db_path") L = Lookup(safebrowsing_db_path) for x in sys.argv[1:]: lkup = L.lookup_by_url(x) if lkup: print lkup, x