-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsteganography.py
197 lines (145 loc) · 5.58 KB
/
steganography.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
from tkinter import *
from tkinter import messagebox
from argparse import FileType
from stegano import lsb
from tkinter.filedialog import *
from PIL import ImageTk,Image
from stegano.lsbset import generators
import request
from stegano import lsb
from tkinter import font as tkFont
from stegano import exifHeader as aaa
import os
from subprocess import Popen
def encode():
main.destroy()
enc=Tk()
enc.attributes("-fullscreen", True)
enc.wm_attributes('-transparentcolor')
img=ImageTk.PhotoImage(Image.open("bg2.jpg"))
fontl = tkFont.Font(family='Algerian', size=32)
label1=Label(enc,image=img)
label1.pack()
LabelTitle=Label(text="ENCODE",bg="red",fg="white",width=20)
LabelTitle['font']=fontl
LabelTitle.place(relx=0.6, rely=0.1)
def openfile():
global fileopen
global imagee
fileopen=StringVar()
fileopen=askopenfilename(initialdir="/Desktop",title="select file",filetypes=(("jpeg,png files","*jpg *png"),("all files","*.*")))
imagee=ImageTk.PhotoImage(Image.open(fileopen))
Labelpath=Label(text=fileopen)
Labelpath.place(relx=0.6, rely=0.25, height=21, width=450)
Labelimg=Label(image=imagee)
Labelimg.place(relx=0.7, rely=0.3, height=200, width=200)
Button2 = Button(text="Openfile",command=openfile)
Button2.place(relx=0.7, rely=0.2, height=31, width=94)
secimg=StringVar()
radio1=Radiobutton(text='jpeg',value='jpeg',variable=secimg)
radio1.place(relx=0.7, rely=0.57)
radio2=Radiobutton(text='png',value='png',variable=secimg)
radio2.place(relx=0.8, rely=0.57)
Label1 =Label(text="Enter message")
Label1.place(relx=0.6, rely=0.6, height=21, width=104)
entrysecmes=Entry()
entrysecmes.place(relx=0.7, rely=0.6, relheight=0.05, relwidth=0.200)
Label2 =Label(text="File Name")
Label2.place(relx=0.6, rely=0.70, height=21, width=104)
entrysave=Entry()
entrysave.place(relx=0.7, rely=0.70, relheight=0.05, relwidth=0.200)
def encode():
if secimg.get()=="jpeg":
inimage=fileopen
response=messagebox.askyesno("popup","do you want to encode")
if response==1:
aaa.hide(inimage,entrysave.get()+'.jpg',entrysecmes.get())
messagebox.showinfo("popup","successfully encode"+entrysave.get()+".jpeg")
else:
messagebox.showwarning("popup","unsuccessful")
if secimg.get()=="png":
inimage=fileopen
response=messagebox.askyesno("popup","do you want to encode")
if response==1:
lsb.hide(inimage,message=entrysecmes.get()).save(entrysave.get()+'.png')
messagebox.showinfo("popup","successfully encode to "+entrysave.get()+".png")
else:
messagebox.showwarning("popup","unsuccessful")
def back():
enc.destroy()
#execfile('image steganography using lsb.py')
#os.system('python imagesteganographyusinglsb.py')
Popen('python steganography.py')
Button2 = Button(text="ENCODE",command=encode)
Button2.place(relx=0.7, rely=0.8, height=31, width=94)
Buttonback = Button(text="Back",command=back)
Buttonback.place(relx=0.7, rely=0.85, height=31, width=94)
enc.mainloop()
def decode():
main.destroy()
dec=Tk()
dec.attributes("-fullscreen", True)
dec.wm_attributes('-transparentcolor')
img=ImageTk.PhotoImage(Image.open("bg2.jpg"))
fontl = tkFont.Font(family='Algerian', size=32)
label1=Label(dec,image=img)
label1.pack()
LabelTitle=Label(text="DECODE",bg="blue",fg="white",width=20)
LabelTitle['font']=fontl
LabelTitle.place(relx=0.6, rely=0.1)
secimg=StringVar()
radio1=Radiobutton(text='jpeg',value='jpeg',variable=secimg)
radio1.place(relx=0.7, rely=0.57)
radio2=Radiobutton(text='png',value='png',variable=secimg)
radio2.place(relx=0.8, rely=0.57)
def openfile():
global fileopen
global imagee
fileopen=StringVar()
fileopen=askopenfilename(initialdir="/Desktop",title="select file",filetypes=(("jpeg files, png file","*jpg *png"),("all files","*.*")))
imagee=ImageTk.PhotoImage(Image.open(fileopen))
Labelpath=Label(text=fileopen)
Labelpath.place(relx=0.6, rely=0.25, height=21, width=450)
Labelimg=Label(image=imagee)
Labelimg.place(relx=0.7, rely=0.3, height=200, width=200)
def deimg():
if secimg.get()=="png":
messag=lsb.reveal(fileopen)
if secimg.get()=="jpeg":
messag=aaa.reveal(fileopen)
Label2=Label(text=messag)
Label2.place(relx=0.7, rely=0.7, height=21, width=204)
Button2 = Button(text="Openfile",command=openfile)
Button2.place(relx=0.7, rely=0.2, height=31, width=94)
Button2 = Button(text="DECODE",command=deimg)
Button2.place(relx=0.7, rely=0.8, height=31, width=94)
def back():
dec.destroy()
#execfile('image steganography using lsb.py')
#os.system('python imagesteganographyusinglsb.py')
Popen('python steganography.py')
Buttonback = Button(text="Back",command=back)
Buttonback.place(relx=0.7, rely=0.85, height=31, width=94)
dec.mainloop()
#main program
main=Tk()
main.title('Enc & Dec Panel ')
#main.geometry("1300x750")
main.attributes("-fullscreen", True)
fontl = tkFont.Font(family='Algerian', size=32)
global image1
image1=ImageTk.PhotoImage(Image.open("bg1.jpg"))
label=Label(main,text="lalal",image=image1)
label.pack()
encbutton=Button(text='Encode',fg="white",bg="black",width=20,command=encode)
encbutton['font'] =fontl
encbutton.place(relx=0.6,rely=0.3)
decbutton=Button(text='Decode',fg="white",bg="black",width=20,command=decode)
decbutton['font'] =fontl
decbutton.place(relx=0.6,rely=0.5)
def exit():
main.destroy()
closebutton=Button(text='EXIT',fg="white",bg="red",width=20,command=exit)
closebutton['font'] =fontl
closebutton.place(relx=0.6,rely=0.7)
main.mainloop()