Search code examples
memgraphdb

Cypher query for finding out content and connectedness as security measure


I have a node that represents a computer infected with malware. I want to see if other computers (based on log files) have had some interaction with the infected computer. I have already transferred and mapped log files into the Memgraph database.

How would Cypher query look for this scenario?


Solution

  • Basic cypher code that you can use for this scenario would be:

    MATCH p1=(n:Node1)-[*]->(m:Node2), p2=(n)-[*]->(m), (n)-[r]->(f:FraudulantActivity)
    WHERE p1!=p2
    RETURN nodes(p1)+nodes(p2)
    

    This Cypher query looks for different paths p1 and p2 between node named n and node named m and returns such nodes on those different paths. Those nodes could be part of some malicious actions.