| Prevent overwrite - warvox - VoIP based wardialing tool, forked from rapid7/war… | |
| Log | |
| Files | |
| Refs | |
| README | |
| --- | |
| commit a1f6730b831422fc51fb5af175d279f97452983c | |
| parent bc1510fd13e58d1bb35c52464f2f384b8ea6970c | |
| Author: HD Moore <[email protected]> | |
| Date: Sat, 2 Jul 2016 10:49:10 -0500 | |
| Prevent overwrite | |
| Diffstat: | |
| M bin/audio_raw_to_speech.rb | 12 +++++++++++- | |
| 1 file changed, 11 insertions(+), 1 deletion(-) | |
| --- | |
| diff --git a/bin/audio_raw_to_speech.rb b/bin/audio_raw_to_speech.rb | |
| @@ -32,6 +32,11 @@ if (inp and inp == "-h") or not inp | |
| usage() | |
| end | |
| +if out && File.exists?(out) | |
| + $stderr.puts "Error: The output file already exists: #{out}" | |
| + exit(0) | |
| +end | |
| + | |
| raw = WarVOX::Audio::Raw.from_file(inp) | |
| res = nil | |
| flac = raw.to_flac | |
| @@ -57,13 +62,18 @@ loop do | |
| } | |
| }.to_json | |
| - | |
| +begin | |
| http = Net::HTTP.new(uri.hostname, uri.port) | |
| http.use_ssl = true | |
| res = http.request(req) | |
| break if res.code.to_s == "200" | |
| $stderr.puts "Retrying due to #{res.code} #{res.message}..." | |
| +rescue ::Interrupt | |
| + exit(0) | |
| +rescue ::Exception | |
| + $stderr.puts "Exception: #{$!} #{$!.backtrace}" | |
| +end | |
| sleep(1) | |
| end | |