Skip to content

Commit 6df55c9

Browse files
committed
Gotta catch 'em (post statuses) all
1 parent 7583d05 commit 6df55c9

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

modules/auxiliary/scanner/http/wordpress_content_injection.rb

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,21 @@ def do_list
8383

8484
tbl = Rex::Text::Table.new(
8585
'Header' => full_uri,
86-
'Columns' => ['ID', 'Title', 'URL', 'Password']
86+
'Columns' => %w{ID Title URL Status Password}
8787
)
8888

8989
posts_to_list.each do |post|
90+
if post[:status] == 'publish'
91+
status = 'Published'
92+
else
93+
status = post[:status].capitalize
94+
end
95+
9096
tbl << [
9197
post[:id],
9298
Rex::Text.html_decode(post[:title]),
9399
post[:url],
100+
status,
94101
post[:password] ? 'Yes' : 'No'
95102
]
96103
end
@@ -135,22 +142,26 @@ def do_update
135142
def list_posts
136143
posts = []
137144

138-
res = send_request_cgi({
139-
'method' => 'GET',
140-
'uri' => normalize_uri(get_rest_api, 'posts'),
141-
'vars_get' => {
142-
'per_page' => datastore['PostCount']
143-
}
144-
}, 3.5)
145-
146-
if res && res.code == 200
147-
res.get_json_document.each do |post|
148-
posts << {
149-
id: post['id'],
150-
title: post['title']['rendered'],
151-
url: post['link'],
152-
password: post['content']['protected']
145+
%w{publish future draft pending private}.each do |status|
146+
res = send_request_cgi({
147+
'method' => 'GET',
148+
'uri' => normalize_uri(get_rest_api, 'posts'),
149+
'vars_get' => {
150+
'status' => status,
151+
'per_page' => datastore['PostCount']
153152
}
153+
}, 3.5)
154+
155+
if res && res.code == 200
156+
res.get_json_document.each do |post|
157+
posts << {
158+
id: post['id'],
159+
title: post['title']['rendered'],
160+
url: post['link'],
161+
status: status,
162+
password: post['content']['protected']
163+
}
164+
end
154165
end
155166
end
156167

0 commit comments

Comments
 (0)