示例#1
0
def options():
    if vpn:
        vpncheck()
    if fresh:
        os.system("rm -r output")
        newpath = r"output"
        os.makedirs(newpath)
    if install or upgrade:
        upgradeFiles()
    else:
        if domain:
            if quick:
                amass()
                subfinder()
            elif bruteforce:
                massdns()
                sublist3r()
                enumall()
                amass()
                subfinder()
            else:
                sublist3r(True)
                enumall()
                knockpy()
                amass()
                subfinder()
            subdomainfile()
            if notify:
                notified()
        else:
            warning("\nPlease provide a domain. Ex. -d example.com")
    colored("\nAll your subdomain are belong to us", colorama.Fore.BLUE)
示例#2
0
 def get_information(self):
     for data in self.datas:
         trains = [
             # 车次
             data["station_train_code"],
             # 出发站/到达站
             '\n'.join([
                 color.colored('red', data["start_station_name"]),
                 color.colored('red', data["end_station_name"])
             ]),
             # 出发时间/到达时间
             '\n'.join([
                 color.colored('green', data["start_time"]),
                 color.colored('green', data["arrive_time"])
             ]),
             # 历时
             data["lishi"],
             # 一等坐
             data['zy_num'],
             # 二等坐
             data['ze_num'],
             # 软卧
             data['rw_num'],
             # 软坐
             data['yw_num'],
             # 硬坐
             data['yz_num']
         ]
         #print data["station_train_code"], data["start_station_name"]
         yield trains
示例#3
0
 def __init__(self):
     # self.serverHost = '192.168.1.9'
     self.serverHost = '127.0.0.7'
     self.serverPort = 443
     self.socket = None
     self.cmd_label = ("{user}{host} {current_path}" . format(
         user=colored(getpass.getuser()+"@", color="green", attrs=['bold']),
         host=colored("127.0.0.1", color="green", attrs=['bold']),
         current_path=colored(os.getcwd() + " $", color="blue", attrs=['bold'])))
示例#4
0
 def persistent_connect(self):
     print(colored("[+] Connection stabilized on server: ", color='yellow'))
     while True:
         try:
             self.listen()
         except Exception as e:
             print(colored("[!] Error. Could not keep alive: %s", color='red', attrs=['bold']) % str(e))
             time.sleep(5)
         else:
             break
示例#5
0
    def socket_connect(self):
            try:
                conn = self.socket.connect((self.serverHost, self.serverPort))
            except socket.error as e:
                print(colored("[!] Socket connection error: " + str(e), color='red', attrs=['bold']))
                print(colored("\nTrying to connect again...\n", color='white', attrs=['dark', 'blink']))
                time.sleep(5)
                self.socket_connect()
                self.persistent_connect()

            try:
                self.socket.send(str.encode(socket.gethostname()))
            except socket.error as e:
                print(colored("[!] Cannot send hostname to server: %s", color='red', attrs=['bold']) % str(e))
                raise
示例#6
0
    def format(self, record):
        message = record.getMessage()
        mapping = {
            'CRITICAL': 'bgred',
            'ERROR': 'red',
            'WARNING': 'yellow',
            'SUCCESS': 'green',
            'INFO': 'cyan',
            'DEBUG': 'bggrey',
        }

        # default color
        color = mapping.get(record.levelname, "write")
        level = colored('%-8s' % record.levelname, color)
        time = colored(datetime.datetime.now().strftime("(%H:%M:%S)"), "magenta")
        return " ".join([level, time, message])
示例#7
0
def gt(text,
       font=DEFAULT_FONT,
       color="magenta",
       on_color=None,
       attr=None,
       width=80,
       justify="center"):
    """An art font that generates the effect of 
       the specified parameter.


       Args:
        text: Get an character string.
        on_color: Get an character string,setting the background 
                  color of the text.
        available text highlights:
            on_red, on_green, on_yellow, on_blue, on_magenta, on_cyan, 
            on_white.
        attr: Get a character string,setting the effect of the text.
        available attributes:
                bold, dark, underline, blink, reverse, concealed.

        width: Setting the size of the terminal output font, type is int.
        justify: Setting the location of the terminal output font.
        available parameter: left, enter, right.

    Returns:
        A text of a specific color effect.

    """

    f = Figlet(font, width=width, justify=justify)
    r = f.renderText(text)
    return colored(r, color, on_color, attr)
