class Onionurigen::AddressFinder
Attributes
found[R]
match[R]
onion_url[R]
private_key[R]
rsa[R]
Public Class Methods
new(match, multi_threading = false)
click to toggle source
# File lib/onionurigen/address_finder.rb, line 16 def initialize(match, multi_threading = false) raise 'Invalid Pattern' unless [String, Regexp].include?(match.class) @found = false @match = match.class.eql?(String) ? /\A#{Regexp.quote(match.upcase)}/ : match multi_threading ? multi_thread_process : single_thread_process end
Public Instance Methods
found?()
click to toggle source
# File lib/onionurigen/address_finder.rb, line 44 def found? @found end
multi_thread_process()
click to toggle source
# File lib/onionurigen/address_finder.rb, line 34 def multi_thread_process @rsa = Onionurigen::RSAGen.new @spki = Onionurigen::SPKI.new(@rsa) if @spki.encoded =~ @match @found = true @private_key = @rsa.private_key.to_pem_pkcs8 @onion_url = "http://#{@spki.encoded.downcase}.onion" end end
single_thread_process()
click to toggle source
# File lib/onionurigen/address_finder.rb, line 23 def single_thread_process loop do @rsa = Onionurigen::RSAGen.new @spki = Onionurigen::SPKI.new(@rsa) break if @spki.encoded =~ @match end @found = true @private_key = @rsa.private_key.to_pem_pkcs8 @onion_url = "http://#{@spki.encoded.downcase}.onion" end