MCPcopy
hub / github.com/eldraco/domain_analyzer / check_PTR_record

Function check_PTR_record

domain_analyzer.py:958–986  ·  view source on GitHub ↗

This function takes one ip and ask for the dns PTR record information or reverse DNS hostname, and latter adds it to the main dictionary

(ip)

Source from the content-addressed store, hash-verified

956
957
958def check_PTR_record(ip):
959 """
960 This function takes one ip and ask for the dns PTR record information or reverse DNS hostname, and latter adds it to the main dictionary
961 """
962 global debug
963 global domain_data
964
965 try:
966 if debug:
967 logging.debug('\t\t> Checking {0} ip reverse DNS hostname'.format(ip))
968 """
969 temp_ip = ip.split('.')
970 temp_ip.reverse()
971 reverse_ip=""
972 for i in temp_ip:
973 reverse_ip = reverse_ip + i +'.'
974 reverse_ip = reverse_ip + 'in-addr.arpa'
975 """
976 reverse_name = dns.reversename.from_address(ip).to_text()[:-1]
977 return reverse_name
978
979 except Exception as inst:
980 print(type(inst)) # the exception instance
981 print(inst.args) # arguments stored in .args
982 print(inst) # __str__ allows args to printed directly
983 x, y = inst # __getitem__ allows args to be unpacked directly
984 print('x =', x)
985 print('y =', y)
986 return ""
987
988
989

Callers 5

get_NS_recordsFunction · 0.85
get_MX_recordsFunction · 0.85
dns_requestFunction · 0.85
check_SPF_recordFunction · 0.85
check_A_recordsFunction · 0.85

Calls 1

formatMethod · 0.80

Tested by

no test coverage detected