forked from Aditya0709-alt/stegano-master
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
90 lines (69 loc) · 2.8 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
from pyfiglet import Figlet
from helpers import *
from subprocess import call,STDOUT
import os
if __name__ == '__main__':
f = Figlet(font='slant')
print(f.renderText("CCVS"))
print("CaesarCipherVideoSteganography")
print("")
print("Menu :")
print("")
print("a. Encypt & Merge into Video")
print("b. Decrypt & Get the plain text")
print("-----------------------")
choice = input("(!) Choose option : ")
def encrypt():
call(["clear"])
print(f.renderText("Encrypt"))
print("----------------------------------------")
file_name = input("Enter the video file name in the data folder: ")
try:
caesarn = int(input("Caesar cypher value: "))
except ValueError:
print("-----------------------")
print("The value is not an integer ")
exit()
try:
open("data/" + file_name)
except IOError:
print("-----------------------")
print("File not found ")
exit()
print("-----------------------")
print("Extracting Frame(s)")
frame_extract(str(file_name))
print("Extracting audio")
call(["ffmpeg", "-i", "data/" + str(file_name), "-q:a", "0", "-map", "a", "temp/audio.mp3", "-y"],stdout=open(os.devnull, "w"), stderr=STDOUT)
print("(-) Reading text-to-hide.txt")
print("(-) Encrypting & appending string into frame(s) ")
encode_frame("temp", "data/text-to-hide.txt", caesarn)
print("(-) Merging frame(s) ")
call(["ffmpeg", "-i", "temp/%d.png" , "-vcodec", "png", "temp/video.mov", "-y"],stdout=open(os.devnull, "w"), stderr=STDOUT)
print("(-) Optimizing encode & Merging audio ")
call(["ffmpeg", "-i", "temp/video.mov", "-i", "temp/audio.mp3", "-codec", "copy","data/enc-" + str(file_name)+".mov", "-y"],stdout=open(os.devnull, "w"), stderr=STDOUT)
print("(!) Success , output : enc-" + str(file_name)+".mov")
def decrypt():
call(["clear"])
print(f.renderText("Decrypt"))
print("----------------------------------------")
file_name = input("Enter the video file name in the data folder: ")
try:
caesarn = int(input("Caesar cypher value: "))
except ValueError:
print("-----------------------")
print("The value is not an integer ")
exit()
try:
open("data/" + file_name)
except IOError:
print("-----------------------")
print("File not found ")
exit()
print("-----------------------")
print("Extracting Frame(s)")
frame_extract(str(file_name))
print("Decrypting Frame(s)")
decode_frame("temp",caesarn)
print("Writing to recovered-text.txt")
print("Success")