コード例 #1
0
ファイル: main.py プロジェクト: kronos2003/Steno
        def pan():
            """Opens message prompt to enter message"""
            global mess
            message = Toplevel(aud_win)
            message.title('Enter Message')
            message.resizable(False, False)
            lm = Label(message,
                       text='Enter your message that you want to hide:',
                       bg='yellow',
                       font=cas)
            lm.pack(side=TOP, fill=BOTH)
            ho.CreateToolTip(
                lm,
                'The message that you\nenter here will be encoded\nin your chosen file.'
            )
            t = st.ScrolledText(message)
            t.config(font=cas)
            t.pack()

            def click(event=None):
                """Collects the message entered by user"""
                global mess
                message.withdraw()
                mess = t.get("1.0", "end-1c")

            bm = Button(message,
                        text='Done(Ctrl+b)',
                        command=click,
                        relief='flat',
                        bg='yellow',
                        font=cas)
            bm.pack(side=BOTTOM, fill=BOTH)
            ho.CreateToolTip(
                bm, 'This accepts the\nmessage you entered\nand encodes it.')
            message.bind('<Control-b>', click)
コード例 #2
0
ファイル: main.py プロジェクト: kronos2003/Steno
 def work(event=None):
     """Here after collecting the requirements decoding is carried out"""
     global data
     try:
         data = txt.decode(passwd=pass_ent.get(), file=file_ent.get())
     except FileNotFoundError:
         data = txt.decode(passwd=pass_ent.get(), file=file_loc)
     finally:
         text_win = Toplevel(dec)
         text_win.title('Decoded Message')
         text_win.resizable(False, False)
         show_lb = Label(
             text_win,
             text='The message hidden in the selected file:',
             bg='yellow',
             fg='red',
             font=cas)
         show_lb.pack(side=TOP, fill=BOTH)
         ho.CreateToolTip(
             show_lb,
             "Can't understand what's decoded\nthen your password is WRONG"
         )
         show_text = st.ScrolledText(text_win)
         show_text.pack()
         show_text.tag_configure('beauty', font=cas)
         show_text.insert(INSERT, data, 'beauty')
         show_text.config(state=DISABLED)
         show_bu = Button(text_win,
                          text='Exit',
                          bg='yellow',
                          fg='red',
                          command=text_win.destroy,
                          font=cas)
         show_bu.pack(side=BOTTOM, fill=BOTH)
         ho.CreateToolTip(show_bu, 'Closes the window')
コード例 #3
0
ファイル: main.py プロジェクト: kronos2003/Steno
        def choice():
            """Here the user's choice is evaluated & accordingly work is done"""
            global choice_button
            if select.get() == "1":
                """If the user chooses to enter a message a text prompt is opened"""
                message = Toplevel(master=win)
                message.title('Enter Message')
                message.resizable(False, False)
                lm = Label(message,
                           text='Enter your message that you want to hide:',
                           bg='yellow',
                           font=cas)
                lm.pack(side=TOP, fill=BOTH)
                ho.CreateToolTip(
                    lm,
                    'The message that you\nenter here will be encoded\nin your chosen file.'
                )
                t = st.ScrolledText(message)
                t.config(font=cas)
                t.pack()

                def click(event=None):
                    """Here we collect whatever message the user entered"""
                    global m_or_f
                    message.withdraw()
                    m_or_f = t.get("1.0", "end-1c")
                    # after getting message we allow the user to enter password
                    password.config(state=NORMAL)
                    password.focus()

                bm = Button(message,
                            text='Done(Ctrl+b)',
                            command=click,
                            relief='flat',
                            bg='yellow',
                            font=cas)
                bm.pack(side=BOTTOM, fill=BOTH)
                ho.CreateToolTip(
                    bm,
                    'This accepts the\nmessage you entered\nand encodes it.')
                message.bind('<Control-b>', click)
                choice_button.config(state=DISABLED)
                refresh.config(state=NORMAL)

            elif select.get() == "2":
                """If user chooses to encode a file then select file prompt opens up"""
                global m_or_f
                m.showinfo(
                    'Procedure',
                    'Select the file which contains\nthe data you want to encode.'
                )
                m_or_f = askopenfilename(parent=win,
                                         initialdir=os.getcwd(),
                                         title='Select File',
                                         filetypes=[('Text files', '.txt')],
                                         defaultextension='.txt')
                choice_button.config(state=DISABLED)
                refresh.config(state=NORMAL)
                password.config(state=NORMAL)
                password.focus()
コード例 #4
0
ファイル: main.py プロジェクト: kronos2003/Steno
    def ex_aud():
        """Data extracting function of audio steno"""
        global ex_file
        ex_win = Toplevel(root, bg='#c3f0fa')
        ex_win.title('Audio Steno-EXTRACT')
        ex_win.geometry('515x310')
        ex_lb = Label(ex_win,
                      text='Audio -Stenography[EXTRACT]',
                      bg='#c3f0fa',
                      fg='#fa05bd',
                      font=cas_big)
        ex_lb.place(x=10, y=10)
        file_lb = Label(ex_win,
                        text='Select File:',
                        font=cas,
                        bg='#c3f0fa',
                        fg='#fa0505')
        file_lb.place(x=5, y=50)
        file_ex = Entry(ex_win, width=55, font=cas, relief='ridge')
        file_ex.place(x=7, y=75)
        file_ex.focus()

        def browse():
            """Opens a prompt for selecting files"""
            global ex_file
            ex_file = askopenfilename(parent=ex_win,
                                      initialdir=os.getcwd(),
                                      title='Select File to EMBED',
                                      filetypes=[('Audio files', '.wav')],
                                      defaultextension='.wav')
            file_ex.delete(0, END)
            file_ex.insert(0, ex_file)
            file_lb.config(text='Selected File:')

        se_bu = Button(ex_win,
                       text='Browse',
                       bg='#8ed925',
                       font=cas,
                       command=browse,
                       relief='ridge')
        se_bu.place(x=450, y=70)
        ho.CreateToolTip(se_bu, 'Browse thorough &\nselect the file')

        def extract_data(event=None):
            """Extracts data from the audio file and shows it in a text box"""
            dat = aud.extract(ex_file)
            suc_lb = Label(ex_win,
                           text='Hidden message is:',
                           font=cas,
                           fg='#f50c81',
                           bg='#c3f0fa').place(x=6, y=130)
            sh = st.ScrolledText(ex_win, width=60, height=7, font=cas)
            sh.place(x=8, y=155)
            sh.insert(INSERT, dat)
            sh.config(state=DISABLED)

        ex_bu = Button(ex_win,
                       text='Extract Message',
                       bg='#f79205',
                       font=cas,
                       command=extract_data)
        ex_bu.place(x=10, y=100)
        ho.CreateToolTip(ex_bu, 'Extracts the hidden \ndata & displays it')
        ex_win.bind('<Return>', extract_data)

        qu_bu = Button(ex_win,
                       text='Exit',
                       font=cas,
                       bg='#f23f3f',
                       fg='#e1f719',
                       command=ex_win.destroy)
        qu_bu.place(x=467, y=278)
        ho.CreateToolTip(qu_bu, 'Exits window')
