| Export a CSV: - warvox - VoIP based wardialing tool, forked from rapid7/warvox. | |
| Log | |
| Files | |
| Refs | |
| README | |
| --- | |
| commit fa274655412515187110cee09e8e04c9b70571df | |
| parent 87fadd022a11fcd97151c6a7cbef60bdefb44915 | |
| Author: HD Moore <[email protected]> | |
| 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(-) | |
| --- | |
| 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 no… | |
| begin | |
| - job = DialJob.find(job.to_i) | |
| - job.dial_results.sort{|a,b| a.number.to_i <=> b.number.to_i}.each do |… | |
| + $stdout.puts fields.to_csv | |
| + DialResult.where(:dial_job_id => job.to_i).find(:order => :number) do … | |
| 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}\trin… | |
| + out = [] | |
| + fields.each do |f| | |
| + out << r[f].to_s | |
| + end | |
| + $stdout.puts out.to_csv | |
| end | |
| end | |
| rescue ActiveRecord::RecordNotFound |