output interesting http-headers

This commit is contained in:
Christian Mehlmauer
2013-07-19 14:14:13 +02:00
parent f49b53b095
commit bb35837ea1
6 changed files with 87 additions and 0 deletions

View File

@@ -23,6 +23,7 @@ describe WpTarget do
it_behaves_like 'WpTarget::WpRegistrable'
it_behaves_like 'WpTarget::WpConfigBackup'
it_behaves_like 'WpTarget::WpLoginProtection'
it_behaves_like 'WpTarget::InterestingHeaders'
it_behaves_like 'WpTarget::WpCustomDirectories'
it_behaves_like 'WpTarget::WpFullPathDisclosure'

View File

@@ -0,0 +1,36 @@
# encoding: UTF-8
shared_examples 'WpTarget::InterestingHeaders' do
let(:known_headers) { WpTarget::InterestingHeaders.known_headers }
let(:url) { 'http://localhost.com' }
describe '#interesting_headers' do
it 'returns MyTestHeader' do
stub_request(:head, wp_target.url).
to_return(status: 200, headers: { 'Mytestheader' => 'Mytestheadervalue' })
wp_target.interesting_headers.should =~ [ [ 'Mytestheader', 'Mytestheadervalue' ] ]
end
it 'removes known headers' do
stub_request(:head, wp_target.url).
to_return(status: 200, headers: { 'Location' => 'a', 'Connection' => 'Close' })
wp_target.interesting_headers.should be_empty
end
it 'returns nothing' do
stub_request(:head, wp_target.url).
to_return(status: 200, headers: { })
wp_target.interesting_headers.should be_empty
end
end
describe '#known_headers' do
it 'does not contain duplicates' do
known_headers.flatten.uniq.length.should == known_headers.length
end
end
end