コード例 #5
0
ファイル: main.py プロジェクト: kronos2003/Steno
    def em_aud():
        """Audio steno's embedding function"""
        global file, mess
        select_lb = Label(aud_win,
                          text='Select File:',
                          font=cas,
                          bg='#c3f0fa',
                          fg='#fa0505')
        select_lb.place(x=5, y=50)
        file_au = Entry(aud_win, width=55, font=cas, relief='ridge')
        file_au.place(x=7, y=75)
        file_au.focus()

        def browse():
            """Opens a prompt for selecting files"""
            global file
            file = askopenfilename(parent=aud_win,
                                   initialdir=os.getcwd(),
                                   title='Select File to EMBED',
                                   filetypes=[('Audio files', '.wav')],
                                   defaultextension='.wav')
            file_au.delete(0, END)
            file_au.insert(0, file)
            select_lb.config(text='Selected File:')

        se_bu = Button(aud_win,
                       text='Browse',
                       bg='#8ed925',
                       font=cas,
                       command=browse,
                       relief='ridge')
        se_bu.place(x=450, y=70)
        ho.CreateToolTip(se_bu, 'Browse thorough &\nselect the file')

        def pan():
            """Opens message prompt to enter message"""
            global mess
            message = Toplevel(aud_win)
            message.title('Enter Message')
            message.resizable(False, False)
            lm = Label(message,
                       text='Enter your message that you want to hide:',
                       bg='yellow',
                       font=cas)
            lm.pack(side=TOP, fill=BOTH)
            ho.CreateToolTip(
                lm,
                'The message that you\nenter here will be encoded\nin your chosen file.'
            )
            t = st.ScrolledText(message)
            t.config(font=cas)
            t.pack()

            def click(event=None):
                """Collects the message entered by user"""
                global mess
                message.withdraw()
                mess = t.get("1.0", "end-1c")

            bm = Button(message,
                        text='Done(Ctrl+b)',
                        command=click,
                        relief='flat',
                        bg='yellow',
                        font=cas)
            bm.pack(side=BOTTOM, fill=BOTH)
            ho.CreateToolTip(
                bm, 'This accepts the\nmessage you entered\nand encodes it.')
            message.bind('<Control-b>', click)

        b = Button(aud_win,
                   command=pan,
                   text='Enter Message',
                   font=cas,
                   bg='#94f748')
        b.place(x=10, y=100)
        ho.CreateToolTip(b, 'Opens a prompt where you can enter message')
        success = Label(aud_win, bg='#c3f0fa', font=cas)
        success.place(x=10, y=170)

        def done():
            """Main function which asks for saving file location and then embeds the data in audio file"""
            global file, mess
            m.showinfo(
                'Procedure',
                'Where would you like the embedded file to be saved?\n'
                'Select the path in the next window.')
            out = asksaveasfilename(title='Save your embedded file as',
                                    filetypes=[('Audio File', '.wav')],
                                    defaultextension='.wav',
                                    initialdir=os.getcwd(),
                                    parent=aud_win)
            if mess != '' and file != '' and file_au.get() != '' and out != '':
                try:
                    aud.embed(infile=file, message=mess, outfile=out)
                    success.config(text='Successfully embedded message in\n{}'.
                                   format(out))
                except FileNotFoundError:
                    aud.embed(infile=file_au.get(), message=mess, outfile=out)
                    success.config(text='Successfully embedded message in\n{}'.
                                   format(out))
            else:
                m.showerror('ERROR', 'Something went wrong try again')

        main_bu = Button(aud_win,
                         text='Embed Message',
                         bg='#f79205',
                         font=cas,
                         command=done)
        main_bu.place(x=10, y=130)
        ho.CreateToolTip(main_bu, 'Checks everything and embeds your data')
