This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pwn import * | |
import urllib | |
import os | |
import readline | |
testfile = urllib.URLopener() | |
testfile.retrieve("http://yacst.2015.volgactf.ru/captcha", "captcha.wav") | |
os.system("ffmpeg -y -i captcha.wav -acodec pcm_s16le -ac 1 -ar 16000 file.wav") | |
var = raw_input("Please enter something: ") | |
import wave | |
hasharray = [] | |
for x in range(0, 10): | |
print "Loading sample wav %d" % (x) | |
hasharray.append(wave.open('samples/fix_' + str(x) + ".wav", 'r')) | |
w = wave.open('file.wav', 'r') | |
index = 0 | |
Captcha = [] | |
DoingChar = False | |
WaveSamplesIndex = 0 | |
TheCode = "" | |
SkippingRope = None | |
Fuck = False | |
for i in range(w.getnframes()): | |
if not(SkippingRope == None): | |
if not(SkippingRope == i): | |
continue | |
else: | |
print("skippin done") | |
SkippingRope = None | |
if not(DoingChar): | |
Captcha.append(index) | |
Captcha[index] = [] | |
for x in range(0, 10): | |
Captcha[index].append(x) | |
Captcha[index][x] = True | |
DoingChar = True | |
frame = w.readframes(WaveSamplesIndex) | |
for x in range(0, 10): | |
if not(Captcha[index][x]): | |
continue | |
data = hasharray[x].readframes(WaveSamplesIndex) | |
print("Frame len: " + str(len(frame))) | |
print("Sample Frame len " + str(len(data))) | |
if not(data == frame): | |
Captcha[index][x] = False | |
#print(Captcha) | |
SamplesStillMatching = 0 | |
Match = None | |
#print(Captcha) | |
for x in range(0, 10): | |
if (Captcha[index][x] == True): | |
SamplesStillMatching = SamplesStillMatching + 1 | |
Match = x | |
if(SamplesStillMatching == 1): | |
print("GOT A CHAR: " + str(Match)) | |
DoingChar = False | |
TheCode = TheCode + str(Match) | |
print(i) | |
WaveSamplesIndex = 0 | |
print(hasharray[Match].getnframes()) | |
print(w.getnframes()) | |
w.setpos(hasharray[Match].getnframes()) | |
SkippingRope = hasharray[Match].getnframes() | |
#print(Captcha) | |
index = index + 1 | |
#Fuck = True | |
continue | |
else: | |
WaveSamplesIndex = WaveSamplesIndex + 1 | |
if(Fuck): | |
print("At " + str(i)) | |
print(Captcha) | |
var = raw_input("Please enter something: ") | |
print(Captcha) | |
#print i | |
#print frame |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment