diff --git a/poli/views/apiview.py b/poli/views/apiview.py index 008500a..44ff95a 100644 --- a/poli/views/apiview.py +++ b/poli/views/apiview.py @@ -292,8 +292,7 @@ def api_get_sample_id_from_hash(shash): abort(400, "Invalid hash length") if sample is not None: return jsonify({'sample_id': sample.id}) - else: - abort(404) + return jsonify({'sample_id': None}) @apiview.route('/samples//download/') diff --git a/poli/views/webui.py b/poli/views/webui.py index b830cc3..0596207 100644 --- a/poli/views/webui.py +++ b/poli/views/webui.py @@ -65,7 +65,8 @@ def before_request(): Affects global variables for each request """ g.user = current_user - g.samples = Sample.query.order_by(Sample.id).limit(15).all() + # Query the last 15 samples for displaying in the index page + g.samples = Sample.query.order_by(Sample.id.desc()).limit(15).all() """ diff --git a/poliapi/mainapi.py b/poliapi/mainapi.py index 3fd9151..8e79145 100644 --- a/poliapi/mainapi.py +++ b/poliapi/mainapi.py @@ -105,8 +105,9 @@ class SampleModule(MainModule): Uses the sample endpoint """ - def __init__(self): - super(SampleModule, self).__init__() + def __init__(self, server="127.0.0.1", server_port=5000, + base_uri='/api/1.0/'): + super(SampleModule, self).__init__(server, server_port, base_uri) def send_sample(self, filename, tlp): """ @@ -178,8 +179,9 @@ class FamilyModule(MainModule): Utilities to manage families """ - def __init__(self): - super(FamilyModule, self).__init__() + def __init__(self, server="127.0.0.1", server_port=5000, + base_uri='/api/1.0/'): + super(FamilyModule, self).__init__(server, server_port, base_uri) def create_family(self, name, parent=None, tlp_level=3): """ @@ -229,8 +231,9 @@ class YaraModule(MainModule): Manage yara rules """ - def __init__(self): - super(YaraModule, self).__init__() + def __init__(self, server="127.0.0.1", server_port=5000, + base_uri='/api/1.0/'): + super(YaraModule, self).__init__(server, server_port, base_uri) def create_yara(self, name, rule, tlp_level=2): """