Export a CSV: - warvox - VoIP based wardialing tool, forked from rapid7/warvox.
DIR Log
DIR Files
DIR Refs
DIR README
---
DIR commit fa274655412515187110cee09e8e04c9b70571df
DIR parent 87fadd022a11fcd97151c6a7cbef60bdefb44915
HTML Author: HD Moore <hd_moore@rapid7.com>
Date: Fri, 28 Dec 2012 13:49:02 -0600
Export a CSV:
Diffstat:
M bin/export_list.rb | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
---
DIR diff --git a/bin/export_list.rb b/bin/export_list.rb
@@ -11,6 +11,7 @@ end
$:.unshift(File.join(File.expand_path(File.dirname(base)), '..', 'lib'))
require 'warvox'
+require 'csv'
ENV['RAILS_ENV'] ||= 'production'
@@ -43,12 +44,17 @@ if(not job)
exit
end
+fields = %W{ number line_type cid completed busy seconds ringtime peak_freq notes signatures }
begin
- job = DialJob.find(job.to_i)
- job.dial_results.sort{|a,b| a.number.to_i <=> b.number.to_i}.each do |r|
+ $stdout.puts fields.to_csv
+ DialResult.where(:dial_job_id => job.to_i).find(:order => :number) do |r|
next if not r.number
if(not typ or typ.downcase == (r.line_type||"").downcase)
- puts "#{r.number}\t#{r.line_type}\tbusy=#{r.busy}\tring=#{r.ringtime}"
+ out = []
+ fields.each do |f|
+ out << r[f].to_s
+ end
+ $stdout.puts out.to_csv
end
end
rescue ActiveRecord::RecordNotFound