Fixes empty username returned in some cases
This commit is contained in:
@@ -97,9 +97,12 @@ module WPScan
|
||||
# @return [ String, nil ]
|
||||
def display_name_from_body(body)
|
||||
page = Nokogiri::HTML.parse(body)
|
||||
|
||||
# WP >= 3.0
|
||||
page.css('h1.page-title span').each do |node|
|
||||
return node.text.to_s
|
||||
text = node.text.to_s.strip
|
||||
|
||||
return text unless text.empty?
|
||||
end
|
||||
|
||||
# WP < 3.0
|
||||
|
||||
@@ -50,7 +50,7 @@ describe WPScan::Finders::Users::AuthorIdBruteForcing do
|
||||
end
|
||||
|
||||
context 'when no display_name' do
|
||||
['4.1.1', '3.0', '2.9.2'].each do |file|
|
||||
%w[4.9-span-tag 4.1.1 3.0 2.9.2].each do |file|
|
||||
it "returns nil for #{file}-empty.html" do
|
||||
body = File.read(fixtures.join("#{file}-empty.html"))
|
||||
|
||||
|
||||
20
spec/fixtures/finders/users/author_id_brute_forcing/4.9-span-tag-empty.html
vendored
Normal file
20
spec/fixtures/finders/users/author_id_brute_forcing/4.9-span-tag-empty.html
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<body>
|
||||
<div id="content" class="site-content container">
|
||||
<div class="tie-row main-content-row">
|
||||
<div class="main-content tie-col-md-8 tie-col-xs-12" role="main">
|
||||
<header class="entry-header-outer container-wrapper">
|
||||
<nav id="breadcrumb"><a href="https://xxxx.com/"><span class="fa fa-home" aria-hidden="true"></span> ا</a><em class="delimiter">/</em><span class="current"></span></nav>
|
||||
|
||||
<h1 class="page-title"><span class="vcard"> </span></h1> </header><!-- .entry-header-outer /-->
|
||||
|
||||
|
||||
<div class="mag-box wide-post-box">
|
||||
<div class="container-wrapper">
|
||||
<div class="mag-box-container clearfix">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
Reference in New Issue
Block a user