# Path: interface/messages.py
# def print_error(*args, **kwargs):
#     print(Color.RED + Color.BOLD + "[-]" + Color.ENDC, *args, **kwargs)
# 
# def print_info(*args, **kwargs):
#     print(Color.BLUE + Color.BOLD + "[*]" + Color.ENDC, *args, **kwargs)
# 
# def print_success(*args, **kwargs):
#     print(Color.GREEN + Color.BOLD + "[+]" + Color.ENDC, *args, **kwargs)


import core.Exploit
import core.io
import core.loader
import interface.utils
import paramiko
import io
from interface.messages import print_error, print_info, print_success
        args = e.split(' ')
        try:
            if args[0] == "host":
                if interface.utils.validate_ipv4(args[1]):
                    self.host = args[1]
                else:
                    print_error("please provide valid IPv4 address")
        except IndexError:
            print_error("please specify value for variable")

    def do_run(self, e):
        print_info("Testing known keys")
        client = paramiko.SSHClient()
        client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        connection = core.loader.open_database("./databases/bad_keys.db")
        cursor = connection.cursor()
        cursor.execute("SELECT user, port, filename, type, private_key FROM keys;")
        entries = cursor.fetchall()
        for entry in entries:
            try:
                username = entry[0]
                port = entry[1]
                filename = entry[2]
                key_type = entry[3]
                string_key = entry[4]
                if key_type == 'RSA':
                    private_key = paramiko.RSAKey.from_private_key(io.StringIO(string_key))
                elif key_type == 'DSA':
                    private_key = paramiko.DSSKey.from_private_key(io.StringIO(string_key))
                else:

# Path: interface/messages.py
# def print_error(*args, **kwargs):
#     print(Color.RED + Color.BOLD + "[-]" + Color.ENDC, *args, **kwargs)
# 
# def print_info(*args, **kwargs):
#     print(Color.BLUE + Color.BOLD + "[*]" + Color.ENDC, *args, **kwargs)
# 
# def print_success(*args, **kwargs):
#     print(Color.GREEN + Color.BOLD + "[+]" + Color.ENDC, *args, **kwargs)


# Path: modules/misc/generic/ssh_bad_keys.py
import core.Exploit
import core.io
import core.loader
import interface.utils
import paramiko
import io
from interface.messages import print_error, print_info, print_success

        args = e.split(' ')
        try:
            if args[0] == "host":
                if interface.utils.validate_ipv4(args[1]):
                    self.host = args[1]
                else:
                    print_error("please provide valid IPv4 address")
        except IndexError:
            print_error("please specify value for variable")

    def do_run(self, e):
        print_info("Testing known keys")
        client = paramiko.SSHClient()
        client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        connection = core.loader.open_database("./databases/bad_keys.db")
        cursor = connection.cursor()
        cursor.execute("SELECT user, port, filename, type, private_key FROM keys;")
        entries = cursor.fetchall()
        for entry in entries:
            try:
                username = entry[0]
                port = entry[1]
                filename = entry[2]
                key_type = entry[3]
                string_key = entry[4]
                if key_type == 'RSA':
                    private_key = paramiko.RSAKey.from_private_key(io.StringIO(string_key))
                elif key_type == 'DSA':
                    private_key = paramiko.DSSKey.from_private_key(io.StringIO(string_key))
                else:

                    print_error("Failed to load key of type:", key_type)