diff --git a/api/project.py b/api/project.py index df1ef7c..2dfe2a7 100644 --- a/api/project.py +++ b/api/project.py @@ -28,7 +28,7 @@ async def get_projects_data(request_data: dict, db=Depends(get_mongo_db), _: dic query = { "$or": [ {"name": {"$regex": search_query, "$options": "i"}}, - {"target": {"$regex": search_query, "$options": "i"}} + {"root_domain": {"$regex": search_query, "$options": "i"}} ] } if search_query else {} diff --git a/api/project_aggregation.py b/api/project_aggregation.py index 7e7ba55..775a2a8 100644 --- a/api/project_aggregation.py +++ b/api/project_aggregation.py @@ -152,7 +152,8 @@ async def get_projects_vul_data(request_data: dict, db=Depends(get_mongo_db), _: async def fetch_asset_data(r): tmp_result = { "port": r['_id'], - "id": generate_random_string(5) + "id": generate_random_string(5), + "count": r['count'] } query_copy = query.copy() @@ -236,6 +237,7 @@ async def get_projects_service_data(request_data: dict, db=Depends(get_mongo_db) async def fetch_asset_data(r): tmp_result = { "service": r['_id'], + "count": r['count'], "id": generate_random_string(5), "domain": "", "ip": "", diff --git a/core/util.py b/core/util.py index bd09401..d9ae327 100644 --- a/core/util.py +++ b/core/util.py @@ -427,7 +427,8 @@ async def get_search_query(name, request_data): if len(tmp_or) != 0: query["$and"].append({"$or": tmp_or}) fuzzy_query = request_data.get("fq", {}) - fuzzy_query_key = {"sub_host": 'host', "sub_value": "value", "sub_ip": "ip", "port_port": "port", "port_domain":['domain', 'host'], 'port_ip': ['ip', 'host'], 'port_protocol': ['type', 'protocol']} + fuzzy_query_key = {"sub_host": 'host', "sub_value": "value", "sub_ip": "ip", "port_port": "port", "port_domain":['domain', 'host'], 'port_ip': ['ip', 'host'], 'port_protocol': ['type', 'protocol'], + "service_service": ['type', 'webServer', 'protocol'], "service_domain": ['domain', 'host'], "service_port": "port", "service_ip": ['ip', 'host']} if fuzzy_query: if "$and" not in query: query["$and"] = []