Introduction
Introduction Statistics Contact Development Disclaimer Help
audio_compare.rb - warvox - VoIP based wardialing tool, forked from rapid7/warv…
git clone git://jay.scot/warvox
Log
Files
Refs
README
---
audio_compare.rb (819B)
---
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 require 'pry'
15
16 def usage
17 $stderr.puts "Usage: #{$0} <inputA.raw> <inputB.raw>"
18 exit
19 end
20
21 def log(m)
22 $stderr.puts "[*] #{m}"
23 end
24
25 def score(a,b)
26 (a & b).length / [a,b].max.length.to_f
27 end
28
29 #
30 # Script
31 #
32
33 inp1 = ARGV.shift
34 inp2 = ARGV.shift
35
36 if [inp1, inp2].include?("-h") or not (inp1 && inp2)
37 usage()
38 end
39
40 # log("Processing #{inp1}...")
41 raw1 = WarVOX::Audio::Raw.from_file(inp1)
42 sig1 = raw1.to_freq_sig
43
44 # log("Processing #{inp2}...")
45 raw2 = WarVOX::Audio::Raw.from_file(inp2)
46 sig2 = raw2.to_freq_sig
47
48 puts "Score: #{score(sig1, sig2)}"
You are viewing proxied material from jay.scot. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.