Skip to content

Instantly share code, notes, and snippets.

@jamie-34254
Last active August 29, 2015 14:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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