Skip to content

Commit 0c58a11

Browse files
Found the issue I believe, fixed two issues. One with 301/302 responses getting a bad URI due to switch from ip to dns in location header and other from res.to_s rather than res.body being passed to regex
1 parent fc5a0e2 commit 0c58a11

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

modules/auxiliary/scanner/http/wordpress_pingback_access.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,9 @@ def get_blog_posts(xml_rpc, ip)
122122

123123
# Follow redirects
124124
while (res.code == 301 || res.code == 302) and res.headers['Location'] and count != 0
125-
vprint_status("Web server returned a #{res.code}...following to #{res.headers['Location']}")
126-
uri = res.headers['Location'].sub(/.*?#{ip}/, "")
125+
vprint_status("Web server returned a #{res.code}...following to #{res.headers['Location']}")
126+
127+
uri = res.headers['Location'].sub(/(http|https):\/\/.*?\//, "/")
127128
res = send_request_cgi({
128129
'uri' => "#{uri}",
129130
'method' => 'GET'
@@ -150,7 +151,7 @@ def get_blog_posts(xml_rpc, ip)
150151
end
151152

152153
# parse out links and place in array
153-
links = res.to_s.scan(/<link>([^<]+)<\/link>/i)
154+
links = res.body.scan(/<link>([^<]+)<\/link>/i)
154155

155156
if links.nil? or links.empty?
156157
vprint_status("Feed at #{ip} did not have any links present")

0 commit comments

Comments
 (0)