📖 Scenario: You work in a control center managing a SCADA system that controls water treatment plants. Keeping the system secure means regularly applying patches to devices. You will create a simple program to track which devices need patches and apply them step-by-step.
🎯 Goal: Build a program that stores SCADA devices and their patch status, sets a patch threshold, identifies devices needing patches, and prints the list of devices to patch.
📋 What You'll Learn
Create a dictionary called devices with device names as keys and their patch age in days as values
Create a variable called patch_threshold set to 30 days
Use a for loop with variables device and days to find devices with patch age greater than patch_threshold
Create a list called devices_to_patch containing device names needing patches
Print the devices_to_patch list
💡 Why This Matters
🌍 Real World
SCADA systems control critical infrastructure like water plants and power grids. Keeping devices patched prevents security risks and system failures.
💼 Career
Understanding patch management helps DevOps and system engineers maintain secure and reliable industrial control systems.
Progress0 / 4 steps
1
Create the SCADA devices dictionary
Create a dictionary called devices with these exact entries: 'Pump1': 45, 'Valve2': 10, 'Sensor3': 60, 'Controller4': 20
SCADA systems
Hint
Use curly braces {} to create the dictionary with device names as keys and patch ages as values.
2
Set the patch threshold
Create a variable called patch_threshold and set it to 30 to represent days
SCADA systems
Hint
Just assign the number 30 to the variable patch_threshold.
3
Find devices needing patches
Create an empty list called devices_to_patch. Use a for loop with variables device and days to iterate over devices.items(). Inside the loop, if days is greater than patch_threshold, append device to devices_to_patch
SCADA systems
Hint
Remember to create an empty list first. Then loop over the dictionary items and check if patch age is greater than the threshold.
4
Print devices that need patching
Write a print statement to display the devices_to_patch list
SCADA systems
Hint
Use print(devices_to_patch) to show the list of devices needing patches.
Practice
(1/5)
1. What is the main purpose of patch management in SCADA systems?
easy
A. To keep the system secure and reliable
B. To add new hardware components
C. To increase the system's power consumption
D. To remove all user access
Solution
Step 1: Understand patch management role
Patch management involves applying updates to fix security holes and bugs.
Step 2: Relate to SCADA system needs
SCADA systems require security and reliability to operate safely and continuously.
Final Answer:
To keep the system secure and reliable -> Option A
Quick Check:
Patch management = security and reliability [OK]
Hint: Patch management fixes bugs and security issues [OK]
Common Mistakes:
Confusing patching with hardware upgrades
Thinking patching increases power use
Believing patching removes user access
2. Which of the following is the correct way to schedule a patch installation on a SCADA system using a cron job syntax?
easy
A. 0 0 0 0 0 /usr/local/bin/patch_install.sh
B. 60 24 * * * /usr/local/bin/patch_install.sh
C. * * * /usr/local/bin/patch_install.sh
D. 0 2 * * * /usr/local/bin/patch_install.sh
Solution
Step 1: Understand cron syntax
Cron jobs use five fields: minute (0-59), hour (0-23), day, month, weekday.
Step 2: Check each option
0 2 * * * /usr/local/bin/patch_install.sh runs at 2:00 AM daily, which is valid. 60 24 * * * /usr/local/bin/patch_install.sh has invalid minute and hour values. * * * /usr/local/bin/patch_install.sh misses fields. 0 0 0 0 0 /usr/local/bin/patch_install.sh uses zeros incorrectly.
Final Answer:
0 2 * * * /usr/local/bin/patch_install.sh -> Option D