示例#8
0
def rd(text, on_color=None, attr=None, width=80, justify="center"):
    """An art font that generates random fonts 
       and random colors.


       Args:
        text: Get an character string.
        color: Get a color string,dye the input string 
               with the corresponding color.
        available text colors:
               red, green, yellow, blue, magenta, cyan, white.
        on_color: Get an character string,setting the background 
                  color of the text.
        available text highlights:
            on_red, on_green, on_yellow, on_blue, on_magenta, on_cyan, 
            on_white.
        attr: Get a character string,setting the effect of the text.
        available attributes:
                bold, dark, underline, blink, reverse, concealed.

        width: Setting the terminal width of the output font, type is int.
        justify: Setting the location of the terminal output font.
        available parameter: left, enter, right.

    Returns:
        A text of a specific color effect.
    """
    rand_int = random.randint(1, len(font_list) + 1)
    rand_color = color_dict.get(random.randint(30, 38))

    rand_font = font_list[rand_int]
    print(f"Random font: {format(rand_font)}")
    f = Figlet(font=rand_font, width=width, justify=justify)
    r = f.renderText(text)
    return colored(r, rand_color, on_color, attr)
示例#9
0
def link(conf, args):
  '''Link all files in the repo directory to their configured locations.'''

  # load our machine id so we know which files to link
  machine_id = config.get_machine_id()

  # map all file paths to their destination configs for this machine
  links = {}
  for path in os.listdir(constants.REPO_DIR):
    path = util.normalize_to_root(path, constants.REPO_DIR)

    is_hidden = util.is_hidden(path)
    is_ignored = path in conf['ignore']

    if not is_hidden and not is_ignored:
      # load the config for the given path
      file_config = config.get_file_config(path, conf['destination'])

      # if the file belongs on this machine, store its config
      if config.machine_matches(machine_id, file_config['machines']):
        links[path] = file_config

  # find the longest link basename for pretty output formatting
  max_src_width = 0
  if len(links) > 0:
    max_src_width = max(len(os.path.basename(k)) for k in links.keys())

  # link the files to their destination(s)
  link_symbol = ' -> '
  for src, info in links.iteritems():
    msg = os.path.basename(src).rjust(max_src_width)
    msg += color.grey(link_symbol)

    for i, dest in enumerate(info['paths']):
      # the color of the link destination, different when we're creating a new
      # link, overwriting a link, and overwriting a normal file.
      dest_color = 'green'
      if os.path.lexists(dest):
        dest_color = 'cyan'
        if not os.path.islink(dest):
          dest_color = 'yellow'

      # do the symlink unless we're doing a dry run
      if not args.test:
        # overwrite links only by default, everything if forcing
        overwrite = True if args.force else None
        util.symlink(dest, src, overwrite=overwrite)

      # pad the left space if we're not the first item, since items with
      # multiple destinations are all under the same link name and symbol.
      if i > 0:
        msg += os.linesep
        msg += ' ' * (max_src_width + len(link_symbol))

      msg += color.colored(dest, dest_color)

    print(msg)

  # return the created links for good measure
  return links
示例#10
0
 def listen(self):
     conn = self.socket
     try:
         data = conn.recv(1024)
         print data
     except socket.error as e:
         print(colored("[!] Listen error: %s", color='red', attrs=['bold']) % str(e))
         self.socket_kill(conn)
         return self.build()
示例#11
0
 def write(self, message, level=None, color=None):
     level = Level.labelize(level)
     if level < self.min_level:
         return
     now = datetime.now().isoformat()
     if color:
         text = colored('{} [{}] {}\n'.format(now, level, message),
                        color=color)
     else:
         text = '{} [{}] {}\n'.format(now, level, message)
     self.output.write(text)
