smbmap.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:pentestly 作者: praetorian-inc 项目源码 文件源码
def color(string, color='', graphic=''):
    """
    Change text color for the Linux terminal.

    Args:
        string (str): String to colorify
        color (str): Color to colorify the string in the following list:
            black, red, green, yellow, blue, purple, cyan, gr[ae]y
        graphic (str): Graphic to append to the beginning of the line
    """


    if not color:
        if string.startswith("[!] "):
            color = 'red'
        elif string.startswith("[+] "):
            color = 'green'
        elif string.startswith("[*] "):
            color = 'blue'
        else:
            color = 'normal'

    if color not in colors:
        print(colors['red'] + 'Color not found: {}'.format(color) + colors['normal'])
        return

    if color:
        return colors[color] + graphic + string + colors['normal']
    else:
        return string + colors['normal']
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号