Skip to content

Commit 7583d05

Browse files
committed
Add AutoPublish to publish updated posts
1 parent e480107 commit 7583d05

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

modules/auxiliary/scanner/http/wordpress_content_injection.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ def initialize(info = {})
4343
])
4444

4545
register_advanced_options([
46-
OptInt.new('PostCount', [false, 'Number of posts to list', 100])
46+
OptInt.new('PostCount', [false, 'Number of posts to list', 100]),
47+
OptBool.new('AutoPublish', [false, 'Publish updated posts', true])
4748
])
4849
end
4950

@@ -115,7 +116,8 @@ def do_update
115116
res = update_post(post[:id],
116117
title: datastore['POST_TITLE'],
117118
content: datastore['POST_CONTENT'],
118-
password: datastore['POST_PASSWORD']
119+
password: datastore['POST_PASSWORD'],
120+
status: datastore['AutoPublish'] ? 'publish' : nil
119121
)
120122

121123
post_url = full_uri(wordpress_url_post(post[:id]))
@@ -162,6 +164,7 @@ def update_post(id, opts = {})
162164
payload[:title] = opts[:title] if opts[:title]
163165
payload[:content] = opts[:content] if opts[:content]
164166
payload[:password] = opts[:password] if opts[:password]
167+
payload[:status] = opts[:status] if opts[:status]
165168

166169
send_request_cgi({
167170
'method' => 'POST',

0 commit comments

Comments
 (0)