From a3046f657b08b8fc125da9be36d3d6a7fff1c1b8 Mon Sep 17 00:00:00 2001 From: Shariq Malik Date: Fri, 25 Nov 2022 16:58:52 +0500 Subject: [PATCH] Fixed bh_owned error on non-existing values If a computer on the network has been compromised but is not listed in the Neo4j database. CME won't crash any more. --- cme/modules/bh_owned.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cme/modules/bh_owned.py b/cme/modules/bh_owned.py index 06e972ad..43de4d7a 100644 --- a/cme/modules/bh_owned.py +++ b/cme/modules/bh_owned.py @@ -75,7 +75,10 @@ class CMEModule: result = tx.run( "MATCH (c:Computer {{name:\"{}\"}}) SET c.owned=True RETURN c.name AS name".format(host_fqdn)) record = result.single() - value = record.value() + try: + value = record.value() + except AttributeError: + value = [] if len(value) > 0: context.log.success("Node {} successfully set as owned in BloodHound".format(host_fqdn)) else: