diff --git a/faraday_client/bin/autoclose_vulns.py b/faraday_client/bin/autoclose_vulns.py index 4c9b5bce..e7cd77e1 100644 --- a/faraday_client/bin/autoclose_vulns.py +++ b/faraday_client/bin/autoclose_vulns.py @@ -16,7 +16,7 @@ def get_vulns_from_workspace(session, url, workspace): - vulns = session.get('{url}/_api/v2/ws/{ws_name}/vulns/'\ + vulns = session.get('{url}/_api/v3/ws/{ws_name}/vulns'\ .format(url=url, ws_name=workspace)) return vulns.json() @@ -37,7 +37,7 @@ def close_vulns(session, url, workspace, vulns, duration_time): # If elapsed time since creation is greater than duration time, the vuln will be closed if elapsed_time.total_seconds() > duration_time and vuln['value']['status'] != 'closed': vuln['value']['status'] = 'closed' - close = session.put('{url}/_api/v2/ws/{ws_name}/vulns/{vuln_id}/'\ + close = session.put('{url}/_api/v3/ws/{ws_name}/vulns/{vuln_id}'\ .format(url=url, ws_name=workspace, vuln_id=vuln['id'] diff --git a/faraday_client/bin/create_xlsx_report.py b/faraday_client/bin/create_xlsx_report.py index 1eb5f12d..4c910a87 100644 --- a/faraday_client/bin/create_xlsx_report.py +++ b/faraday_client/bin/create_xlsx_report.py @@ -210,7 +210,7 @@ def main(workspace='', args=None, parser=None): session = Session() session.post(models.server.SERVER_URL + '/_api/login', json={'email': models.server.AUTH_USER, 'password': models.server.AUTH_PASS}) - vulns = session.get(models.server.SERVER_URL + '/_api/v2/ws/' + workspace + '/vulns') + vulns = session.get(models.server.SERVER_URL + '/_api/v3/ws/' + workspace + '/vulns') parser.add_argument('-o', '--output', help='Output xlsx file report', required=True) parsed_args = parser.parse_args(args) diff --git a/faraday_client/bin/fbruteforce_services.py b/faraday_client/bin/fbruteforce_services.py index dc50dc9c..1d60d74c 100644 --- a/faraday_client/bin/fbruteforce_services.py +++ b/faraday_client/bin/fbruteforce_services.py @@ -66,7 +66,7 @@ def search_hosts_by_service(workspace, b_service): def total_credentials(workspace): json_creds = server._get( - SERVER_URL + "/_api/v2/ws/%s/credential" % workspace) + SERVER_URL + "/_api/v3/ws/%s/credential" % workspace) return len(json_creds["rows"]) @@ -75,7 +75,7 @@ def get_credentials(workspace, key): credentials = "" json_creds = server._get( - SERVER_URL + "/_api/v2/ws/%s/credential" % workspace) + SERVER_URL + "/_api/v3/ws/%s/credential" % workspace) if len(json_creds["rows"]) > 0: @@ -93,7 +93,7 @@ def show_table_services(workspace): table = "" j_parsed = server._get( - SERVER_URL + "/_api/v2/ws/%s/services/count?group_by=name" % workspace) + SERVER_URL + "/_api/v3/ws/%s/services/count?group_by=name" % workspace) if len(j_parsed["groups"]) > 0: diff --git a/faraday_client/persistence/server/changes_stream.py b/faraday_client/persistence/server/changes_stream.py index cec7c3f7..2ad34ebf 100644 --- a/faraday_client/persistence/server/changes_stream.py +++ b/faraday_client/persistence/server/changes_stream.py @@ -134,7 +134,7 @@ def on_open(self): response = _post( _create_server_api_url() + - '/ws/{}/websocket_token/'.format(self.workspace_name), + '/ws/{}/websocket_token'.format(self.workspace_name), expected_response=200) token = response['token'] self.ws.send(json.dumps({ diff --git a/faraday_client/persistence/server/server.py b/faraday_client/persistence/server/server.py index 834368c4..8ce82bab 100644 --- a/faraday_client/persistence/server/server.py +++ b/faraday_client/persistence/server/server.py @@ -91,7 +91,7 @@ def _get_base_server_url(): def _create_server_api_url(): """Return the server's api url.""" - return "{0}/_api/v2".format(_get_base_server_url()) + return "{0}/_api/v3".format(_get_base_server_url()) def _create_server_get_url(workspace_name, object_name=None, object_id=None, **params): """Creates a url to get from the server. Takes the workspace name @@ -103,7 +103,7 @@ def _create_server_get_url(workspace_name, object_name=None, object_id=None, **p Return the get_url as a string. """ get_url = "/{0}".format(object_name) if object_name else "" - get_url += "/{0}/".format(object_id) if object_id else "" + get_url += "/{0}".format(object_id) if object_id else "" get_url = '{0}/ws/{1}{2}'.format(_create_server_api_url(), workspace_name, get_url) @@ -116,7 +116,7 @@ def _create_server_post_url(workspace_name, obj_type, command_id): object_end_point_name = OBJECT_TYPE_END_POINT_MAPPER[obj_type] if obj_type == 'comment': object_end_point_name = object_end_point_name.strip('/') + '_unique/' - post_url = '{0}/ws/{1}/{2}/'.format(server_api_url, workspace_name, object_end_point_name) + post_url = '{0}/ws/{1}/{2}'.format(server_api_url, workspace_name, object_end_point_name) if command_id: get_params = {'command_id': command_id} post_url += '?' + urlencode(get_params) @@ -126,7 +126,7 @@ def _create_server_post_url(workspace_name, obj_type, command_id): def _create_server_put_url(workspace_name, obj_type, obj_id, command_id): server_api_url = _create_server_api_url() object_end_point_name = OBJECT_TYPE_END_POINT_MAPPER[obj_type] - put_url = '{0}/ws/{1}/{2}/{3}/'.format(server_api_url, workspace_name, object_end_point_name, obj_id) + put_url = '{0}/ws/{1}/{2}/{3}'.format(server_api_url, workspace_name, object_end_point_name, obj_id) if command_id: get_params = {'command_id': command_id} put_url += '?' + urlencode(get_params) @@ -156,7 +156,7 @@ def _create_couch_db_url(workspace_name): def _create_server_db_url(workspace_name): server_api_url = _create_server_api_url() - db_url = '{0}/ws/'.format(server_api_url) + db_url = '{0}/ws'.format(server_api_url) return db_url @@ -1671,7 +1671,7 @@ def check_server_url(url_to_test): False otherwise. """ try: - resp = _get("{0}/_api/v2/info".format(url_to_test)) + resp = _get("{0}/_api/v3/info".format(url_to_test)) return 'Faraday Server' in resp except Exception as ex: logger.exception(ex) diff --git a/faraday_client/plugins/controller.py b/faraday_client/plugins/controller.py index 1ba44e66..1dc8884f 100644 --- a/faraday_client/plugins/controller.py +++ b/faraday_client/plugins/controller.py @@ -133,7 +133,7 @@ def processOutput(self, plugin, output, command, isReport=False): data['tool'] = data['command'] data.pop('id_available') res = requests.put( - f'{base_url}/_api/v2/ws/{command.workspace}/commands/{command_id}/', + f'{base_url}/_api/v3/ws/{command.workspace}/commands/{command_id}', json=data, cookies=cookies) logger.info(f'Sent command duration {res.status_code}') @@ -142,7 +142,7 @@ def send_data(self, workspace, data): cookies = _conf().getFaradaySessionCookies() base_url = _get_base_server_url() res = requests.post( - f'{base_url}/_api/v2/ws/{workspace}/bulk_create/', + f'{base_url}/_api/v3/ws/{workspace}/bulk_create', cookies=cookies, json=json.loads(data)) if res.status_code != 201: