示例#1
0
	def analyze(self, line):
		if line.startswith('#') or line.startswith('\n'):
			return

		try:
			ip = toolbox.find_ips(line)[0]
		except Exception, e:
			# if find_ip raises an exception, it means no ip 
			# was found in the line, so we return
			return
示例#2
0
        try:
            tornode["ip"] = fields[0]
            tornode["name"] = fields[1]
            tornode["router-port"] = fields[2]
            tornode["directory-port"] = fields[3]
            tornode["flags"] = fields[4]
            tornode["uptime"] = fields[5]
            tornode["version"] = fields[6]
            tornode["contactinfo"] = fields[7]
        except Exception, e:
            return

        tornode["value"] = "Tor: %s (%s)" % (tornode["name"], tornode["ip"])

        try:
            ip = toolbox.find_ips(tornode["ip"])[0]
            ip = Ip(ip=ip, tags=["Tor Node"])
        except Exception, e:
            # if find_ip raises an exception, it means no ip
            # was found in the line, so we return
            return

            # store ip in database
        ip, status = self.analytics.save_element(ip, with_status=True)
        if status["updatedExisting"] == False:
            self.elements_fetched += 1

            # store tornode in database
        tornode, status = self.analytics.save_element(tornode, with_status=True)
        if status["updatedExisting"] == False:
            self.elements_fetched += 1