Digital_apocalypse.PY
% Define the infrastructure components components = struct('name', {'Underwater Cable Landing Station A', 'Internet Exchange Point B', 'Data Center C', 'Telecommunication Hub D', 'Satellite Network E', 'DNS Server F', 'Power Plant G'},... 'criticality', [5, 5, 5, 5, 5, 5, 5],... 'tatus', repmat({'Operational'}, 7, 1),... 'epair_time', rand(7, 1).* [5, 5, 5, 5, 5, 5, 5]); % Define the attack function function attack(component) component.status = 'Down'; fprintf('Attack on %s. Status: %s\n', component.name, component.status); end % Define the repair function function repair(component) pause(component.repair_time); component.status = 'Operational'; fprintf('Repair of %s. Status: %s\n', component.name, component.status); end % Define the cascading failure function function cascading_failure(component) if strcmp(component.name, 'Underwater Cable Landing Station A') attack(components(find(strcmp(components.name, 'Internet Exchange Point B')))); attack(components(find(strcmp(components.name, 'Data Center C')))); elseif strcmp(component.name, 'Internet Exchange Point B') attack(components(find(strcmp(components.name, 'Telecommunication Hub D')))); elseif strcmp(component.name, 'Data Center C') attack(components(find(strcmp(components.name, 'Satellite Network E')))); elseif strcmp(component.name, 'Telecommunication Hub D') attack(components(find(strcmp(components.name, 'DNS Server F')))); elseif strcmp(component.name, 'Satellite Network E') attack(components(find(strcmp(components.name, 'Power Plant G')))); elseif strcmp(component.name, 'DNS Server F') attack(components(find(strcmp(components.name, 'Data Center C')))); elseif strcmp(component.name, 'Power Plant G') attack(components(find(strcmp(components.name, 'Telecommunication Hub D')))); end % Define the inability to repair function function inability_to_repair() fprintf('\nInability to Repair:\n'); for i = 1:length(components) if strcmp(components(i).status, 'Down') repair(components(i)); end end end % Define the status report function function status_report() fprintf('\nStatus Report:\n'); for i = 1:length(components) fprintf('%s: %s\n', components(i).name, components(i).status); end end % Define the emulate attack function function emulate_attack() fprintf('Initiating D