Beispiel #1
0
    def CreateReports(self):
        """Create CSV & HTML reports for the latest run."""

        if self.options.output_file:
            self.report_path = self.options.output_file
        else:
            self.report_path = util.GenerateOutputFilename(
                self.options.template)

        if self.options.csv_file:
            self.csv_path = self.options_csv_file
        else:
            self.csv_path = util.GenerateOutputFilename('csv')

        if self.options.upload_results in (1, True):
            # This is for debugging and transparency only.
            self.json_path = util.GenerateOutputFilename('js')
            self.UpdateStatus('Saving anonymized JSON to %s' % self.json_path)
            json_data = self.reporter.CreateJsonData()
            f = open(self.json_path, 'w')
            f.write(json_data)
            f.close()

            self.UpdateStatus('Uploading results to %s' %
                              self.options.site_url)
            connector = site_connector.SiteConnector(
                self.options, status_callback=self.UpdateStatus)
            self.url, self.share_state = connector.UploadJsonResults(
                json_data, hide_results=self.options.hide_results)

            if self.url:
                self.UpdateStatus('Your sharing URL: %s (%s)' %
                                  (self.url, self.share_state))

        self.UpdateStatus('Saving report to %s' % self.report_path)
        f = open(self.report_path, 'w')
        self.reporter.CreateReport(format=self.options.template,
                                   output_fp=f,
                                   csv_path=self.csv_path,
                                   sharing_url=self.url,
                                   sharing_state=self.share_state)
        f.close()

        self.UpdateStatus('Saving detailed results to %s' % self.csv_path)
        self.reporter.SaveResultsToCsv(self.csv_path)
Beispiel #2
0
import sys
import threading
import tkFont
# Wildcard imports are evil.
from Tkinter import *
import tkMessageBox
import traceback

import addr_util
import base_ui
import conn_quality
import nameserver_list
import util

THREAD_UNSAFE_TK = 0
LOG_FILE_PATH = util.GenerateOutputFilename('log')


def closedWindowHandler():
    print '[法 语] Au revoir, mes amis!'
    print '[诺克语] Kancee, kilc teonu!'
    print '[中 文] 再见了,我的朋友!'
    sys.exit(1)


global_message_queue = Queue.Queue()
global_last_message = None


def AddMsg(message, master=None, backup_notifier=None, **kwargs):
    """Add a message to the global queue for output."""