python类colored()的实例源码

email_basic_checks.py 文件源码 项目:DataSploit 作者: zanyarjamal 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def main():
    email = sys.argv[1]
    basic_checks(email)








    '''
    print colored(style.BOLD + '\n---> Basic Email Check(s)..\n' + style.END, 'blue')
    if cfg.mailboxlayer_api != "" and cfg.mailboxlayer_api != "XYZ" and cfg.mailboxlayer_api != "" and cfg.mailboxlayer_api != "XYZ":
        total_results = google_search(email, 1)
        if (total_results != 0 and total_results > 10):
            more_iters = (total_results / 10)
            if more_iters >= 10:
                    print colored(style.BOLD + '\n---> Too many results, Daily API limit might exceed\n' + style.END, 'red')
            for x in xrange(1,more_iters + 1):  
                google_search(email, (x*10)+1)
        print "\n\n-----------------------------\n"
    else:
        print colored(style.BOLD + '\n[-] google_cse_key and google_cse_cx not configured. Skipping paste(s) search.\nPlease refer to http://datasploit.readthedocs.io/en/latest/apiGeneration/.\n' + style.END, 'red')
    '''
domain_wappalyzer.py 文件源码 项目:DataSploit 作者: zanyarjamal 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def main():
    domain = sys.argv[1]
    print colored(style.BOLD + '\n---> Wapplyzing web page of base domain:\n' + style.END, 'blue')

    #make proper URL with domain. Check on ssl as well as 80.
    print "Hitting HTTP:\n",
    try:
        targeturl = "http://" + domain
        wappalyzeit(targeturl)
    except:
        print "[-] HTTP connection was unavailable"
    print "\nHitting HTTPS:\n",
    try:
        targeturl = "https://" + domain
        wappalyzeit(targeturl)
    except:
        print "[-] HTTPS connection was unavailable"
    print "\n-----------------------------\n"
serving.py 文件源码 项目:Liljimbo-Chatbot 作者: chrisjim316 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def log_request(self, code='-', size='-'):
        msg = self.requestline
        code = str(code)

        if termcolor:
            color = termcolor.colored

            if code[0] == '1':    # 1xx - Informational
                msg = color(msg, attrs=['bold'])
            if code[0] == '2':    # 2xx - Success
                msg = color(msg, color='white')
            elif code == '304':   # 304 - Resource Not Modified
                msg = color(msg, color='cyan')
            elif code[0] == '3':  # 3xx - Redirection
                msg = color(msg, color='green')
            elif code == '404':   # 404 - Resource Not Found
                msg = color(msg, color='yellow')
            elif code[0] == '4':  # 4xx - Client Error
                msg = color(msg, color='red', attrs=['bold'])
            else:                 # 5xx, or any other response
                msg = color(msg, color='magenta', attrs=['bold'])

        self.log('info', '"%s" %s %s', msg, code, size)
navigator.py 文件源码 项目:litchi 作者: 245967906 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def _show_inventory(self):
        title = '{serial} {hostname} {ip} {account}\n'.format(
            serial='ID'.ljust(10),
            hostname='Hostname'.ljust(15),
            ip='IP'.ljust(25),
            account='Account'.ljust(10),
        )
        body = [
            '{serial} {hostname} {ip} {account}'.format(
                serial=str(c).ljust(10),
                hostname=value.asset.hostname.ljust(15),
                ip=value.asset.ip.ljust(25),
                account=value.account.username.ljust(10),
            ) for c, value in enumerate(self._inventory)
        ]
        sys.stdout.write(colored(title, 'grey', 'on_cyan', attrs=[]))
        sys.stdout.write('\n'.join(body) + '\n\n')
