Access official resources from Carbon Black experts
NewRegistrationCallbackModulePath=/usr/share/cb/plugins/default_new_sensor_registration_callback_sid_hostname.py NewRegistrationCallbackClassName=DefaultNewRegistrationCallback
cp /usr/share/cb/plugins/default_new_sensor_registration_callback.py /usr/share/cb/plugins/default_new_sensor_registration_callback_sid_hostname.py
from cb.sensor.NewRegistrationCallback import NewRegistrationCallback from cb.db.core_models import SensorRegistration class DefaultNewRegistrationCallback (NewRegistrationCallback): @staticmethod def get_sensor_id(db_session, sensor_reg_request, logger): sensor_host_name = sensor_reg_request.ComputerId.ComputerName sensor_dns_name = sensor_reg_request.ComputerId.ComputerDnsName sensor_sid = sensor_reg_request.ComputerId.ComputerSid sensor = db_session.query(SensorRegistration).filter(SensorRegistration.computer_sid == sensor_sid).filter(SensorRegistration.computer_name==sensor_host_name).order_by(SensorRegistration.last_checkin_time.desc()).first() if sensor is not None: logger.debug("Found sensor id [%d] for hostname [%s @ %s]" % (sensor.id, sensor_host_name, sensor_dns_name)) return sensor.id else: logger.debug("Could not find a sensor id for hostname hostname [%s @ %s]" % (sensor_host_name, sensor_dns_name)) return 0
Copyright © 2005-2023 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.