コード例 #6
0
ファイル: main.py プロジェクト: kronos2003/Steno
def audio_steno():
    """Audio stenography functions"""
    aud_win = Toplevel(master=root, bg='#c3f0fa')
    aud_win.title('Audio Steno')
    aud_win.geometry('515x260')
    au_lb = Label(aud_win,
                  text='Audio -Stenography',
                  bg='#c3f0fa',
                  fg='#fa05bd',
                  font=cas_big)
    au_lb.place(x=10, y=10)

    def em_aud():
        """Audio steno's embedding function"""
        global file, mess
        select_lb = Label(aud_win,
                          text='Select File:',
                          font=cas,
                          bg='#c3f0fa',
                          fg='#fa0505')
        select_lb.place(x=5, y=50)
        file_au = Entry(aud_win, width=55, font=cas, relief='ridge')
        file_au.place(x=7, y=75)
        file_au.focus()

        def browse():
            """Opens a prompt for selecting files"""
            global file
            file = askopenfilename(parent=aud_win,
                                   initialdir=os.getcwd(),
                                   title='Select File to EMBED',
                                   filetypes=[('Audio files', '.wav')],
                                   defaultextension='.wav')
            file_au.delete(0, END)
            file_au.insert(0, file)
            select_lb.config(text='Selected File:')

        se_bu = Button(aud_win,
                       text='Browse',
                       bg='#8ed925',
                       font=cas,
                       command=browse,
                       relief='ridge')
        se_bu.place(x=450, y=70)
        ho.CreateToolTip(se_bu, 'Browse thorough &\nselect the file')

        def pan():
            """Opens message prompt to enter message"""
            global mess
            message = Toplevel(aud_win)
            message.title('Enter Message')
            message.resizable(False, False)
            lm = Label(message,
                       text='Enter your message that you want to hide:',
                       bg='yellow',
                       font=cas)
            lm.pack(side=TOP, fill=BOTH)
            ho.CreateToolTip(
                lm,
                'The message that you\nenter here will be encoded\nin your chosen file.'
            )
            t = st.ScrolledText(message)
            t.config(font=cas)
            t.pack()

            def click(event=None):
                """Collects the message entered by user"""
                global mess
                message.withdraw()
                mess = t.get("1.0", "end-1c")

            bm = Button(message,
                        text='Done(Ctrl+b)',
                        command=click,
                        relief='flat',
                        bg='yellow',
                        font=cas)
            bm.pack(side=BOTTOM, fill=BOTH)
            ho.CreateToolTip(
                bm, 'This accepts the\nmessage you entered\nand encodes it.')
            message.bind('<Control-b>', click)

        b = Button(aud_win,
                   command=pan,
                   text='Enter Message',
                   font=cas,
                   bg='#94f748')
        b.place(x=10, y=100)
        ho.CreateToolTip(b, 'Opens a prompt where you can enter message')
        success = Label(aud_win, bg='#c3f0fa', font=cas)
        success.place(x=10, y=170)

        def done():
            """Main function which asks for saving file location and then embeds the data in audio file"""
            global file, mess
            m.showinfo(
                'Procedure',
                'Where would you like the embedded file to be saved?\n'
                'Select the path in the next window.')
            out = asksaveasfilename(title='Save your embedded file as',
                                    filetypes=[('Audio File', '.wav')],
                                    defaultextension='.wav',
                                    initialdir=os.getcwd(),
                                    parent=aud_win)
            if mess != '' and file != '' and file_au.get() != '' and out != '':
                try:
                    aud.embed(infile=file, message=mess, outfile=out)
                    success.config(text='Successfully embedded message in\n{}'.
                                   format(out))
                except FileNotFoundError:
                    aud.embed(infile=file_au.get(), message=mess, outfile=out)
                    success.config(text='Successfully embedded message in\n{}'.
                                   format(out))
            else:
                m.showerror('ERROR', 'Something went wrong try again')

        main_bu = Button(aud_win,
                         text='Embed Message',
                         bg='#f79205',
                         font=cas,
                         command=done)
        main_bu.place(x=10, y=130)
        ho.CreateToolTip(main_bu, 'Checks everything and embeds your data')

    def ex_aud():
        """Data extracting function of audio steno"""
        global ex_file
        ex_win = Toplevel(root, bg='#c3f0fa')
        ex_win.title('Audio Steno-EXTRACT')
        ex_win.geometry('515x310')
        ex_lb = Label(ex_win,
                      text='Audio -Stenography[EXTRACT]',
                      bg='#c3f0fa',
                      fg='#fa05bd',
                      font=cas_big)
        ex_lb.place(x=10, y=10)
        file_lb = Label(ex_win,
                        text='Select File:',
                        font=cas,
                        bg='#c3f0fa',
                        fg='#fa0505')
        file_lb.place(x=5, y=50)
        file_ex = Entry(ex_win, width=55, font=cas, relief='ridge')
        file_ex.place(x=7, y=75)
        file_ex.focus()

        def browse():
            """Opens a prompt for selecting files"""
            global ex_file
            ex_file = askopenfilename(parent=ex_win,
                                      initialdir=os.getcwd(),
                                      title='Select File to EMBED',
                                      filetypes=[('Audio files', '.wav')],
                                      defaultextension='.wav')
            file_ex.delete(0, END)
            file_ex.insert(0, ex_file)
            file_lb.config(text='Selected File:')

        se_bu = Button(ex_win,
                       text='Browse',
                       bg='#8ed925',
                       font=cas,
                       command=browse,
                       relief='ridge')
        se_bu.place(x=450, y=70)
        ho.CreateToolTip(se_bu, 'Browse thorough &\nselect the file')

        def extract_data(event=None):
            """Extracts data from the audio file and shows it in a text box"""
            dat = aud.extract(ex_file)
            suc_lb = Label(ex_win,
                           text='Hidden message is:',
                           font=cas,
                           fg='#f50c81',
                           bg='#c3f0fa').place(x=6, y=130)
            sh = st.ScrolledText(ex_win, width=60, height=7, font=cas)
            sh.place(x=8, y=155)
            sh.insert(INSERT, dat)
            sh.config(state=DISABLED)

        ex_bu = Button(ex_win,
                       text='Extract Message',
                       bg='#f79205',
                       font=cas,
                       command=extract_data)
        ex_bu.place(x=10, y=100)
        ho.CreateToolTip(ex_bu, 'Extracts the hidden \ndata & displays it')
        ex_win.bind('<Return>', extract_data)

        qu_bu = Button(ex_win,
                       text='Exit',
                       font=cas,
                       bg='#f23f3f',
                       fg='#e1f719',
                       command=ex_win.destroy)
        qu_bu.place(x=467, y=278)
        ho.CreateToolTip(qu_bu, 'Exits window')

    bu_en = Button(aud_win,
                   text='Embed',
                   font=cas,
                   bg='#05ff82',
                   fg='#0569ff',
                   command=em_aud)
    bu_en.place(x=70, y=220)
    ho.CreateToolTip(bu_en, 'Embeds data in audio file')
    bu_ex = Button(aud_win,
                   text='Extract',
                   font=cas,
                   bg='#acff05',
                   fg='#fa029b',
                   command=ex_aud)
    bu_ex.place(x=260, y=220)
    ho.CreateToolTip(bu_ex, 'Extracts data from audio file')
    qubu = Button(aud_win,
                  text='Exit',
                  font=cas,
                  bg='#f23f3f',
                  fg='#e1f719',
                  command=aud_win.destroy)
    qubu.place(x=410, y=220)
    ho.CreateToolTip(qubu, 'Exits window')
