本文整理匯總了Python中neo4j.v1.GraphDatabase.driver方法的典型用法代碼示例。如果您正苦於以下問題:Python GraphDatabase.driver方法的具體用法?Python GraphDatabase.driver怎麽用?Python GraphDatabase.driver使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類neo4j.v1.GraphDatabase
的用法示例。
在下文中一共展示了GraphDatabase.driver方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create_edge_statistics
# 需要導入模塊: from neo4j.v1 import GraphDatabase [as 別名]
# 或者: from neo4j.v1.GraphDatabase import driver [as 別名]
def create_edge_statistics(self, sheet):
session = self.driver.session()
for result in session.run("MATCH ()-[r:MemberOf]->({domain:{domain}}) RETURN count(r)", domain=self.domain):
self.write_single_cell(
sheet, 2, 2, "MemberOf: {:,}".format(result[0]))
for result in session.run("MATCH ()-[r:AdminTo]->({domain:{domain}}) RETURN count(r)", domain=self.domain):
self.write_single_cell(
sheet, 3, 2, "AdminTo: {:,}".format(result[0]))
for result in session.run("MATCH ()-[r:HasSession]->({domain:{domain}}) RETURN count(r)", domain=self.domain):
self.write_single_cell(
sheet, 4, 2, "HasSession: {:,}".format(result[0]))
for result in session.run("MATCH ()-[r:GpLink]-(n) WHERE n.name =~ '.*"+ self.domain +"$' RETURN count(r)"):
self.write_single_cell(
sheet, 5, 2, "GpLinks: {:,}".format(result[0]))
for result in session.run("MATCH ()-[r {isacl:true}]->({domain:{domain}}) RETURN count(r)", domain=self.domain):
self.write_single_cell(
sheet, 6, 2, "ACLs: {:,}".format(result[0]))
session.close()
示例2: everyone_admin
# 需要導入模塊: from neo4j.v1 import GraphDatabase [as 別名]
# 或者: from neo4j.v1.GraphDatabase import driver [as 別名]
def everyone_admin(self, sheet):
list_query = """MATCH (g:Group {domain:{domain}})
WHERE g.objectsid = "S-1-1-0"
OPTIONAL MATCH (g)-[:AdminTo]->(c1)
OPTIONAL MATCH (g)-[:MemberOf*1..]->(:Group)-[:AdminTo]->(c2)
WITH COLLECT(c1) + COLLECT(c2) as tempVar
UNWIND tempVar AS computers
RETURN DISTINCT(computers.name)
"""
session = self.driver.session()
results = []
for result in session.run(list_query, domain=self.domain):
results.append(result[0])
session.close()
self.write_column_data(sheet, "Everyone with Local Admin: {}", results)
示例3: authenticated_users_admin
# 需要導入模塊: from neo4j.v1 import GraphDatabase [as 別名]
# 或者: from neo4j.v1.GraphDatabase import driver [as 別名]
def authenticated_users_admin(self, sheet):
list_query = """MATCH (g:Group {domain:{domain}})
WHERE g.objectsid = "S-1-5-11"
OPTIONAL MATCH (g)-[:AdminTo]->(c1)
OPTIONAL MATCH (g)-[:MemberOf*1..]->(:Group)-[:AdminTo]->(c2)
WITH COLLECT(c1) + COLLECT(c2) as tempVar
UNWIND tempVar AS computers
RETURN DISTINCT(computers.name)
"""
session = self.driver.session()
results = []
for result in session.run(list_query, domain=self.domain):
results.append(result[0])
session.close()
self.write_column_data(
sheet, "Authenticated Users with Local Admin: {}", results)
示例4: domain_users_control
# 需要導入模塊: from neo4j.v1 import GraphDatabase [as 別名]
# 或者: from neo4j.v1.GraphDatabase import driver [as 別名]
def domain_users_control(self, sheet):
list_query = """MATCH (g:Group {domain:{domain}})
WHERE g.objectsid ENDS WITH "-513"
OPTIONAL MATCH (g)-[{isacl:true}]->(n)
OPTIONAL MATCH (g)-[:MemberOf*1..]->(:Group)-[{isacl:true}]->(m)
WITH COLLECT(n) + COLLECT(m) as tempVar
UNWIND tempVar AS objects
RETURN DISTINCT(objects)
ORDER BY objects.name ASC
"""
session = self.driver.session()
results = []
for result in session.run(list_query, domain=self.domain):
results.append(result[0])
session.close()
self.write_column_data(
sheet, "Objects Controlled by Domain Users: {}", results)
示例5: everyone_control
# 需要導入模塊: from neo4j.v1 import GraphDatabase [as 別名]
# 或者: from neo4j.v1.GraphDatabase import driver [as 別名]
def everyone_control(self, sheet):
list_query = """MATCH (g:Group {domain:{domain}})
WHERE g.objectsid = 'S-1-1-0'
OPTIONAL MATCH (g)-[{isacl:true}]->(n)
OPTIONAL MATCH (g)-[:MemberOf*1..]->(:Group)-[{isacl:true}]->(m)
WITH COLLECT(n) + COLLECT(m) as tempVar
UNWIND tempVar AS objects
RETURN DISTINCT(objects)
ORDER BY objects.name ASC
"""
session = self.driver.session()
results = []
for result in session.run(list_query, domain=self.domain):
results.append(result[0])
session.close()
self.write_column_data(
sheet, "Objects Controlled by Everyone: {}", results)
示例6: authenticated_users_control
# 需要導入模塊: from neo4j.v1 import GraphDatabase [as 別名]
# 或者: from neo4j.v1.GraphDatabase import driver [as 別名]
def authenticated_users_control(self, sheet):
list_query = """MATCH (g:Group {domain:{domain}})
WHERE g.objectsid = 'S-1-5-11'
OPTIONAL MATCH (g)-[{isacl:true}]->(n)
OPTIONAL MATCH (g)-[:MemberOf*1..]->(:Group)-[{isacl:true}]->(m)
WITH COLLECT(n) + COLLECT(m) as tempVar
UNWIND tempVar AS objects
RETURN DISTINCT(objects)
ORDER BY objects.name ASC
"""
session = self.driver.session()
results = []
for result in session.run(list_query, domain=self.domain):
results.append(result[0])
session.close()
self.write_column_data(
sheet, "Objects Controlled by Authenticated Users: {}", results)
示例7: everyone_rdp
# 需要導入模塊: from neo4j.v1 import GraphDatabase [as 別名]
# 或者: from neo4j.v1.GraphDatabase import driver [as 別名]
def everyone_rdp(self, sheet):
list_query = """MATCH (g:Group {domain:{domain}})
WHERE g.objectsid = "S-1-1-0"
OPTIONAL MATCH (g)-[:CanRDP]->(c1)
OPTIONAL MATCH (g)-[:MemberOf*1..]->(:Group)-[:CanRDP]->(c2)
WITH COLLECT(c1) + COLLECT(c2) as tempVar
UNWIND tempVar AS computers
RETURN DISTINCT(computers.name)
"""
session = self.driver.session()
results = []
for result in session.run(list_query, domain=self.domain):
results.append(result[0])
session.close()
self.write_column_data(sheet, "Everyone with RDP Rights: {}", results)
示例8: authenticated_users_rdp
# 需要導入模塊: from neo4j.v1 import GraphDatabase [as 別名]
# 或者: from neo4j.v1.GraphDatabase import driver [as 別名]
def authenticated_users_rdp(self, sheet):
list_query = """MATCH (g:Group {domain:{domain}})
WHERE g.objectsid = "S-1-5-11"
OPTIONAL MATCH (g)-[:CanRDP]->(c1)
OPTIONAL MATCH (g)-[:MemberOf*1..]->(:Group)-[:CanRDP]->(c2)
WITH COLLECT(c1) + COLLECT(c2) as tempVar
UNWIND tempVar AS computers
RETURN DISTINCT(computers.name)
"""
session = self.driver.session()
results = []
for result in session.run(list_query, domain=self.domain):
results.append(result[0])
session.close()
self.write_column_data(
sheet, "Authenticated Users with RDP Rights: {}", results)
示例9: domain_users_dcom
# 需要導入模塊: from neo4j.v1 import GraphDatabase [as 別名]
# 或者: from neo4j.v1.GraphDatabase import driver [as 別名]
def domain_users_dcom(self, sheet):
list_query = """MATCH (g:Group {domain:{domain}})
WHERE g.objectsid ENDS WITH "-513"
OPTIONAL MATCH (g)-[:ExecuteDCOM]->(c1)
OPTIONAL MATCH (g)-[:MemberOf*1..]->(:Group)-[:ExecuteDCOM]->(c2)
WITH COLLECT(c1) + COLLECT(c2) as tempVar
UNWIND tempVar AS computers
RETURN DISTINCT(computers.name)
"""
session = self.driver.session()
results = []
for result in session.run(list_query, domain=self.domain):
results.append(result[0])
session.close()
self.write_column_data(
sheet, "Domain Users with DCOM Rights: {}", results)
示例10: everyone_dcom
# 需要導入模塊: from neo4j.v1 import GraphDatabase [as 別名]
# 或者: from neo4j.v1.GraphDatabase import driver [as 別名]
def everyone_dcom(self, sheet):
list_query = """MATCH (g:Group {domain:{domain}})
WHERE g.objectsid = "S-1-1-0"
OPTIONAL MATCH (g)-[:ExecuteDCOM]->(c1)
OPTIONAL MATCH (g)-[:MemberOf*1..]->(:Group)-[:ExecuteDCOM]->(c2)
WITH COLLECT(c1) + COLLECT(c2) as tempVar
UNWIND tempVar AS computers
RETURN DISTINCT(computers.name)
"""
session = self.driver.session()
results = []
for result in session.run(list_query, domain=self.domain):
results.append(result[0])
session.close()
self.write_column_data(
sheet, "Domain Users with DCOM Rights: {}", results)
示例11: authenticated_users_dcom
# 需要導入模塊: from neo4j.v1 import GraphDatabase [as 別名]
# 或者: from neo4j.v1.GraphDatabase import driver [as 別名]
def authenticated_users_dcom(self, sheet):
list_query = """MATCH (g:Group {domain:{domain}})
WHERE g.objectsid = "S-1-5-11"
OPTIONAL MATCH (g)-[:ExecuteDCOM]->(c1)
OPTIONAL MATCH (g)-[:MemberOf*1..]->(:Group)-[:ExecuteDCOM]->(c2)
WITH COLLECT(c1) + COLLECT(c2) as tempVar
UNWIND tempVar AS computers
RETURN DISTINCT(computers.name)
"""
session = self.driver.session()
results = []
for result in session.run(list_query, domain=self.domain):
results.append(result[0])
session.close()
self.write_column_data(
sheet, "Domain Users with DCOM Rights: {}", results)
示例12: shortest_derivative_path_domain_users
# 需要導入模塊: from neo4j.v1 import GraphDatabase [as 別名]
# 或者: from neo4j.v1.GraphDatabase import driver [as 別名]
def shortest_derivative_path_domain_users(self, sheet):
count_query = """MATCH (g1:Group {domain:{domain}})
WHERE g1.objectsid ENDS WITH "-513"
MATCH (g2:Group {domain:{domain}})
WHERE g2.objectsid ENDS WITH "-512"
MATCH p = shortestPath((g1)-[:AdminTo|HasSession|MemberOf*1..]->(g2))
RETURN LENGTH(p)
"""
session = self.driver.session()
count = 0
for result in session.run(count_query, domain=self.domain):
count = result[0]
session.close()
self.write_single_cell(
sheet, 3, 1, "Shortest Derivative Path Length: {}".format(count))
示例13: shortest_hybrid_path_domain_users
# 需要導入模塊: from neo4j.v1 import GraphDatabase [as 別名]
# 或者: from neo4j.v1.GraphDatabase import driver [as 別名]
def shortest_hybrid_path_domain_users(self, sheet):
count_query = """MATCH (g1:Group {domain:{domain}})
WHERE g1.objectsid ENDS WITH "-513"
MATCH (g2:Group {domain:{domain}})
WHERE g2.objectsid ENDS WITH "-512"
MATCH p = shortestPath((g1)-[r*1..]->(g2))
WHERE NONE(rel in r WHERE type(rel)="GetChanges")
WITH *
WHERE NONE(rel in r WHERE type(rel)="GetChangesAll")
RETURN LENGTH(p)
"""
session = self.driver.session()
count = 0
for result in session.run(count_query, domain=self.domain):
count = result[0]
session.close()
self.write_single_cell(
sheet, 4, 1, "Shortest Hybrid Path Length: {}".format(count))
示例14: shortest_acl_path_everyone
# 需要導入模塊: from neo4j.v1 import GraphDatabase [as 別名]
# 或者: from neo4j.v1.GraphDatabase import driver [as 別名]
def shortest_acl_path_everyone(self, sheet):
count_query = """MATCH (g1:Group {domain:{domain}})
WHERE g1.objectsid = 'S-1-1-0'
MATCH (g2:Group {domain:{domain}})
WHERE g2.objectsid ENDS WITH "-512"
MATCH p = shortestPath((g1)-[:Owns|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner*1..]->(g2))
RETURN LENGTH(p)
"""
session = self.driver.session()
count = 0
for result in session.run(count_query, domain=self.domain):
count = result[0]
session.close()
self.write_single_cell(
sheet, 2, 2, "Shortest ACL Path Length: {}".format(count))
示例15: shortest_derivative_path_everyone
# 需要導入模塊: from neo4j.v1 import GraphDatabase [as 別名]
# 或者: from neo4j.v1.GraphDatabase import driver [as 別名]
def shortest_derivative_path_everyone(self, sheet):
count_query = """MATCH (g1:Group {domain:{domain}})
WHERE g1.objectsid = 'S-1-1-0'
MATCH (g2:Group {domain:{domain}})
WHERE g2.objectsid ENDS WITH "-512"
MATCH p = shortestPath((g1)-[:AdminTo|HasSession|MemberOf*1..]->(g2))
RETURN LENGTH(p)
"""
session = self.driver.session()
count = 0
for result in session.run(count_query, domain=self.domain):
count = result[0]
session.close()
self.write_single_cell(
sheet, 3, 2, "Shortest Derivative Path Length: {}".format(count))