@@ -83,14 +83,21 @@ def do_list
83
83
84
84
tbl = Rex ::Text ::Table . new (
85
85
'Header' => full_uri ,
86
- 'Columns' => [ 'ID' , ' Title' , ' URL' , ' Password' ]
86
+ 'Columns' => %w{ ID Title URL Status Password }
87
87
)
88
88
89
89
posts_to_list . each do |post |
90
+ if post [ :status ] == 'publish'
91
+ status = 'Published'
92
+ else
93
+ status = post [ :status ] . capitalize
94
+ end
95
+
90
96
tbl << [
91
97
post [ :id ] ,
92
98
Rex ::Text . html_decode ( post [ :title ] ) ,
93
99
post [ :url ] ,
100
+ status ,
94
101
post [ :password ] ? 'Yes' : 'No'
95
102
]
96
103
end
@@ -135,22 +142,26 @@ def do_update
135
142
def list_posts
136
143
posts = [ ]
137
144
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' ]
153
152
}
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
154
165
end
155
166
end
156
167
0 commit comments