예제 #1
0
def color_cmd(color):
    """
    colors for terminal and windows cmd

    Args:
        color: color name

    Returns:
        color values or empty string
    """
    from core.compatible import os_name
    if "--disable-colors" in sys.argv:
        return ""
    if "linux" in os_name() or os_name() == "darwin":
        if color == "reset":
            return "\033[0m"
        elif color == "grey":
            return "\033[1;30m"
        elif color == "red":
            return "\033[1;31m"
        elif color == "green":
            return "\033[1;32m"
        elif color == "yellow":
            return "\033[1;33m"
        elif color == "blue":
            return "\033[1;34m"
        elif color == "purple":
            return "\033[1;35m"
        elif color == "cyan":
            return "\033[1;36m"
        elif color == "white":
            return "\033[1;37m"
        else:
            return ""
    else:
        std_out_handle = ctypes.windll.kernel32.GetStdHandle(-11)
        handle = std_out_handle
        if color == "reset":
            pass
        if color == "grey":
            ctypes.windll.kernel32.SetConsoleTextAttribute(handle, 0x07)
        if color == "red":
            ctypes.windll.kernel32.SetConsoleTextAttribute(handle, 12)
        if color == "green":
            ctypes.windll.kernel32.SetConsoleTextAttribute(handle, 10)
        if color == "yellow":
            ctypes.windll.kernel32.SetConsoleTextAttribute(handle, 0x06)
        if color == "blue":
            ctypes.windll.kernel32.SetConsoleTextAttribute(handle, 0x09)
        if color == "purple":
            ctypes.windll.kernel32.SetConsoleTextAttribute(handle, 13)
        if color == "cyan":
            ctypes.windll.kernel32.SetConsoleTextAttribute(handle, 11)
        if color == "white":
            ctypes.windll.kernel32.SetConsoleTextAttribute(handle, 0x07)
    return ""
예제 #2
0
def reset_cmd_color():
    """
    reset the color of windows/terminal before exit
    """
    # TODO : Fix the cyclic dependency later
    from core.compatible import os_name
    if "linux" in os_name() or os_name() == "darwin":
        sys.stdout.write("\033[0m")
    else:
        std_out_handle = ctypes.windll.kernel32.GetStdHandle(-11)
        handle = std_out_handle
        ctypes.windll.kernel32.SetConsoleTextAttribute(handle, 7)
예제 #3
0
파일: color.py 프로젝트: 0x0mar/OWASP-ZSC
#!/usr/bin/env python
'''
OWASP ZSC | ZCR Shellcoder
https://www.owasp.org/index.php/OWASP_ZSC_Tool_Project
https://github.com/Ali-Razmjoo/OWASP-ZSC
http://api.z3r0d4y.com/
https://groups.google.com/d/forum/owasp-zsc [ owasp-zsc[at]googlegroups[dot]com ]
'''
#bug fix reported by John Babio in version 1.0.4 johndbabio/[at]/gmail/./com
from core import compatible
os_name = compatible.os_name()
def color(color):
	if 'linux' in os_name or os_name == 'darwin':
		if color == 'reset':
			return '\033[0m'
		if color == 'grey':
			return '\033[1;30m'
		if color == 'red':
			return '\033[1;31m'
		if color == 'green':
			return '\033[1;32m'
		if color == 'yellow':
			return '\033[1;33m'
		if color == 'blue':
			return '\033[1;34m'
		if color == 'purple':
			return '\033[1;35m'
		if color == 'cyan':
			return '\033[1;36m'
		if color == 'white':
			return '\033[1;37m'
예제 #4
0
from core.compatible import check
from core.compatible import version
from core.compatible import os_name
from core.load_modules import load_all_graphs
from core.config import _core_config
from core.config_builder import _builder
from core._die import __die_success
from core._die import __die_failure
from core.color import finish
from core.wizard import __wizard
from core.config_builder import _core_default_config
from core.config_builder import default_profiles
from core.config import _profiles

# temporary use fixed version of argparse
if os_name() == "win32" or os_name() == "win64":
    if version() is 2:
        from lib.argparse.v2 import argparse
    else:
        from lib.argparse.v3 import argparse
else:
    import argparse


def load_all_args(module_names, graph_names):
    # Language Options
    # import libs
    default_config = _builder(_core_config(), _core_default_config())
    _all_profiles = [key for key in _builder(_profiles(), default_profiles())]
    _all_profiles.append("all")
    language_list = [lang for lang in messages(-1, 0)]
import sys
import os
from core.alert import error
from core.alert import write
from core.alert import warn
from core.alert import info
from core.alert import messages
from core.compatible import check
from core.compatible import version
from core.compatible import os_name
from core.load_modules import load_all_graphs
from config import get_config
from core.config_builder import _builder

# temporary use fixed version of argparse
if os_name() == 'win32' or os_name() == 'win64':
    if version() is 2:
        from lib.argparse import argparse_v2 as argparse
    else:
        from lib.argparse import argparse_v3 as argparse
else:
    import argparse


def load_all_args(module_names, graph_names):
    # Language Options
    # import libs
    from core.color import finish
    default_config = _builder(get_config())
    language_list = [lang for lang in messages(-1, 0)]
    if "-L" in sys.argv or "--language" in sys.argv:
예제 #6
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from core import compatible
os_name = compatible.os_name()


def color(color):
    if 'linux' in os_name or os_name == 'darwin':
        if color == 'reset':
            return '\033[0m'
        if color == 'grey':
            return '\033[1;30m'
        if color == 'red':
            return '\033[1;31m'
        if color == 'green':
            return '\033[1;32m'
        if color == 'yellow':
            return '\033[1;33m'
        if color == 'blue':
            return '\033[1;34m'
        if color == 'purple':
            return '\033[1;35m'
        if color == 'cyan':
            return '\033[1;36m'
        if color == 'white':
            return '\033[1;37m'
    else:
        return ''
    ''' Add in next versions!
		import ctypes