Python clint.textui.colored.green() Examples

The following are 30 code examples of clint.textui.colored.green(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module clint.textui.colored , or try the search function .
Example #1
Source File: mech.py    From mech with MIT License 6 votes vote down vote up
def suspend(self, arguments):
        """
        Suspends the machine.

        Usage: mech suspend [options] [<instance>]

        Options:
            -h, --help                       Print this help
        """
        instance_name = arguments['<instance>']
        instance_name = self.activate(instance_name)

        vmrun = VMrun(self.vmx, user=self.user, password=self.password)
        if vmrun.suspend() is None:
            puts_err(colored.red("Not suspended", vmrun))
        else:
            puts_err(colored.green("Suspended", vmrun)) 
Example #2
Source File: mech.py    From mech with MIT License 6 votes vote down vote up
def ip(self, arguments):
        """
        Outputs ip of the Mech machine.

        Usage: mech ip [options] [<instance>]

        Options:
            -h, --help                       Print this help
        """
        instance_name = arguments['<instance>']
        instance_name = self.activate(instance_name)

        vmrun = VMrun(self.vmx, user=self.user, password=self.password)
        lookup = self.get("enable_ip_lookup", False)
        ip = vmrun.getGuestIPAddress(lookup=lookup)
        if ip:
            puts_err(colored.green(ip))
        else:
            puts_err(colored.red("Unknown IP address")) 
Example #3
Source File: barq.py    From barq with MIT License 6 votes vote down vote up
def main_loop():
    """
    The command handler loop for the main menu. Commands will be sent to the processor and the prompt will be displayed.
    :return: None
    """
    try:
        command = ''
        while command == '':
            try:
                readline.set_completer_delims(' \t\n;')
                readline.parse_and_bind("tab: complete")
                readline.set_completer(maincomplete)
                command = raw_input('barq '+color('main', 'green')+' > ')
            except Exception as e:
                exit()
            #command = prompt.query('aws sheller main> ', validators=[])
        command = str(command)
        process_main_command(command)
    except KeyboardInterrupt as k:
        print(color("CTRL+C pressed. Exiting...", 'red'))
        exit() 
Example #4
Source File: reference.py    From VCF-kit with MIT License 6 votes vote down vote up
def resolve_reference_genome(loc):
    """
        Resolve location of reference genome file.
    """

    if loc is None:
        message("You must specify a genome:")
        output_genome_list()
        exit()

    if os.path.exists(loc):
        return loc
    else:
        if loc in get_genome_list():
            reference_location = "{gd}/{loc}/{loc}.fa.gz".format(gd = get_genome_directory(), loc = loc)
            with indent(4):
                puts_err(colored.green("\nUsing reference located at %s\n" % reference_location))
            return reference_location
        else:
            with indent(4):
                exit(puts_err(colored.red("\nGenome '%s' does not exist\n" % loc))) 
Example #5
Source File: i18ntool.py    From kobo-predict with BSD 2-Clause "Simplified" License 6 votes vote down vote up
def update(user, password, lang=None):
    langs = getlangs(lang)
    puts(u"Updating %s" % ', '.join(langs))
    for loc in langs:
        with indent(2):
            puts(u"Downloading PO for %s" % loc)
        url = (u'https://www.transifex.com/projects/p/formhub/'
               u'resource/django/l/%(lang)s/download/for_use/' % {'lang': loc})
        try:
            tmp_po_file = download_with_login(url, TX_LOGIN_URL,
                                              login=user, password=password,
                                              ext='po',
                                              username_field='identification',
                                              password_field='password',
                                              form_id=1)
            po_file = os.path.join(REPO_ROOT, 'locale', loc,
                                   'LC_MESSAGES', 'django.po')
            with indent(2):
                puts(u"Copying downloaded file to %s" % po_file)
            shutil.move(tmp_po_file, po_file)
        except Exception as e:
            puts(colored.red(u"Unable to update %s "
                             u"from Transifex: %r" % (loc, e)))
        puts(colored.green("sucesssfuly retrieved %s" % loc))
    compile_mo(langs) 
Example #6
Source File: call.py    From VCF-kit with MIT License 6 votes vote down vote up
def seq_type(filename):
    """
        Resolves sequence filetype using extension.
    """
    filename, ext = os.path.splitext(filename.lower())
    if ext in [".fasta", ".fa"]:
        extension = 'fasta'
    elif ext in [".fastq",".fq"]:
        extension = 'fastq'
    elif ext in [".ab1", '.abi']:
        extension = 'abi'
    else:
        raise Exception("Unknown sequence file type: " + filename)

    with indent(4):
        puts_err(colored.green("\nReading sequences as %s\n" % extension.upper()))
    return extension 
Example #7
Source File: __init__.py    From s3tk with MIT License 6 votes vote down vote up
def fix_check(klass, buckets, dry_run, fix_args={}):
    for bucket in fetch_buckets(buckets):
        check = klass(bucket)
        check.perform()

        if check.status == 'passed':
            message = colored.green('already ' + check.pass_message)
        elif check.status == 'denied':
            message = colored.red('access denied')
        else:
            if dry_run:
                message = colored.yellow('to be ' + check.pass_message)
            else:
                try:
                    check.fix(fix_args)
                    message = colored.blue('just ' + check.pass_message)
                except botocore.exceptions.ClientError as e:
                    message = colored.red(str(e))

        puts(bucket.name + ' ' + message) 
Example #8
Source File: mech.py    From mech with MIT License 6 votes vote down vote up
def delete(self, arguments):
        """
        Delete a snapshot taken previously with snapshot save.

        Usage: mech snapshot delete [options] <name> [<instance>]

        Options:
            -h, --help                       Print this help
        """
        name = arguments['<name>']

        instance_name = arguments['<instance>']
        instance_name = self.activate(instance_name)

        vmrun = VMrun(self.vmx, user=self.user, password=self.password)
        if vmrun.deleteSnapshot(name) is None:
            puts_err(colored.red("Cannot delete name"))
        else:
            puts_err(colored.green("Snapshot {} deleted".format(name))) 
Example #9
Source File: __init__.py    From s3tk with MIT License 6 votes vote down vote up
def scan_object(bucket_name, key):
    obj = s3().Object(bucket_name, key)
    str_key = unicode_key(key)

    try:
        mode = determine_mode(obj.Acl())

        if mode == 'private':
            puts(str_key + ' ' + colored.green(mode))
        else:
            puts(str_key + ' ' + colored.yellow(mode))

        return mode
    except (botocore.exceptions.ClientError, botocore.exceptions.NoCredentialsError) as e:
        puts(str_key + ' ' + colored.red(str(e)))
        return 'error' 
Example #10
Source File: __init__.py    From s3tk with MIT License 6 votes vote down vote up
def reset_object(bucket_name, key, dry_run, acl):
    obj = s3().Object(bucket_name, key)
    str_key = unicode_key(key)

    try:
        obj_acl = obj.Acl()
        mode = determine_mode(obj_acl)

        if mode == acl:
            puts(str_key + ' ' + colored.green('ACL already ' + acl))
            return 'ACL already ' + acl
        elif dry_run:
            puts(str_key + ' ' + colored.yellow('ACL to be updated to ' + acl))
            return 'ACL to be updated to ' + acl
        else:
            obj_acl.put(ACL=acl)
            puts(str_key + ' ' + colored.blue('ACL updated to ' + acl))
            return 'ACL updated to ' + acl

    except (botocore.exceptions.ClientError, botocore.exceptions.NoCredentialsError) as e:
        puts(str_key + ' ' + colored.red(str(e)))
        return 'error' 
Example #11
Source File: tag-bit9.py    From community with MIT License 5 votes vote down vote up
def tag_computer(self, computername, description, computertag):
    	print colored.yellow("[*] Finding "+computername)
        result = self.find_computer(computername)
        computerid = str(result[0]['id'])
        print colored.green("[+] "+computername+" ID="+computerid)
        data = {'description':description, 'computerTag': computertag}
        print colored.yellow("[*] Tagging "+computername)
        r = requests.put(self.computerurl+computerid, json.dumps(data), headers=self.authJson, verify=self.b9StrongCert)
        r.raise_for_status()
        result = r.json()
        print colored.green("[+] Tag Succeeded! ...waiting...\n")
        time.sleep(.07) 
Example #12
Source File: mech.py    From mech with MIT License 5 votes vote down vote up
def reload(self, arguments):
        """
        Restarts Mech machine, loads new Mechfile configuration.

        Usage: mech reload [options] [<instance>]

        Options:
                --provision                  Enable provisioning
            -h, --help                       Print this help
        """
        instance_name = arguments['<instance>']
        instance_name = self.activate(instance_name)

        vmrun = VMrun(self.vmx, user=self.user, password=self.password)

        puts_err(colored.blue("Reloading machine..."))
        started = vmrun.reset()
        if started is None:
            puts_err(colored.red("VM not restarted"))
        else:
            time.sleep(3)
            puts_err(colored.blue("Getting IP address..."))
            lookup = self.get("enable_ip_lookup", False)
            ip = vmrun.getGuestIPAddress(lookup=lookup)
            if ip:
                if started:
                    puts_err(colored.green("VM started on {}".format(ip)))
                else:
                    puts_err(colored.yellow("VM already was started on {}".format(ip)))
            else:
                if started:
                    puts_err(colored.green("VM started on an unknown IP address"))
                else:
                    puts_err(colored.yellow("VM already was started on an unknown IP address")) 
Example #13
Source File: predict.py    From neural-finance with Apache License 2.0 5 votes vote down vote up
def get(self):
        batch_size = 1
        rolling_window_size = 5
        # r = requests.get('http://localhost:5000/api/v1/neural_data') # Call neural_data
        # print(r)
        Neural_Data.get(Neural_Data)
        data = list(mongo.db.neural_data.find({}).sort('timestamp', -1).limit(5))
        arr = create_rolling_window(data, rolling_window_size)
        X = np.array([arr])
        X = np.reshape(X, (X.shape[0], 1, X.shape[1]))

        json_file = open('model.json', 'r')
        loaded_model_json = json_file.read()
        json_file.close()
        model = model_from_json(loaded_model_json)
        # load weights into new model
        model.load_weights("model.h5")
        print("Loaded model from disk")

        prediction = model.predict(X, batch_size=batch_size, verbose=1)
        prediction = prediction.tolist()[0][0]
        print(colored.green("Make new prediction...And its {}".format(prediction)))
        prediction = round(prediction, 0)
        result = {
            'price_growth': True
        }
        if prediction == 0:
            result["price_growth"] = False
            print('Price will fall')
        else:
            print('Price will growth')

        return jsonify(result) 
Example #14
Source File: generate_hit.py    From flickr-cropping-dataset with MIT License 5 votes vote down vote up
def prepare_ranking(mturk, num_hits, num_assignment, qualification):
    num_images_per_hit = 10
    mturk_rank_db = pickle.load( open('../mturk_rank_db.pkl', 'rb') )
    crop_db = pickle.load( open('../cropping_results.pkl', 'rb') )

    id_url_mapping = dict()
    for photo_id, url, username, x, y, w, h in crop_db:
        id_url_mapping[photo_id] = url

    indexes = []
    for i in xrange(len(mturk_rank_db)):
        if mturk_rank_db[i]['hit_id'] == 'n/a':
            indexes.append(i)
        if len(indexes) == num_hits * num_images_per_hit:
            break

    import math
    num_hits = int( math.ceil(len(indexes) / float(num_images_per_hit)) )

    # Create HITs
    for i in xrange(num_hits):
        print 'Pushing HIT #', i, '...'
        image_indexes = indexes[i*num_images_per_hit:(i+1)*num_images_per_hit]
        print image_indexes
        URLs = [mturk_rank_db[j]['url'] for j in image_indexes]

        # pre-compute source image display resolution
        src_url = id_url_mapping[mturk_rank_db[image_indexes[0]]['photo_id']]
        HITId = create_rank_hit(mturk, src_url, URLs, num_assignment, qualification)
        puts(colored.green('\tID: {}'.format(HITId)))

        # save results
        for idx in xrange(len(image_indexes)):
            mturk_rank_db[image_indexes[idx]]['hit_id'] = HITId
            mturk_rank_db[image_indexes[idx]]['question_idx'] = idx
            mturk_rank_db[image_indexes[idx]]['num_assignment'] += num_assignment

    pickle.dump( mturk_rank_db, open('../mturk_rank_db.pkl', 'wb') ) 
Example #15
Source File: generate_hit.py    From flickr-cropping-dataset with MIT License 5 votes vote down vote up
def prepare_cropping(mturk, num_hits, num_assignment, qualification):
    num_images_per_hit = 10
    mturk_crop_db = pickle.load( open('../mturk_crop_db.pkl', 'rb') )

    indexes = []
    for i in xrange(len(mturk_crop_db)):
        if mturk_crop_db[i]['hit_id'] == 'n/a' and mturk_crop_db[i]['disabled'] == False:
            indexes.append(i)
        if len(indexes) == num_hits * num_images_per_hit:
            break

    #print indexes
    import math
    num_hits = int( math.ceil(len(indexes) / float(num_images_per_hit)) )

    # Create HITs
    for i in xrange(num_hits):
        print 'Pushing HIT #', i, '...'
        image_indexes = indexes[i*num_images_per_hit:(i+1)*num_images_per_hit]
        print image_indexes
        URLs = [mturk_crop_db[j]['url'] for j in image_indexes]
        HITId = create_crop_hit(mturk, URLs, num_assignment, qualification)
        puts(colored.green('\tID: {}'.format(HITId)))

        # save results
        for idx in xrange(len(image_indexes)):
            mturk_crop_db[image_indexes[idx]]['hit_id'] = HITId
            mturk_crop_db[image_indexes[idx]]['question_idx'] = idx
            mturk_crop_db[image_indexes[idx]]['num_assignment'] += num_assignment

    pickle.dump( mturk_crop_db, open('../mturk_crop_db.pkl', 'wb') ) 
Example #16
Source File: manage_hit.py    From flickr-cropping-dataset with MIT License 5 votes vote down vote up
def approve_and_disable_all_hits(mtc):
    page_size = 50
    hits = mtc.get_reviewable_hits(page_size=page_size)
    print "Total results to fetch %s " % hits.TotalNumResults
    print "Request hits page %i" % 1
    total_pages = float(hits.TotalNumResults) / page_size
    int_total = int(total_pages)
    if total_pages-int_total > 0:
        total_pages = int_total + 1
    else:
        total_pages = int_total
    pn = 1
    while pn < total_pages:
        pn = pn + 1
        print "Request hits page %i" % pn
        temp_hits = mtc.get_reviewable_hits(page_size=page_size, page_number=pn)
        hits.extend(temp_hits)

    for hit in hits:
        print "-------------------------------------------"
        puts(colored.green("Processing HIT # {}:".format(hit.HITId)))
        assignments = mtc.get_assignments(hit.HITId)
        for assignment in assignments:
            print "    Approved assignment!"
            mtc.approve_assignment(assignment.AssignmentId, feedback='Thank you for your time!')
        mtc.disable_hit(hit.HITId)
        puts(colored.red("HIT # {} disabled!".format(hit.HITId))) 
Example #17
Source File: cl_utils.py    From bcwallet with Apache License 2.0 5 votes vote down vote up
def print_keys_not_saved():
    puts()
    puts(colored.green('User private keys intentionally never saved.'))
    puts(colored.green('Please do not lose your seed, bcwallet intentionally has no backup!'))
    puts() 
Example #18
Source File: bcwallet.py    From bcwallet with Apache License 2.0 5 votes vote down vote up
def print_path_info(address, path, coin_symbol, wif=None):

    assert path, path
    assert coin_symbol, coin_symbol
    assert address, address

    if wif:
        address_formatted = '%s/%s' % (address, wif)
    else:
        address_formatted = address

    if USER_ONLINE:
        addr_balance = get_total_balance(
                address=address,
                coin_symbol=coin_symbol,
                )

        with indent(2):
            puts(colored.green('%s (%s) - %s' % (
                path,
                address_formatted,
                format_crypto_units(
                    input_quantity=addr_balance,
                    input_type='satoshi',
                    output_type=UNIT_CHOICE,
                    coin_symbol=coin_symbol,
                    print_cs=True,
                    ),
                )))
    else:
        with indent(2):
            puts(colored.green('%s (%s)' % (
                path,
                address_formatted,
                ))) 
Example #19
Source File: fix.py    From pgrepup with GNU General Public License v3.0 5 votes vote down vote up
def fix():

    # Shortcut to ask master password before output Configuration message
    decrypt(config().get('Source', 'password'))

    output_cli_message("Find Source cluster's databases with tables without primary key/unique index...", color='cyan')
    print

    db_conn = connect('Source')
    with indent(4, quote=' >'):
        for db in get_cluster_databases(db_conn):
            output_cli_message(db)
            s_db_conn = connect('Source', db_name=db)
            tables_without_unique = False
            with indent(4, quote=' '):
                for table in get_database_tables(s_db_conn):
                    t_r = table_has_primary_key(s_db_conn, table['schema'], table['table'])
                    if not t_r:
                        tables_without_unique = True
                        print
                        output_cli_message("Found %s.%s without primary key" % (table['schema'], table['table']))
                        result = add_table_unique_index(s_db_conn, table['schema'], table['table'])
                        print(output_cli_result(
                            colored.green('Added %s field' % get_unique_field_name()) if result else False,
                            compensation=4
                        ))

            if not tables_without_unique:
                print(output_cli_result(True)) 
Example #20
Source File: text.py    From slack-machine with MIT License 5 votes vote down vote up
def show_valid(valid_str):
    puts(colored.green(f"✓ {valid_str}")) 
Example #21
Source File: barq.py    From barq with MIT License 5 votes vote down vote up
def color(string, color=None):
    """
    Change text color for the Linux terminal. (Taken from Empire: https://github.com/EmpireProject/Empire/blob/master/lib/common/helpers.py)
    """

    attr = []
    # bold
    attr.append('1')

    if color:
        if color.lower() == "red":
            attr.append('31')
        elif color.lower() == "green":
            attr.append('32')
        elif color.lower() == "yellow":
            attr.append('33')
        elif color.lower() == "blue":
            attr.append('34')
        return '\x1b[%sm%s\x1b[0m' % (';'.join(attr), string)

    else:
        if string.strip().startswith("[!]"):
            attr.append('31')
            return '\x1b[%sm%s\x1b[0m' % (';'.join(attr), string)
        elif string.strip().startswith("[+]"):
            attr.append('32')
            return '\x1b[%sm%s\x1b[0m' % (';'.join(attr), string)
        elif string.strip().startswith("[..]"):
            attr.append('33')
            return '\x1b[%sm%s\x1b[0m' % (';'.join(attr), string)
        elif string.strip().startswith("[*]"):
            attr.append('34')
            return '\x1b[%sm%s\x1b[0m' % (';'.join(attr), string)
        else:
            return string 
Example #22
Source File: barq.py    From barq with MIT License 5 votes vote down vote up
def process_training_command(command):
    """
    Process command in the training menu.
    :param command: The command to process.
    :return: None
    """
    global menu_stack
    if command == 'help':
        training_help()
    elif command == 'where':
        puts(colored.green("You are in training menu"))
    elif command == 'setprofile':
        set_aws_creds('training')
    elif command == 'start':
        start_training_mode('training')
    elif command == 'back':
        # handle_menu()
        menu_backward()
    elif command == 'showprofile':
        show_aws_creds('training')
    elif command == 'exit':
        exit()

    training_loop()

    """             pass
    elif command == 'setprofile':
        set_aws_creds('main')
    elif command == 'showprofile':
        show_aws_creds('main')
    elif command == 'dumpsecrets':
        find_all_creds('main')
    elif command == 'attacksurface':
        find_attacksurface('main')
""" 
Example #23
Source File: barq.py    From barq with MIT License 5 votes vote down vote up
def process_instances_command(command):
    """
    Process command in the EC2 instances menu.
    :param command: The command to process.
    :return: None
    """
    global menu_stack
    if command == 'help':
        instances_help()
    elif command == 'where':
        puts(colored.green("You are in EC2 instances menu"))
    elif command == 'setprofile':
        set_aws_creds('ec2instances')
    elif command == 'showprofile':
        show_aws_creds('ec2instances')
    elif command == 'dumpsecrets':
        find_all_creds('ec2instances')
    elif command == 'attacksurface':
        find_attacksurface('ec2instances')
    elif command == 'showsecrets':
        show_cred_loot('ec2instances')
    elif command == 'securitygroups':
        get_security_groups('ec2instances')
    elif command == 'ec2attacks':
        ec2attacks('ec2instances')
    elif command == 'back':
        # handle_menu()
        menu_backward()
    elif command == 'list':
        get_ec2_instances('ec2instances')
    elif command == 'showsecrets':
        show_aws_creds('ec2instances')
    elif command == 'commandresults':
        check_command_invocations('ec2instances')
    elif command == 'instance':
        get_instance_details('ec2instances')
    elif command == 'exit':
        exit()

    instances_loop() 
Example #24
Source File: barq.py    From barq with MIT License 5 votes vote down vote up
def process_main_command(command):
    """
    Process command in the main menu.
    :param command: The command to process.
    :return: None
    """
    global menu_stack
    if command == 'help':
        main_help()
    elif command == 'where':
        puts(colored.green('You are in the main menu'))
    elif command == 'back':
        puts(colored.green('You are the at the top menu.'))
    elif command == 'exit':
        # cleanup tasks
        try:
            exit()
        except:
            pass
    elif command == 'setprofile':
        set_aws_creds('main')
    elif command == 'showprofile':
        show_aws_creds('main')
    elif command == 'dumpsecrets':
        find_all_creds('main')
    elif command == 'attacksurface':
        find_attacksurface('main')
    elif command == 'showsecrets':
        show_cred_loot('main')

    elif command == 'securitygroups':
        get_security_groups('main')
    elif command == 'training':
        # menu_stack.append('training')
        # handle_menu()
        menu_forward('training')
    elif command == 'ec2instances':
        menu_forward('ec2instances')

    main_loop() 
Example #25
Source File: barq.py    From barq with MIT License 5 votes vote down vote up
def get_security_groups(caller):
    """
    List security groups discovered.
    :param caller: calling menu to return to.
    :return: None
    """
    global secgroups
    try:
        puts(color(
            '[*] Your collected security groups, if you want an updated list, invoke attacksurface:'))
        for group in secgroups['groups']:
            puts(colored.green("Group ID: %s" % group.get('id', '')))
            puts(colored.green("Group description: %s" %
                               group.get('description', '')))
            puts(colored.green('Group Ingress IP permissions:'))
            for p in group['ip_permissions']:
                ranges = ''
                for iprange in p.get('ranges', []):
                    ranges = ranges + '%s,' % iprange['CidrIp']
                if len(ranges) > 1 and ranges[-1] == ',':
                    ranges = ranges[:-1]
                puts(colored.green('From Port: %s, To Port: %s, Protocol: %s, IP Ranges: %s' % (
                    p.get('fromport', 'Any'), p.get('toport', 'Any'), p.get('protocol', 'All'), ranges)))

            puts(colored.green('Group Egress IP permissions:'))
            for p in group['ip_permissions_egress']:
                ranges = ''
                for iprange in p.get('ranges', []):
                    ranges = ranges + '%s,' % iprange['CidrIp']
                if len(ranges) > 1 and ranges[-1] == ',':
                    ranges = ranges[:-1]
                puts(colored.green('From Port: %s, To Port: %s, Protocol: %s, IP Ranges: %s' % (
                    p.get('fromport', 'Any'), p.get('toport', 'Any'), p.get('protocol', 'All'), ranges)))

            puts(colored.magenta('======================================='))

    except Exception as e:
        print(e)
        puts(color(
            '[!] You have no stored security groups. Run the command attacksurface to discover them'))
    go_to_menu(caller) 
Example #26
Source File: barq.py    From barq with MIT License 5 votes vote down vote up
def check_command_invocations(caller):
    """
    Check stored results of previously executed attacks on EC2 instances.
    :param caller: calling menu
    :return: None
    """
    global command_invocations
    if len(command_invocations['commands']) < 1:
        puts(color(
            '[!] You don\'t have any commands run yet against EC2 targets. Run ec2attacks to launch commands.'))
        go_to_menu(caller)

    for command in command_invocations['commands']:
        puts(colored.green('command id: %s' % command.get('id')))
        puts(colored.green('command instance id: %s' % command.get('instanceid')))
        puts(colored.green('command state: %s' % command.get('state')))
        puts(colored.green('command platform: %s' % command.get('platform')))
        puts(colored.green('command region: %s' % command.get('region')))
        try:
            puts(colored.green('command error: %s' %
                               command.get('error', 'No errors')[0:5000]))
        except:
            pass
        try:
            puts(colored.green('command output: %s' %
                               command.get('output', 'No output')[0:5000]))
        except:
            pass

        puts(colored.magenta('=======================================')) 
Example #27
Source File: kvm_local_deploy_v2.py    From bubble-toolkit with Apache License 2.0 5 votes vote down vote up
def print_welcome(self):
        print(colored.green("Welcome to KVM local Deploy for MCT"))
        hostname = self.conn.getHostname()
        print("Note: We're connected to " + hostname)
        print()

    # Get override or else the default 
Example #28
Source File: __init__.py    From s3tk with MIT License 5 votes vote down vote up
def perform(check):
    check.perform()

    with indent(2):
        if check.status == 'passed':
            puts(colored.green('✔ ' + check.name + ' ' + unicode_key(check.pass_message)))
        elif check.status == 'failed':
            puts(colored.red('✘ ' + check.name + ' ' + check.fail_message))
        else:
            puts(colored.red('✘ ' + check.name + ' access denied'))

    return check 
Example #29
Source File: __init__.py    From s3tk with MIT License 5 votes vote down vote up
def print_dns_bucket(name, buckets, found_buckets):
    if not name in found_buckets:
        puts(name)
        with indent(2):
            if name in buckets:
                puts(colored.green('owned'))
            else:
                puts(colored.red('not owned'))

            puts()

        found_buckets.add(name) 
Example #30
Source File: actions.py    From stakkr with Apache License 2.0 5 votes vote down vote up
def _print_status_headers():
    """Display messages for stakkr status (header)"""
    puts(columns(
        [(colored.green('Container')), 16], [colored.green('IP'), 15],
        [(colored.green('Url')), 32], [(colored.green('Image')), 32],
        [(colored.green('Docker ID')), 15], [(colored.green('Docker Name')), 25]
    ))

    puts(columns(
        ['-'*16, 16], ['-'*15, 15],
        ['-'*32, 32], ['-'*32, 32],
        ['-'*15, 15], ['-'*25, 25]
    ))