def security_model_page():
     clear_screen(mainframe)
     Topic1 = get_Topic1()
     # ? Title
     label = Label(mainframe,
                   text="Topic 1.2: Security Model",
                   font=(font_family, 24),
                   background="#ffffff")
     label.grid(row=0, column=0, columnspan=2, padx=1)
     # ? Content Frame
     content_frame = Frame(mainframe, bg=main_colour)
     content_frame.grid(row=1, column=0, columnspan=2)
     Label(
         content_frame,
         text=
         "There are 4 approaches to implement a security model.\n-No Security: We do not need to use additional security protection.\n-Security through obscurity: We secure confidential information by hiding them\n-host security: We provide security by protecting the host\n-network security: We protect the network",
         font=(font_family, 14),
         bg="#ffffff").grid(row=0, column=0, padx=1, pady=50)
     # ? Button Frame
     button_frame = Frame(mainframe, bg=main_colour)
     button_frame.grid(row=2, column=0, columnspan=2)
     Button(button_frame,
            text="Previous Content",
            font=h3_font,
            bg=button_colour,
            command=Topic1.trusted_system_page).grid(row=0,
                                                     column=0,
                                                     padx=10)
     Button(button_frame,
            text="Next Content",
            font=h3_font,
            bg=button_colour,
            command=Topic1.security_management_page).grid(row=0,
                                                          column=1,
                                                          padx=10)
Beispiel #2
0
    def quiz_page():
        clear_screen(mainframe)

        # * Landing Page Frame
        landing_page_frame = Frame(mainframe, bg="#ffffff")
        landing_page_frame.grid(row=0, column=0)
        # * Loading images to make it look nicer
        img1 = ImageTk.PhotoImage(
            Image.open(os.path.join(my_file_path, "resources",
                                    "infosec.jpg")).resize((550, 366)))
        img2 = ImageTk.PhotoImage(
            Image.open(os.path.join(my_file_path, "resources",
                                    "img2.png")).resize((474, 150)))

        # * Label Title
        Label(landing_page_frame,
              text="Quiz",
              font=(font_family, 30, "bold"),
              background="#ffffff").grid(row=0, column=0, pady=5)
        # * Label image
        label_image = Label(landing_page_frame,
                            image=img1,
                            background="#ffffff")
        label_image.image = img1
        label_image.grid(row=1, column=0, pady=15)
        # * Start Button
        start_button = Button(
            landing_page_frame,
            image=img2,
            background="#ffffff",
            relief=FLAT,
            border=0,
            command=lambda: Quiz.startIsPressed(landing_page_frame))
        start_button.image = img2
        start_button.grid(row=2, column=0)
Beispiel #3
0
 def need_for_security_page():
     clear_screen(mainframe)
     Topic1 = get_Topic1()
 # ? Title
     label = Label(
         mainframe,
         text="Topic 1: Need For Security",
         font=(font_family, 24),
         background="#ffffff")
     label.grid(row=0, column=0, columnspan=2, padx=1)
 # ? Content Frame
     content_frame = Frame(
         mainframe,
         bg=main_colour
     )
     content_frame.grid(row=1, column=0, columnspan=2)
     Label(
         content_frame,
         text="Need for Security.\nIn today’s world, we use the Internet for many purposes.\nWe use the Internet to email our friends or colleagues.\nWe use the Internet to WhatsApp our families and clients.\nWe also use the Internet to make purchases or for banking.\nIf we send confidential information in the clear, i.e. unprotected.\nThe confidential information is not secure and can be compromised.",
         font=(font_family, 14),
         bg="#ffffff"
     ).grid(row=0, column=0, padx=1, pady=50)
 # ? Button Frame
     button_frame = Frame(
         mainframe,
         bg=main_colour
     )
     button_frame.grid(row=2, column=0, columnspan=2)
     Button(
         button_frame,
         text="Next Content",
         font=h3_font,
         bg=button_colour,
         command=Topic1.trusted_system_page
     ).grid(row=0, column=1, padx=10)
 def security_management_page():
     clear_screen(mainframe)
     Topic1 = get_Topic1()
 # ? Title
     label = Label(
         mainframe,
         text="Topic 1.3: Security Management Practices",
         font=(font_family, 24),
         background="#ffffff")
     label.grid(row=0, column=0, columnspan=2, padx=1)
 # ? Content Frame
     content_frame = Frame(
         mainframe,
         bg=main_colour
     )
     content_frame.grid(row=1, column=0, columnspan=2)
     Label(
         content_frame,
         text="There are 4 key characteristics of a good security policy:\nAffordability: the security policy should not be too costly and incur too much effort to implement\nFunctionality: there should be available security mechanism to support the security policy\nCultural issues: the security policy should gel with people’s expectations, working style and beliefs\n Legality: the policy should meet legal requirements.",
         font=(font_family, 14),
         bg="#ffffff"
     ).grid(row=0, column=0, padx=1, pady=50)
 # ? Button Frame
     button_frame = Frame(
         mainframe,
         bg=main_colour
     )
     button_frame.grid(row=2, column=0, columnspan=2)
     Button(
         button_frame,
         text="Previous Content",
         font=h3_font,
         bg=button_colour,
         command=Topic1.security_model_page
     ).grid(row=0, column=0, padx=10)
     Button(
         button_frame,
         text="Next Content",
         font=h3_font,
         bg=button_colour,
         command=Topic1.type_of_attack_page
     ).grid(row=0, column=1, padx=10)
