Sha256: e45a893fcae11755de7a9325992968e0662dadce05e5f8b741bf249f180b1b65

Contents?: true

Size: 403 Bytes

Versions: 5

Compression:

Stored size: 403 Bytes

Contents

module Hooray
  #
  # Main runner
  #
  class Scan < Struct.new(:target, :ports, :opts)
    def run
      scan = []
      bots = []
      pa "Starting #{Settings.list}  on '#{target}' #{ports}"
      [ports].flatten.each do |port|
        bots << Thread.new do
          scan << ip if Net::Ping::TCP.new(ip.to_s, port, 1).ping?
        end
      end
      bots.each(&:join)
      scan
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hooray-0.0.9 lib/hooray/scan.rb
hooray-0.0.7 lib/hooray/scan.rb
hooray-0.0.5 lib/hooray/scan.rb
hooray-0.0.3 lib/hooray/scan.rb
hooray-0.0.1 lib/hooray/scan.rb