コード例 #7
0
ファイル: main.py プロジェクト: kronos2003/Steno
    def encode():
        """encoding function for text files"""
        global choice_button, infile_loc
        outfile_loc, m_or_f = '', ''

        size_label = Label(win,
                           text='Select File:',
                           font=cas,
                           bg='#c0ed98',
                           fg='#f20713')
        size_label.place(x=5, y=45)
        es = Entry(win, width=50, font=cas)
        es.place(x=7, y=65)

        def browse():
            """Opens a prompt for selecting files"""
            global infile_loc
            infile_loc = askopenfilename(parent=win,
                                         initialdir=os.getcwd(),
                                         title='Select File to DECODE',
                                         filetypes=[('Text files', '.txt')],
                                         defaultextension='.txt')
            es.delete(0, END)
            es.insert(0, infile_loc)
            size_label.config(text='Selected File:')

        se_bu = Button(win,
                       text='Browse',
                       bg='#8ed925',
                       font=cas,
                       command=browse,
                       relief='ridge')
        se_bu.place(x=411, y=61)
        ho.CreateToolTip(se_bu, 'Browse thorough &\nselect the file')

        # TODO add a widget where user will be able to see contents of their chosen file

        ch_lb = Label(win,
                      text='Select what you want to hide',
                      bg='#c0ed98',
                      fg='#1046b3',
                      font=cas)
        ch_lb.place(x=5, y=85)
        select = StringVar(win)
        style = ttk.Style(master=win)
        style.configure('C.TRadiobutton',
                        font=cas,
                        background='#c0ed98',
                        foreground='#1046b3')

        message_ch = ttk.Radiobutton(win,
                                     text='Hide a Message',
                                     value="1",
                                     variable=select,
                                     style='C.TRadiobutton')
        message_ch.place(x=5, y=105)

        choice_file = ttk.Radiobutton(win,
                                      text='Hide a File',
                                      value="2",
                                      variable=select,
                                      style='C.TRadiobutton')
        choice_file.place(x=5, y=130)

        password = Entry(win, width=20, show='*', font=cas, state=DISABLED)
        password.place(x=10, y=185)

        def choice():
            """Here the user's choice is evaluated & accordingly work is done"""
            global choice_button
            if select.get() == "1":
                """If the user chooses to enter a message a text prompt is opened"""
                message = Toplevel(master=win)
                message.title('Enter Message')
                message.resizable(False, False)
                lm = Label(message,
                           text='Enter your message that you want to hide:',
                           bg='yellow',
                           font=cas)
                lm.pack(side=TOP, fill=BOTH)
                ho.CreateToolTip(
                    lm,
                    'The message that you\nenter here will be encoded\nin your chosen file.'
                )
                t = st.ScrolledText(message)
                t.config(font=cas)
                t.pack()

                def click(event=None):
                    """Here we collect whatever message the user entered"""
                    global m_or_f
                    message.withdraw()
                    m_or_f = t.get("1.0", "end-1c")
                    # after getting message we allow the user to enter password
                    password.config(state=NORMAL)
                    password.focus()

                bm = Button(message,
                            text='Done(Ctrl+b)',
                            command=click,
                            relief='flat',
                            bg='yellow',
                            font=cas)
                bm.pack(side=BOTTOM, fill=BOTH)
                ho.CreateToolTip(
                    bm,
                    'This accepts the\nmessage you entered\nand encodes it.')
                message.bind('<Control-b>', click)
                choice_button.config(state=DISABLED)
                refresh.config(state=NORMAL)

            elif select.get() == "2":
                """If user chooses to encode a file then select file prompt opens up"""
                global m_or_f
                m.showinfo(
                    'Procedure',
                    'Select the file which contains\nthe data you want to encode.'
                )
                m_or_f = askopenfilename(parent=win,
                                         initialdir=os.getcwd(),
                                         title='Select File',
                                         filetypes=[('Text files', '.txt')],
                                         defaultextension='.txt')
                choice_button.config(state=DISABLED)
                refresh.config(state=NORMAL)
                password.config(state=NORMAL)
                password.focus()

        choice_button = Button(win,
                               text='Select',
                               command=choice,
                               bg='#08d0fc',
                               font=cas,
                               relief='ridge')
        choice_button.place(x=152, y=122)
        ho.CreateToolTip(choice_button,
                         'Opens a prompt according\nto your chosen option.')

        def process():
            """Here the password's eyes show & hide functions are carried out"""
            if password["state"] == ACTIVE or password['state'] == NORMAL:
                if password["show"] == '*':
                    password.config(show="")
                    pass_button.config(image=img2)
                elif password["show"] == "":
                    password.config(show='*')
                    pass_button.config(image=img)

        pass_label = Label(win,
                           text='Set password:'******'#c0ed98',
                           fg='#1046b3')
        pass_label.place(x=10, y=155)

        pass_button = Button(win,
                             image=img,
                             relief='ridge',
                             bg='#36f5eb',
                             command=process)
        pass_button.place(x=195, y=180)
        ho.CreateToolTip(pass_button, 'Show/ Hide password')
        success = Label(win, bg='#c0ed98', font=cas, fg='red')
        success.place(x=20, y=280)

        def execute():
            """Main function which checks the requirements and encodes data accordingly"""
            global outfile_loc, m_or_f
            m.showinfo(
                'Procedure',
                'Where would you like the encoded file to be saved?\n'
                'Select the path in the next window.')
            outfile_loc = asksaveasfilename(title='Save your encoded file as',
                                            filetypes=[('Text File', '.txt')],
                                            defaultextension='.txt',
                                            initialdir=os.getcwd(),
                                            parent=win)
            if password.get(
            ) != '' and infile_loc != '' and outfile_loc != '' and m_or_f != '' and es.get(
            ) != '':
                if select.get() == '1':
                    try:
                        txt.encode(passwd=password.get(),
                                   infile=es.get(),
                                   outfile=outfile_loc,
                                   message=m_or_f)
                        success.config(
                            text='Successfully encoded message in\n{}'.format(
                                outfile_loc))
                    except FileNotFoundError:
                        txt.encode(passwd=password.get(),
                                   infile=infile_loc,
                                   outfile=outfile_loc,
                                   message=m_or_f)
                        success.config(
                            text='Successfully encoded message in\n{}'.format(
                                outfile_loc))
                elif select.get() == '2':
                    try:
                        txt.encode(passwd=password.get(),
                                   infile=es.get(),
                                   outfile=outfile_loc,
                                   file=m_or_f)
                        success.config(
                            text='Successfully encoded file\n{} in\n{}'.format(
                                m_or_f, outfile_loc))
                    except FileNotFoundError:
                        txt.encode(passwd=password.get(),
                                   infile=infile_loc,
                                   outfile=outfile_loc,
                                   file=m_or_f)
                        success.config(
                            text='Successfully encoded file\n{} in\n{}'.format(
                                m_or_f, outfile_loc))
            else:
                m.showerror('ERROR', 'Something went wrong\ntry again.')

        main = Button(win,
                      text='Hide Data',
                      command=execute,
                      bg='#eba823',
                      relief='ridge',
                      font=cas)
        main.place(x=20, y=250)
        ho.CreateToolTip(main, 'Checks everything\nthen encodes the data')

        # TODO show contents of file after encoding[optional]

        def refresh():
            """If the user wants to again choose the options"""
            if choice_button['state'] == DISABLED:
                choice_button.config(state=NORMAL)

        refresh = Button(win,
                         text='Refresh',
                         command=refresh,
                         state=DISABLED,
                         relief='ridge',
                         font=cas,
                         bg='#fca903')
        refresh.place(x=360, y=122)
        ho.CreateToolTip(refresh, 'Refreshes Page')