Beispiel #5
0
 def trusted_system_page():
     clear_screen(mainframe)
     Topic1 = get_Topic1()
     # ? Title
     label = Label(mainframe,
                   text="Topic 1.1: Trusted System and Reference Monitor",
                   font=(font_family, 24),
                   background="#ffffff")
     label.grid(row=0, column=0, columnspan=2, padx=1)
     # ? Content Frame
     content_frame = Frame(mainframe, bg=main_colour)
     content_frame.grid(row=1, column=0, columnspan=2)
     Label(
         content_frame,
         text=
         "What is a trusted system?\nA trusted system is a computer system that can be trusted to a specified extent.\nIt is able to enforce a specified security policy",
         font=(font_family, 14),
         bg="#ffffff").grid(row=0, column=0, padx=1, pady=(50, 0))
     Label(
         content_frame,
         text=
         "Reference Monitor: A trusted system can be implemented using a reference monitor.\nWhat is a reference monitor? A reference monitor is an entity at the heart of a computer system.\nIt is responsible for all decisions related to enforcing access controls.\nSuppose a subject would like to request for an action on an object,\nThe reference monitor will check the request to determine if the subject has the privilege to do so.\nIf he has, access is granted. If not, access is denied.\nFor example, if a user requests to read a file,\nThe reference monitor will check if the user has read access to the file.\nIf he has, access is granted. If not, access is denied.",
         font=(font_family, 14),
         bg="#ffffff").grid(row=1, column=0, padx=1, pady=50)
     # ? Button Frame
     button_frame = Frame(mainframe, bg=main_colour)
     button_frame.grid(row=2, column=0, columnspan=2)
     Button(button_frame,
            text="Previous Content",
            font=h3_font,
            bg=button_colour,
            command=Topic1.need_for_security_page).grid(row=0,
                                                        column=0,
                                                        padx=10)
     Button(button_frame,
            text="Next Content",
            font=h3_font,
            bg=button_colour,
            command=Topic1.security_model_page).grid(row=0,
                                                     column=1,
                                                     padx=10)
 def aes_page():
     clear_screen(mainframe)
     global plaintext_input, key_size, cipher_mode, ciphertext_file, key_file, plaintext_input_error, key_file_error, cipher_mode_error, ciphertext_file_error, success
 # ? Tkinter Variables
     # * create a tkinter variable called cipher_mode
     cipher_mode = StringVar(root)
     # * create a tkinter variable called key_size
     key_size = StringVar(root)
     # * create a tkinter variable called ciphertext_file
     ciphertext_file = StringVar(root)
     # * createa tkinter variable called key_file
     key_file = StringVar(root)
 # ?
 # ? Choices
     # * dictionary with different choices of cipher_mode
     cipher_mode_choices = {'ECB', 'CBC', 'CFB', 'OFB'}
     # * dictionary with different choices of  key_size
     key_size_choices = {'128', '192', '256'}
 # ?
 # ? Setting default value in dropdown
     # set default values of key_size and cipher_mode
     cipher_mode.set('CBC')
     key_size.set('192')
 # ?
 # ? Title
     Label(
         mainframe,
         text="AES",
         font=h1_font,
         bg=main_colour).grid(row=0, column=0, columnspan=5)
 # ?
 # ? Plaintext Frame
     plaintext_frame = Frame(mainframe, bg=main_colour)
     plaintext_frame.grid(row=1, column=0, rowspan=4)
     Label(
         plaintext_frame,
         text="Plaintext:",
         font=h2_font,
         background=main_colour).grid(row=0, column=0, padx=10, pady=10)
     plaintext_input = Text(
         plaintext_frame,
         width=box_width,
         height=10,
         font=h3_font,
         relief="solid")
     plaintext_input.grid(row=1, column=0, padx=10, pady=10)
 # ?
 # ? Key Frame
     key_frame = Frame(mainframe, bg=main_colour)
     key_frame.grid(row=1, column=1, rowspan=2)
     Label(
         key_frame,
         text="Key File:",
         font=h2_font,
         background=main_colour,
         width=box_width).grid(row=0, column=1, columnspan=2)
     key_file_label = Label(
         key_frame,
         text="",
         font=h3_font,
         background=main_colour)
     key_file_label.grid(row=1, column=1, padx=10, pady=10, columnspan=2)
     Button(
         key_frame,
         text="Choose A File",
         font=(font_family, 12),
         background=button_colour2,
         command=lambda: Topic3.choose_file(key_file, key_file_label)).grid(
         row=2, column=1, padx=10, pady=10)
     Button(
         key_frame,
         text="Create A File",
         font=(font_family, 12),
         background=button_colour2,
         command=lambda: Topic3.create_file(key_file, key_file_label)).grid(
         row=2, column=2, padx=10, pady=10)
 # ?
 # ? Ciphertext Frame
     ciphertext_frame = Frame(mainframe, bg=main_colour)
     ciphertext_frame.grid(row=1, column=3, rowspan=2)
     Label(
         ciphertext_frame,
         text="Ciphertext File:",
         font=h2_font,
         background=main_colour,
         width=box_width).grid(row=0, column=0, columnspan=2)
     ciphertext_file_label = Label(
         ciphertext_frame,
         text="",
         font=h3_font,
         background=main_colour)
     ciphertext_file_label.grid(
         row=1, column=0, padx=10, pady=10, columnspan=2)
     Button(
         ciphertext_frame,
         text="Choose A File",
         font=(font_family, 12),
         background=button_colour2,
         command=lambda: Topic3.choose_file(ciphertext_file, ciphertext_file_label)).grid(
         row=2, column=0, padx=20, pady=10)
     Button(
         ciphertext_frame,
         text="Create A File",
         font=(font_family, 12),
         background=button_colour2,
         command=lambda: Topic3.create_file(ciphertext_file, ciphertext_file_label)).grid(
         row=2, column=1, padx=20, pady=10)
 # ?
 # ? Key Mode Frame
     key_mode_frame = Frame(mainframe, bg=main_colour)
     key_mode_frame.grid(row=3, column=1)
     Label(
         key_mode_frame,
         text="Cipher Mode:",
         font=h2_font,
         background=main_colour).grid(row=0, column=0)
     cipher_mode_option = OptionMenu(
         key_mode_frame,
         cipher_mode,
         *cipher_mode_choices)
     cipher_mode_option.config(bg=button_colour2, relief="solid")
     cipher_mode_option.grid(row=0, column=1, padx=10, pady=10)
 # ?
 # ? Key Size Frame
     key_size_frame = Frame(mainframe, bg=main_colour)
     key_size_frame.grid(row=4, column=1)
     Label(
         key_size_frame,
         text="Key Size:",
         font=h2_font,
         background=main_colour).grid(row=0, column=0)
     key_size_option = OptionMenu(
         key_size_frame,
         key_size,
         *key_size_choices)
     key_size_option.config(bg=button_colour2, relief="solid")
     key_size_option.grid(row=0, column=1, padx=10, pady=10)
 # ?
 # ? Buttons Frame
     button_frame = Frame(mainframe, bg=main_colour)
     button_frame.grid(row=5, column=1)
     Button(
         button_frame,
         text="Encrypt",
         font=(font_family, 12),
         background=button_colour,
         command=lambda: Topic3.encrypt_data()).grid(
         row=1, column=1, padx=10, pady=10)
     Button(
         button_frame,
         text="Decrypt",
         font=(font_family, 12),
         background=button_colour,
         command=lambda: Topic3.decrypt_data()).grid(
         row=1, column=2, padx=10, pady=10)
 # ?
 # ? Errors Frame
     error_frame = Frame(mainframe, bg=main_colour)
     error_frame.grid(row=6, column=1)
     plaintext_input_error = Label(
         error_frame,
         text="",
         font=error_font,
         fg="red",
         background=main_colour)
     plaintext_input_error.grid(row=0, column=0)
     key_file_error = Label(
         error_frame,
         text="",
         font=error_font,
         fg="red",
         background=main_colour)
     key_file_error.grid(row=1, column=0)
     ciphertext_file_error = Label(
         error_frame,
         text="",
         font=error_font,
         fg="red",
         background=main_colour)
     ciphertext_file_error.grid(row=2, column=0)
     cipher_mode_error = Label(
         error_frame,
         text="",
         font=error_font,
         fg="red",
         background=main_colour)
     cipher_mode_error.grid(row=3, column=0)
 # ?
 # ? Response Frame
     response_frame = Frame(mainframe, bg=main_colour)
     response_frame.grid(row=7, column=1)
     success = Label(
         response_frame,
         text="",
         font=(font_family, 13, 'bold'),
         background=main_colour
     )
     success.grid(row=0, column=0, pady=5)
