Skip to content
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.

Commit

Permalink
renamed api to aceapi to work around name collision issues with other…
Browse files Browse the repository at this point in the history
… libraries
  • Loading branch information
unixfreak0037 committed Nov 14, 2019
1 parent b325dcd commit b0d7e14
Show file tree
Hide file tree
Showing 16 changed files with 20 additions and 20 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion api/analysis/__init__.py → aceapi/analysis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ def get_file(uuid, file_uuid_or_name):

# NOTE we use an absolute path here because if we don't then
# send_from_directory makes it relavive from the app root path
# which is (/opt/ace/api)
# which is (/opt/ace/aceapi)

target_path = os.path.join(saq.SAQ_HOME, root.storage_dir, file_observable.value)
if not os.path.exists(target_path):
Expand Down
2 changes: 1 addition & 1 deletion api/analysis/test.py → aceapi/analysis/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from saq.constants import *
from saq.database import use_db
from saq.test import *
from api.test import APIBasicTestCase
from aceapi.test import APIBasicTestCase
from saq.util import parse_event_time

import pytz
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion api/cloudphish/test.py → aceapi/cloudphish/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from unittest import TestCase

import saq
from api.test import APIBasicTestCase
from aceapi.test import APIBasicTestCase
from saq.analysis import RootAnalysis
from saq.brocess import query_brocess_by_fqdn
from saq.constants import *
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion api/engine/test.py → aceapi/engine/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from saq.analysis import RootAnalysis
from saq.constants import *
from saq.database import acquire_lock, release_lock, use_db
from api.test import *
from aceapi.test import *
from saq.test import *
from saq.util import storage_dir_from_uuid

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion api/events/test.py → aceapi/events/test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# vim: sw=4:ts=4:et

from saq.database import get_db_connection
from api.test import APIBasicTestCase
from aceapi.test import APIBasicTestCase

from flask import url_for

Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions api.wsgi
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import saq
saq.initialize(saq_home=saq_home, config_paths=None, logging_config_path=logging_config_path, relative_dir=saq_home)

# initialize flask
import api
application = api.create_app()
import aceapi
application = aceapi.create_app()
# tell ACE to use the session scope provided by the sqlalchemy-flask extension
saq.db = api.db.session
saq.db = aceapi.db.session
2 changes: 1 addition & 1 deletion lib/saq/modules/test_cloudphish.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from subprocess import Popen, PIPE

import saq, saq.test
from api.cloudphish.test import CloudphishTestCase
from aceapi.cloudphish.test import CloudphishTestCase
from saq.analysis import RootAnalysis, Analysis
from saq.cloudphish import *
from saq.constants import *
Expand Down
12 changes: 6 additions & 6 deletions lib/saq/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,15 +482,15 @@ def setUp(self):
self.initialize_test_client()

def initialize_test_client(self):
from api import create_app
from aceapi import create_app
self.app = create_app(testing=True)
self.app_context = self.app.test_request_context()
self.app_context.push()
self.client = self.app.test_client()

# Hopefully temporary hack to ensure session is cleared after each test
import api
api.db.session.close()
import aceapi
aceapi.db.session.close()

def tearDown(self):
close_test_comms()
Expand Down Expand Up @@ -768,10 +768,10 @@ def execute_api_server(self, listen_address=None, listen_port=None, ssl_cert=Non
# this is a bit weird because I want the urls to be the same as they
# are configured for apache, where they are all starting with /api

import api
import aceapi
from saq.database import initialize_database

app = api.create_app(testing=True)
app = aceapi.create_app(testing=True)
from werkzeug.serving import run_simple
from werkzeug.wsgi import DispatcherMiddleware
from flask import Flask
Expand All @@ -790,7 +790,7 @@ def execute_api_server(self, listen_address=None, listen_port=None, ssl_cert=Non
saq.CONFIG.get('api', 'ssl_key') if ssl_key is None else ssl_key )

initialize_database()
saq.db = api.db.session
saq.db = aceapi.db.session

logging.info(f"starting api server on {listen_address} port {listen_port}")
run_simple(listen_address, listen_port, application, ssl_context=ssl_context, use_reloader=False)
Expand Down
8 changes: 4 additions & 4 deletions test
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ then
saq.modules.test_crits \
saq.modules.test_intel \
saq.observables.test \
api.analysis.test \
api.engine.test \
api.cloudphish.test \
api.events.test \
aceapi.analysis.test \
aceapi.engine.test \
aceapi.cloudphish.test \
aceapi.events.test \
test_ace_api \

#saq.collectors.test_cb_binaries \
Expand Down
2 changes: 1 addition & 1 deletion test_ace_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from saq.constants import *
from saq.database import acquire_lock, use_db
from saq.test import *
from api.cloudphish.test import CloudphishTestCase, TEST_URL
from aceapi.cloudphish.test import CloudphishTestCase, TEST_URL
from saq.util import *

import pytz
Expand Down

0 comments on commit b0d7e14

Please sign in to comment.