serving.py 文件源码 项目:flask_system 作者: prashasy 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def log_request(self, code='-', size='-'):
        msg = self.requestline
        code = str(code)

        if termcolor:
            color = termcolor.colored

            if code[0] == '1':    # 1xx - Informational
                msg = color(msg, attrs=['bold'])
            if code[0] == '2':    # 2xx - Success
                msg = color(msg, color='white')
            elif code == '304':   # 304 - Resource Not Modified
                msg = color(msg, color='cyan')
            elif code[0] == '3':  # 3xx - Redirection
                msg = color(msg, color='green')
            elif code == '404':   # 404 - Resource Not Found
                msg = color(msg, color='yellow')
            elif code[0] == '4':  # 4xx - Client Error
                msg = color(msg, color='red', attrs=['bold'])
            else:                 # 5xx, or any other response
                msg = color(msg, color='magenta', attrs=['bold'])

        self.log('info', '"%s" %s %s', msg, code, size)
notas.py 文件源码 项目:OSCP_notas 作者: hriesco 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def parse_file(index, file_name):
    filename = file_name.replace('.txt','')
    words_array = filename.split("[")
    module_array1 = words_array[0].split("_")
    s = str(index+1) + ") " + module_array1[0]
    for i in range(1, len(module_array1)):
        if module_array1[i]: 
            s += " " + module_array1[i]

    if len(words_array) > 1:
        module_array2 = words_array[1].split("_")
        s += colored(" [", "red") + colored(module_array2[0], "red")
        for i in range(1, len(module_array2)):
            if module_array2[i]: 
                s += " " + colored(module_array2[i], 'red')

    return s

# For each module parse NAME_PORTS
serving.py 文件源码 项目:ShelbySearch 作者: Agentscreech 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def log_request(self, code='-', size='-'):
        msg = self.requestline
        code = str(code)

        if termcolor:
            color = termcolor.colored

            if code[0] == '1':    # 1xx - Informational
                msg = color(msg, attrs=['bold'])
            if code[0] == '2':    # 2xx - Success
                msg = color(msg, color='white')
            elif code == '304':   # 304 - Resource Not Modified
                msg = color(msg, color='cyan')
            elif code[0] == '3':  # 3xx - Redirection
                msg = color(msg, color='green')
            elif code == '404':   # 404 - Resource Not Found
                msg = color(msg, color='yellow')
            elif code[0] == '4':  # 4xx - Client Error
                msg = color(msg, color='red', attrs=['bold'])
            else:                 # 5xx, or any other response
                msg = color(msg, color='magenta', attrs=['bold'])

        self.log('info', '"%s" %s %s', msg, code, size)
tracking.py 文件源码 项目:Social-Network-Tracking-And-Analysis 作者: batuhaniskr 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def print_color_text():
    print(colored('''\n\t\t\033[1m
                      __            _       _       __     _                      _
                     / _\ ___   ___(_) __ _| |   /\ \ \___| |___      _____  _ __| | __
                     \ \ / _ \ / __| |/ _` | |  /  \/ / _ \ __\ \ /\ / / _ \| '__| |/ /
                     _\ \ (_) | (__| | (_| | | / /\  /  __/ |_ \ V  V / (_) | |  |   <
                     \__/\___/ \___|_|\__,_|_| \_\ \/ \___|\__| \_/\_/ \___/|_|  |_|\_\

            _____                _    _                               _     _               _           _
           /__   \_ __ __ _  ___| | _(_)_ __   __ _    __ _ _ __   __| |   /_\  _ __   __ _| |_   _ ___(_)___
             / /\/ '__/ _` |/ __| |/ / | '_ \ / _` |  / _` | '_ \ / _` |  //_\\| '_ \ / _` | | | | / __| / __|
            / /  | | | (_| | (__|   <| | | | | (_| | | (_| | | | | (_| | /  _  \ | | | (_| | | |_| \__ \ \__ \\
            \/   |_|  \__,_|\___|_|\_\_|_| |_|\__, |  \__,_|_| |_|\__,_| \_/ \_/_| |_|\__,_|_|\__, |___/_|___/
                                              |___/                                           |___/



                   ''', 'blue'))
util.py 文件源码 项目:uicourses_v2 作者: sumerinlan 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def log(type='I', tag='', comment=''):
    tag = tag[:8]
    type = type[0]
    fstr = '{type}    {tag}{tagpad}    {comment}'\
               .format(type=type,
                       tag=tag, tagpad=' ' * (8 - len(tag)),
                       comment=comment)

    color = None
    if type.upper() == 'I':
        color = 'cyan'
    if type.upper() == 'C':
        color = 'green'
    if type.upper() == 'W':
        color = 'magenta'
    if type.upper() == 'E':
        color = 'red'
    if type.upper() == 'D':
        color = 'yellow'
    if color is not None:
        fstr = colored(fstr, color)

    print(fstr)


###############################################################################
# DATA FORMAT
###############################################################################
util.py 文件源码 项目:uicourses_v2 作者: sumerinlan 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def log(type='I', tag='', comment=''):
    tag = tag[:8]
    type = type[0]
    fstr = '{type}    {tag}{tagpad}    {comment}'\
               .format(type=type,
                       tag=tag, tagpad=' ' * (8 - len(tag)),
                       comment=comment)

    color = None
    if type.upper() == 'I':
        color = 'cyan'
    if type.upper() == 'C':
        color = 'green'
    if type.upper() == 'W':
        color = 'magenta'
    if type.upper() == 'E':
        color = 'red'
    if type.upper() == 'D':
        color = 'yellow'
    if color is not None:
        fstr = colored(fstr, color)

    print(fstr)


###############################################################################
# DATA FORMAT
###############################################################################
Computer.py 文件源码 项目:HTP 作者: nklose 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def show_login_banner(self):
        banner_file = File('banner.txt', self.get_os_dir())
        banner_file.lookup()
        if not banner_file.exists:
            banner_file.content = 'Welcome to ' + self.ip + '.'
            banner_file.save()
        banner_lines = banner_file.content.split('\n')
        lines_printed = 0
        for line in banner_lines:
            if lines_printed < 10:
                print '    ' + colored(line, 'yellow')
            lines_printed += 1

    # return a list of all files on this computer
GameController.py 文件源码 项目:HTP 作者: nklose 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def prompt(message):
    return raw_input(colored('  ' + message + ': ', 'cyan')).lower()

# Prompts the user with a yes or no question
GameController.py 文件源码 项目:HTP 作者: nklose 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def prompt_yn(message, default = 'y'):
    yn_str = ''
    if default == 'y':
        yn_str = ' (Y/n): '
    else:
        yn_str = ' (y/N): '
    choice = raw_input(colored('  ' + message + yn_str, 'cyan')).lower()
    return choice == 'y' or (choice == '' and default == 'y')

## Output Messages
# Standard Message
GameController.py 文件源码 项目:HTP 作者: nklose 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def msg(message):
    print(colored('  ' + message, 'cyan'))

# Success Message
GameController.py 文件源码 项目:HTP 作者: nklose 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def success(message):
    print(colored('  ' + message, 'green'))

# Warning Message
GameController.py 文件源码 项目:HTP 作者: nklose 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def error(message):
    print(colored('  ' + message, 'red'))

# Report Bug Message
GameController.py 文件源码 项目:HTP 作者: nklose 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def report(id):
    print(colored('  [E' + str(id) + ']: An unexpected error occurred. Please report this bug.'))

# Info Message
GameController.py 文件源码 项目:HTP 作者: nklose 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def info(message):
    print(colored('  ' + message, 'blue'))

# Paired Message
GameController.py 文件源码 项目:HTP 作者: nklose 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def msg_pair(msg1, msg2):
    print(colored('  ' + msg1 + ' ', 'cyan') + colored(msg2, 'white'))

# Debug Message
GameController.py 文件源码 项目:HTP 作者: nklose 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def debug(message, level = 2):
    if DEBUG_LEVEL >= level:
        label = ''
        if level == 1:
            label = colored('  [DEBUG] ', 'red')
        elif level == 2:
            label = colored('  [INFO] ', 'yellow')
        print(label + colored(message, 'white'))

# Typewriter-like animation


问题


面经


文章

微信
公众号

扫码关注公众号