def execute(self):
        """
        Update selected credential

        Usage: execute
        """
        if self.selected == 'add':
            temp = {}
            for key, val in self.record_options.items():
                temp[key] = val['Value']
            response = state.add_credential(temp)
            if 'ID' in response.keys():
                print(print_util.color(f'[*] Credential {response["ID"]} successfully added'))
                state.get_credentials()
            elif 'error' in response.keys():
                if response['error'].startswith('[!]'):
                    msg = response['error']
                else:
                    msg = f"[!] Error: {response['error']}"
                print(print_util.color(msg))
        else:
            temp = {}
            for key, val in self.record_options.items():
                temp[key] = val['Value']
            response = state.edit_credential(self.selected, temp)
            if 'ID' in response.keys():
                print(print_util.color(f'[*] Credential {response["ID"]} successfully updated'))
                state.get_credentials()
            elif 'error' in response.keys():
                if response['error'].startswith('[!]'):
                    msg = response['error']
                else:
                    msg = f"[!] Error: {response['error']}"
                print(print_util.color(msg))
Example #2
0
    def on_enter(self, **kwargs) -> bool:
        if 'selected' not in kwargs:
            return False
        else:
            state.get_bypasses()
            self.use(kwargs['selected'])
            self.stop_threads = False

            if 'agent' in kwargs and 'Agent' in self.record_options:
                self.set('Agent', kwargs['agent'])
            self.info()
            self.options()
            state.get_credentials()
            return True
Example #3
0
    def on_enter(self, **kwargs) -> bool:
        if "selected" not in kwargs:
            return False
        else:
            state.get_bypasses()
            self.use(kwargs["selected"])
            self.stop_threads = False

            if "agent" in kwargs and "Agent" in self.record_options:
                self.set("Agent", kwargs["agent"])
            self.info()
            self.options()
            state.get_credentials()
            return True
    def remove(self, cred_id: str) -> None:
        """
        Removes specified credential ID. if 'all' is provided, all credentials will be removed.

        Usage: remove <cred_id>
        """
        if cred_id == 'all':
            choice = input(
                print_util.color(
                    f"[>] Are you sure you want to remove all credentials? [y/N] ",
                    "red"))
            if choice.lower() == "y":
                for key in state.credentials.keys():
                    self.remove_credential(key)
        else:
            self.remove_credential(cred_id)

        state.get_credentials()
    def list(self) -> None:
        """
        Get running/available agents

        Usage: list
        """
        cred_list = list(
            map(
                lambda x: [
                    x['ID'], x['credtype'], x['domain'], x['username'],
                    x['host'], x['password'][:50], x['sid'], x['os'], x['notes'
                                                                        ]
                ], state.get_credentials()))
        cred_list.insert(0, [
            'ID', 'CredType', 'Domain', 'UserName', 'Host', 'Password/Hash',
            'SID', 'OS', 'Notes'
        ])

        table_util.print_table(cred_list, 'Credentials')
Example #6
0
    def list(self) -> None:
        """
        Get running/available agents

        Usage: list
        """
        cred_list = list(
            map(
                lambda x: [
                    x["ID"],
                    x["credtype"],
                    x["domain"],
                    x["username"],
                    x["host"],
                    x["password"][:50],
                    x["sid"],
                    x["os"],
                    x["notes"],
                ],
                state.get_credentials(),
            )
        )
        cred_list.insert(
            0,
            [
                "ID",
                "CredType",
                "Domain",
                "UserName",
                "Host",
                "Password/Hash",
                "SID",
                "OS",
                "Notes",
            ],
        )

        table_util.print_table(cred_list, "Credentials")
Example #7
0
 def on_enter(self):
     state.get_credentials()
     self.list()
     return True