#!/usr/bin/env ruby require 'proxy_finder' require 'optparse' files = Hash.new option_parser = OptionParser.new do |opts| opts.banner = "Usage: proxy_finder -i INFILE -o OUTFILE" opts.on('-i', '--infile FILENAME', 'File containing hosts to test.') do |filename| files[:infile] = filename end opts.on('-o', '--outfile FILENAME', 'File to output working hosts.') do |filename| files[:outfile] = filename end opts.on("-h", "--help", "This usage menu.") do puts option_parser end end option_parser.parse! unless files[:infile] && files[:outfile] puts option_parser end # Allows halting via ctrl-c trap("SIGINT") { throw :ctrl_c } catch :ctrl_c do pf = ProxyFinder.new pf.start(files) end