/
main.py
executable file
·59 lines (42 loc) · 1.49 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
__author__ = 'rodrigoguimaraes'
from PIL import Image
import subprocess
import Steganography
import Helpers
# "img/input.jpg"
# "img/output.bmp"
if __name__ == '__main__':
mode = raw_input('Choose a mode between steg and desteg:')
if mode == "steg":
fileName = raw_input('Would You Kindly Give the Name of The File:')
audioName = raw_input('Would You Kindly Give the Name of the Audio File:')
strOut = ""
f = open(audioName, "rb")
try:
byte = f.read(1)
while byte != "":
strOut = strOut + byte
byte = f.read(1)
finally:
f.close()
numBytes = len(strOut)
Steganography.steg(Helpers.stringToBitArray(strOut), False, fileName)
elif mode == "desteg":
fileName = raw_input('Would You Kindly Give the Name of the File:')
strOut = ""
f = open("mario.mid", "rb")
try:
byte = f.read(1)
while byte != "":
strOut = strOut + byte
byte = f.read(1)
finally:
f.close()
numBytes = len(strOut)
Steganography.deStegToFile(numBytes, fileName)
#TO PLAY, IT IS CONSIDERING THAT YOU HAVE Aria Maestosa copied to your applications folder
pathApp = "/Applications/Aria Maestosa.app/Contents/MacOS/Aria Maestosa"
pathFile = "output.mid"
im = Image.open ("img/output.bmp")
im.show()
subprocess.call([pathApp, pathFile])