-
Notifications
You must be signed in to change notification settings - Fork 3
/
Audspy_ext.py
62 lines (50 loc) · 2.58 KB
/
Audspy_ext.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
import os
import wave
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-f', help='audiofile', dest='audiofile')
args = parser.parse_args()
af = args.audiofile
arged = False
if af:
arged = True
def cls():
os.system("clear")
def help():
print("\033[92mExtract Your Secret Message from Audio Wave File.\033[0m")
print ('''usage: Audspy_ext.py [-h] [-f AUDIOFILE]
optional arguments:
-h, --help show this help message and exit
-f AUDIOFILE Select Audio File''')
def banner():
print ('''
▄▄▄ █ ██ ▓█████▄ ██████ ██▓███ ▓██ ██▓
▒████▄ ██ ▓██▒▒██▀ ██▌▒██ ▒ ▓██░ ██▒▒██ ██▒
▒██ ▀█▄ ▓██ ▒██░░██ █▌░ ▓██▄ ▓██░ ██▓▒ ▒██ ██░
░██▄▄▄▄██ ▓▓█ ░██░░▓█▄ ▌ ▒ ██▒▒██▄█▓▒ ▒ ░ ▐██▓░
▓█ ▓██▒▒▒█████▓ ░▒████▓ ▒██████▒▒▒██▒ ░ ░ ░ ██▒▓░
▒▒ ▓▒█░░▒▓▒ ▒ ▒ ▒▒▓ ▒ ▒ ▒▓▒ ▒ ░▒▓▒░ ░ ░ ██▒▒▒
▒ ▒▒ ░░░▒░ ░ ░ ░ ▒ ▒ ░ ░▒ ░ ░░▒ ░ ▓██ ░▒░
░ ▒ ░░░ ░ ░ ░ ░ ░ ░ ░ ░ ░░ ▒ ▒ ░░
░ ░ ░ ░ ░ ░ ░
░ ░ ░
''')
def ex_msg(af):
if not arged:
help()
else:
print ("Please wait...")
waveaudio = wave.open(af, mode='rb')
frame_bytes = bytearray(list(waveaudio.readframes(waveaudio.getnframes())))
extracted = [frame_bytes[i] & 1 for i in range(len(frame_bytes))]
string = "".join(chr(int("".join(map(str,extracted[i:i+8])),2)) for i in range(0,len(extracted),8))
msg = string.split("###")[0]
print("Your Secret Message is: \033[1;91m"+msg+"\033[0m")
waveaudio.close()
cls()
banner()
try:
ex_msg(af)
except:
print ("Something went wrong!! try again")
quit('')