Method: Inspec::Resources::LinuxHostProvider#tcp_check_command

Defined in:
lib/resources/host.rb

#tcp_check_command(hostname, port) ⇒ Object



249
250
251
252
253
254
255
256
257
258
259
# File 'lib/resources/host.rb', line 249

def tcp_check_command(hostname, port)
  if inspec.command('nc').exist?
    base_cmd = 'nc'
  elsif inspec.command('ncat').exist?
    base_cmd = 'ncat'
  else
    return
  end

  "echo | #{base_cmd} -v -w 1 #{hostname} #{port}"
end