Fix output always returning false
Based on Neo4j documentation https://neo4j.com/docs/api/python-driver/current/api.html#neo4j.Result I added some modification to the result variable. The way it was code, `result.value()` always return 0.main
parent
39fe536d3b
commit
a5c30851c0
|
@ -74,9 +74,11 @@ class CMEModule:
|
||||||
with session.begin_transaction() as tx:
|
with session.begin_transaction() as tx:
|
||||||
result = tx.run(
|
result = tx.run(
|
||||||
"MATCH (c:Computer {{name:\"{}\"}}) SET c.owned=True RETURN c.name AS name".format(host_fqdn))
|
"MATCH (c:Computer {{name:\"{}\"}}) SET c.owned=True RETURN c.name AS name".format(host_fqdn))
|
||||||
if len(result.value()) > 0:
|
record = result.single()
|
||||||
|
value = record.value()
|
||||||
|
if len(value) > 0:
|
||||||
context.log.success("Node {} successfully set as owned in BloodHound".format(host_fqdn))
|
context.log.success("Node {} successfully set as owned in BloodHound".format(host_fqdn))
|
||||||
else:
|
else:
|
||||||
context.log.error(
|
context.log.error(
|
||||||
"Node {} does not appear to be in Neo4J database. Have you imported correct data?".format(host_fqdn))
|
"Node {} does not appear to be in Neo4J database. Have you imported correct data?".format(host_fqdn))
|
||||||
driver.close()
|
driver.close()
|
||||||
|
|
Loading…
Reference in New Issue