83 lines
2.2 KiB
Python
Executable File
83 lines
2.2 KiB
Python
Executable File
import argparse
|
|
import subprocess
|
|
import re # YAY REVERSE ENGINEER... wait its just regex
|
|
|
|
#Made this work with linux magic
|
|
|
|
inInput = ""
|
|
partDomain = ""
|
|
running = 1
|
|
pingOn = 1
|
|
|
|
|
|
def iterate(inArray, pre):
|
|
count = 0
|
|
while count != len(inArray) - 1:
|
|
print pre, inArray[count]
|
|
count = count + 1
|
|
|
|
def whois(inDomain):
|
|
lookup = subprocess.check_output(["whois", inDomain])
|
|
print "========================================================"
|
|
test = lookup.split("\n")
|
|
iterate(test, "")
|
|
|
|
def dig(inDomain, record):
|
|
dig = subprocess.check_output(["dig", record, "+short", inDomain])
|
|
print "========================================================" #ADD REST OF DIGS
|
|
test = dig.split("\n")
|
|
#print record, test[0]
|
|
iterate(test, record) #fix up mutiple record types...
|
|
|
|
def ipLookup(inDomain):
|
|
host = "N/A"
|
|
ipLook = subprocess.check_output(["geoiplookup", inDomain])
|
|
try:
|
|
host = subprocess.check_output(["host", inDomain]) #Do exit status check...
|
|
returncode = 0
|
|
except subprocess.CalledProcessError as e:
|
|
output = e.output
|
|
returncode = e.returncode
|
|
|
|
print ipLook, "PTR: ", host
|
|
|
|
def ipPing(inDomain):
|
|
ping = subprocess.call(["ping", "-c 2", inDomain])
|
|
#iterate(ping, "")
|
|
|
|
def getInput():
|
|
global inInput
|
|
global partDomain
|
|
global running
|
|
global pingOn
|
|
if pingOn:
|
|
inInput = raw_input("[P] Please enter a domain/IP: ")
|
|
else:
|
|
inInput = raw_input("[p] Please enter a domain/IP: ")
|
|
partDomain = inInput.split(".")
|
|
if inInput == "quit":
|
|
running = 0
|
|
|
|
#Main Loop
|
|
while running == 1:
|
|
getInput()
|
|
if inInput == "ping":
|
|
pingOn = !pingOn
|
|
if inInput == "":
|
|
pass
|
|
else:
|
|
if running == 0:
|
|
pass
|
|
else:
|
|
if len(partDomain) == 4:
|
|
ipLookup(inInput)
|
|
ipPing(inInput)
|
|
else:
|
|
whois(inInput)
|
|
#Condense dig calls
|
|
dig(inInput, "A")
|
|
dig(inInput, "MX")
|
|
dig(inInput, "TXT")
|
|
dig(inInput, "NS")
|
|
dig(inInput, "SRV")
|
|
dig(inInput, "SOA") |