from kytin.commands.base import Command
from kytin.core.executor import exec_command
from rich import print


class Exploit(Command):
    name = "exploit"
    description = "Quick exploit search"

    def run(self, cmd, context):
        parts = cmd.split()

        if len(parts) < 2:
            print("[!] Usage: exploit <service>")
            return

        query = " ".join(parts[1:])

        exec_command(
            f"searchsploit {query}",
            context,
            message=f"Searching exploits for {query}..."
        )