Railsbin – The vulnerable pastebin service!

User:

Title: broken DTMF code generator

Content:

#!/bin/sh
#generate DTMF tones
#requires ffmpeg and aplay
#the whole program is in an endless loop:
#it asks for a number/symbol/letter,
#plays the correspnoding code, and
#begins anew.

while true; do
read -p "Type number/symbol/letter here: " -N 1
case $REPLY in
	1)
		echo ; ffmpeg \
		-f lavfi -i "sine=frequency=697:duration=0.50" \
		-f lavfi -i "sine=frequency=1209:duration=0.50" \
		-f wav pipe:1 2>/dev/null | aplay 2>/dev/null
	;;
	2)
                echo ; ffmpeg \
                -f lavfi -i "sine=frequency=697:duration=0.50" \
                -f lavfi -i "sine=frequency=1336:duration=0.50" \
                -f wav pipe:1 2>/dev/null | aplay 2>/dev/null
        ;;
	3)
                echo ; ffmpeg \
                -f lavfi -i "sine=frequency=697:duration=0.50" \
                -f lavfi -i "sine=frequency=1477:duration=0.50" \
                -f wav pipe:1 2>/dev/null | aplay 2>/dev/null
        ;;
	a)
                echo ; ffmpeg \
                -f lavfi -i "sine=frequency=697:duration=0.50" \
                -f lavfi -i "sine=frequency=1633:duration=0.50" \
                -f wav pipe:1 2>/dev/null | aplay 2>/dev/null
        ;;
	4)
		echo ; ffmpeg \
                -f lavfi -i "sine=frequency=770:duration=0.50" \
                -f lavfi -i "sine=frequency=1209:duration=0.50" \
                -f wav pipe:1 2>/dev/null | aplay 2>/dev/null
        ;;
	5)
                echo ; ffmpeg \
                -f lavfi -i "sine=frequency=770:duration=0.50" \
                -f lavfi -i "sine=frequency=1336:duration=0.50" \
                -f wav pipe:1 2>/dev/null | aplay 2>/dev/null
        ;;
	6)
                echo ; ffmpeg \
                -f lavfi -i "sine=frequency=770:duration=0.50" \
                -f lavfi -i "sine=frequency=1477:duration=0.50" \
                -f wav pipe:1 2>/dev/null | aplay 2>/dev/null
        ;;
	b)
                echo ; ffmpeg \
                -f lavfi -i "sine=frequency=770:duration=0.50" \
                -f lavfi -i "sine=frequency=1633:duration=0.50" \
                -f wav pipe:1 2>/dev/null | aplay 2>/dev/null
        ;;
	7)
                echo ; ffmpeg \
                -f lavfi -i "sine=frequency=852:duration=0.50" \
                -f lavfi -i "sine=frequency=1209:duration=0.50" \
                -f wav pipe:1 2>/dev/null | aplay 2>/dev/null
        ;;
	8)
                echo ; ffmpeg \
                -f lavfi -i "sine=frequency=852:duration=0.50" \
                -f lavfi -i "sine=frequency=1336:duration=0.50" \
                -f wav pipe:1 2>/dev/null | aplay 2>/dev/null
        ;;
	9)
                echo ; ffmpeg \
                -f lavfi -i "sine=frequency=852:duration=0.50" \
                -f lavfi -i "sine=frequency=1477:duration=0.50" \
                -f wav pipe:1 2>/dev/null | aplay 2>/dev/null
        ;;
	c)
                echo ; ffmpeg \
                -f lavfi -i "sine=frequency=852:duration=0.50" \
                -f lavfi -i "sine=frequency=1633:duration=0.50" \
                -f wav pipe:1 2>/dev/null | aplay 2>/dev/null
        ;;
	'*')
                echo ; ffmpeg \
                -f lavfi -i "sine=frequency=941:duration=0.50" \
                -f lavfi -i "sine=frequency=1209:duration=0.50" \
                -f wav pipe:1 2>/dev/null | aplay 2>/dev/null
        ;;
	0)
                echo ; ffmpeg \
                -f lavfi -i "sine=frequency=941:duration=0.50" \
                -f lavfi -i "sine=frequency=1336:duration=0.50" \
                -f wav pipe:1 2>/dev/null | aplay 2>/dev/null
        ;;
	'#')
                echo ; ffmpeg \
                -f lavfi -i "sine=frequency=941:duration=0.50" \
                -f lavfi -i "sine=frequency=1477:duration=0.50" \
                -f wav pipe:1 2>/dev/null | aplay 2>/dev/null
        ;;
	d)
                echo ; ffmpeg \
                -f lavfi -i "sine=frequency=941:duration=0.50" \
                -f lavfi -i "sine=frequency=1633:duration=0.50" \
                -f wav pipe:1 2>/dev/null | aplay 2>/dev/null
        ;;
	*)
		echo #newline, added to not garble the screen
		continue
	;;
esac
done

Edit | Back