示例#12
0
文件: bench.py 项目: asajeffrey/luau
def addTotalsToTable():
    if len(vmTotalMin) == 0:
        return

    if arguments.vmNext != None:
        index = 0

        resultPrinter.add_row({
            'Test': 'Total',
            'Min': '{:8.3f}ms'.format(vmTotalMin[index]),
            'Average': '{:8.3f}ms'.format(vmTotalAverage[index]),
            'StdDev%': "---",
            'Driver': getShortVmName(os.path.abspath(arguments.vm)),
            'Speedup': "",
            'Significance': "",
            'P(T<=t)': ""
        })

        for compareVm in arguments.vmNext:
            index = index + 1

            speedup = vmTotalAverage[0] / vmTotalAverage[index] * 100 - 100

            resultPrinter.add_row({
                'Test': 'Total',
                'Min': '{:8.3f}ms'.format(vmTotalMin[index]),
                'Average': '{:8.3f}ms'.format(vmTotalAverage[index]),
                'StdDev%': "---",
                'Driver': getShortVmName(os.path.abspath(compareVm)),
                'Speedup': colored(Color.RED if speedup < 0 else Color.GREEN if speedup > 0 else Color.YELLOW, '{:8.3f}%'.format(speedup)),
                'Significance': "",
                'P(T<=t)': ""
            })
    else:
        resultPrinter.add_row({
            'Test': 'Total',
            'Min': '{:8.3f}ms'.format(vmTotalMin[0]),
            'Average': '{:8.3f}ms'.format(vmTotalAverage[0]),
            'StdDev%': "---",
            'Driver': getShortVmName(os.path.abspath(arguments.vm))
        })
示例#13
0
 def color(self, today_string):
     return color.colored(today_string, 'grey', 'on_yellow')
示例#14
0
#crete by: white termux

import requests
from threading import Thread
import random
from color import colored

print(
    colored(
        '''

────╔╗─╔╗╔╗────╔╗─────────────────
╔╦╦╗║╚╗╠╣║╚╗╔═╗║╚╗╔═╗╔╦╗╔══╗╔╦╗╔╦╗
║║║║║║║║║║╔╣║╩╣║╔╣║╩╣║╔╝║║║║║║║╠║╣
╚══╝╚╩╝╚╝╚═╝╚═╝╚═╝╚═╝╚╝─╚╩╩╝╚═╝╚╩╝

		  create by WHITE TERMUX
''', 'magenta'))

phone = input(colored('Enter your phone number>>: ', 'cyan'))
countT = input(colored('Enter threading>>: ', 'blue'))

iteration = 0
_name = ''
for x in range(12):
    _name = _name + random.choice(
        list('123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM'))
    password = _name + random.choice(
        list('123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM'))
    username = _name + random.choice(
        list('123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM'))
