def use(self, agent_name: str) -> None:
        """
        Use the selected agent

        Usage: use <agent_name>
        """
        state.get_agents()
        if agent_name in state.agents.keys():
            self.selected = agent_name
            self.session_id = state.agents[self.selected]['session_id']
            self.agent_options = state.agents[agent_name]  # todo rename agent_options
            self.agent_language = self.agent_options['language']
Ejemplo n.º 2
0
    def list(self) -> None:
        """
        Get running/available agents

        Usage: list
        """
        agent_list = []
        agent_formatting = []
        for agent in state.get_agents().values():
            agent_list.append([
                str(agent['ID']), agent['name'], agent['language'],
                agent['internal_ip'],
                print_util.text_wrap(agent['username']),
                print_util.text_wrap(agent['process_name'],
                                     width=20), agent['process_id'],
                str(agent['delay']) + '/' + str(agent['jitter']),
                print_util.text_wrap(date_util.humanize_datetime(
                    agent['lastseen_time']),
                                     width=25), agent['listener']
            ])
            agent_formatting.append([agent['stale'], agent['high_integrity']])

        agent_formatting.insert(0, ['Stale', 'High Integrity'])
        agent_list.insert(0, [
            'ID', 'Name', 'Language', 'Internal IP', 'Username', 'Process',
            'PID', 'Delay', 'Last Seen', 'Listener'
        ])
        table_util.print_agent_table(agent_list, agent_formatting, 'Agents')
Ejemplo n.º 3
0
    def kill(self, agent_name: str) -> None:
        """
        Kills and removes specified agent [agent_name, stale, or all].

        Usage: kill <agent_name>
        """
        choice = input(
            print_util.color(
                f"[>] Are you sure you want to kill { agent_name }? [y/N] ",
                "red"))
        if choice.lower() == "y":
            if agent_name == "all":
                for agent_name in state.get_agents().keys():
                    self.kill_agent(agent_name)
            elif agent_name == "stale":
                for agent_name, agent in state.get_agents().items():
                    if agent["stale"] == True:
                        self.kill_agent(agent_name)
            else:
                self.kill_agent(agent_name)
        else:
            return
Ejemplo n.º 4
0
    def list(self) -> None:
        """
        Get running/available agents

        Usage: list
        """
        agent_list = []
        agent_formatting = []
        for agent in state.get_agents().values():
            agent_list.append([
                str(agent["ID"]),
                agent["name"],
                agent["language"],
                agent["internal_ip"],
                print_util.text_wrap(agent["username"]),
                print_util.text_wrap(agent["process_name"], width=20),
                agent["process_id"],
                str(agent["delay"]) + "/" + str(agent["jitter"]),
                print_util.text_wrap(date_util.humanize_datetime(
                    agent["lastseen_time"]),
                                     width=25),
                agent["listener"],
            ])
            agent_formatting.append([agent["stale"], agent["high_integrity"]])

        agent_formatting.insert(0, ["Stale", "High Integrity"])
        agent_list.insert(
            0,
            [
                "ID",
                "Name",
                "Language",
                "Internal IP",
                "Username",
                "Process",
                "PID",
                "Delay",
                "Last Seen",
                "Listener",
            ],
        )
        table_util.print_agent_table(agent_list, agent_formatting, "Agents")