Esempio n. 1
0
         Stream Authorization
    -> Optional
    ==========================================================================='''
 
# register_ecu_classes(r"C:\Users\artur.mrowca\workspace\ECUSimulation\components\base\gateways")
api_log_path = os.path.join(os.path.dirname(__file__), "logs/api.log")
api.show_logging(logging.INFO, api_log_path, True)
my_env = api.create_environment(180)
 
# Simple ECU CREATION
# ecu_spec = SimpleECUSpec([], 200, 200)
# set_settings_ecu(ecu_spec)
# ecu_group_0 = api.set_ecus(my_env, 7, 'SecureECU', ecu_spec)
 
# Sending ECU: Sends data in fixed intervals 
ecu_spec = RegularECUSpec(["RegularSecureECU_15"], 2000, 2000)
set_settings_ecu(ecu_spec)
 
ecu_spec.set_ecu_setting('p_stream_hold', False)  # Define holding behavior per ECU
ecu_spec.set_ecu_setting('p_stream_req_min_interval', 5)
 
ecu_spec.add_sending_actions(150, 0.6, can_registration.CAN_TEST_MSG, "TEST STRING A", 50)
ecu_spec.add_sending_actions(150, 0.3, 16, "TEST STRING B", 50)  # sends at 300, 308, 316, ...
 
ecu_group_1 = api.set_ecus(my_env, 1, 'RegularSecureECU', ecu_spec)
 
 
ecu_spec = SimpleECUSpec(['SEC 1'], 2000, 2000)
ecu_spec.set_ecu_setting('t_ecu_auth_trigger_process', 100)  
ecu_spec.set_ecu_setting('t_ecu_auth_trigger_intervall', 1000)  
 
Esempio n. 2
0
#     -> Create Environment
#===============================================================================
api.register_ecu_classes(os.path.join(os.path.dirname(__file__), "ecus"))

# setup the logging
api_log_path = os.path.join(os.path.dirname(__file__), "logs/api.log")
api.show_logging(logging.INFO, api_log_path, True)

# create an empty environment specification for the environment
sim_env = api.create_environment(200)

#===============================================================================
#     Creating ECUs
#=============================================================================== 
# create ECU with specification A
ecu_spec = RegularECUSpec(["My_Test_ECU_1"], 20000, 20000)
ecu_spec.add_sending_actions(2, 0.5, 16, "TEST STRING B", 50)  # sends a at time 10, 10.5, 11... message id 16, content test string b and size 50
ecu_group_1 = api.set_ecus(sim_env, 1, 'MyProtocolECU', ecu_spec)
 
# create 2 ECUs with specification B (here: same as A)
ecu_spec = RegularECUSpec(["My_Test_ECU_2", "My_Test_ECU_3"], 20000, 20000)
ecu_group_3 = api.set_ecus(sim_env, 2, 'MyProtocolECU', ecu_spec)

# create 3 ECUs with specification C (here: same as A)
ecu_spec = RegularECUSpec(["My_Test_ECU_4", "My_Test_ECU_5", "My_Test_ECU_6"], 20000, 20000)
ecu_group_4 = api.set_ecus(sim_env, 3, 'MyProtocolECU', ecu_spec)
 
#===============================================================================
#     Creating Gateways
#===============================================================================
Esempio n. 3
0
from io_processing.result_interpreter.can_bus_interpreter import CanBusInterpreter
from components.security.ecu.types.impl_ecu_tesla import StdTeslaECUTimingFunctions

#===============================================================================
#     Setup project, ECUs, Gateways, Busses
#===============================================================================
api_log_path = os.path.join(os.path.dirname(__file__), "logs/api.log")
api.show_logging(logging.INFO, api_log_path, True)

# environment
sim_env = api.create_environment(500)
  
# create ECUs: Attention: for Tesla the sending actions defined in  add_sending_actions() must
#              conform the defined MessageStream objects. i.e. if a MessageStream is defined 
#              that starts sending at time t_0 with a message sending interval of t_int then
#              the exact same sending action has to be put in the add_sending_action() method!
ecu_spec = RegularECUSpec(["RegularSecureECU_15"], 20000, 20000)
ecu_spec.set_apply_jitter(0.0000001)
# ecu_spec.set_ecu_setting('t_prf_for_key_legitimation', 0)  # NOTE: If this value has a realistic value this is not working or better to say it works with a extreme delay
# ecu_spec.set_ecu_setting('t_generate_compare_mac', 0)  # NOTE: If this value has a realistic value this is not working or better to say it works with a extreme delay
ecu_spec.add_sending_actions(260, 0.1, can_registration.CAN_TEST_MSG, "TEST STRING B", 50)
ecu_group_1 = api.set_ecus(sim_env, 1, 'TeslaECU', ecu_spec)
  
ecu_spec = RegularECUSpec(["TEST ECU 9", "TEST ECU 10"], 20000, 20000)
ecu_spec.set_apply_jitter(0.0000001)
# ecu_spec.set_ecu_setting('t_prf_for_key_legitimation', 0)  # NOTE: If this value has a realistic value this is not working or better to say it works with a extreme delay
# ecu_spec.set_ecu_setting('t_generate_compare_mac', 0)  # NOTE: If this value has a realistic value this is not working or better to say it works with a extreme delay
ecu_group_3 = api.set_ecus(sim_env, 2, 'TeslaECU', ecu_spec)
 
ecu_spec = RegularECUSpec(["TEST ECU 11", "TEST ECU 12"], 20000, 20000)
ecu_spec.set_apply_jitter(0.0000001)
Esempio n. 4
0
from components.security.ecu.types.impl_ecu_tesla import StdTeslaECUTimingFunctions

#===============================================================================
#     Setup project, ECUs, Gateways, Busses
#===============================================================================
api_log_path = os.path.join(os.path.dirname(__file__), "logs/api.log")
api.show_logging(logging.INFO, api_log_path, True)

# environment
sim_env = api.create_environment(500)

# create ECUs: Attention: for Tesla the sending actions defined in  add_sending_actions() must
#              conform the defined MessageStream objects. i.e. if a MessageStream is defined
#              that starts sending at time t_0 with a message sending interval of t_int then
#              the exact same sending action has to be put in the add_sending_action() method!
ecu_spec = RegularECUSpec(["RegularSecureECU_15"], 20000, 20000)
ecu_spec.set_apply_jitter(0.0000001)
# ecu_spec.set_ecu_setting('t_prf_for_key_legitimation', 0)  # NOTE: If this value has a realistic value this is not working or better to say it works with a extreme delay
# ecu_spec.set_ecu_setting('t_generate_compare_mac', 0)  # NOTE: If this value has a realistic value this is not working or better to say it works with a extreme delay
ecu_spec.add_sending_actions(260, 0.1, can_registration.CAN_TEST_MSG,
                             "TEST STRING B", 50)
ecu_group_1 = api.set_ecus(sim_env, 1, 'TeslaECU', ecu_spec)

ecu_spec = RegularECUSpec(["TEST ECU 9", "TEST ECU 10"], 20000, 20000)
ecu_spec.set_apply_jitter(0.0000001)
# ecu_spec.set_ecu_setting('t_prf_for_key_legitimation', 0)  # NOTE: If this value has a realistic value this is not working or better to say it works with a extreme delay
# ecu_spec.set_ecu_setting('t_generate_compare_mac', 0)  # NOTE: If this value has a realistic value this is not working or better to say it works with a extreme delay
ecu_group_3 = api.set_ecus(sim_env, 2, 'TeslaECU', ecu_spec)

ecu_spec = RegularECUSpec(["TEST ECU 11", "TEST ECU 12"], 20000, 20000)
ecu_spec.set_apply_jitter(0.0000001)
Esempio n. 5
0
#     -> Create Environment
#===============================================================================
api.register_ecu_classes(os.path.join(os.path.dirname(__file__), "ecus"))

# setup the logging
api_log_path = os.path.join(os.path.dirname(__file__), "logs/api.log")
api.show_logging(logging.INFO, api_log_path, True)

# create an empty environment specification for the environment
sim_env = api.create_environment(200)

#===============================================================================
#     Creating ECUs
#=============================================================================== 
# create ECU with specification A
ecu_spec = RegularECUSpec(["My_Test_ECU_1"], 20000, 20000)
ecu_spec.add_sending_actions(2, 0.5, 16, "TEST STRING B", 50)  # sends a at time 10, 10.5, 11... message id 16, content test string b and size 50
ecu_group_1 = api.set_ecus(sim_env, 1, 'MyProtocolECU', ecu_spec)
 
# create 2 ECUs with specification B (here: same as A)
ecu_spec = RegularECUSpec(["My_Test_ECU_2", "My_Test_ECU_3"], 20000, 20000)
ecu_group_3 = api.set_ecus(sim_env, 2, 'MyProtocolECU', ecu_spec)

# create 3 ECUs with specification C (here: same as A)
ecu_spec = RegularECUSpec(["My_Test_ECU_4", "My_Test_ECU_5", "My_Test_ECU_6"], 20000, 20000)
ecu_group_4 = api.set_ecus(sim_env, 3, 'MyProtocolECU', ecu_spec)
 
#===============================================================================
#     Creating Gateways
#===============================================================================
Esempio n. 6
0
# usual folders: components.base.ecu.types and components.security.ecu.types
#api.register_ecu_classes(r"C:\Users\artur.mrowca\workspace\ECUSimulation\components\base\gateways")

# setup the logging
api_log_path = os.path.join(os.path.dirname(__file__), "logs/api.log")
api.show_logging(logging.INFO, api_log_path, True)

# create an empty environment specification for the environment
sim_env = api.create_environment(200)

#===============================================================================
#     Creating ECUs
#=============================================================================== 

# create the ECU specification
ecu_spec = RegularECUSpec(["RegularSecureECU_15"], 20000, 20000)

# adjust the specification
ecu_spec.set_apply_jitter(0.000001)

# further settings can be found in the set_settings method of each component e.g. see RegularSecureECU class
ecu_spec.set_ecu_setting('p_stream_hold', False)
ecu_spec.set_ecu_setting('p_stream_req_min_interval', 5)
LWASpecPresets().apply_spec(ecu_spec, 'ecu')

# for a RegularECUSpec define sending actions of the ECU
ecu_spec.add_sending_actions(10, 0.25, can_registration.CAN_TEST_MSG, "TEST STRING A", 50)
ecu_spec.add_sending_actions(10, 0.5, 16, "TEST STRING B", 50)  # sends at 300, 308, 316, ...

# set the ECU already authenticated
ecu_spec.set_authenticated(True)
Esempio n. 7
0
File: main.py Progetto: xding/IVNS
    -> Optional
    ==========================================================================='''