示例#15
0
文件: bench.py 项目: alexmccord/luau
def runTest(subdir, filename, filepath):
    filepath = os.path.abspath(filepath)

    mainVm = os.path.abspath(arguments.vm)

    # Process output will contain the test name and execution times
    mainOutput = getVmOutput(
        substituteArguments(mainVm, getExtraArguments(filepath)) + " " +
        filepath)
    mainResultSet = extractResults(filename, mainVm, mainOutput, False)

    if len(mainResultSet) == 0:
        print(
            colored(Color.RED, 'FAILED') + ":  '" + filepath + "' on '" +
            mainVm + "'")

        if arguments.vmNext != None:
            resultPrinter.add_row({
                'Test': filepath,
                'Min': "",
                'Average': "FAILED",
                'StdDev%': "",
                'Driver': getShortVmName(mainVm),
                'Speedup': "",
                'Significance': "",
                'P(T<=t)': ""
            })
        else:
            resultPrinter.add_row({
                'Test': filepath,
                'Min': "",
                'Average': "FAILED",
                'StdDev%': "",
                'Driver': getShortVmName(mainVm)
            })

        if influxReporter != None:
            influxReporter.report_result(subdir, filename, filename, "FAILED",
                                         0.0, 0.0, 0.0, 0.0,
                                         getShortVmName(mainVm), mainVm)
        return

    compareResultSets = []

    if arguments.vmNext != None:
        for compareVm in arguments.vmNext:
            compareVm = os.path.abspath(compareVm)

            compareOutput = getVmOutput(
                substituteArguments(compareVm, getExtraArguments(filepath)) +
                " " + filepath)
            compareResultSet = extractResults(filename, compareVm,
                                              compareOutput, True)

            compareResultSets.append(compareResultSet)

    if arguments.extra_loops > 0:
        # get more results
        for i in range(arguments.extra_loops):
            extraMainOutput = getVmOutput(
                substituteArguments(mainVm, getExtraArguments(filepath)) +
                " " + filepath)
            extraMainResultSet = extractResults(filename, mainVm,
                                                extraMainOutput, False)

            mergeResults(mainResultSet, extraMainResultSet)

            if arguments.vmNext != None:
                i = 0
                for compareVm in arguments.vmNext:
                    compareVm = os.path.abspath(compareVm)

                    extraCompareOutput = getVmOutput(
                        substituteArguments(compareVm,
                                            getExtraArguments(filepath)) +
                        " " + filepath)
                    extraCompareResultSet = extractResults(
                        filename, compareVm, extraCompareOutput, True)

                    mergeResults(compareResultSets[i], extraCompareResultSet)
                    i += 1

    # finalize results
    for result in mainResultSet:
        finalizeResult(result)

    for compareResultSet in compareResultSets:
        for result in compareResultSet:
            finalizeResult(result)

    # analyze results
    for i in range(len(mainResultSet)):
        mainResult = mainResultSet[i]
        compareResults = []

        for el in compareResultSets:
            if i < len(el):
                compareResults.append(el[i])
            else:
                noResult = TestResult()

                noResult.filename = el[0].filename
                noResult.vm = el[0].vm
                noResult.shortVm = el[0].shortVm

                compareResults.append(noResult)

        analyzeResult(subdir, mainResult, compareResults)

        mergedResults = []
        mergedResults.append(mainResult)

        for el in compareResults:
            mergedResults.append(el)

        allResults.append(mergedResults)
