-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
249 lines (197 loc) · 7.82 KB
/
main.cpp
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
#include<bits/stdc++.h>
#include<iostream>
#include<fstream>
#include<time.h>
#include <cstdlib>
#include "header.h"
#include<time.h>
#include <thread>
#include<windows.h>
#include<wincon.h>
#include<sstream>
using namespace std;
int main()
{
system("color ED");
cout<<"**********************************************";
cout<<"**************************************************************************\n\n";
cout<<"\t\t\t\t Welcome to Invisible Ink & Animated Frame Encoder";
cout<<"\n\n";
cout<<"**********************************************";
cout<<"**************************************************************************\n\n";
cout<<"\t\t\t\t\t Here are my project features:\n";
cout<<"\t\t\t\t\t _______________________________";
cout<<"\n\n\n";
cout<<" \t--------------------------\t\t\t";
cout<<" --------------------------\n";
cout<<" \t| Invisible Ink |\t\t\t";
cout<<" | Animated Frame Encoder | \n";
cout<<" \t--------------------------\t\t\t";
cout<<" --------------------------\n";
cout<<" \t | |\t\t\t\t\t\t |\n";
cout<<" \t | |\t\t\t\t\t\t |\n";
cout<<" \t | |\t\t\t\t\t\t |\n";
cout<<" \t | |\t\t\t\t\t\t |\n";
cout<<" --------------- ";
cout<<" -------------------\t\t\t";
cout<<" --------------------\n";
cout<<" | Data Hiding | ";
cout<<" | Data Extracting |\t\t\t";
cout<<" | GIF Encoder |\n";
cout<<" --------------- ";
cout<<" -------------------\t\t\t";
cout<<" --------------------\n";
bool continueLoop=true;
while(continueLoop)
{
cout<<"\nSelect an option to proceed: \n\n";
cout<<"press 1 for part I: Invisible Ink\n";
cout<<"press 2 for part II: Animated Frame Encoder\n";
cout<<"press 0 to quit\n";
int option;
cin>>option;
if(option==1)
{
cout<<"press 1 for Data Hiding\n";
cout<<"press 2 for Data Extracting\n";
int choice;
cin>>choice;
if(choice==1)
{
string imageFileName;
string textFileName;
string extendedTextFileName;
cout<<"provide image file name";
cout<<"\n";
cin>>imageFileName;
string extendedImageFileName=addImageFileExtension(imageFileName);
openingImage(extendedImageFileName);
// option for text file
bool looping=true;
while(looping)
{
cout<<"How do you want to provide hidden data?";
cout<<"\n";
cout<<"\t--------------------\t\t\t---------------------------\n";
cout<<"\t| Write Now |\t\t\t| Provide Text File Name |\n";
cout<<"\t--------------------\t\t\t---------------------------\n";
cout<<"\n";
cout<<"press 1 for Writing Now";
cout<<"\n";
cout<<"press 2 for Providing Text File Name";
cout<<"\n";
int pressingValue;
cin>>pressingValue;
if(pressingValue==1)
{
extendedTextFileName="input.txt";
processInputText(extendedTextFileName);
}
else if(pressingValue==2)
{
cin>>textFileName;
extendedTextFileName=addTextFileExtension(textFileName);
}
else
{
continue;
}
looping=false;
}
/** checking opening issue of image file**/
ifstream inputFile;
inputFile.open(extendedImageFileName,ios:: binary);
if(!inputFile)
{
cout<<"couldn't find the image file in storage\n";
cout<<"redirecting to the option menu\n\n";
continue;
}
inputFile.close();
if(!checkingImageFormat(extendedImageFileName))
{
cout<<"sorry, the image format is not correct.\n";
cout<<"redirecting to the option menu.\n\n";
continue;
}
// openingImage(extendedImageFileName);
/** checking if the text file is compatible for steganography **/ // correction
ifstream inputfile1;
inputfile1.open(extendedTextFileName,ios:: binary);
if(!inputfile1)
{
cout<<"couldn't load the text file\n";
cout<<"redirecting to the option menu\n\n";
continue;
}
if(!checkingTextFile(extendedImageFileName,extendedTextFileName))
{
cout<<"not possible to hide the text file within provided image file.";
cout<<"redirecting to the option menu.\n\n";
continue;
}
inputfile1.close();
string stegoImage;
if((stegoImage=hidingData(extendedImageFileName,extendedTextFileName))!=" ")
{
puts("stego image is ready");
cout<<"\n\n";
}
else
{
puts("failed to create stego image");
continue;
}
Sleep(4000);
openingImage(stegoImage);
}
else if(choice==2)
{
string stegoImageFileName;
cout<<"provide stego image file name";
cout<<"\n";
cin>>stegoImageFileName;
string extendedStegoImageFileName=addImageFileExtension(stegoImageFileName);
ifstream inputFile;
inputFile.open(extendedStegoImageFileName,ios:: binary);
if(!inputFile)
{
cout<<"couldn't find the image file in storage\n";
cout<<"redirecting to the option menu\n\n";
continue;
}
inputFile.close();
if(!checkingImageFormat(extendedStegoImageFileName))
{
cout<<"sorry, the image format is not correct.\n";
cout<<"redirecting to the option menu.\n\n";
continue;
}
extractingData(extendedStegoImageFileName);
Sleep(25000);
}
}
else if(option==2)
{
string GIFFileName;
cout<<"provide a name for your GIF file";
cout<<"\n";
cin>>GIFFileName;
string extendedGIFFileName=addGIFFileExtension(GIFFileName);
cout<<"Showing the GIF file";
cout<<"\n\n\n";
creatingGif(extendedGIFFileName);
}
else if(option==0)
{
continueLoop=false;
}
else
{
cout<<"Invalid option";
cout<<"\n\n";
return EXIT_FAILURE;
}
system("cls");
}
}