class Torrific::Application
Attributes
daemonize[RW]
host[RW]
interval[RW]
password[RW]
port[RW]
tor_controller[RW]
Public Class Methods
parse_options()
click to toggle source
# File lib/application.rb, line 31 def parse_options options = OptionParser.new do |opts| opts.banner = "Usage: torrific [options]" opts.on("--password PASSWORD", "Sets the authentication password(default is nil)") do |pass| self.password = pass end opts.on("--host HOST", "Tor Control host(default is localhost)") do |host| self.host = host end opts.on("--port PORT", "Tor Control port(default is 9051).") do |port| self.port = port end opts.on("--interval INT", "Changes identity each INT seconds.(default is only once)") do |seconds| self.interval = seconds.to_i end opts.on("-d", "Daemonize the process") do self.daemonize = true end end options.parse! end
run()
click to toggle source
# File lib/application.rb, line 8 def run self.parse_options Process.daemon if self.daemonize trap('SIGINT') do puts "Bye Bye!" exit end self.tor_controller = TorControl.new(host: self.host, port: self.port, password: self.password) while true self.tor_controller.change_ip puts "Your identity has been changed." if(self.interval && self.interval > 0) sleep self.interval else break end end end