示例#16
0
文件: bench.py 项目: alexmccord/luau
def run(args, argsubcb):
    global arguments, resultPrinter, influxReporter, argumentSubstituionCallback, allResults
    arguments = args
    argumentSubstituionCallback = argsubcb

    if arguments.report_metrics or arguments.print_influx_debugging:
        influxReporter = influxbench.InfluxReporter(arguments)
    else:
        influxReporter = None

    if matplotlib == None:
        arguments.absolute = 0
        arguments.speedup = 0
        arguments.sort = 0
        arguments.window = 0

    # Load results from files
    if arguments.results != None:
        vmList = []

        for result in arguments.results:
            with open(result) as resultsFile:
                resultArray = json.load(resultsFile)

            for test in resultArray:
                for i in range(len(test)):
                    arr = test[i]

                    tr = TestResult()

                    tr.filename = arr[0]
                    tr.vm = arr[1]
                    tr.shortVm = arr[2]
                    tr.name = arr[3]
                    tr.values = arr[4]
                    tr.count = arr[5]

                    test[i] = tr

            for test in resultArray[0]:
                if vmList.count(test.vm) > 0:
                    pointPos = result.rfind(".")

                    if pointPos != -1:
                        vmList.append(test.vm + " [" + result[0:pointPos] +
                                      "]")
                    else:
                        vmList.append(test.vm + " [" + result + "]")
                else:
                    vmList.append(test.vm)

            if len(allResults) == 0:
                allResults = resultArray
            else:
                for prevEl in allResults:
                    found = False

                    for nextEl in resultArray:
                        if nextEl[0].filename == prevEl[0].filename and nextEl[
                                0].name == prevEl[0].name:
                            for run in nextEl:
                                prevEl.append(run)
                            found = True

                    if not found:
                        el = resultArray[0]

                        for run in el:
                            result = TestResult()

                            result.filename = run.filename
                            result.vm = run.vm
                            result.shortVm = run.shortVm
                            result.name = run.name

                            prevEl.append(result)

        arguments.vmNext = []

        for i in range(len(vmList)):
            if i == 0:
                arguments.vm = vmList[i]
            else:
                arguments.vmNext.append(vmList[i])

    plotLegend.append(getShortVmName(arguments.vm))

    if arguments.vmNext != None:
        for compareVm in arguments.vmNext:
            plotLegend.append(getShortVmName(compareVm))
    else:
        arguments.absolute = 1  # When looking at one VM, I feel that relative graph doesn't make a lot of sense

    # Results table formatting
    if arguments.vmNext != None:
        resultPrinter = TablePrinter([{
            'label': 'Test',
            'align': Alignment.LEFT
        }, {
            'label': 'Min',
            'align': Alignment.RIGHT
        }, {
            'label': 'Average',
            'align': Alignment.RIGHT
        }, {
            'label': 'StdDev%',
            'align': Alignment.RIGHT
        }, {
            'label': 'Driver',
            'align': Alignment.LEFT
        }, {
            'label': 'Speedup',
            'align': Alignment.RIGHT
        }, {
            'label': 'Significance',
            'align': Alignment.LEFT
        }, {
            'label': 'P(T<=t)',
            'align': Alignment.RIGHT
        }])
    else:
        resultPrinter = TablePrinter([{
            'label': 'Test',
            'align': Alignment.LEFT
        }, {
            'label': 'Min',
            'align': Alignment.RIGHT
        }, {
            'label': 'Average',
            'align': Alignment.RIGHT
        }, {
            'label': 'StdDev%',
            'align': Alignment.RIGHT
        }, {
            'label': 'Driver',
            'align': Alignment.LEFT
        }])

    if arguments.results != None:
        for resultSet in allResults:
            # finalize results
            for result in resultSet:
                finalizeResult(result)

            # analyze results
            mainResult = resultSet[0]
            compareResults = []

            for i in range(len(resultSet)):
                if i != 0:
                    compareResults.append(resultSet[i])

            analyzeResult('', mainResult, compareResults)
    else:
        for subdir, dirs, files in os.walk(arguments.folder):
            for filename in files:
                filepath = subdir + os.sep + filename

                if filename.endswith(".lua"):
                    if arguments.run_test == None or re.match(
                            arguments.run_test, filename[:-4]):
                        runTest(subdir, filename, filepath)

    if arguments.sort and len(plotValueLists) > 1:
        rearrange(rearrangeSortKeyForComparison)
    elif arguments.sort and len(plotValueLists) == 1:
        rearrange(rearrangeSortKeyDescending)
    elif arguments.speedup:
        rearrange(rearrangeSortKeyForSpeedup)

        plotLegend[0] = arguments.vm + " vs " + arguments.vmNext[0]

    if arguments.print_final_summary:
        addTotalsToTable()

        print()
        print(
            colored(
                Color.YELLOW,
                '==================================================RESULTS=================================================='
            ))
        resultPrinter.print(summary=False)
        print(colored(Color.YELLOW, '---'))

    if len(vmTotalMin) != 0 and arguments.vmNext != None:
        index = 0

        for compareVm in arguments.vmNext:
            index = index + 1

            name = getShortVmName(os.path.abspath(compareVm))
            deltaGeoMean = math.exp(
                vmTotalImprovement[index] / vmTotalResults[index]) * 100 - 100

            if deltaGeoMean > 0:
                print("'{}' change is {:.3f}% positive on average".format(
                    name, deltaGeoMean))
            else:
                print("'{}' change is {:.3f}% negative on average".format(
                    name, deltaGeoMean))

    if matplotlib != None:
        graph()

    writeResultsToFile()

    if influxReporter != None:
        influxReporter.report_result(arguments.folder, "Total", "all",
                                     "SUCCESS", mainTotalMin, mainTotalAverage,
                                     mainTotalMax, 0.0,
                                     getShortVmName(arguments.vm),
                                     os.path.abspath(arguments.vm))
        influxReporter.flush(0)
