當前位置: 首頁>>代碼示例>>Python>>正文


Python GraphDatabase.driver方法代碼示例

本文整理匯總了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() 
開發者ID:BloodHoundAD,項目名稱:BloodHound-Tools,代碼行數:24,代碼來源:bloodhoundanalytics.py

示例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) 
開發者ID:BloodHoundAD,項目名稱:BloodHound-Tools,代碼行數:20,代碼來源:bloodhoundanalytics.py

示例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) 
開發者ID:BloodHoundAD,項目名稱:BloodHound-Tools,代碼行數:22,代碼來源:bloodhoundanalytics.py

示例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) 
開發者ID:BloodHoundAD,項目名稱:BloodHound-Tools,代碼行數:23,代碼來源:bloodhoundanalytics.py

示例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) 
開發者ID:BloodHoundAD,項目名稱:BloodHound-Tools,代碼行數:23,代碼來源:bloodhoundanalytics.py

示例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) 
開發者ID:BloodHoundAD,項目名稱:BloodHound-Tools,代碼行數:23,代碼來源:bloodhoundanalytics.py

示例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) 
開發者ID:BloodHoundAD,項目名稱:BloodHound-Tools,代碼行數:21,代碼來源:bloodhoundanalytics.py

示例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) 
開發者ID:BloodHoundAD,項目名稱:BloodHound-Tools,代碼行數:22,代碼來源:bloodhoundanalytics.py

示例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) 
開發者ID:BloodHoundAD,項目名稱:BloodHound-Tools,代碼行數:22,代碼來源:bloodhoundanalytics.py

示例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) 
開發者ID:BloodHoundAD,項目名稱:BloodHound-Tools,代碼行數:22,代碼來源:bloodhoundanalytics.py

示例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) 
開發者ID:BloodHoundAD,項目名稱:BloodHound-Tools,代碼行數:22,代碼來源:bloodhoundanalytics.py

示例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)) 
開發者ID:BloodHoundAD,項目名稱:BloodHound-Tools,代碼行數:19,代碼來源:bloodhoundanalytics.py

示例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)) 
開發者ID:BloodHoundAD,項目名稱:BloodHound-Tools,代碼行數:22,代碼來源:bloodhoundanalytics.py

示例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)) 
開發者ID:BloodHoundAD,項目名稱:BloodHound-Tools,代碼行數:19,代碼來源:bloodhoundanalytics.py

示例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)) 
開發者ID:BloodHoundAD,項目名稱:BloodHound-Tools,代碼行數:19,代碼來源:bloodhoundanalytics.py


注:本文中的neo4j.v1.GraphDatabase.driver方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。