Permissions - warvox - VoIP based wardialing tool, forked from rapid7/warvox.
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) commit 6da2bec72d9c7e6c7e8114fc4dfba5ac5e30598e
(DIR) parent 7bcac597dbf94b510242581bb21f8d9ddae4a514
(HTM) Author: HD Moore <hd_moore@rapid7.com>
Date: Mon, 31 Dec 2012 19:10:24 -0600
Permissions
Diffstat:
M bin/export_list.rb | 45 +++++++++++++++----------------
M bin/import_audio.rb | 4 ++--
M bin/warvox.rb | 26 +++++++++++++++++++++++---
3 files changed, 47 insertions(+), 28 deletions(-)
---
(DIR) diff --git a/bin/export_list.rb b/bin/export_list.rb
@@ -14,10 +14,7 @@ require 'warvox'
require 'csv'
ENV['RAILS_ENV'] ||= 'production'
-
$:.unshift(File.join(File.expand_path(File.dirname(base)), '..'))
-require 'config/boot'
-require 'config/environment'
def usage
$stderr.puts "Usage: #{$0} [Job ID] <Type>"
@@ -28,36 +25,38 @@ end
# Script
#
-job = ARGV.shift
-typ = ARGV.shift
+project_id = ARGV.shift
+line_type = ARGV.shift
-if(job and job == "-h")
+if(project_id and project_id == "-h")
usage()
end
-if(not job)
- $stderr.puts "Listing all available jobs"
- $stderr.puts "=========================="
- DialJob.find(:all).each do |j|
- puts "#{j.id}\t#{j.started_at} --> #{j.completed_at}"
+require 'config/boot'
+require 'config/environment'
+
+if(not project_id)
+ $stderr.puts "Listing all projects"
+ $stderr.puts "===================="
+ Project.find(:all).each do |j|
+ puts "#{j.id}\t#{j.name}\t#{j.created_at}"
end
exit
end
-fields = %W{ number line_type cid completed busy seconds ringtime peak_freq notes signatures }
+fields = %W{ number line_type caller_id answered busy audio_length ring_length peak_freq }
begin
$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)
- out = []
- fields.each do |f|
- out << r[f].to_s
- end
- $stdout.puts out.to_csv
+ cond = { :project_id => project_id.to_i }
+ if line_type
+ cond[:line_type] = line_type.downcase
+ end
+
+ Call.where(cond).find(:order => :number) do |r|
+ out = []
+ fields.each do |f|
+ out << r[f].to_s
end
+ $stdout.puts out.to_csv
end
-rescue ActiveRecord::RecordNotFound
- $stderr.puts "Job not found"
- exit
end
(DIR) diff --git a/bin/import_audio.rb b/bin/import_audio.rb
@@ -49,7 +49,7 @@ project = nil
provider = nil
if project_id
- project = Project.find(pid)
+ project = Project.where(:id => project_id).first
unless project
$stderr.puts "Error: Specified Project ID not found"
exit(1)
@@ -57,7 +57,7 @@ if project_id
end
if provider_id
- provider = Provider.find(pid)
+ provider = Provider.where(:id => provider_id).first
unless provider
$stderr.puts "Error: Specified Provider ID not found"
exit(1)
(DIR) diff --git a/bin/warvox.rb b/bin/warvox.rb
@@ -2,7 +2,7 @@
###################
require 'getoptlong'
-
+require 'open3'
#
# Load the library path
@@ -12,11 +12,18 @@ while File.symlink?(base)
base = File.expand_path(File.readlink(base), File.dirname(base))
end
-voxroot = File.join(File.dirname(base), '..')
-voxserv = File.join(File.expand_path(voxroot), 'script', 'rails')
+voxroot = File.expand_path(File.join(File.dirname(base), '..'))
+voxserv = File.expand_path(File.join(File.expand_path(voxroot), 'script', 'rails'))
+manager = File.expand_path(File.join(File.dirname(base), 'worker_manager.rb'))
Dir.chdir(voxroot)
+def stop
+ $stderr.puts "[-] Interrupt received, shutting down workers and web server..."
+ Process.kill("TERM", @manager_pid) if @manager_pid
+ exit(0)
+end
+
def usage
$stderr.puts "#{$0} [--address IP] [--port PORT] --background"
exit(0)
@@ -60,12 +67,25 @@ if opts['Background']
args.push("-d")
end
+
+trap("SIGINT") { stop() }
+
$browser_url = "http://#{opts['ServerHost']}:#{opts['ServerPort']}/"
$stderr.puts ""
$stderr.puts "[*] Starting WarVOX on #{$browser_url}"
$stderr.puts ""
+
+@manager_pid = Process.fork()
+if not @manager_pid
+ while (ARGV.shift) { }
+ load(manager)
+ exit(0)
+end
+
+@webserver_pid = $$
+
while(ARGV.length > 0); ARGV.shift; end
args.each {|arg| ARGV.push(arg) }