Class: RangeScan::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/rangescan/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/rangescan/cli.rb', line 39

def exit_on_failure?
  true
end

Instance Method Details

#scan(ip_with_subnet_mask, regexp = ".") ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rangescan/cli.rb', line 17

def scan(ip_with_subnet_mask, regexp = ".")
  symbolized_options = symbolize_hash_keys(options)
  range = Range.new(ip_with_subnet_mask)

  scanner = Scanner.new(**symbolized_options)
  results = scanner.scan(range.to_a)

  matcher = Matcher.new(regexp)
  filtered = matcher.filter(results)

  puts JSON.pretty_generate(filtered)
end