示例#17
0
文件: bench.py 项目: alexmccord/luau
def analyzeResult(subdir, main, comparisons):
    # Aggregate statistics
    global mainTotalMin, mainTotalAverage, mainTotalMax

    mainTotalMin = mainTotalMin + main.min
    mainTotalAverage = mainTotalAverage + main.avg
    mainTotalMax = mainTotalMax + main.max

    if arguments.vmNext != None:
        resultPrinter.add_row({
            'Test':
            main.name,
            'Min':
            '{:8.3f}ms'.format(main.min),
            'Average':
            '{:8.3f}ms'.format(main.avg),
            'StdDev%':
            '{:8.3f}%'.format(main.sampleConfidenceInterval / main.avg * 100),
            'Driver':
            main.shortVm,
            'Speedup':
            "",
            'Significance':
            "",
            'P(T<=t)':
            ""
        })
    else:
        resultPrinter.add_row({
            'Test':
            main.name,
            'Min':
            '{:8.3f}ms'.format(main.min),
            'Average':
            '{:8.3f}ms'.format(main.avg),
            'StdDev%':
            '{:8.3f}%'.format(main.sampleConfidenceInterval / main.avg * 100),
            'Driver':
            main.shortVm
        })

    if influxReporter != None:
        influxReporter.report_result(subdir, main.name, main.filename,
                                     "SUCCESS", main.min, main.avg, main.max,
                                     main.sampleConfidenceInterval,
                                     main.shortVm, main.vm)

    print(
        colored(Color.YELLOW, 'SUCCESS') + ': {:<40}'.format(main.name) +
        ": " + '{:8.3f}'.format(main.avg) + "ms +/- " +
        '{:6.3f}'.format(main.sampleConfidenceInterval / main.avg * 100) +
        "% on " + main.shortVm)

    plotLabels.append(main.name)

    index = 0

    if len(plotValueLists) < index + 1:
        plotValueLists.append([])
        plotConfIntLists.append([])

        vmTotalMin.append(0.0)
        vmTotalAverage.append(0.0)
        vmTotalImprovement.append(0.0)
        vmTotalResults.append(0)

    if arguments.absolute or arguments.speedup:
        scale = 1
    else:
        scale = 100 / main.avg

    plotValueLists[index].append(main.avg * scale)
    plotConfIntLists[index].append(main.sampleConfidenceInterval * scale)

    vmTotalMin[index] += main.min
    vmTotalAverage[index] += main.avg

    for compare in comparisons:
        index = index + 1

        if len(plotValueLists) < index + 1 and not arguments.speedup:
            plotValueLists.append([])
            plotConfIntLists.append([])

            vmTotalMin.append(0.0)
            vmTotalAverage.append(0.0)
            vmTotalImprovement.append(0.0)
            vmTotalResults.append(0)

        if compare.min == None:
            print(
                colored(Color.RED, 'FAILED') + ":  '" + main.name + "' on '" +
                compare.vm + "'")

            resultPrinter.add_row({
                'Test': main.name,
                'Min': "",
                'Average': "FAILED",
                'StdDev%': "",
                'Driver': compare.shortVm,
                'Speedup': "",
                'Significance': "",
                'P(T<=t)': ""
            })

            if influxReporter != None:
                influxReporter.report_result(subdir, main.filename,
                                             main.filename, "FAILED", 0.0, 0.0,
                                             0.0, 0.0, compare.shortVm,
                                             compare.vm)

            if arguments.speedup:
                plotValueLists[0].pop()
                plotValueLists[0].append(0)

                plotConfIntLists[0].pop()
                plotConfIntLists[0].append(0)
            else:
                plotValueLists[index].append(0)
                plotConfIntLists[index].append(0)

            continue

        pooledStdDev = math.sqrt((main.unbiasedEst + compare.unbiasedEst) / 2)

        tStat = abs(main.avg - compare.avg) / (pooledStdDev *
                                               math.sqrt(2 / main.count))
        degreesOfFreedom = 2 * main.count - 2

        if stats:
            # Two-tailed distribution with 95% conf.
            tCritical = stats.t.ppf(1 - 0.05 / 2, degreesOfFreedom)

            noSignificantDifference = tStat < tCritical
            pValue = 2 * (1 - stats.t.cdf(tStat, df=degreesOfFreedom))
        else:
            noSignificantDifference = None
            pValue = -1

        if noSignificantDifference is None:
            verdict = ""
        elif noSignificantDifference:
            verdict = "likely same"
        elif main.avg < compare.avg:
            verdict = "likely worse"
        else:
            verdict = "likely better"

        speedup = (plotValueLists[0][-1] / (compare.avg * scale) - 1)
        speedupColor = Color.YELLOW if speedup < 0 and noSignificantDifference else Color.RED if speedup < 0 else Color.GREEN if speedup > 0 else Color.YELLOW

        resultPrinter.add_row({
            'Test':
            main.name,
            'Min':
            '{:8.3f}ms'.format(compare.min),
            'Average':
            '{:8.3f}ms'.format(compare.avg),
            'StdDev%':
            '{:8.3f}%'.format(compare.sampleConfidenceInterval / compare.avg *
                              100),
            'Driver':
            compare.shortVm,
            'Speedup':
            colored(speedupColor, '{:8.3f}%'.format(speedup * 100)),
            'Significance':
            verdict,
            'P(T<=t)':
            '---' if pValue < 0 else '{:.0f}%'.format(pValue * 100)
        })

        print(
            colored(Color.YELLOW, 'SUCCESS') + ': {:<40}'.format(main.name) +
            ": " + '{:8.3f}'.format(compare.avg) + "ms +/- " +
            '{:6.3f}'.format(compare.sampleConfidenceInterval / compare.avg *
                             100) + "% on " + compare.shortVm +
            ' ({:+7.3f}%, '.format(speedup * 100) + verdict + ")")

        if influxReporter != None:
            influxReporter.report_result(subdir, main.name, main.filename,
                                         "SUCCESS", compare.min, compare.avg,
                                         compare.max,
                                         compare.sampleConfidenceInterval,
                                         compare.shortVm, compare.vm)

        if arguments.speedup:
            oldValue = plotValueLists[0].pop()
            newValue = compare.avg

            plotValueLists[0].append((oldValue / newValue - 1) * 100)

            plotConfIntLists[0].pop()
            plotConfIntLists[0].append(0)
        else:
            plotValueLists[index].append(compare.avg * scale)
            plotConfIntLists[index].append(compare.sampleConfidenceInterval *
                                           scale)

        vmTotalMin[index] += compare.min
        vmTotalAverage[index] += compare.avg
        vmTotalImprovement[index] += math.log(main.avg / compare.avg)
        vmTotalResults[index] += 1
