-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
173 lines (140 loc) · 7.34 KB
/
main.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
import colorama
from colorama import Fore, Style
from Steg_Files.steg_image import encode_text_in_image, decode_text_from_image
from Steg_Files.steg_audio import encode_text_in_audio_wav,decode_text_in_audio_wav
from Steg_Files.steg_video import encode_vid_data,decode_vid_data
from Steg_Files.steg_image_image import encode_image_in_image, decode_image_in_image
from Steg_Files.steg_text_text import encode_text_in_text, decode_text_in_text
colorama.init()
def xor_encrypt_decrypt(text, key):
return ''.join(chr(ord(c) ^ ord(key[i % len(key)])) for i, c in enumerate(text))
if __name__=="__main__":
print(Fore.YELLOW + Style.BRIGHT + """
███████╗████████╗███████╗ ██████╗ ██████╗ ██╗ ██╗
██╔════╝╚══██╔══╝██╔════╝██╔════╝ ██╔══██╗╚██╗ ██╔╝
███████╗ ██║ █████╗ ██║ ███╗██████╔╝ ╚████╔╝
╚════██║ ██║ ██╔══╝ ██║ ██║██╔═══╝ ╚██╔╝
███████║ ██║ ███████╗╚██████╔╝██║ ██║
╚══════╝ ╚═╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝
- by ROOT Squad
""" + Style.RESET_ALL)
print(Fore.CYAN + Style.BRIGHT + """
Type of Steganography:
1. Text in Image Steganography
2. Text in Audio Steganography
3. Text in Video Steganography
4. Text in Text Steganography
5. Image in Image Steganography
Enter The Type of Steganography: """ + Style.RESET_ALL,end="")
choice = int(input())
if choice == 1:
print(Fore.GREEN + Style.BRIGHT + """
Image Steganography:
1. Hide Text in Image
2. Extract Text from Image
Enter The Option: """ + Style.RESET_ALL,end='')
option = int(input())
if option == 1:
image_path = input("Enter the image path: ")
text = input("Enter the text to hide: ")
key = input("Enter the key (If the key is not required press Enter): ")
if key != "":
text = xor_encrypt_decrypt(text, key)
encode_text_in_image(image_path, text)
print(Fore.YELLOW + "Text hidden successfully in the image." + Style.RESET_ALL)
elif option == 2:
image_path = input("Enter the image path: ")
text = decode_text_from_image(image_path)
key = input("Enter the key (If the key is not required press Enter): ")
if key != "":
text = xor_encrypt_decrypt(text, key)
print(Fore.YELLOW + "Extracted text from the image: " + Style.RESET_ALL, text)
else:
print(Fore.RED + "Invalid option selected." + Style.RESET_ALL)
elif choice == 2:
print(Fore.GREEN + Style.BRIGHT + """
Audio Steganography:
1. Hide Text in Audio
2. Extract Text from Audio
Enter The Option: """ + Style.RESET_ALL,end='')
option = int(input())
if option == 1:
audio_path = input("Enter the audio path: ")
text = input("Enter the text to hide: ")
key = input("Enter the key (If the key is not required press Enter): ")
if key != "":
text = xor_encrypt_decrypt(text, key)
encode_text_in_audio_wav(audio_path, text)
print(Fore.YELLOW + "Text hidden successfully in the audio." + Style.RESET_ALL)
elif option == 2:
audio_path = input("Enter the audio path: ")
text = decode_text_in_audio_wav(audio_path)
key = input("Enter the key (If the key is not required press Enter): ")
if key != "":
text = xor_encrypt_decrypt(text, key)
print(Fore.YELLOW + "Extracted text from the audio: " + Style.RESET_ALL, text)
else:
print(Fore.RED + "Invalid option selected." + Style.RESET_ALL)
elif choice == 3:
print(Fore.GREEN + Style.BRIGHT + """
Video Steganography:
1. Hide Text in Video
2. Extract Text from Video
Enter The Option: """ + Style.RESET_ALL,end='')
option = int(input())
if option == 1:
video_path = input("Enter the video path: ")
text = input("Enter the text to hide: ")
encode_vid_data(video_path, text)
print(Fore.YELLOW + "Text hidden successfully in the video." + Style.RESET_ALL)
elif option == 2:
video_path = input("Enter the video path: ")
text = decode_vid_data(video_path)
print(Fore.YELLOW + "Extracted text from the video: " + Style.RESET_ALL, text)
else:
print(Fore.RED + "Invalid option selected." + Style.RESET_ALL)
elif choice == 4:
print(Fore.GREEN + Style.BRIGHT + """
Text Steganography:
1. Encode Text in Text
2. Decode Text from Text
Enter The Option: """ + Style.RESET_ALL,end='')
option = int(input())
if option == 1:
text = input("Enter the text to hide: ")
path_txt = input("Enter the path of the cover text file: ")
output_path = input("Enter the path of the output text file: ")
key = input("Enter the key (If the key is not required press Enter): ")
if key != "":
text = xor_encrypt_decrypt(text, key,output_path)
encode_text_in_text(text, path_txt)
print(Fore.YELLOW + f"Text hidden successfully in the text file: {output_path}" + Style.RESET_ALL)
elif option == 2:
input_path = input("Enter the path of the text file to decode: ")
text = decode_text_in_text(input_path)
key = input("Enter the key (If the key is not required press Enter): ")
if key != "":
text = xor_encrypt_decrypt(text, key)
print(Fore.YELLOW + "Decoded text: " + Style.RESET_ALL, text)
else:
print(Fore.RED + "Invalid option selected." + Style.RESET_ALL)
elif choice == 5:
print(Fore.GREEN + Style.BRIGHT + """
Image in Image Steganography:
1. Hide Image in Image
2. Extract Image from Image
Enter The Option: """ + Style.RESET_ALL,end='')
option = int(input())
if option == 1:
main_image_path = input("Enter the main image path: ")
secret_image_path = input("Enter the secret image path: ")
output_image_path = input("Enter the output image path: ")
encode_image_in_image(main_image_path, secret_image_path, output_image_path)
print(Fore.YELLOW + "Image hidden successfully in the image." + Style.RESET_ALL)
elif option == 2:
encoded_image_path = input("Enter the encoded image path: ")
output_image_path = input("Enter the output image path: ")
decode_image_in_image(encoded_image_path, output_image_path)
print(Fore.YELLOW + "Extracted image from the image successfully." + Style.RESET_ALL)
else:
print(Fore.RED + "Invalid choice selected." + Style.RESET_ALL)