diff --git a/docs/src/usage/plugins/alerts.md b/docs/src/usage/plugins/alerts.md index 2ff5754..ea30600 100644 --- a/docs/src/usage/plugins/alerts.md +++ b/docs/src/usage/plugins/alerts.md @@ -37,6 +37,6 @@ The functions within this plugin don't follow the standard naming convention. > >> Examples >> ```python3 ->> >>> h.db.synack_url = 'https://hooks.slack.com/services/x/y/z' +>> >>> h.db.slack_url = 'https://hooks.slack.com/services/x/y/z' >> >>> h.alerts.slack('Something important happened!') >> ``` diff --git a/src/synack/plugins/targets.py b/src/synack/plugins/targets.py index f6052c7..eb7e468 100644 --- a/src/synack/plugins/targets.py +++ b/src/synack/plugins/targets.py @@ -109,15 +109,12 @@ def get_connected(self): res = self.api.request('GET', 'launchpoint') if res.status_code == 200: j = res.json() - if j['pending_slug'] != '-1': - slug = j['pending_slug'] - status = "Connecting" - else: - slug = j['slug'] - status = "Connected" + slug = j.get('slug') if slug == '': status = 'Not Connected' + else: + status = "Connected" ret = { "slug": slug, diff --git a/test/test_targets.py b/test/test_targets.py index f8d94e7..ec7d2a9 100644 --- a/test/test_targets.py +++ b/test/test_targets.py @@ -227,7 +227,6 @@ def test_get_connected(self): """Should make a request to get the currently selected target""" self.targets.api.request.return_value.status_code = 200 self.targets.api.request.return_value.json.return_value = { - "pending_slug": "-1", "slug": "qwfars", "status": "connected" } @@ -244,7 +243,6 @@ def test_get_connected_disconnected(self): """Should report Not Connected when not connected to a target""" self.targets.api.request.return_value.status_code = 200 self.targets.api.request.return_value.json.return_value = { - "pending_slug": "-1", "slug": "", "status": "connected" } @@ -257,23 +255,6 @@ def test_get_connected_disconnected(self): } self.assertEqual(out, self.targets.get_connected()) - def test_get_connected_pending(self): - """Should return the pending target if one is pending""" - self.targets.api.request.return_value.status_code = 200 - self.targets.api.request.return_value.json.return_value = { - "pending_slug": "qwfars", - "slug": "", - "status": "" - } - self.targets.build_codename_from_slug = MagicMock() - self.targets.build_codename_from_slug.return_value = "SLOPPYSLUG" - out = { - "slug": "qwfars", - "codename": "SLOPPYSLUG", - "status": "Connecting" - } - self.assertEqual(out, self.targets.get_connected()) - def test_get_credentials(self): """Should get credentials for a given target""" target = Target(organization="qwewqe", slug="asdasd")