# register_ecu_classes(r"C:\Users\artur.mrowca\workspace\ECUSimulation\components\base\gateways")
api_log_path = os.path.join(os.path.dirname(__file__), "logs/api.log")
api.show_logging(logging.INFO, api_log_path, True)
my_env = api.create_environment(180)

# Simple ECU CREATION
# ecu_spec = SimpleECUSpec([], 200, 200)
# set_settings_ecu(ecu_spec)
# ecu_group_0 = api.set_ecus(my_env, 7, 'SecureECU', ecu_spec)

# Sending ECU: Sends data in fixed intervals
ecu_spec = RegularECUSpec(["RegularSecureECU_15"], 2000, 2000)
set_settings_ecu(ecu_spec)

ecu_spec.set_ecu_setting('p_stream_hold',
                         False)  # Define holding behavior per ECU
ecu_spec.set_ecu_setting('p_stream_req_min_interval', 5)

ecu_spec.add_sending_actions(150, 0.6, can_registration.CAN_TEST_MSG,
                             "TEST STRING A", 50)
ecu_spec.add_sending_actions(150, 0.3, 16, "TEST STRING B",
                             50)  # sends at 300, 308, 316, ...

ecu_group_1 = api.set_ecus(my_env, 1, 'RegularSecureECU', ecu_spec)

ecu_spec = SimpleECUSpec(['SEC 1'], 2000, 2000)
ecu_spec.set_ecu_setting('t_ecu_auth_trigger_process', 100)