コード例 #8
0
ファイル: main.py プロジェクト: kronos2003/Steno
    def decode():
        """Decoding function for text files"""
        global file_loc
        dec = Toplevel(master=root, bg='#c0ed98')
        dec.title('Text Steno-DECODE')
        dec.geometry('480x250')
        dec_label = Label(dec,
                          text='Text -Stenography[DECODE]',
                          font=cas_big,
                          bg='#c0ed98',
                          fg='#1046b3')
        dec_label.place(x=5, y=4)
        info_label = Label(dec,
                           text='Select File:',
                           font=cas,
                           bg='#c0ed98',
                           fg='#f20713')
        info_label.place(x=5, y=60)
        file_ent = Entry(master=dec, width=50, font=cas)
        file_ent.place(x=7, y=85)

        def browse():
            """Opens a prompt for selecting files"""
            global file_loc
            file_loc = askopenfilename(parent=dec,
                                       initialdir=os.getcwd(),
                                       title='Select File to DECODE',
                                       filetypes=[('Text files', '.txt')],
                                       defaultextension='.txt')
            file_ent.delete(0, END)
            file_ent.insert(0, file_loc)
            info_label.config(text='Selected File:')

        se_bu = Button(dec,
                       text='Browse',
                       bg='#8ed925',
                       font=cas,
                       command=browse,
                       relief='ridge')
        se_bu.place(x=410, y=82)
        ho.CreateToolTip(se_bu, 'Browse thorough &\nselect the file')

        pass_lb = Label(dec,
                        text='Enter password:'******'#c0ed98',
                        fg='#1046b3',
                        font=cas)
        pass_lb.place(x=5, y=110)
        pass_ent = Entry(dec, width=20, font=cas, show='*')
        pass_ent.place(x=7, y=135)
        pass_ent.focus()

        def show():
            """Here the password's eyes show & hide functions are carried out"""
            if pass_ent["state"] == ACTIVE or pass_ent['state'] == NORMAL:
                if pass_ent["show"] == '*':
                    pass_ent.config(show="")
                    pass_bu.config(image=img2)
                elif pass_ent["show"] == "":
                    pass_ent.config(show='*')
                    pass_bu.config(image=img)

        pass_bu = Button(dec,
                         image=img,
                         command=show,
                         bg='#36f5eb',
                         relief='ridge')
        pass_bu.place(x=190, y=130)
        ho.CreateToolTip(pass_bu, 'Show/ Hide password')

        def work(event=None):
            """Here after collecting the requirements decoding is carried out"""
            global data
            try:
                data = txt.decode(passwd=pass_ent.get(), file=file_ent.get())
            except FileNotFoundError:
                data = txt.decode(passwd=pass_ent.get(), file=file_loc)
            finally:
                text_win = Toplevel(dec)
                text_win.title('Decoded Message')
                text_win.resizable(False, False)
                show_lb = Label(
                    text_win,
                    text='The message hidden in the selected file:',
                    bg='yellow',
                    fg='red',
                    font=cas)
                show_lb.pack(side=TOP, fill=BOTH)
                ho.CreateToolTip(
                    show_lb,
                    "Can't understand what's decoded\nthen your password is WRONG"
                )
                show_text = st.ScrolledText(text_win)
                show_text.pack()
                show_text.tag_configure('beauty', font=cas)
                show_text.insert(INSERT, data, 'beauty')
                show_text.config(state=DISABLED)
                show_bu = Button(text_win,
                                 text='Exit',
                                 bg='yellow',
                                 fg='red',
                                 command=text_win.destroy,
                                 font=cas)
                show_bu.pack(side=BOTTOM, fill=BOTH)
                ho.CreateToolTip(show_bu, 'Closes the window')

        decode_main = Button(dec,
                             text='Decode',
                             relief='ridge',
                             bg='#00fc69',
                             font=cas,
                             command=work)
        decode_main.place(x=10, y=190)
        ho.CreateToolTip(
            decode_main,
            'Checks the requirements then\nshows the decoded data.')
        exit_dec = Button(dec,
                          text='Exit',
                          bg='#eb3131',
                          font=cas,
                          relief='ridge',
                          command=dec.destroy)
        exit_dec.place(x=360, y=200)
        ho.CreateToolTip(exit_dec, 'Closes the window')
        dec.bind('<Return>', work)
コード例 #9
0
ファイル: main.py プロジェクト: kronos2003/Steno
lb = Label(root,
           text="Steno\n- Ultimate Stenography",
           font=('Showcard Gothic', 20),
           bg='#f5f59a',
           fg='#8507fa')
lb.place(x=18, y=20)

text = Button(root,
              text='Text\nStenography',
              relief='flat',
              bg='#A68064',
              command=text_steno,
              font=cas)
text.place(x=56, y=250)
ho.CreateToolTip(text, 'Click here\nto hide your\ndata in a text file')

image = Button(root,
               text='Image\nStenography',
               relief='flat',
               bg='#A68064',
               command=image_steno,
               font=cas)
image.place(x=156, y=250)
ho.CreateToolTip(image, 'Click here\nto hide your\ndata in an image file')

audio = Button(root,
               text='Audio\nStenography',
               relief='flat',
               bg='#A68064',
               command=audio_steno,