示例#18
0
 def socket_create(self):
     try:
         self.socket = socket.socket()
     except socket.error as e:
         print(colored("[!] Socket creation error: %s", color='red', attrs=['bold']) % str(e))
         return
示例#19
0
        while interrupt == 0:
                if result[1] == 9:
                        #print "Sandbox function called"
                        #Sandbox(result[0])
                        log.info('Provide sandbox request for %s' % result[0])
                        sys.exit()
                elif result[1] == 1:
                        LASTGOOD = result[0]
                        No_of_changes = commands.getoutput('/exit14/home/performance/src/automation/bin/p4range -b %s -B %s -E %s | wc -l' % (sys.argv[1],LASTGOOD,LASTBAD))
                        if int(No_of_changes) > 2:
                                result = deploy_best_available_CN(sys.argv[1],LASTGOOD,LASTBAD)
                                print result
                        else:
                                print "Not enough changes in between"
                                log.info('No changes in between the Good %s and Bad number %s' % (LASTGOOD,LASTBAD))
                                print colored('The problem Change-set might be %s','red') % LASTBAD
                                log.info('The problem Change-set might be %s' % LASTBAD)
                                sys.exit()
                else:
                        LASTBAD = result[0]
                        No_of_changes = commands.getoutput('/exit14/home/performance/src/automation/bin/p4range -b %s -B %s -E %s | wc -l' % (sys.argv[1],LASTGOOD,LASTBAD))
                        if int(No_of_changes) > 2:
                                result = deploy_best_available_CN(sys.argv[1],LASTGOOD,LASTBAD)
                                print result
                        else:
                                print "Not enough changes in between"
                                log.info('No changes in between the Good %s and Bad number %s' % (LASTGOOD,LASTBAD))
                                print colored('The problem Change-set might be %s','red') % LASTBAD
                                log.info('The problem Change-set might be %s' % LASTBAD)
                                sys.exit()
else :