Sha256: a36b5d7d7d2e995b9b977ff274ca8723dd566507eb0e43d300cd8ec7c2cf5216

Contents?: true

Size: 1.65 KB

Versions: 11

Compression:

Stored size: 1.65 KB

Contents

require File.dirname(__FILE__) + '/../lib/yawast'
require File.dirname(__FILE__) + '/base'

class TestScannerApacheBanner < Minitest::Test
  include TestBase

  def test_apache_banner_no_version
    server = 'Apache'
    override_stdout
    Yawast::Scanner::Plugins::Servers::Apache.check_banner server

    assert stdout_value.include?("Apache Server: #{server}"), "Unexpected banner: #{stdout_value}"

    restore_stdout
  end

  def test_apache_basic_banner
    server = 'Apache/2.4.7'
    override_stdout
    Yawast::Scanner::Plugins::Servers::Apache.check_banner server

    assert stdout_value.include?("Apache Server: #{server}"), "Unexpected banner: #{stdout_value}"

    restore_stdout
  end

  def test_apache_banner_distro
    server = 'Apache/2.4.7 (Ubuntu)'
    override_stdout
    Yawast::Scanner::Plugins::Servers::Apache.check_banner server

    assert stdout_value.include?("Apache Server: #{server}"), "Unexpected banner: #{stdout_value}"

    restore_stdout
  end

  def test_apache_one_module
    server = 'Apache/2.4.6 (FreeBSD) PHP/5.4.23'
    override_stdout
    Yawast::Scanner::Plugins::Servers::Apache.check_banner server

    assert stdout_value.include?('Apache Server: Module listing enabled'), 'Module listing missing'

    restore_stdout
  end

  def test_apache_openssl_module
    server = 'Apache/2.4.6 (FreeBSD) PHP/5.4.23 OpenSSL/0.9.8n'
    override_stdout
    Yawast::Scanner::Plugins::Servers::Apache.check_banner server

    assert stdout_value.include?('Apache Server: Module listing enabled'), 'Module listing missing'
    assert stdout_value.include?('OpenSSL Version Disclosure'), 'OpenSSL version warning missing'

    restore_stdout
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
yawast-0.7.2 test/test_scan_apache_banner.rb
yawast-0.7.1 test/test_scan_apache_banner.rb
yawast-0.7.0 test/test_scan_apache_banner.rb
yawast-0.7.0.beta3 test/test_scan_apache_banner.rb
yawast-0.7.0.beta2 test/test_scan_apache_banner.rb
yawast-0.7.0.beta1 test/test_scan_apache_banner.rb
yawast-0.6.0 test/test_scan_apache_banner.rb
yawast-0.6.0.beta6 test/test_scan_apache_banner.rb
yawast-0.6.0.beta5 test/test_scan_apache_banner.rb
yawast-0.6.0.beta4 test/test_scan_apache_banner.rb
yawast-0.6.0.beta3 test/test_scan_apache_banner.rb