Changed the logic to look for MX records of IPs and if there is none just return location data
This commit is contained in:
		
							parent
							
								
									89fde516ca
								
							
						
					
					
						commit
						3904363c71
					
				@ -33,6 +33,9 @@ def findMX(host):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    # append terminal output to variable std_out
 | 
					    # append terminal output to variable std_out
 | 
				
			||||||
    for line in p:
 | 
					    for line in p:
 | 
				
			||||||
 | 
					        if re.search('not found', line):
 | 
				
			||||||
 | 
					             query_api([host])
 | 
				
			||||||
 | 
					             break
 | 
				
			||||||
        std_out.append(line)
 | 
					        std_out.append(line)
 | 
				
			||||||
    p.close
 | 
					    p.close
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -50,8 +53,4 @@ if __name__ == "__main__":
 | 
				
			|||||||
    parser = argparse.ArgumentParser()
 | 
					    parser = argparse.ArgumentParser()
 | 
				
			||||||
    parser.add_argument("host", help="hostname to lookip")
 | 
					    parser.add_argument("host", help="hostname to lookip")
 | 
				
			||||||
    args = parser.parse_args()
 | 
					    args = parser.parse_args()
 | 
				
			||||||
    # If the arg is an IP address go straight to API
 | 
					 | 
				
			||||||
    if re.search('[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}', args.host):
 | 
					 | 
				
			||||||
        query_api([args.host])
 | 
					 | 
				
			||||||
    else:
 | 
					 | 
				
			||||||
    findMX(args.host)
 | 
					    findMX(args.host)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user