Introduction
Introduction Statistics Contact Development Disclaimer Help
warvox - warvox - VoIP based wardialing tool, forked from rapid7/warvox.
git clone git://jay.scot/warvox
Log
Files
Refs
README
---
warvox (2083B)
---
1 #!/usr/bin/env ruby
2 ###################
3
4 require 'getoptlong'
5 require 'open3'
6
7 #
8 # Load the library path
9 #
10 base = __FILE__
11 while File.symlink?(base)
12 base = File.expand_path(File.readlink(base), File.dirname(base))
13 end
14
15 $:.unshift(File.join(File.expand_path(File.dirname(base)), '..', 'lib'))
16
17 voxroot = File.expand_path(File.join(File.dirname(base), '..'))
18 manager = File.expand_path(File.join(File.dirname(base), 'worker_manager…
19
20 require 'warvox'
21
22
23 Dir.chdir(voxroot)
24
25 def stop
26 $stderr.puts "[-] Interrupt received, shutting down workers and web se…
27 Process.kill("TERM", @manager_pid) if @manager_pid
28 exit(0)
29 end
30
31 def usage
32 $stderr.puts "#{$0} [--address IP] [--port PORT] --background"
33 exit(0)
34 end
35
36 opts =
37 {
38 'ServerPort' => 7777,
39 'ServerHost' => '127.0.0.1',
40 'Background' => false,
41 }
42
43 args = GetoptLong.new(
44 ["--address", "-a", GetoptLong::REQUIRED_ARGUMENT ],
45 ["--port", "-p", GetoptLong::REQUIRED_ARGUMENT ],
46 ["--daemon", "-d", GetoptLong::NO_ARGUMENT ],
47 ["--help", "-h", GetoptLong::NO_ARGUMENT]
48 )
49
50 args.each do |opt,arg|
51 case opt
52 when '--address'
53 opts['ServerHost'] = arg
54 when '--port'
55 opts['ServerPort'] = arg
56 when '--daemon'
57 opts['Background'] = true
58 when '--help'
59 usage()
60 end
61 end
62
63 args = [
64 'server',
65 '-p', opts['ServerPort'].to_s,
66 '-b', opts['ServerHost'],
67 '-e', 'production',
68 ]
69
70 if opts['Background']
71 args.push("-d")
72 end
73
74
75 trap("SIGINT") { Thread.new{ stop } }
76
77 $browser_url = "http://#{opts['ServerHost']}:#{opts['ServerPort']}/"
78
79 WarVOX::Log.info("")
80 WarVOX::Log.info("[*] Starting WarVOX on #{$browser_url}")
81 WarVOX::Log.info("")
82 WarVOX::Log.info("WarVOX is starting up...")
83
84 @manager_pid = Process.fork()
85 if not @manager_pid
86 while ARGV.shift do
87 end
88 load(manager)
89 exit(0)
90 end
91
92 WarVOX::Log.info("Worker Manager has PID #{@manager_pid}")
93
94 @webserver_pid = $$
95
96 WarVOX::Log.info("Web Server has PID #{@webserver_pid}")
97
98 while(ARGV.length > 0); ARGV.shift; end
99 args.each {|arg| ARGV.push(arg) }
100
101 # need to pass config opts above into the system command below
102 system "bin/rails", *args
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.