From 8973032ca56fbe7997ad42422b0ff3c81c7c2fe9 Mon Sep 17 00:00:00 2001 From: Itay Mizeretz Date: Wed, 13 Sep 2017 18:11:59 +0300 Subject: [PATCH] Extract credentials in a more generic fashion --- monkey_island/cc/services/edge.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/monkey_island/cc/services/edge.py b/monkey_island/cc/services/edge.py index 05159560f..edadb1322 100644 --- a/monkey_island/cc/services/edge.py +++ b/monkey_island/cc/services/edge.py @@ -70,17 +70,14 @@ class EdgeService: user = "" password = "" - # TODO: implement for other exploiters # TODO: The format that's used today to get the credentials is bad. Change it from monkey side and adapt. result = exploit["data"]["result"] - if exploit["exploiter"] == "RdpExploiter": - user = exploit["data"]["machine"]["creds"].keys()[0] - password = exploit["data"]["machine"]["creds"][user] - elif exploit["exploiter"] == "SmbExploiter": - if result: - user = exploit["data"]["machine"]["cred"].keys()[0] - password = exploit["data"]["machine"]["cred"][user] - else: + if result: + if "creds" in exploit["data"]["machine"]: + user = exploit["data"]["machine"]["creds"].keys()[0] + password = exploit["data"]["machine"]["creds"][user] + else: + if ("user" in exploit["data"]) and ("password" in exploit["data"]): user = exploit["data"]["user"] password = exploit["data"]["password"]