How to use the ipdb.ipdb.get_geo_iter function in ipdb

To help you get started, we’ve selected a few ipdb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Phype / telnet-iot-honeypot / backend / clientcontroller.py View on Github external
	@db_wrapper
	def fill_db_ipranges(self):		
		if self.session.query(IPRange.ip_min).count() != 0:
			return
		
		print "Filling IPRange Tables"
		
		asntable = ipdb.ipdb.get_asn()
		progress = 0
		
		for row in ipdb.ipdb.get_geo_iter():
			progress += 1
			if progress % 1000 == 0:
				self.session.commit()
				self.session.flush()
				print str(100.0 * float(row[0]) / 4294967296.0) + "% / " + str(100.0 * progress / 3315466) + "%" 
			
			ip = IPRange(ip_min = int(row[0]), ip_max=int(row[1]))
			
			ip.country   = row[2]
			ip.region    = row[4]
			ip.city      = row[5]
			ip.zipcode   = row[8]
			ip.timezone  = row[9]
			ip.latitude  = float(row[6])
			ip.longitude = float(row[7])