Skip to content

Commit ed9d290

Browse files
added status messages, made var blog_posts initalize as nil rather than empty string
1 parent 5bafd6d commit ed9d290

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

modules/auxiliary/scanner/http/wordpress_pingback_access.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def generate_pingback_xml (target, valid_blog_post)
105105
def get_blog_posts(xml_rpc, ip)
106106
# find all blog posts within IP and determine if pingback is enabled
107107
vprint_status("Enumerating Blog posts on #{ip}...")
108-
blog_posts = ""
108+
blog_posts = nil
109109

110110
uri = target_uri.path
111111
uri << '/' if uri[-1,1] != '/'
@@ -124,6 +124,7 @@ def get_blog_posts(xml_rpc, ip)
124124
while (res.code == 301 || res.code == 302) and res.headers['Location'] and count != 0
125125
vprint_status("Web server returned a #{res.code}...following to #{res.headers['Location']}")
126126
uri = res.headers['Location'].sub(/.*?#{ip}/, "")
127+
puts uri
127128
res = send_request_cgi({
128129
'uri' => "#{uri}",
129130
'method' => 'GET'
@@ -132,7 +133,7 @@ def get_blog_posts(xml_rpc, ip)
132133
if res.code == 200
133134
vprint_status("Feed located at http://#{ip}#{uri}")
134135
else
135-
vprint_status("#{ip} returned a #{res.code}")
136+
vprint_status("#{ip} returned a #{res.code}...")
136137
end
137138
count = count - 1
138139
end
@@ -144,18 +145,19 @@ def get_blog_posts(xml_rpc, ip)
144145
return nil
145146
end
146147

147-
# parse out links and place in array
148148
if res.nil? or res.code != 200
149+
vprint_status("")
149150
return blog_posts
150151
end
151152

153+
# parse out links and place in array
152154
links = res.to_s.scan(/<link>([^<]+)<\/link>/i)
153155

154156
if links.nil? or links.empty?
157+
vprint_status("Feed at #{ip} did not have any links present")
155158
return blog_posts
156159
end
157160

158-
159161
links.each do |link|
160162
blog_post = link[0]
161163
pingback_response = get_pingback_request(xml_rpc, 'http://127.0.0.1', blog_post)

0 commit comments

Comments
 (0)