Added argument parser - warvox - VoIP based wardialing tool, forked from rapid7/warvox.
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) commit befd31db192887a838b233fca335eb6bfa68a7c0
(DIR) parent 94e9d75611114ada01cb5df237e17250beda085b
(HTM) Author: HD Moore <hd_moore@rapid7.com>
Date: Sun, 1 Mar 2009 22:18:11 +0000
Added argument parser
Diffstat:
M bin/warvox.rb | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/bin/warvox.rb b/bin/warvox.rb
@@ -11,9 +11,15 @@ end
voxroot = File.join(File.dirname(base), '..', 'web')
Dir.chdir(voxroot)
+require 'getoptlong'
voxserv = File.join('script', 'server')
+def usage
+ $stderr.puts "#{$0} [--address IP] [--port PORT] --background"
+ exit(0)
+end
+
opts =
{
'ServerPort' => 7777,
@@ -21,6 +27,26 @@ opts =
'Background' => false,
}
+args = GetoptLong.new(
+ ["--address", "-a", GetoptLong::REQUIRED_ARGUMENT ],
+ ["--port", "-p", GetoptLong::REQUIRED_ARGUMENT ],
+ ["--daemon", "-d", GetoptLong::NO_ARGUMENT ],
+ ["--help", "-h", GetoptLong::NO_ARGUMENT]
+)
+
+args.each do |opt,arg|
+ case opt
+ when '--address'
+ opts['ServerHost'] = arg
+ when '--port'
+ opts['ServerPort'] = arg
+ when '--daemon'
+ opts['Background'] = true
+ when '--help'
+ usage()
+ end
+end
+
# Clear ARGV
while(ARGV.length > 0)