INSTRUCTIONS:

  • Follow the instructions on the stage to complete this interactive learning activity.
  • Look out for key terms marked with a ★!
  • Sometimes you will have to complete a task on the stage to continue. Pay attention!
  • At the end of the activity click Submit and Next to move on!

To navigate the page using the TAB key, first press ESC to exit the code editor.

import codesters import random from codesters.demo import Demo from codesters import Text # Set constants stage_height = float(stage.get_stage_height()) stage_width = float(stage.get_stage_width()) offstage_below = -1000 # Use as y value to create objects below the stage wait_time = 1 # Create Demo instance demo = Demo() # Set up stage stage.auto_cache_off() stage.set_background_color("black") stage.disable_floor() chars = [] for counter in range(60): x = random.randint(-550, 550) binary = codesters.Text(chr(random.randint(33, 255)), x, 300, "green") binary.set_y_speed(random.randint(-3, -1)) binary.set_physics_on() binary.set_opacity(random.random()) chars.append(binary) def interval(): for char in chars: if char.get_y() <= -(stage_height/2): char.go_to(random.randint(-550, 550), 310) char.set_y_speed(random.randint(-3, -1)) # char.set_opacity(random.randint(1,10)/10) stage.event_interval(interval, 0.05) lesson_title = Text("Cybersecurity: Introduction", 0, 200, "white") lesson_title.set_text_width(800) lesson_title.set_text_size(40) activity_title = Text("Systems Thinking", 0, 150, "white") activity_title.set_text_width(600) activity_title.set_text_size(30) stage.wait(wait_time) guide = demo.create_sprite_off_screen("person20", -stage_width/2-50, -150, 1) guide.glide_to(0, -150) guide.say("Welcome back!\nClick Next to learn about systems thinking.", 0, "white", 18) stage.wait(wait_time*3) demo.continue_action() guide.say("") lesson_title.set_speed(10) lesson_title.glide_to(0, 1000) activity_title.set_speed(10) activity_title.glide_to(0, 1000) # guide.say("") # guide.move_forward(stage_width+75) # stage.wait(wait_time) # stage.set_background("cyber_chip_blue") # demo.remove_all_sprites_except([]) # stage.event_interval(None) # guide = demo.create_sprite_off_screen("robot3", -stage_width/2-50, -175, 1) # guide.move_forward(stage_width/2+50) ### add front loading re:systems thinking def stamp_animation(sprite, x, y): opacity = 0 sprite.set_opacity(opacity) sprite.set_size(3) sprite.go_to(x, y) for counter in range(10): opacity += .1 size = .895 sprite.set_opacity(opacity) sprite.set_size(size) stage.wait(1/60) # stage.set_background("cyber_chip_blue") guide.say("Cybersecurity has to do with secure computer systems...\n\n", 0, "lightgreen", 18) stage.wait(wait_time*2) star = codesters.Star(0, 1000, 5, 20, "lightgreen", "white") star.set_line_thickness(3) stamp_animation(star, 0, 150) stage.wait(wait_time*0.5) guide.say("Cybersecurity has to do with secure computer systems...\n\nClick on the star!", 0, "lightgreen", 18) star.event_click(demo.return_paused_click()) demo.pause() guide.say("Cybersecurity has to do with secure computer systems...\n\n", 0, "lightgreen", 18) star.turn_right(360) star.set_radius(10) star.set_color("white") star.glide_to(-stage_width/3-100, 245) stage.remove_sprite(star) text = u"★" + " Cybersecurity is all about building secure computer systems that we can trust! " cyber_def = demo.animate_typing_text(text, -stage_width/3-100, 245, align="left", font_size=25, color = "white", cursor_wait = False) stage.wait(wait_time*3) guide.say("Cybersecurity has to do with secure computer systems...\n\nClick the word system.", 0, "white", 18) square_overlay = codesters.Rectangle(185, 245, 100, 35, "white") square_overlay.set_opacity(0.2) square_overlay_outline = codesters.Rectangle(185, 245, 100, 35, None, "lightgreen") square_overlay_outline.set_line_thickness(3) square_overlay.event_click(demo.return_paused_click()) demo.pause() stage.remove_sprite(square_overlay_outline) stage.remove_sprite(square_overlay) text = u"★" + " A system is a group of parts that work together as a whole " systems_def = demo.animate_typing_text(text, -stage_width/3-100, 200, align="left", font_size=25, color = "white", cursor_wait = False) stage.wait(wait_time) guide.say("Now that we know what a system is,\nlet's talk about systems thinking!", 0, "white", 20) stage.wait(wait_time*2) demo.continue_action() guide.say("In order to study and change a system,\n\n", 0, "white", 20) stage.wait(wait_time*2) guide.say("In order to study and change a system,\nwe need to know the parts of the system,\n", 0, "white", 20) stage.wait(wait_time*2) guide.say("In order to study and change a system,\nwe need to know the parts of the system,\nhow they interact, and the results they produce!", 0, "white", 20) stage.wait(wait_time*4) demo.continue_action() guide.say("") guide.move_forward(stage_width+75) demo.remove_all_sprites_except(chars) stage.event_interval(None) for char in chars: char.set_y_speed(0) char.hide() stage.set_background("cyber_chip_blue") phone = demo.create_sprite_off_screen("smartphone", -offstage_below, 0, 2) guide = demo.create_sprite_off_screen("robot3", -stage_width/2-50, -175, 1) guide.move_forward(stage_width/2+50) guide.set_say_width(550) guide.say("Let's start by thinking about a simple, fun system...a game!\n\n", 0, "black", 20) stage.wait(wait_time*2) guide.say("Let's start by thinking about a simple, fun system...a game!\n\nI've been playing a fun game on my phone:", 0, "black", 20) stage.wait(wait_time*2) phone.go_to(-325, 0) demo.continue_action() guide.say("") cyber_def.hide() systems_def.hide() stage.wait(wait_time*.5) size = 2.1 for counter in range(5): phone.turn_right(360/5) phone.set_size(size) size += .1 stage.set_background_color("#0897ff") stage.remove_sprite(phone) phone_left_edge = codesters.Rectangle(-stage_width/2+25, 0, 50, stage_height, "black") phone_right_edge = codesters.Rectangle(stage_width/2-25, 0, 50, stage_height, "black") guide.say("I earn 10 free coins a day!") stage.disable_floor() stage.disable_ceiling() for counter in range(10): coin = codesters.Sprite("coin", random.randint(-stage_width/2+100, stage_width/2-100), stage_height+random.randint(60, 100)) coin.set_y_speed(-10) stage.wait(wait_time*3) demo.continue_action() demo.remove_all_sprites_except([guide, phone_left_edge, phone_right_edge]+chars) guide.say("That's not enough for me!\n", 0, "black", 18) stage.wait(wait_time*2) guide.say("That's not enough for me!\nLet's think about this system's parts and rules...", 0, "black", 18) stage.wait(wait_time*2) demo.continue_action() guide_text = codesters.Text("PHONE GAME SYSTEM:\n\n* Earn 10 coins a day\n* The game uses the phone's calendar to count how many days have passed", -325, 200) guide_text.set_text_width(30) guide_text.set_text_width(850) guide_text.set_text_align("left") guide_text.set_text_height(25) guide_text.set_text_background("silver", "white", 0.85) stage.wait(wait_time*2) guide.say("Hmmmm...how can I exploit this system?\n\n", 0, "black", 20) stage.wait(wait_time*2) demo.continue_action() guide.say("Hmmmm...how can I exploit this system?\nIf only I could speed up time!\n", 0, "black", 20) stage.wait(wait_time*2) guide.say("Hmmmm...how can I exploit this system?\nIf only I could speed up time!\nI could earn coins so much faster!", 0, "black", 20) stage.wait(wait_time*2) demo.continue_action() guide.say("") lightbulb = demo.create_sprite_off_screen("lightbulb_41a", -100, -50, .3) lightbulb.set_rotation(30) stage.wait(wait_time) guide.say("I can change what day the phone thinks it is!", 0, "black", 20) stage.wait(wait_time*2) calendar = demo.create_sprite_off_screen("calendar", 115, -125, 1.5) stage.wait(wait_time) demo.continue_action() def create_full_screen_calendar(): demo.remove_all_sprites_except([phone_left_edge, phone_right_edge]+chars) stage.set_background_color("white") x_coord = -352.58 for counter in range(6): sprite = codesters.Line(x_coord, stage_height, x_coord, -stage_height, "silver") x_coord += 141.42 #164.667 y_coord = 250 for counter in range(5): sprite = codesters.Line(-stage_width/2+50, y_coord, stage_width/2-50, y_coord, "silver") y_coord -= 111.2 days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] x = -430 for day in days: day_text = codesters.Text(day, x, 275, "black") x += 141.42 x = 140 y = 195 for counter in range(1, 32): date_text = codesters.Text(str(counter), x, y, "darkgrey") date_text.set_text_size(50) x += 140 if x > 420: y -= 115 x = -420 create_full_screen_calendar() phone = demo.create_sprite_off_screen("smartphone", -325, 0, 2) phone.hide() guide = demo.create_sprite_off_screen("robot3", 0, -175, 1) stage.wait(wait_time) guide.say("Today is the 5th!\n\n") stage.wait(wait_time*2) date_overlay = codesters.Rectangle(-282, 83, 140, 110, "white") date_overlay.set_opacity(0.01) guide.say("Today is the 5th!\n\nClick the correct date on the calendar.") date_overlay.event_click(demo.return_paused_click()) demo.pause() stage.remove_sprite(date_overlay) sprite = turtle.Turtle() sprite.hideturtle() sprite.color("red") sprite.setposition(-280, 37) sprite.shape("classic") sprite.pen_width(8) sprite.circle(45) blue_sprite = turtle.Turtle() blue_sprite.hideturtle() blue_sprite.color("blue") blue_sprite.setposition(145, -74+90) blue_sprite.pen_width(8) guide.say("If I set the date to the 15th,\nthe phone game counts 10 days passing!\n\n", 0, "black", 20) stage.wait(wait_time*2) guide.say("If I set the date to the 15th,\nthe phone game counts 10 days passing!\n\nDrag the red circle to the 15th!", 0, "black", 20) new_ring = codesters.Circle(-280, 82, 90, None, "red") new_ring.set_line_thickness(8) new_ring.set_drag_on() circle_overlay = codesters.Circle(145, -30, 45, "pink") circle_overlay.set_opacity(0.01) def collision(new_ring, hit_sprite): if hit_sprite.get_color()== 'pink': new_ring.event_collision(None) new_ring.glide_to(145, -30) new_ring.hide() stage.wait(0.5) blue_sprite.circle(-45) stage.wait(0.5) new_ring.event_collision(None) demo.unpause() new_ring.event_collision(collision) demo.pause() stage.wait(0.5) demo.continue_action() old_guide = guide guide = demo.create_sprite_off_screen("robot3", 0, -175, 1) old_guide.hide() guide.set_say_position(0, 50, "relative") guide.say("If I set the date to the 15th,\nthe phone game counts 10 days passing!\n\nI get 100 coins!", 0, "black", 25) coins = [] for counter in range(25): x = random.randint(-stage_width/2+75, stage_width/2-75) coin = codesters.Sprite("coin", x, offstage_below) coin.hide() coin.cycle = 0 coin.go_to(x, random.randint(-stage_height/2, stage_height/2)) coins.append(coin) stage.wait(wait_time) demo.continue_action() stage.set_background_color("#0897ff") sprite.clear() blue_sprite.clear() demo.remove_all_sprites_except([guide, phone_left_edge, phone_right_edge, phone]+coins+chars) def coin_interval(): for coin in coins: if coin.get_y() < -stage_height/2 and coin.cycle < 3: coin.go_to(random.randint(-stage_width/2+75, stage_width/2-75), stage_height/2+60) coin.set_y_speed(random.randint(-20, -12)) coin.cycle += 1 elif coin.get_y() < -stage_height/2 and coin.cycle > 2: coins.remove(coin) stage.remove_sprite(coin) if len(coins) == 0: stage.event_interval(None) guide.say("") demo.unpause() for coin in coins: coin.show() coin.set_y_speed(random.randint(-20, -12)) stage.event_interval(coin_interval, 0.05) demo.pause() # demo.continue_action() stage.wait(2) guide.say("By understanding how the system for gaining coins works,\nI was able to exploit the system to get more free coins!\n\n") stage.wait(wait_time*3) demo.continue_action() guide.say("By understanding how the system for gaining coins works,\nI was able to exploit the system to get more free coins!\n\nI applied systems thinking!") stage.wait(wait_time*2) demo.continue_action() text = u"★" + " An exploit is the process of using a system's vulnerabilities to gain unauthorized access or functionality" exploit_def = demo.animate_typing_text(text, -stage_width/3-100, 245, width = 950, align="left", font_size=25, color = "white", cursor_wait = False) stage.wait(wait_time*3) square_overlay = codesters.Rectangle(138, 245+15, 156, 35, "white") square_overlay.set_opacity(0.2) square_overlay_outline = codesters.Rectangle(138, 245+15, 156, 35, None, "lightgreen") square_overlay_outline.set_line_thickness(3) guide.say("Click the highlighted word!") square_overlay.event_click(demo.return_paused_click()) demo.pause() stage.remove_sprite(square_overlay) stage.remove_sprite(square_overlay_outline) guide.say("") text = u"★" + " A vulnerability is any error, weakness, or design flaw that can be exploited by a threat actor" vulnerability_def = demo.animate_typing_text(text, -stage_width/3-100, 175, width = 900, align="left", font_size=25, color = "white", cursor_wait = False) stage.wait(wait_time*2) guide.say("In my game, the vulnerability was that the game relied on the phone's built in calendar.\n\n") stage.wait(wait_time*3) guide.say("In my game, the vulnerability was that the game relied on the phone's built in calendar.\n\nAnd I exploited it by changing the date!") stage.wait(wait_time*3) demo.continue_action() demo.remove_all_sprites_except([guide, phone]+chars) stage.set_background("cyber_chip_blue") guide.say("") phone.show() guide.say("I used systems thinking!\n", 0, "black", 20) stage.wait(wait_time*2) guide.say("I used systems thinking!\nLet's take a look at some more systems thinking in action.", 0, "black", 20) stage.wait(wait_time*3) demo.continue_action() # guide.move_right(800) # stage.remove_sprite(guide) # guide = demo.create_sprite_off_screen("person20", -stage_width/2-50, -150, 1) # guide.glide_to(0, -150) # # phone.show() # guide.say("Systems thinkers are very important in cybersecurity.\n\n") # stage.wait(wait_time*3) # guide.say("Systems thinkers are very important in cybersecurity.\nThey are able to see ways that the system can be used that the builders did not intend.") # stage.wait(wait_time*3) # demo.continue_action() demo.remove_all_sprites_except(chars) stage.set_background_color("oldlace") support = codesters.Rectangle(-400, -200, 200, 200, "dimgrey") soda_machine = codesters.Sprite("sodamachine_afb", -400, 0) free_refills = codesters.Text("Free Refills", -400, 70, "black") free_refills.set_text_size(30) free_refills.set_text_background("red", "black", 1) # X = -477 # for counter in range(10): # sticker = codesters.Rectangle(X, 20, 12, 13, "green") # X += 17.5 sprite = codesters.Sprite("teen2", 0, -150) sprite.flip_right_left() sprite.say("My friends and I each want a soda!\n\n") stage.wait(wait_time*2) sprite.say("My friends and I each want a soda!\nWe don't have enough money to buy 1 per person, but look!\n") stage.wait(wait_time*4) sprite.say("My friends and I each want a soda!\nWe don't have enough money to buy 1 per person, but look!\nFree refills!") stage.wait(wait_time) demo.continue_action() sprite.say("I'll buy ONE soda...then refill it and pour it into a new cup.") stage.wait(wait_time*2) x = -460 for counter in range(5): soda = demo.create_sprite_off_screen("soda_19d", x, -45, .2) x += 30 sprite.say("Now we have enough!\n\n") stage.wait(wait_time) sprite.say('Now we have enough!\n\nI thought about how the drink system worked...and exploited the "Free Refills" vulnerability for free drinks.') stage.wait(wait_time*3) demo.continue_action() sprite.say("Let's look at one more example of systems thinking in action...") stage.wait(wait_time*3) demo.continue_action() demo.remove_all_sprites_except(chars) stage.set_background("bbcourt") stage.set_background_scale(.18) sprite = codesters.Sprite("cheerleader1", 15, -130) sprite.set_say_width(600) sprite.say("I reeeaaaaalllllyyyy wanted to attend this game...\n\n", 0, "aqua", 20) stage.wait(wait_time*3) sprite.say("I reeeaaaaalllllyyyy wanted to attend this game...\nBut it was sold out!\n", 0, "aqua", 20) stage.wait(wait_time*3) sprite.say("I reeeaaaaalllllyyyy wanted to attend this game...\nBut it was sold out!\nSo I borrowed a cheerleading costume. This game is great!", 0, "aqua", 20) stage.wait(wait_time*3) demo.continue_action() demo.remove_all_sprites_except(chars) stage.set_background_color("black") for char in chars: char.show() char.set_y_speed(random.randint(-3, -1)) stage.event_interval(interval, 0.05) guide = demo.create_sprite_off_screen("person20", 0, -150, 1) guide.set_say_color("white") guide.set_say_width(1000) guide.set_say_position(0, -25, "relative") guide.say("Systems thinkers are very important in cybersecurity.\n\n", 0, "white", 20) stage.wait(wait_time*3) guide.say("Systems thinkers are very important in cybersecurity.\nSystems thinkers can work in designing systems for cybersecurity...\n", 0, "white", 20) stage.wait(wait_time*3) guide.say("Systems thinkers are very important in cybersecurity.\nSystems thinkers can work in designing systems for cybersecurity...\nThey can also be users who use the systems in unintended ways, or see vulnerabilities in the system.", 0, "white", 20) stage.wait(wait_time*5) demo.continue_action() guide.say("In the next activity, you will learn about different parts of the cybersecurity system!", 0, "white", 20) stage.wait(wait_time*2) sprite_list = demo.remind_student_to_submit(guide.get_x() - 175, guide.get_y() + 175, 25) for sprite in sprite_list: if sprite.get_name() == 'line' or sprite.get_name() == 'arrowLine': sprite.set_color("white") elif sprite.get_text() != None: sprite.set_color("white") tester = TestManager() tester.display_success_message("Great job!") stage.wait(10) stage.event_interval(None)
  • Run Code
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)