Beispiel #7
0
 def rail_fence_cipher_page():
     global plaintext_error, ciphertext_error, key_error, key_input, plaintext_input, ciphertext_input
     clear_screen(mainframe)
     # ? Title
     Label(mainframe,
           text="Rail Fence Cipher",
           font=h1_font,
           bg=main_colour).grid(row=0, column=0, columnspan=3)
     # ?
     # ? Plaintext Frame
     plaintext_frame = Frame(mainframe, bg=main_colour)
     plaintext_frame.grid(row=1, column=0)
     plaintext = Label(plaintext_frame,
                       text="Plaintext:",
                       font=h2_font,
                       background=main_colour)
     plaintext.grid(row=0, column=0, padx=10, pady=10)
     plaintext_input = Text(plaintext_frame,
                            width=box_width,
                            height=10,
                            font=h3_font,
                            relief="solid")
     plaintext_input.grid(row=1, column=0, padx=10, pady=10)
     # ?
     # ? Ciphertext Frame
     ciphertext_frame = Frame(mainframe, bg=main_colour)
     ciphertext_frame.grid(row=1, column=2)
     ciphertext = Label(ciphertext_frame,
                        text="Ciphertext:",
                        font=h2_font,
                        background=main_colour)
     ciphertext.grid(row=0, column=0, padx=10, pady=10)
     ciphertext_input = Text(ciphertext_frame,
                             width=box_width,
                             height=10,
                             font=h3_font,
                             relief="solid")
     ciphertext_input.grid(row=1, column=0, padx=10, pady=10)
     # ?
     # ? Key Frame
     key_frame = Frame(mainframe, bg=main_colour)
     key_frame.grid(row=1, column=1, padx=20)
     Label(key_frame,
           text="Key (number of rows)",
           font=h2_font,
           background=main_colour).grid(row=0, column=0)
     key_input = Entry(key_frame, width=8, font=h2_font, relief="solid")
     key_input.grid(row=0, column=1)
     # ?
     # ? Button Frame
     button_frame = Frame(mainframe, bg=main_colour)
     button_frame.grid(row=2, column=0, columnspan=3)
     Button(button_frame,
            text="Encrypt",
            font=(font_family, 12),
            background=button_colour,
            command=lambda: Rail_fence_cipher.encrypt_data()).grid(row=0,
                                                                   column=0,
                                                                   padx=10,
                                                                   pady=10)
     Button(button_frame,
            text="Decrypt",
            font=(font_family, 12),
            background=button_colour,
            command=lambda: Rail_fence_cipher.decrypt_data()).grid(row=0,
                                                                   column=1,
                                                                   padx=10,
                                                                   pady=10)
     # ?
     # ? Error Frame
     error_frame = Frame(mainframe, bg=main_colour)
     error_frame.grid(row=3, column=0, columnspan=3)
     plaintext_error = Label(error_frame,
                             text="",
                             fg="red",
                             font=error_font,
                             background=main_colour)
     plaintext_error.grid(row=0, column=0)
     key_error = Label(error_frame,
                       text="",
                       fg="red",
                       font=error_font,
                       background=main_colour)
     key_error.grid(row=1, column=0)
     ciphertext_error = Label(error_frame,
                              text="",
                              fg="red",
                              font=error_font,
                              background=main_colour)
     ciphertext_error.grid(row=2, column=0)
    def mono_alphabet_cipher_page():
        global Plaintext_error, Key_error, Ciphertext_error, Plaintext_input, Ciphertext_input, Key
        clear_screen(mainframe)
    # ? Title
        Label(
            mainframe,
            text="Monoalphabet Cipher",
            font=h1_font,
            bg=main_colour).grid(row=0, column=0, columnspan=3)
    # ?
    # ? Plaintext Frame
        plaintext_frame = Frame(mainframe, bg=main_colour)
        plaintext_frame.grid(row=1, column=0)
        plaintext = Label(
            plaintext_frame,
            text="Plaintext:",
            font=h2_font,
            background=main_colour)
        plaintext.grid(row=0, column=0, padx=10, pady=10)
        Plaintext_input = Text(
            plaintext_frame,
            width=box_width,
            height=10,
            font=h3_font,
            relief="solid")
        Plaintext_input.grid(row=1, column=0, padx=10, pady=10)
    # ?
    # ? Ciphertext Frame
        ciphertext_frame = Frame(mainframe, bg=main_colour)
        ciphertext_frame.grid(row=1, column=2)
        ciphertext = Label(
            ciphertext_frame,
            text="Ciphertext:",
            font=h2_font,
            background=main_colour)
        ciphertext.grid(row=0, column=0, padx=10, pady=10)
        Ciphertext_input = Text(
            ciphertext_frame,
            width=box_width,
            height=10,
            font=h3_font,
            relief="solid")
        Ciphertext_input.grid(row=1, column=0, padx=10, pady=10)
    # ?
    # ? Key Frame
        key_frame = Frame(mainframe, bg=main_colour)
        key_frame.grid(row=1, column=1, padx=20)
        Label(
            key_frame,
            text="Plaintext Alphabet",
            font=h2_font,
            background=main_colour).grid(row=3, column=0)
        Label(
            key_frame,
            text="Ciphertext Alphabet",
            font=h2_font,
            background=main_colour).grid(row=4, column=0)

        Message(
            key_frame,
            text="ABCDEFGHIJKLMNOPQRSTUVWXYZ",
            relief=RAISED,
            width=260,
            font=(font_family, 12),
            background="#ffffff").grid(row=3, column=1, columnspan=2)

        Key = Text(
            key_frame,
            width=27,
            height=1,
            font=(font_family, 12),
            relief="solid")
        Key.grid(row=4, column=1, columnspan=2)
    # ?
    # ? Button Frame
        button_frame = Frame(mainframe, bg=main_colour)
        button_frame.grid(row=2, column=0, columnspan=3)
        Button(
            button_frame,
            text="Encrypt",
            font=(font_family, 12),
            background=button_colour,
            command=lambda: Mono_alphabet_cipher.encrypt_data()).grid(row=0, column=0, padx=10, pady=10)
        Button(
            button_frame,
            text="Decrypt",
            font=(font_family, 12),
            background=button_colour,
            command=lambda: Mono_alphabet_cipher.decrypt_data()).grid(row=0, column=1, padx=10, pady=10)
    # ?
    # ? Error Frame
        error_frame = Frame(mainframe, bg=main_colour)
        error_frame.grid(row=3, column=0, columnspan=3)
        Plaintext_error = Label(
            error_frame,
            text="",
            font=error_font,
            fg="red",
            background=main_colour)
        Plaintext_error.grid(row=0, column=0)
        Key_error = Label(
            error_frame,
            text="",
            font=error_font,
            fg="red",
            background=main_colour)
        Key_error.grid(row=1, column=0)
        Ciphertext_error = Label(
            error_frame,
            text="",
            font=error_font,
            fg="red",
            background=main_colour)
        Ciphertext_error.grid(row=2, column=0)
    def diffie_hellman_page():
        global g_number, n_number, alice_number, bob_number, g_number_error, n_number_error, alice_number_error, bob_number_error, alice_key, bob_key

        alice_number = StringVar(mainframe)
        bob_number = StringVar(mainframe)
        g_number = StringVar(mainframe)
        n_number = StringVar(mainframe)

        clear_screen(mainframe)
        # ? Title
        Label(mainframe,
              text="Diffie Hellman Key Exchange",
              font=h1_font,
              bg=main_colour).grid(row=0, column=0, columnspan=5)
        # ?
        # ? Alice Frame
        alice_frame = Frame(mainframe, bg=main_colour)
        alice_frame.grid(row=1, column=0, rowspan=3)
        Label(alice_frame, text="Alice", font=h2_font,
              bg=main_colour).grid(row=0, column=0, columnspan=2)
        Label(alice_frame,
              text="Any random number:",
              font=h3_font,
              bg=main_colour).grid(row=1, column=0)
        Entry(alice_frame,
              width=10,
              font=h3_font,
              relief="solid",
              textvariable=alice_number).grid(row=1, column=1)
        alice_key = Label(alice_frame,
                          width=box_width,
                          font=h3_font,
                          bg=main_colour,
                          wraplength=350)
        alice_key.grid(row=2, column=0, columnspan=2, pady=(10, 0))

        # ? Bob Frame
        bob_frame = Frame(mainframe, bg=main_colour)
        bob_frame.grid(row=1, column=3, rowspan=3)
        Label(bob_frame, text="Bob", font=h2_font,
              bg=main_colour).grid(row=0, column=0, columnspan=2)
        Label(bob_frame,
              text="Any random number:",
              font=h3_font,
              bg=main_colour).grid(row=1, column=0)
        Entry(bob_frame,
              width=10,
              font=h3_font,
              relief="solid",
              textvariable=bob_number).grid(row=1, column=1)
        bob_key = Label(bob_frame,
                        width=box_width,
                        font=h3_font,
                        bg=main_colour,
                        wraplength=350)
        bob_key.grid(row=2, column=0, columnspan=2, pady=(10, 0))

        # ? Shared Number Frame
        shared_number_frame = Frame(mainframe, bg=main_colour)
        shared_number_frame.grid(row=1, column=1, padx=30, pady=20)
        Label(shared_number_frame,
              text="G (any prime number):",
              font=h3_font,
              bg=main_colour).grid(row=0, column=0)
        Entry(shared_number_frame,
              width=8,
              font=h3_font,
              relief="solid",
              textvariable=g_number).grid(row=0, column=1)
        Label(shared_number_frame,
              text="N (any prime number):",
              font=h3_font,
              bg=main_colour).grid(row=1, column=0)
        Entry(shared_number_frame,
              width=8,
              font=h3_font,
              relief="solid",
              textvariable=n_number).grid(row=1, column=1)

        # ? Button Frame
        button_frame = Frame(mainframe, bg=main_colour)
        button_frame.grid(row=2, column=1, pady=(10, 0))
        Button(button_frame,
               text="Generate Key",
               font=(font_family, 12),
               bg=button_colour,
               command=Diffie_hellman.generate_key).grid(row=0, column=0)
        # ? Error Frame
        error_frame = Frame(mainframe, bg=main_colour)
        error_frame.grid(row=3, column=0, columnspan=5)
        g_number_error = Label(error_frame)
        n_number_error = Label(error_frame)
        alice_number_error = Label(error_frame)
        bob_number_error = Label(error_frame)
        list_of_label_error = [
            g_number_error, n_number_error, alice_number_error,
            bob_number_error
        ]
        i = 0
        for label_error in list_of_label_error:
            label_error.config(font=error_font,
                               fg="red",
                               background=main_colour)
            label_error.grid(row=i, column=0)
            i += 1