| audio_raw_to_wav.rb - warvox - VoIP based wardialing tool, forked from rapid7/w… | |
| git clone git://jay.scot/warvox | |
| Log | |
| Files | |
| Refs | |
| README | |
| --- | |
| audio_raw_to_wav.rb (602B) | |
| --- | |
| 1 #!/usr/bin/env ruby | |
| 2 ################### | |
| 3 | |
| 4 # | |
| 5 # Load the library path | |
| 6 # | |
| 7 base = __FILE__ | |
| 8 while File.symlink?(base) | |
| 9 base = File.expand_path(File.readlink(base), File.dirname(base)) | |
| 10 end | |
| 11 $:.unshift(File.join(File.expand_path(File.dirname(base)), '..', 'lib')) | |
| 12 | |
| 13 require 'warvox' | |
| 14 | |
| 15 def usage | |
| 16 $stderr.puts "Usage: #{$0} <input.raw> <output.wav>" | |
| 17 exit | |
| 18 end | |
| 19 | |
| 20 # | |
| 21 # Script | |
| 22 # | |
| 23 | |
| 24 inp = ARGV.shift | |
| 25 out = ARGV.shift | |
| 26 | |
| 27 if (inp and inp == "-h") or not inp | |
| 28 usage() | |
| 29 end | |
| 30 | |
| 31 raw = WarVOX::Audio::Raw.from_file(inp) | |
| 32 if out | |
| 33 ::File.open(out, "wb") do |fd| | |
| 34 fd.write(raw.to_wav) | |
| 35 end | |
| 36 else | |
| 37 $stdout.write(raw.to_wav) | |
| 38 end |