Created
April 25, 2017 13:05
-
-
Save mfridman/6fd4fa93f68ee61a5c52e1fe7893b6bb to your computer and use it in GitHub Desktop.
plaidCTF2017-echo-run.py
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
import sys | |
from subprocess import call | |
import signal | |
import os | |
def handler(signum, frame): | |
os._exit(-1) | |
signal.signal(signal.SIGALRM, handler) | |
signal.alarm(30) | |
INPUT_FILE="/share/input" | |
OUTPUT_PATH="/share/out/" | |
def just_saying (fname): | |
with open(fname) as f: | |
lines = f.readlines() | |
i=0 | |
for l in lines: | |
i += 1 | |
if i == 5: | |
break | |
l = l.strip() | |
# Do TTS into mp3 file into output path | |
call(["sh","-c", | |
"espeak " + " -w " + OUTPUT_PATH + str(i) + ".wav \"" + l + "\""]) | |
def main(): | |
just_saying(INPUT_FILE) | |
if __name__ == "__main__": | |
main() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment