diff --git a/bin/tai-server.py b/bin/tai-server.py index c11d338..189585a 100644 --- a/bin/tai-server.py +++ b/bin/tai-server.py @@ -32,13 +32,17 @@ class Query(tornado.web.RequestHandler): for uuid in tai_names[query['name'].lower()]: result.append(tai_full[uuid]) if 'country' in query: - ta = tai_country[query['country'].lower()] - result = [] - for uuid in tai_country[query['country'].lower()]: - result.append(tai_full[uuid]) + if query['country'].lower() in tai_country: + ta = tai_country[query['country'].lower()] + result = [] + for uuid in tai_country[query['country'].lower()]: + result.append(tai_full[uuid]) + else: + result = {'error': 'Not existing country in the MISP galaxy threat-actor'} print("Query {} from {}".format(query, user_agent)) return self.write("{}".format(json.dumps(result))) + class Get(tornado.web.RequestHandler): def prepare(self):