Example #1
0
def pDNS_Dom2IP(dom):
	TRX = MaltegoTransform()
	
	domain = dom.Value
	aKey = dom.getTransformSetting('apikey')
	try:
		results = query('-r', domain, 0, 'n', aKey)
	except:
		results = 'none'
		TRX.addUIMessage('No pDNS Results')
		
	if not results == 'none':
		for result in results:
			data = json.loads(result)
			if data.has_key('time_first'):
				first = data['time_first']
				last = data['time_last']
			elif data.has_key('zone_time_first'):
				first = data['zone_time_first']
				last = data['zone_time_last']
				
			fnice = datetime.datetime.fromtimestamp(int(first)).strftime('%m-%d-%Y')
			lnice = datetime.datetime.fromtimestamp(int(last)).strftime('%m-%d-%Y')
			
			if data['rrtype'] == 'A':
				Ent = TRX.addEntity('maltego.Domain', data['rrname'].rstrip('.'))
				Ent.setLinkLabel(fnice + ' - ' + lnice)

	TRX.returnOutput()
Example #2
0
def pDNS_OtherRR(dom):
	TRX = MaltegoTransform()
	
	domain = dom.Value
	aKey = dom.getTransformSetting('apikey')
	try:
		results = query('-r', domain, 0, 'n', aKey)
	except:
		results = 'none'
		TRX.addUIMessage('No pDNS Results')

	if not results == 'none':
		for result in results:
			data = json.loads(result)
			if data.has_key('time_first'):
				first = data['time_first']
				last = data['time_last']
			elif data.has_key('zone_time_first'):
				first = data['zone_time_first']
				last = data['zone_time_last']
				
			fnice = datetime.datetime.fromtimestamp(int(first)).strftime('%m-%d-%Y')
			lnice = datetime.datetime.fromtimestamp(int(last)).strftime('%m-%d-%Y')
		
			if data['rrtype'] == 'NS':
				for item in data['rdata']:
					Ent = TRX.addEntity('maltego.NSRecord', item)
					Ent.setLinkLabel(fnice + ' - ' + lnice)
			elif data['rrtype'] == 'MX':
				for item in data['rdata']:
					Ent = TRX.addEntity('maltego.MXRecord', item)
					Ent.setLinkLabel(fnice + ' - ' + lnice)
			elif data['rrtype'] == 'CNAME':
				for item in data['rdata']:
					Ent = TRX.addEntity('maltego.Domain', item.rstrip('.'))
					Ent.setLinkLabel(fnice + ' - ' + lnice)
			elif data['rrtype'] == 'A':
				pass
			else:
				type = data['rrtype']
				for item in data['rdata']:
					label = type + ' ' + item
					Ent = TRX.addEntity('maltego.Phrase', label)
					Ent.setLinkLabel(fnice + ' - ' + lnice)
					
	TRX.returnOutput()