mirror of
https://github.com/rscmbbng/Border-Check.git
synced 2024-12-25 21:41:28 +01:00
expanded the debugmode logfile on code checkpoint. It now includes info on browser and url, ip and hostname. Also created self.host_name variable
This commit is contained in:
parent
a27b6f1a48
commit
2954627fba
38
main.py
Normal file → Executable file
38
main.py
Normal file → Executable file
@ -41,6 +41,7 @@ class bc(object):
|
|||||||
self.url = ""
|
self.url = ""
|
||||||
self.old_url = ""
|
self.old_url = ""
|
||||||
self.ip = ""
|
self.ip = ""
|
||||||
|
self.host_name =""
|
||||||
self.city = ""
|
self.city = ""
|
||||||
self.country = ""
|
self.country = ""
|
||||||
self.routes = ""
|
self.routes = ""
|
||||||
@ -152,26 +153,19 @@ class bc(object):
|
|||||||
self.browser_history_path = chromium_lin
|
self.browser_history_path = chromium_lin
|
||||||
|
|
||||||
print "Browser Options:\n" + '='*45 + "\n"
|
print "Browser Options:\n" + '='*45 + "\n"
|
||||||
if self.browser == "F":
|
print "Currently used:", self.browser_path.split('/')[-1], "\n"
|
||||||
print "Browser used: Firefox \n"
|
|
||||||
elif self.browser == "C":
|
|
||||||
print "Browser used: Chrome \n"
|
|
||||||
elif self.browser == "CHROMIUM":
|
|
||||||
print "Browser used: Chromium \n"
|
|
||||||
elif self.browser == "S":
|
|
||||||
print "Browser used: Safari \n"
|
|
||||||
|
|
||||||
if self.options.debug == True:
|
if self.options.debug == True:
|
||||||
if self.browser == "F" and sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
self.browser_version = subprocess.check_output([self.browser_path, '--version']).strip('\n')
|
if self.browser == "F" or self.browser == "C" or self.browser == "CHROMIUM":
|
||||||
elif self.browser == "F" and sys.platform.startswith('linux'):
|
self.browser_version = subprocess.check_output([self.browser_path, '--version']).strip('\n')
|
||||||
|
elif sys.platform.startswith('linux') and self.browser == "F":
|
||||||
self.browser_version = subprocess.check_output(['firefox', '--version']).strip('\n')
|
self.browser_version = subprocess.check_output(['firefox', '--version']).strip('\n')
|
||||||
elif self.browser == "C" and sys.platform == 'darwin':
|
|
||||||
self.browser_version = subprocess.check_output([self.browser_path, '--version']).strip('\n')
|
|
||||||
elif self.browser == "CHROMIUM" and sys.platform == 'darwin':
|
|
||||||
self.browser_version = subprocess.check_output([self.browser_path, '--version']).strip('\n')
|
|
||||||
|
|
||||||
print "Version:", self.browser_version, "\n"
|
if self.browser == "S":
|
||||||
|
print "Can't get Safari version information, you'll have to look it up manually \n"
|
||||||
|
else:
|
||||||
|
print "Version:", self.browser_version, "\n"
|
||||||
print "History:", self.browser_history_path, "\n"
|
print "History:", self.browser_history_path, "\n"
|
||||||
|
|
||||||
#move the subprocesses to debug mode
|
#move the subprocesses to debug mode
|
||||||
@ -263,7 +257,12 @@ class bc(object):
|
|||||||
except:
|
except:
|
||||||
print "Error: network is not responding correctly. Aborting...\n"
|
print "Error: network is not responding correctly. Aborting...\n"
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
logfile = open('logfile', 'a')
|
#Make a tracelog file.
|
||||||
|
if self.options.debug == True:
|
||||||
|
logfile = open('tracelogfile', 'a')
|
||||||
|
thingstolog = ['='*45 + "\n", "Browser: ", self.browser_path.split('/')[-1], "\n", "Version: ", self.browser_version, "\n", "Path to browser: ", self.browser_path, "\n", "History db: ", self.browser_history_path, "\n","URL: ", self.url[0], "\n", "Host: ",url, "\n", "Host ip: ", url_ip, "\n", '='*45, "\n"]
|
||||||
|
for item in thingstolog:
|
||||||
|
logfile.write(item)
|
||||||
print '='*45 + "\n" + "Packages Route:\n" + '='*45
|
print '='*45 + "\n" + "Packages Route:\n" + '='*45
|
||||||
for line in a.stdout:
|
for line in a.stdout:
|
||||||
logfile.write(line)
|
logfile.write(line)
|
||||||
@ -271,6 +270,7 @@ class bc(object):
|
|||||||
for ip in parts:
|
for ip in parts:
|
||||||
if re.match(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$",ip):
|
if re.match(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$",ip):
|
||||||
record = self.geoip.record_by_addr(ip)
|
record = self.geoip.record_by_addr(ip)
|
||||||
|
self.host_name = socket.gethostbyaddr(ip)[0]
|
||||||
#print record
|
#print record
|
||||||
try:
|
try:
|
||||||
if record.has_key('country_name') and record['city'] is not '':
|
if record.has_key('country_name') and record['city'] is not '':
|
||||||
@ -369,8 +369,6 @@ class bc(object):
|
|||||||
else:
|
else:
|
||||||
traces = self.try_running(self.traces, "\nInternal error tracerouting.")
|
traces = self.try_running(self.traces, "\nInternal error tracerouting.")
|
||||||
# export data to XML
|
# export data to XML
|
||||||
xml_results = xml_reporting(self)
|
|
||||||
xml_results.print_xml_results('data.xml')
|
|
||||||
print '='*45 + "\n"
|
print '='*45 + "\n"
|
||||||
print "Status: Waiting for new urls ...\n"
|
print "Status: Waiting for new urls ...\n"
|
||||||
# stay latent waiting for new urls
|
# stay latent waiting for new urls
|
||||||
@ -383,6 +381,8 @@ class bc(object):
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
traces = self.try_running(self.traces, "\nInternal error tracerouting.")
|
traces = self.try_running(self.traces, "\nInternal error tracerouting.")
|
||||||
|
xml_results = xml_reporting(self)
|
||||||
|
xml_results.print_xml_results('data.xml')
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app = bc()
|
app = bc()
|
||||||
|
Loading…
Reference in New Issue
Block a user