예제 #1
0
def evaluateIncident(params):
	attack_name = params[2]
	affected_element_ip = params[6]
	affected_element_info = decideAffectedElement(attack_name, affected_element_ip)

	data = ds.calculateParams(params,affected_element_info[0],affected_element_info[1],affected_element_info[2])
	
	risk = ds.calculateRisk(data)
	
	print 'New risk: %s  on  "%s" with IP direction "%s"' % (risk, affected_element_info[0], affected_element_ip)
	report(risk, affected_element_info[0], affected_element_ip, params[0])
	systemstatus.updateElement(affected_element_info[0], affected_element_info[3], risk)
예제 #2
0
def init():
	elements = rf.getElements()
	db = systemdb.systemDatabase()

	for element in elements:
		info = element.split(':')

		element_name = info[0]
		element_id = info[1]
		element_rating = info[2]

		temp = element_name + '-' + element_id
		params = [0,0,0,0,0,0,0,0]
		data = ds.calculateParams(params ,element_name , element_rating, 0)
		# system_risk_dict['element_name - element_id'] = element_risk
		system_risk_dict[temp] = ds.calculateRisk(data)

		# updating an element
		db.modifyDatabase(element_name, element_id,'risk', system_risk_dict[temp])

	db.closeDatabase()
	print 'Initialized system risk.'