diff --git a/New Folder (2)/COMPUTER_PROJECT.docx b/New Folder (2)/COMPUTER_PROJECT.docx deleted file mode 100644 index c9252f1..0000000 Binary files a/New Folder (2)/COMPUTER_PROJECT.docx and /dev/null differ diff --git a/New Folder (2)/LICENSE b/New Folder (2)/LICENSE deleted file mode 100644 index a52ad75..0000000 --- a/New Folder (2)/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 Sohel Ahmed - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/New Folder (2)/README.md b/New Folder (2)/README.md deleted file mode 100644 index 0d61196..0000000 --- a/New Folder (2)/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# Steno :loop: -## Ultimate Stenography software:superhero: -The do all stenography application.:grin:
-**Formats Supported-** -- Images -- Audio -- Text -- ~~Video~~ _To be supported in future version_ ->This is an important application especially in today's world.
-> We need hide the messages rather than only encrypting them. ---- -### Stenography is not Cryptography ! :confused: -If you are getting confused between _Stenography_ & _Cryptography_. Then see this - -#### Cryptography -**If** `you = wms` **then** `Qcaapgrw gq gknmprylr` **= ?**
-_Can you guess the answer?_
-Here we have `key = -2` i.e. if we go 2 alphabets behind `y` you get -`w` and similarly if you go 2 alphabets behind `o` we get `m` and similarly 2 alphabets behind `u` gives us `s`. Therefore `you = wms`.
-So now you may have got the answer which is `Security is important`. -> Note: The cryptography algorithms are much advanced now. -#### Stenography -So now that you know what is cryptography so lets know what is _Stenography_.
-**If** `____=____` **then** `______=______` **?**
-_Confused ?_
-Here you won't be able to even sense the presence of data. Leave alone knowing what -is the data. That's why it is called hiding data in plain sight. There are some applications which -may detect the presence of hidden data. CIA obviously has it
-Generally at professional level the data hidden is encrypted first. So _stenography_ and _cryptography_ are not -mutually exclusive to each other. ->Knowledge fact: Jeff Bezos's mobile was hacked by hiding malicious code in a media ->file which on getting downloaded sent the host device's control to the hacker. ---- \ No newline at end of file diff --git a/New Folder (2)/SNOW.EXE b/New Folder (2)/SNOW.EXE deleted file mode 100644 index 332e8a9..0000000 Binary files a/New Folder (2)/SNOW.EXE and /dev/null differ diff --git a/New Folder (2)/data.db b/New Folder (2)/data.db deleted file mode 100644 index 3a34f0e..0000000 Binary files a/New Folder (2)/data.db and /dev/null differ diff --git a/New Folder (2)/images/noshow.png b/New Folder (2)/images/noshow.png deleted file mode 100644 index d8dddb9..0000000 Binary files a/New Folder (2)/images/noshow.png and /dev/null differ diff --git a/New Folder (2)/images/show.png b/New Folder (2)/images/show.png deleted file mode 100644 index c8931ae..0000000 Binary files a/New Folder (2)/images/show.png and /dev/null differ diff --git a/New Folder (2)/main.txt b/New Folder (2)/main.txt deleted file mode 100644 index d1b9a0a..0000000 --- a/New Folder (2)/main.txt +++ /dev/null @@ -1,570 +0,0 @@ -import os -import tkinter.scrolledtext as st -from tkinter import * -from tkinter import messagebox as m -from tkinter import ttk -from tkinter.filedialog import askopenfilename, asksaveasfilename - -import sten.hover as ho -import sten.text as txt -import sten.audio as aud -import sten.image as img -import sten.databse as db -# TODO add database management systems[important] -root = Tk() -root.title('Steno') -root.config(bg='#f5f59a') - -# centering the main window -root_h, root_w = 300, 400 -s_w = root.winfo_screenwidth() -s_h = root.winfo_screenheight() -x_coor = int((s_w / 2) - (root_w / 2)) -y_coor = int((s_h / 2) - (root_h / 2)) -root.geometry("{}x{}+{}+{}".format(root_w, root_h, x_coor, y_coor)) - -root.resizable(False, False) -# defining the fonts used and images -cas = ('Cascadia Code', 10) -cas_big = ('Cascadia Code', 20) -img = PhotoImage(file="images/noshow.png").subsample(4, 4) -img2 = PhotoImage(file="images/show.png").subsample(4, 4) -# TODO add documentation - - -def text_steno(): - """The text stenography function this includes both encoding and decoding""" - win = Toplevel(master=root, bg='#c0ed98') - win.title('Text Steno') - win.geometry('480x410') - win_label = Label(win, text='Text -Stenography', font=cas_big, bg='#c0ed98', fg='#1046b3') - win_label.place(x=5, y=4) - - 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 ENCODE', - 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('', 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:', font=cas, bg='#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') - - 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:', bg='#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('', work) - - encoding = Button(win, text='Encode data', command=encode, relief='ridge', font=cas, bg='#f00c58') - encoding.place(x=40, y=360) - ho.CreateToolTip(encoding, 'Encoding data function') - decoding = Button(win, text="Decode data", command=decode, relief='ridge', font=cas, bg='#6b0cf0') - decoding.place(x=180, y=360) - ho.CreateToolTip(decoding, "Decoding data function") - exit_win = Button(win, text='Exit', bg='#eb3131', font=cas, relief='ridge', command=win.destroy) - exit_win.place(x=360, y=360) - ho.CreateToolTip(exit_win, 'Closes the window') - - -def image_steno(): - """Image stenography function""" - img_win=Toplevel(master=root,bg='#c3f0fa') - img_win.title('Image steno') - img_win.geometry('515x260') - im_lb=Label(img_win,text='Image -stenography',bg='#c3f0fa',fg='#fa05bd', font=cas_big) - im_lb.place(x=10,y=10) - - def em_img(): - """Image stenography functions""" - global file,mess - select_lb=Label(img_win,text='Select File:',font=cas,bg='#c3f0fa',fg='#fa05bd') - select_lb.place(x=5,y=50) - file_im=Entry(img_win,width=55,font=cas,relief='ridge') - file_im.place(x=7,y=75) - file_im.place(x=7,y=75) - file_im.focus() - - def browse(): - """Opens a prompt for selecting files""" - global file - file = askopenfilename(parent=img_win, initialdir=os.getcwd(), title='Select File to EMBED', - filetypes=[('Image files', '.png')], defaultextension='.png') - file_im.delete(0, END) - file_im.insert(0, file) - select_lb.config(text='Selected File:') - - se_bu = Button(img_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(img_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('', click) - - b = Button(img_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(img_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 image 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=[('Image files', '.png')], - defaultextension='.png', initialdir=os.getcwd(), parent=img_win) - if mess != '' and file != '' and file_im.get() != '' and out != '': - try: - img.embed(infile=file, message=mess, outfile=out) - success.config(text='Successfully embedded message in\n{}'.format(out)) - except FileNotFoundError: - img.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(img_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_img(): - """Data extracting function of audio steno""" - global ex_file - ex_win = Toplevel(root, bg='#c3f0fa') - ex_win.title('Image Steno-EXTRACT') - ex_win.geometry('515x310') - ex_lb = Label(ex_win, text='Image -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=[('Image files', '.png')], defaultextension='.png') - 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 = img.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('', 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(img_win, text='Embed', font=cas, bg='#05ff82', fg='#0569ff', command=em_img) - bu_en.place(x=70, y=220) - ho.CreateToolTip(bu_en, 'Embeds data in image file') - bu_ex = Button(img_win, text='Extract', font=cas, bg='#acff05', fg='#fa029b', command=ex_img) - bu_ex.place(x=260, y=220) - ho.CreateToolTip(bu_ex, 'Extracts data from image file') - qubu = Button(img_win, text='Exit', font=cas, bg='#f23f3f', fg='#e1f719', command=img_win.destroy) - qubu.place(x=410, y=220) - ho.CreateToolTip(qubu, 'Exits window') - - - -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('', 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('', 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') - - -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, font=cas) -audio.place(x=256, y=250) -ho.CreateToolTip(audio, 'Click here\nto hide data in\n an audio file.') - -root.mainloop() diff --git a/New Folder (2)/sten/audio.py b/New Folder (2)/sten/audio.py deleted file mode 100644 index f119796..0000000 --- a/New Folder (2)/sten/audio.py +++ /dev/null @@ -1,47 +0,0 @@ -# this module comes with standard python installation -import wave -""" -*<[only supports wave files]>* -This module helps us in performing audio stenography -on wave files as they are lossless audio files. -link - https://tinyurl.com/yy3sx6ku -""" - - -def embed(infile: str, message: str, outfile: str): - # TODO add password functionality preferably using encryption - """This takes your message and hides it in infile and saves it in outfile""" - song = wave.open(infile, mode='rb') - # Read frames and convert to byte array - frame_bytes = bytearray(list(song.readframes(song.getnframes()))) - - # Append dummy data to fill out rest of the bytes. Receiver shall detect and remove these characters. - message = message + int((len(frame_bytes) - (len(message) * 8 * 8)) / 8) * '#' - # Convert text to bit array - bits = list(map(int, ''.join([bin(ord(i)).lstrip('0b').rjust(8, '0') for i in message]))) - - # Replace LSB of each byte of the audio data by one bit from the text bit array - for i, bit in enumerate(bits): - frame_bytes[i] = (frame_bytes[i] & 254) | bit - frame_modified = bytes(frame_bytes) - - # Write bytes to a new wave audio file - with wave.open(outfile, 'wb') as fd: - fd.setparams(song.getparams()) - fd.writeframes(frame_modified) - song.close() - - -def extract(file: str): - """This function takes the filepath and decodes the hidden data and returns it""" - song = wave.open(file, mode='rb') - # Convert audio to byte array - frame_bytes = bytearray(list(song.readframes(song.getnframes()))) - # Extract the LSB of each byte - extracted = [frame_bytes[i] & 1 for i in range(len(frame_bytes))] - # Convert byte array back to string - message = "".join(chr(int("".join(map(str, extracted[i:i+8])), 2)) for i in range(0, len(extracted), 8)) - # Cut off at the filler characters - decoded = message.split("###")[0] - song.close() - return decoded diff --git a/New Folder (2)/sten/database.py b/New Folder (2)/sten/database.py deleted file mode 100644 index b651dd1..0000000 --- a/New Folder (2)/sten/database.py +++ /dev/null @@ -1,45 +0,0 @@ -import platform -import psutil -import sqlite3 as db -from datetime import date - -connect = db.connect('data.db') -cursor = connect.cursor() -info = platform.system() + ' ' + str(round(psutil.virtual_memory().total / (1024.0 ** 3))) + "GB" - - -def new(name: str, user: str, passwd: str): - cursor.execute("insert into initial values (?, ?, ?, ?)", (name, user, passwd, date.today())) - connect.commit() - - -def format_txt(file: str, passwd: str): - cursor.execute("insert into user values (?, ?, ?, ?, ?)", ('text', date.today(), file, passwd, info)) - connect.commit() - - -def format_oth(types: str, file: str): - st = "insert into user('FORMAT', 'TIME_STAMP', 'FILE_PATH', 'OS_RAM') VALUES(?, ?, ?, ?)", ( - types, date.today(), file, info) - cursor.execute(st) - connect.commit() - - -def main_work(username: str, passwd: str, file: str): - data = cursor.execute("SELECT NAME,PASSWORD FROM initial WHERE USERNAME=?", (username,)).fetchall() - if not data: - return 'No Admin Account', - else: - for i in range(len(data)): - if passwd == data[i][1]: - data2 = cursor.execute("SELECT PASSWORD FROM user WHERE FILE_PATH=?", (file,)).fetchone() - if not data2: - return 'No such file', - else: - return data[i][0], data2 - else: - return 'Wrong Password', - - -def close(): - connect.close() diff --git a/New Folder (2)/sten/hover.py b/New Folder (2)/sten/hover.py deleted file mode 100644 index 8740c2e..0000000 --- a/New Folder (2)/sten/hover.py +++ /dev/null @@ -1,53 +0,0 @@ -from tkinter import * -""" -This module helps us to have a hovering effect on any -widget in tkinter. It helps in giving the user info about -the widget. Especially used to hover over buttons and giving -info about their usage. -link - https://cutt.ly/fhzdiqy -""" - - -class ToolTip(object): - - def __init__(self, widget): - self.widget = widget - self.tipwindow = None - self.id = None - self.x = self.y = 0 - - def showtip(self, text): - """Display text in tooltip window""" - self.text = text - if self.tipwindow or not self.text: - return - x, y, cx, cy = self.widget.bbox("insert") - x = x + self.widget.winfo_rootx() + 57 - y = y + cy + self.widget.winfo_rooty() + 27 - self.tipwindow = tw = Toplevel(self.widget) - tw.wm_overrideredirect(1) - tw.wm_geometry("+%d+%d" % (x, y)) - label = Label(tw, text=self.text, justify=LEFT, - background="#ffffe0", relief=SOLID, borderwidth=1, - font=("tahoma", "8", "normal")) - label.pack(ipadx=1) - - def hidetip(self): - tw = self.tipwindow - self.tipwindow = None - if tw: - tw.destroy() - - -def CreateToolTip(widget, text): - """Main function which is called in programs""" - toolTip = ToolTip(widget) - - def enter(event): - toolTip.showtip(text) - - def leave(event): - toolTip.hidetip() - - widget.bind('', enter) - widget.bind('', leave) diff --git a/New Folder (2)/sten/image.py b/New Folder (2)/sten/image.py deleted file mode 100644 index 7104925..0000000 --- a/New Folder (2)/sten/image.py +++ /dev/null @@ -1,134 +0,0 @@ - - -# Convert encoding data into 8-bit binary -# form using ASCII value of characters -def genData(data): - - # list of binary codes - # of given data - newd = [] - - for i in data: - newd.append(format(ord(i), '08b')) - return newd - -# Pixels are modified according to the -# 8-bit binary data and finally returned -def modPix(pix, data): - - datalist = genData(data) - lendata = len(datalist) - imdata = iter(pix) - - for i in range(lendata): - - # Extracting 3 pixels at a time - pix = [value for value in imdata.__next__()[:3] + - imdata.__next__()[:3] + - imdata.__next__()[:3]] - - # Pixel value should be made - # odd for 1 and even for 0 - for j in range(0, 8): - if (datalist[i][j] == '0' and pix[j]% 2 != 0): - pix[j] -= 1 - - elif (datalist[i][j] == '1' and pix[j] % 2 == 0): - if(pix[j] != 0): - pix[j] -= 1 - else: - pix[j] += 1 - # pix[j] -= 1 - - # Eighth pixel of every set tells - # whether to stop ot read further. - # 0 means keep reading; 1 means thec - # message is over. - if (i == lendata - 1): - if (pix[-1] % 2 == 0): - if(pix[-1] != 0): - pix[-1] -= 1 - else: - pix[-1] += 1 - - else: - if (pix[-1] % 2 != 0): - pix[-1] -= 1 - - pix = tuple(pix) - yield pix[0:3] - yield pix[3:6] - yield pix[6:9] - -def encode_enc(newimg, data): - w = newimg.size[0] - (x, y) = (0, 0) - - for pixel in modPix(newimg.getdata(), data): - - # Putting modified pixels in the new image - newimg.putpixel((x, y), pixel) - if (x == w - 1): - x = 0 - y += 1 - else: - x += 1 - -# Encode data into image -def encode(): - img = input("Enter image name(with extension) : ") - image = Image.open(img, 'r') - - data = input("Enter data to be encoded : ") - if (len(data) == 0): - raise ValueError('Data is empty') - - newimg = image.copy() - encode_enc(newimg, data) - - new_img_name = input("Enter the name of new image(with extension) : ") - newimg.save(new_img_name, str(new_img_name.split(".")[1].upper())) - -# Decode the data in the image -def decode(): - img = input("Enter image name(with extension) : ") - image = Image.open(img, 'r') - - data = '' - imgdata = iter(image.getdata()) - - while (True): - pixels = [value for value in imgdata.__next__()[:3] + - imgdata.__next__()[:3] + - imgdata.__next__()[:3]] - - # string of binary data - binstr = '' - - for i in pixels[:8]: - if (i % 2 == 0): - binstr += '0' - else: - binstr += '1' - - data += chr(int(binstr, 2)) - if (pixels[-1] % 2 != 0): - return data - -# Main Function -def main(): - a = int(input(":: Welcome to Steganography ::\n" - "1. Encode\n2. Decode\n")) - if (a == 1): - encode() - - elif (a == 2): - print("Decoded Word : " + decode()) - else: - raise Exception("Enter correct input") - -# Driver Code -if __name__ == '__main__' : - - # Calling main function - main() diff --git a/New Folder (2)/sten/text.py b/New Folder (2)/sten/text.py deleted file mode 100644 index 8e5aa23..0000000 --- a/New Folder (2)/sten/text.py +++ /dev/null @@ -1,37 +0,0 @@ -# these modules come with standard python installation -import os -import subprocess -__author__ = "Sohel Ahmed" -''' -Module text.py for performing text stenography using SNOW -link - http://darkside.com.au/snow/ -- here you will get to -know about SNOW and also download it. This mainly hides your - data inside spaces and tabs & also encrypts it. -''' - - -def size(file: str): - """Used to know how much data can be hidden in the file returns it in bytes""" - cmd = subprocess.Popen(['snow', '-S', file], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - stdout, stderr = cmd.communicate() - return str(stdout, 'utf-8').split()[-2] - - -def encode(passwd: str, infile: str, outfile: str, file: str = None, message: str = None): - """This is used to encode data in the file with password. Returns nothing""" - if message is not None: - """If the data is a message it encodes it inside the contents of infile and saves it in outfile""" - command = 'snow -C -Q -p "{}" -m "{}" {} {}'.format(passwd, message, infile, outfile) - os.system('cmd /c' + command) - elif file is not None: - """If the data is a file it encodes it in infile and saves it as outfile""" - command = 'snow -C -Q -p "{}" -f {} {} {}'.format(passwd, file, infile, outfile) - os.system('cmd /c' + command) - - -def decode(passwd: str, file: str): - """Decodes the data hidden in the file. Returns the data in readable - form if password is correct else in encrypted form.""" - cmd = subprocess.Popen(['snow', '-C', '-p', passwd, file], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - stdout, stderr = cmd.communicate() - return str(stdout, 'utf-8')