Signature format change - warvox - VoIP based wardialing tool, forked from rapid7/warvox.
DIR Log
DIR Files
DIR Refs
DIR README
---
DIR commit 9cb1016e0f3aa69356bea154884e6f4f16a7041b
DIR parent 0a7a518f66a96f53983aed29e0305dfd7a5ead9d
HTML Author: HD Moore <hd_moore@rapid7.com>
Date: Thu, 31 Mar 2011 00:46:11 +0000
Signature format change
Diffstat:
M bin/create_matches.rb | 6 +++---
M bin/create_media.rb | 4 +++-
M lib/warvox/audio/raw.rb | 10 +++++++---
3 files changed, 13 insertions(+), 7 deletions(-)
---
DIR diff --git a/bin/create_matches.rb b/bin/create_matches.rb
@@ -7,13 +7,13 @@
def is_bad_sig?(sig)
- return true if sig == [0,0,0,0]
+ return true if sig == 0
false
end
def load_signature(data)
data.split("\n").map { |line|
- line.strip.split(",").map{|bits| bits.to_i }
+ line.strip.to_i
}.reject {|sig| is_bad_sig?(sig) }
end
@@ -24,7 +24,7 @@ set = {}
d = Dir.new(dir)
d.entries.each do |ent|
- next if ent !~ /\.sig$/
+ next if ent !~ /\.sigs$/
name,trash = ent.split('.', 2)
data = File.read(File.join(dir, ent))
set[name] = load_signature(data)
DIR diff --git a/bin/create_media.rb b/bin/create_media.rb
@@ -33,9 +33,11 @@ dir = Dir.new(src)
dir.entries.sort.each do |ent|
path = File.join(src, ent)
- next if ent !~ /(.*)\.raw/m
+ next if ent !~ /(.*)\.raw\.gz$/m
num = $1
+ next if File.exist?(File.join(dst, num + ".mp3"))
+
puts "Processing #{num}..."
# Decompress the audio file
DIR diff --git a/lib/warvox/audio/raw.rb b/lib/warvox/audio/raw.rb
@@ -180,7 +180,7 @@ class Raw
# Toss any signals with a strength under 100
if pwr < 100.0
frq,pwr = [0,0]
- # Map the signal to the closest offset of 50hz
+ # Map the signal to the closest offset of 100hz
else
frq = barker.call(frq)
end
@@ -210,11 +210,15 @@ class Raw
# Dump any duplicate signatures
sigs = sigs.uniq
+
+ # Convert each signature into a single 32-bit integer
+ # This is essentially [0-40, 0-40, 0-40, 0-40]
+ sigs.map{|x| x.map{|y| y / 100}.pack("C4").unpack("N")[0] }
end
def to_freq_sig_txt(opts={})
- # Convert this to comma delimited frequencies, one sequence per line
- to_freq_sig(opts).map{|x| x.join(",") }.sort.join("\n")
+ # Convert this to a text file
+ to_freq_sig(opts).sort.join("\n")
end
def self.fft_to_freq_sig(ffts, freq_cnt)