diff --git a/wp-content/plugins/wpscan/app/Account.php b/wp-content/plugins/wpscan/app/Account.php new file mode 100644 index 00000000..ff533a9e --- /dev/null +++ b/wp-content/plugins/wpscan/app/Account.php @@ -0,0 +1,160 @@ +parent = $parent; + + add_action( 'admin_init', array( $this, 'add_account_summary_meta_box' ) ); + } + + /** + * Update account status by calling the /status endpoint. + * + * @since 1.0.0 + * @param string $api_token + * @access public + * @return void + */ + public function update_account_status( $api_token = null ) { + $current = get_option( $this->parent->OPT_ACCOUNT_STATUS, array() ); + $updated = $current; + + $req = $this->parent->api_get( '/status', $api_token ); + + if ( is_object( $req ) ) { + $updated['plan'] = $req->plan; + + // Enterprise users. + if ( -1 === $req->requests_remaining ) { + $updated['limit'] = __( 'unlimited', 'wpscan' ); + $updated['remaining'] = __( 'unlimited', 'wpscan' ); + $updated['reset'] = __( 'unlimited', 'wpscan' ); + } else { + $updated['limit'] = $req->requests_limit; + $updated['remaining'] = $req->requests_remaining; + $updated['reset'] = $req->requests_reset; + } + + update_option( $this->parent->OPT_ACCOUNT_STATUS, $updated ); + } + } + + /** + * Add meta box + * + * @since 1.0.0 + * @access public + * @return void + */ + public function add_account_summary_meta_box() { + if ( $this->parent->classes['settings']->api_token_set() ) { + add_meta_box( + 'wpscan-account-summary', + __( 'Account Status', 'wpscan' ), + array( $this, 'do_meta_box_account_summary' ), + 'wpscan', + 'side', + 'low' + ); + } + } + + /** + * Get account status + * + * @since 1.0.0 + * @access public + * @return array + */ + public function get_account_status() { + $defaults = array( + 'plan' => 'None', + 'limit' => 25, + 'remaining' => 25, + 'reset' => time(), + ); + + return get_option( $this->parent->OPT_ACCOUNT_STATUS, $defaults ); + } + + /** + * Render account status metabox + * + * @since 1.0.0 + * @access public + * @return string + */ + public function do_meta_box_account_summary() { + extract( $this->get_account_status() ); + + if ( 'enterprise' !== $plan ) { + if ( ! isset( $limit ) || ! is_numeric( $limit ) ) { + return; + } + + // Reset time in hours. + $diff = $reset - time(); + $days = floor( $diff / ( 60 * 60 * 24 ) ); + $hours = round( ( $diff - $days * 60 * 60 * 24 ) / ( 60 * 60 ) ); + $hours_display = $hours > 1 ? __( 'Hours', 'wpscan' ) : __( 'Hour', 'wpscan' ); + + // Used. + $used = $limit - $remaining; + + // Usage percentage. + $percentage = 0 !== $limit ? ( $used * 100 ) / $limit : 0; + + // Usage color. + if ( $percentage < 50 ) { + $usage_color = 'wpscan-status-green'; + } elseif ( $percentage >= 50 && $percentage < 95 ) { + $usage_color = 'wpscan-status-orange'; + } else { + $usage_color = 'wpscan-status-red'; + } + } else { + // For enterprise users. + $used = $limit; + $hours = $reset; + $hours_display = null; + $usage_color = 'wpscan-status-green'; + } + + // Upgrade button. + $btn_text = 'free' === $plan ? __( 'Upgrade', 'wpscan' ) : __( 'Manage', 'wpscan' ); + $btn_url = WPSCAN_PROFILE_URL; + + // Output data. + echo ''; + + // Output upgrade/manage button. + echo "$btn_text"; + } +} diff --git a/wp-content/plugins/wpscan/app/Checks/Check.php b/wp-content/plugins/wpscan/app/Checks/Check.php new file mode 100644 index 00000000..ccc6dfb6 --- /dev/null +++ b/wp-content/plugins/wpscan/app/Checks/Check.php @@ -0,0 +1,244 @@ +id = $id; + $this->dir = $dir; + $this->parent = $parent; + + $count = $this->get_vulnerabilities_count(); + + $this->actions[] = array( + 'id' => 'run', + 'title' => __( 'Run', 'wpscan' ), + 'method' => 'run', + ); + + if ( $count > 0 ) { + $this->actions[] = array( + 'id' => 'dismiss', + 'title' => __( 'Dismiss', 'wpscan' ), + 'method' => 'dismiss', + 'confirm' => true, + ); + } + + if ( method_exists( $this, 'init' ) ) { + $this->init(); + } + } + + /** + * Check title. + * + * @since 1.0.0 + * @access public + * @return string + */ + abstract public function title(); + + /** + * Check description. + * + * @since 1.0.0 + * @access public + * @return string + */ + abstract public function description(); + + /** + * Success message. + * + * @since 1.0.0 + * @access public + * @return string + */ + abstract public function success_message(); + + /** + * Add vulnerability + * + * @since 1.0.0 + * + * @param string $title The vulnerability title. + * @param string $severity The severity, can be critical, high, medium, low and info. + * @param string $id Unique string to represent the vulnerability in the report object. + * + * @access public + * @return void + */ + final public function add_vulnerability( $title, $severity, $id, $remediation_url ) { + $vulnerability = array( + 'title' => $title, + 'severity' => $severity, + 'id' => $id, + 'remediation_url' => $remediation_url, + ); + + $this->vulnerabilities[] = $vulnerability; + } + + /** + * Get vulnerabilities. + * + * @since 1.0.0 + * @access public + * @return array|null + */ + final public function get_vulnerabilities() { + if ( ! empty( $this->vulnerabilities ) ) { + return $this->vulnerabilities; + } + + $report = $this->parent->get_report(); + + if ( isset( $report['security-checks'] ) ) { + if ( isset( $report['security-checks'][ $this->id ] ) ) { + return $report['security-checks'][ $this->id ]['vulnerabilities']; + } + } + + return null; + } + + /** + * Get item non-ignored vulnerabilities count + * + * @since 1.0.0 + * + * @access public + * @return int + */ + public function get_vulnerabilities_count() { + $vulnerabilities = $this->get_vulnerabilities(); + $ignored = $this->parent->get_ignored_vulnerabilities(); + + if ( empty( $vulnerabilities ) ) { + return 0; + } + + foreach ( $vulnerabilities as $key => &$item ) { + if ( in_array( $item['id'], $ignored, true ) ) { + unset( $vulnerabilities[ $key ] ); + } + } + + return count( $vulnerabilities ); + } + + /** + * Dismiss action + * + * @since 1.0.0 + * @access public + * @return bool + */ + public function dismiss() { + $report = $this->parent->get_report(); + $updated = $report; + + if ( isset( $updated['security-checks'] ) ) { + if ( isset( $updated['security-checks'][ $this->id ] ) ) { + $updated['security-checks'][ $this->id ]['vulnerabilities'] = array(); + } + } + + if ( $report === $updated ) { + return true; + } else { + return update_option( $this->parent->OPT_REPORT, $updated ); + } + } + + /** + * Run action. + * + * @since 1.0.0 + * @access public + * @return bool + */ + public function run() { + $report = $this->parent->get_report(); + $updated = $report; + + if ( empty( $updated ) ) { + $updated = array( + 'security-checks' => array(), + 'plugins' => array(), + 'themes' => array(), + 'wordpress' => array(), + ); + } + + if ( isset( $updated['security-checks'][ $this->id ] ) ) { + $updated['security-checks'][ $this->id ] = array(); + } + + $this->perform(); + + if ( is_array( $this->vulnerabilities ) ) { + $updated['security-checks'][ $this->id ]['vulnerabilities'] = $this->vulnerabilities; + + $this->parent->maybe_fire_issue_found_action('security-check', $this->id, $updated['security-checks'][ $this->id ]); + } else { + $updated['security-checks'][ $this->id ]['vulnerabilities'] = array(); + } + + if ( $report === $updated ) { + return true; + } else { + return update_option( $this->parent->OPT_REPORT, $updated ); + } + } + + /** + * Perform the check and save the results. + * + * @since 1.0.0 + * @access public + * @return void + */ + abstract public function perform(); +} diff --git a/wp-content/plugins/wpscan/app/Checks/System.php b/wp-content/plugins/wpscan/app/Checks/System.php new file mode 100644 index 00000000..340fdc5d --- /dev/null +++ b/wp-content/plugins/wpscan/app/Checks/System.php @@ -0,0 +1,415 @@ +parent = $parent; + $this->current_running = get_option( $this->OPT_EVENTS_INLINE ); + + register_shutdown_function( array( $this, 'catch_errors' ) ); + + add_action( 'admin_notices', array( $this, 'display_errors' ) ); + + add_action( 'plugins_loaded', array( $this, 'load_checks' ) ); + add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue' ) ); + add_action( 'wp_ajax_wpscan_check_action', array( $this, 'handle_actions' ) ); + + add_action( $this->WPSCAN_SECURITY_SCHEDULE, array( $this, 'security_check_now' ), 99 ); + } + + /** + * Register Admin Scripts + * + * @param string $hook parent. + * + * @access public + * @return void + * @since 1.0.0 + */ + public function admin_enqueue( $hook ) { + if ( $hook === $this->parent->page_hook ) { + wp_enqueue_script( + 'wpscan-security-checks', + plugins_url( 'assets/js/security-checks.js', WPSCAN_PLUGIN_FILE ), + array( 'jquery-ui-tooltip' ) + ); + } + } + + /** + * Load checks files. + * + * @return void + * @since 1.0.0 + * @access public + */ + public function load_checks() { + $dir = $this->parent->plugin_dir . 'security-checks'; + $folders = array_diff( scandir( $dir ), array( '..', '.' ) ); + + foreach ( $folders as $folder ) { + $file = "$dir/$folder/check.php"; + + if ( '.' === $folder[0] ) { + continue; + } + + require_once $file; + + $data = get_file_data( $file, array( 'classname' => 'classname' ) ); + + $data['instance'] = new $data['classname']( $folder, "$dir/$folder", $this->parent ); + + $this->checks[ $folder ] = $data; + } + } + + /** + * Register a shutdown hook to catch errors + * + * @return void + * @since 1.0.0 + * @access public + */ + public function catch_errors() { + $error = error_get_last(); + + if ( $error && $error['type'] ) { + + if ( basename( $error['file'] ) == 'check.php' ) { + $errors = get_option( $this->OPT_FATAL_ERRORS, array() ); + + array_push( $errors, $error ); + + update_option( $this->OPT_FATAL_ERRORS, array_unique( $errors ) ); + + $report = $this->parent->get_report(); + + $report['cache'] = strtotime( current_time( 'mysql' ) ); + + update_option( $this->parent->OPT_REPORT, $report ); + + $this->parent->classes['account']->update_account_status(); + + delete_transient( $this->parent->WPSCAN_TRANSIENT_CRON ); + } + } + } + + /** + * Display fatal errors + * + * @return void + * @since 1.0.0 + * @access public + */ + public function display_errors() { + $screen = get_current_screen(); + $errors = get_option( $this->OPT_FATAL_ERRORS, array() ); + + if ( strstr( $screen->id, $this->parent->classes['report']->page ) ) { + foreach ( $errors as $err ) { + $msg = explode( 'Stack', $err['message'] )[0]; + $msg = trim( $msg ); + + echo "

$msg

"; + } + } + } + + /** + * List vulnerabilities in the report. + * + * @param object $check - The check instance. + * + * @access public + * @return string + * @since 1.0.0 + * + */ + public function list_check_vulnerabilities( $instance ) { + $vulnerabilities = $instance->get_vulnerabilities(); + $count = $instance->get_vulnerabilities_count(); + $ignored = $this->parent->get_ignored_vulnerabilities(); + + $not_checked_text = __( 'Not checked yet. Click the Run button to run a scan', 'wpscan' ); + + if ( ! isset( $vulnerabilities ) ) { + echo esc_html( $not_checked_text ); + } elseif ( empty( $vulnerabilities ) || 0 === $count ) { + echo esc_html( $instance->success_message() ); + } else { + $list = array(); + + foreach ( $vulnerabilities as $item ) { + if ( in_array( $item['id'], $ignored, true ) ) { + continue; + } + + $html = "
"; + $html .= ""; + $html .= "" . esc_html( $item['severity'] ) .""; + $html .= ''; + $html .= "
" . wp_kses( $item['title'], array( 'a' => array( 'href' => array() ) ) ) . '
'; + $html .= "
Click here for further info
"; + $html .= '
'; + $list[] = $html; + } + + echo join( '
', $list ); + } + } + + /** + * Return vulnerabilities in the report. + * + * @param object $check - The check instance. + * + * @access public + * @return string + * @since 1.14.4 + * + */ + public function get_check_vulnerabilities( $instance ) { + $vulnerabilities = $instance->get_vulnerabilities(); + $count = $instance->get_vulnerabilities_count(); + $ignored = $this->parent->get_ignored_vulnerabilities(); + + $not_checked_text = __( 'Not checked yet. Click the Run button to run a scan', 'wpscan' ); + + if ( ! isset( $vulnerabilities ) ) { + return esc_html( $not_checked_text ); + } elseif ( empty( $vulnerabilities ) || 0 === $count ) { + return esc_html( $instance->success_message() ); + } else { + $list = array(); + + foreach ( $vulnerabilities as $item ) { + if ( in_array( $item['id'], $ignored, true ) ) { + continue; + } + + $html = "
"; + $html .= "
"; + $html .= "" . esc_html( $item['severity'] ) . ''; + $html .= '
'; + $html .= "
" . wp_kses( $item['title'], array( 'a' => array( 'href' => array() ) ) ) . '
'; + $html .= '
'; + $list[] = $html; + } + + return join( '
', $list ); + } + } + + /** + * Display actions buttons + * + * @param object $instance - The check instance. + * + * @access public + * @return string + * @since 1.0.0 + * + */ + public function list_actions( $instance ) { + foreach ( $instance->actions as $action ) { + $confirm = isset( $action['confirm'] ) ? $action['confirm'] : false; + $button_text = ( $this->current_running && array_key_exists( $instance->id, $this->current_running ) && 'dismiss' !== $action['id'] ) ? esc_html__( 'Running', 'wpscan' ) : esc_html( $action['title'] ); + $button_disabled = ( $this->current_running && array_key_exists( $instance->id, $this->current_running ) && 'dismiss' !== $action['id'] ) ? ' disabled' : ''; + + echo sprintf( + "", + esc_attr( $instance->id ), + esc_attr( $confirm ), + esc_attr( $action['id'] ), + $button_disabled, + $button_text + ); + } + } + + /** + * Get actions buttons + * + * @param object $instance - The check instance. + * + * @access public + * @return string + * @since 1.14.4 + * + */ + public function get_list_actions( $instance ) { + foreach ( $instance->actions as $action ) { + $confirm = isset( $action['confirm'] ) ? $action['confirm'] : false; + $button_text = ( $this->current_running && array_key_exists( $instance->id, $this->current_running ) && 'dismiss' !== $action['id'] ) ? esc_html__( 'Running', 'wpscan' ) : esc_html( $action['title'] ); + $button_disabled = ( $this->current_running && array_key_exists( $instance->id, $this->current_running ) && 'dismiss' !== $action['id'] ) ? ' disabled' : ''; + + return sprintf( + "", + esc_attr( $instance->id ), + esc_attr( $confirm ), + esc_attr( $action['id'] ), + $button_disabled, + $button_text + ); + } + } + + /** + * Load checks files. + * + * @return void + * @since 1.0.0 + * @access public + */ + public function handle_actions() { + check_ajax_referer( 'wpscan' ); + + if ( ! current_user_can( $this->parent->WPSCAN_ROLE ) ) { + wp_die(); + } + + $check = isset( $_POST['check'] ) ? $_POST['check'] : false; + $action = isset( $_POST['action_id'] ) ? $_POST['action_id'] : false; + + if ( $action && $check ) { + $res = 0; + if ( 'run' === $action ) { + $event_type[ $check ] = $action; + $this->add_event_inline( $event_type ); + + if ( false === as_next_scheduled_action( $this->WPSCAN_SECURITY_SCHEDULE ) ) { + as_schedule_single_action( strtotime( 'now' ), $this->WPSCAN_SECURITY_SCHEDULE ); + } + $res = 1; + } else { + $action = array_filter( + $this->checks[ $check ]['instance']->actions, + function ( $i ) use ( $action ) { + return $i['id'] === $action; + } + ); + + $action = current( $action ); + + if ( method_exists( $this->checks[ $check ]['instance'], $action['method'] ) ) { + $res = call_user_func( array( $this->checks[ $check ]['instance'], $action['method'] ) ); + } + } + + if ( $res ) { + wp_send_json_success( $check ); + } else { + wp_send_json_error(); + } + } + + wp_send_json_error(); + } + + /** + * Run the Security checks + * + * @since 1.15 + * @acces public + */ + public function security_check_now() { + if ( ! empty( $this->current_running ) ) { + foreach ( $this->current_running as $key => $to_check ) { + $check = $key; + $action = $to_check; + $action = array_filter( + $this->checks[ $check ]['instance']->actions, + function ( $i ) use ( $action ) { + return $i['id'] === $action; + } + ); + + $action = current( $action ); + + if ( method_exists( $this->checks[ $check ]['instance'], $action['method'] ) ) { + call_user_func( array( $this->checks[ $check ]['instance'], $action['method'] ) ); + } + $this->remove_event_from_list( $check ); + as_schedule_single_action( strtotime( 'now' ) + 10, $this->WPSCAN_SECURITY_SCHEDULE ); + + break; + } + } else { + delete_option( $this->OPT_EVENTS_INLINE ); + } + } + + /** + * Register event to wait inline + * + * @param $event_type + * + * @since 1.15 + * @acces public + */ + public function add_event_inline( $event_type ) { + if ( $this->current_running ) { + update_option( $this->OPT_EVENTS_INLINE, $this->current_running + $event_type ); + } else { + update_option( $this->OPT_EVENTS_INLINE, $event_type ); + } + } + + /** + * Remove event from the waiting line + * + * @param $event + * + * @since 1.15 + * @acces public + */ + public function remove_event_from_list( $event ) { + if ( $event ) { + unset( $this->current_running[ $event ] ); + update_option( $this->OPT_EVENTS_INLINE, $this->current_running ); + } + } +} diff --git a/wp-content/plugins/wpscan/app/Dashboard.php b/wp-content/plugins/wpscan/app/Dashboard.php new file mode 100644 index 00000000..6b53b9af --- /dev/null +++ b/wp-content/plugins/wpscan/app/Dashboard.php @@ -0,0 +1,84 @@ +parent = $parent; + + add_action( 'wp_dashboard_setup', array( $this, 'add_dashboard_widgets' ) ); + } + + /** + * Add the widget + * + * @since 1.0.0 + * @access public + * @return void + */ + public function add_dashboard_widgets() { + if ( ! current_user_can( $this->parent->WPSCAN_ROLE ) ) { + return; + } + + wp_add_dashboard_widget( + $this->parent->WPSCAN_DASHBOARD, + __( 'WPScan Status', 'wpscan' ), + array( $this, 'dashboard_widget_content' ) + ); + } + + /** + * Render the widget + * + * @since 1.0.0 + * @access public + * @return string + */ + public function dashboard_widget_content() { + $report = $this->parent->get_report(); + + if ( ! $this->parent->classes['settings']->api_token_set() ) { + echo esc_html( '
' . __( 'To use WPScan you have to setup your WPScan API Token.', 'wpscan' ) . '
' ); + return; + } + + if ( empty( $report ) ) { + echo esc_html( __( 'No Report available', 'wpscan' ) ); + return; + } + + $vulns = $this->parent->classes['report']->get_all_vulnerabilities(); + + if ( empty( $vulns ) ) { + echo esc_html( __( 'No vulnerabilities found', 'wpscan' ) ); + } + + echo '
'; + + foreach ( $vulns as $vuln ) { + $vuln = wp_kses( $vuln, array( 'a' => array( 'href' => array() ) ) ); // Only allow a href HTML tags. + echo "
  " . $vuln . "

"; + } + + echo '
'; + } +} diff --git a/wp-content/plugins/wpscan/app/Notification.php b/wp-content/plugins/wpscan/app/Notification.php new file mode 100644 index 00000000..67e743bf --- /dev/null +++ b/wp-content/plugins/wpscan/app/Notification.php @@ -0,0 +1,347 @@ +parent = $parent; + $this->page = 'wpscan_notification'; + + add_action( 'admin_init', array( $this, 'admin_init' ) ); + add_action( 'admin_init', array( $this, 'add_meta_box_notification' ) ); + } + + /** + * Notification Options + * + * @since 1.0.0 + * @access public + * @return void + */ + public function admin_init() { + $total = $this->parent->get_total(); + + register_setting( $this->page, $this->parent->OPT_EMAIL, array( $this, 'sanitize_email' ) ); + register_setting( $this->page, $this->parent->OPT_INTERVAL, array( $this, 'sanitize_interval' ) ); + + $section = $this->page . '_section'; + + add_settings_section( + $section, + null, + array( $this, 'introduction' ), + $this->page + ); + + add_settings_field( + $this->parent->OPT_EMAIL, + __( 'E-mail', 'wpscan' ), + array( $this, 'field_email' ), + $this->page, + $section + ); + + add_settings_field( + $this->parent->OPT_INTERVAL, + __( 'Send Alerts', 'wpscan' ), + array( $this, 'field_interval' ), + $this->page, + $section + ); + } + + /** + * Add meta box + * + * @since 1.0.0 + * @access public + * @return void + */ + public function add_meta_box_notification() { + add_meta_box( + 'wpscan-metabox-notification', + __( 'Notification', 'wpscan' ), + array( $this, 'do_meta_box_notification' ), + 'wpscan', + 'side', + 'low' + ); + } + + /** + * Render meta box + * + * @since 1.0.0 + * @access public + * @return string + */ + public function do_meta_box_notification() { + echo '
'; + + settings_fields( $this->page ); + + do_settings_sections( $this->page ); + + submit_button(); + + echo '
'; + } + + /** + * Introduction + * + * @since 1.0.0 + * @access public + * @return string + */ + public function introduction() { + echo '

' . __( 'Fill in the options below if you want to be notified by mail about new vulnerabilities. To add multiple e-mail addresses comma separate them.', 'wpscan' ) . '

'; + } + + /** + * Email field + * + * @since 1.0.0 + * @access public + * @return string + */ + public function field_email() + { + echo sprintf( + '', + esc_attr( $this->parent->OPT_EMAIL ), + esc_attr( get_option( $this->parent->OPT_EMAIL, '' ) ) + ); + } + + /** + * Interval field + * + * @since 1.0.0 + * @access public + * @return string + */ + public function field_interval() { + $interval = get_option( $this->parent->OPT_INTERVAL, 'd' ); + + echo '"; + + // Messages. + echo '

'; + + if ( defined( 'WPSCAN_API_TOKEN' ) ) { + _e( 'Your API Token has been set in a PHP file and been disabled here.', 'wpscan' ); + echo '
'; + } + + if ( ! empty( $api_token ) ) { + echo sprintf( + __( 'To regenerate your token, or upgrade your plan, %s.', 'wpscan' ), + '' . __( 'check your profile', 'wpscan' ) . '' + ); + } else { + echo sprintf( + __( '%s to get your free API Token.', 'wpscan' ), + '' . __( 'Sign up', 'wpscan' ) . '' + ); + } + + echo '


'; + } + + /** + * Scanning interval field + * + * @since 1.0.0 + * @access public + * @return string + */ + public function field_scanning_interval() { + $opt_name = $this->parent->OPT_SCANNING_INTERVAL; + $value = esc_attr( get_option( $opt_name, 'daily' ) ); + + $disabled = $this->parent->is_interval_scanning_disabled() ? "disabled='true'" : null; + + $options = array( + 'daily' => __( 'Daily', 'wpscan' ), + 'twicedaily' => __( 'Twice daily', 'wpscan' ), + 'hourly' => __( 'Hourly', 'wpscan' ), + ); + + echo "'; + + echo '

'; + + if ( $this->parent->is_interval_scanning_disabled() ) { + _e( 'Automated scanning is currently disabled using the WPSCAN_DISABLE_SCANNING_INTERVAL constant.', 'wpscan' ); + } else { + _e( 'This setting will change the frequency that the WPScan plugin will run an automatic scan. This is useful if you want your report, or notifications, to be updated more frequently. Please note that the more frequent scans are run, the more API requests are consumed.', 'wpscan' ); + } + + echo '


'; + } + + + /** + * Scanning time field. + * + * @since 1.0.0 + * @access public + * @return string + */ + public function field_scanning_time() { + $opt = $this->parent->OPT_SCANNING_TIME; + $value = esc_attr( get_option( $opt, date( 'H:i' ) ) ); + $disabled = $this->parent->is_interval_scanning_disabled() ? "disabled='true'" : null; + + echo " "; + + if ( ! $this->parent->is_interval_scanning_disabled() ) { + echo __( 'Current server time is ', 'wpscan' ) . '' . date( 'H:i' ) . ''; + } + + echo '

'; + + if ( $this->parent->is_interval_scanning_disabled() ) { + _e( 'Automated scanning is currently disabled using the WPSCAN_DISABLE_SCANNING_INTERVAL constant.', 'wpscan' ); + } else { + _e( 'This setting allows you to set the scanning hour for the Daily option. For the Twice Daily this will be the first scan and the second will be 12 hours later. For the Hourly it will affect the first scan only.', 'wpscan' ); + } + + echo '


'; + } + + /** + * Ignore items field + * + * @since 1.0.0 + * @access public + * @return string + */ + public function field_ignore_items() { + $opt = $this->parent->OPT_IGNORE_ITEMS; + $value = get_option( $opt, array() ); + $wp = isset( $value['wordpress'] ) ? 'checked' : null; + + // WordPress. + echo "
"; + + echo "'; + + echo '
'; + + // Plugins list. + $this->ignore_items_section( 'plugins', $value ); + + // Themes list + $this->ignore_items_section( 'themes', $value ); + } + + /** + * Ignore items section + * + * @since 1.0.0 + * @access public + * @return string + */ + public function ignore_items_section( $type, $value ) { + $opt = $this->parent->OPT_IGNORE_ITEMS; + + $items = 'themes' === $type + ? wp_get_themes() + : get_plugins(); + + $title = 'themes' === $type + ? __( 'Themes', 'wpscan' ) + : __( 'Plugins', 'wpscan' ); + + echo "
"; + + echo "

$title

"; + + foreach ( $items as $name => $details ) { + $slug = 'themes' === $type + ? $this->parent->get_theme_slug( $name, $details ) + : $this->parent->get_plugin_slug( $name, $details ); + + $checked = isset( $value[ $type ][ $slug ] ) ? 'checked' : null; + + echo ''; + } + + echo '
'; + } + + /** + * Sanitize API token + * + * @since 1.0.0 + * @access public + * @return string + */ + public function sanitize_api_token( $value ) { + $value = trim( $value ); + + // update_account_status() calls the /status API endpoint, verifying the validity of the Token passed via $value and updates the account status if needed. + if ( empty( $value ) ) { + delete_option( $this->parent->OPT_ACCOUNT_STATUS ); + } else { + $this->parent->classes['account']->update_account_status( $value ); + } + + $errors = get_option( $this->parent->OPT_ERRORS ); + + if ( ! empty( $errors ) ) { + foreach ( $errors as $error ) { + add_settings_error( + $this->page, + 'api_token', + $error + ); + } + + update_option( $this->parent->OPT_ERRORS, array() ); // Clear errors. + } else { + if ( $this->parent->is_interval_scanning_disabled() ) { + as_unschedule_all_actions( $this->parent->WPSCAN_SCHEDULE ); + } + } + + return $value; + } + + /** + * Schedule CRON scanning event + * + * @since 1.0.0 + * @access public + * @return void + */ + public function schedule_event( $old_value, $value ) { + $api_token = get_option( $this->parent->OPT_API_TOKEN ); + + if ( ! empty( $api_token ) && $old_value !== $value ) { + $interval = esc_attr( get_option( $this->parent->OPT_SCANNING_INTERVAL, 'daily' ) ); + $time = esc_attr( get_option( $this->parent->OPT_SCANNING_TIME, date( 'H:i' ) . ' +1day' ) ); + + as_unschedule_all_actions( $this->parent->WPSCAN_SCHEDULE ); + + switch ( $interval ) { + case 'daily': + $interval = DAY_IN_SECONDS; + break; + case 'twicedaily': + $interval = HOUR_IN_SECONDS * 12; + break; + case 'hourly': + $interval = HOUR_IN_SECONDS; + break; + } + + if ( ! $this->parent->is_interval_scanning_disabled() ) { + if ( false === as_next_scheduled_action( $this->parent->WPSCAN_SCHEDULE ) ) { + as_schedule_recurring_action( $time, $interval, $this->parent->WPSCAN_SCHEDULE ); + } + } + } + } + + /** + * Update ignored items + * + * @since 1.0.0 + * @access public + * @return void + */ + public function update_ignored_items( $old_value, $value ) { + $report = $this->parent->get_report(); + + if ( empty( $report ) || $old_value === $value ) { + return; + } + + foreach ( array( 'themes', 'plugins' ) as $type ) { + if ( ! isset( $value[ $type ] ) ) { + continue; + } + + foreach ( $value[ $type ] as $slug => $checked ) { + if ( isset( $report[ $type ][ $slug ] ) ) { + // Remove from the report. + unset( $report[ $type ][ $slug ] ); + } + } + } + + update_option( $this->parent->OPT_REPORT, $report, true ); + } +} diff --git a/wp-content/plugins/wpscan/app/SiteHealth.php b/wp-content/plugins/wpscan/app/SiteHealth.php new file mode 100644 index 00000000..2e1e8464 --- /dev/null +++ b/wp-content/plugins/wpscan/app/SiteHealth.php @@ -0,0 +1,93 @@ +parent = $parent; + + add_filter( 'site_status_tests', array( $this, 'add_site_health_tests' ) ); + } + + /** + * Add site-health page tests. + * + * @since 1.0.0 + * @access public + * @return array + */ + public function add_site_health_tests( $tests ) { + $tests['direct']['wpscan_check'] = array( + 'label' => __( 'WPScan Vulnerabilities Check' ), + 'test' => array( $this, 'site_health_tests' ), + ); + + return $tests; + } + + /** + * Do site-health page tests + * + * @since 1.0.0 + * @access public + * @return array + */ + public function site_health_tests() { + $report = $this->parent->get_report(); + $total = $this->parent->get_total_not_ignored(); + $vulns = $this->parent->classes['report']->get_all_vulnerabilities(); + + /** + * Default, no vulnerabilities found + */ + $result = array( + 'label' => __( 'No known vulnerabilities found', 'wpscan' ), + 'status' => 'good', + 'badge' => array( + 'label' => __( 'Security', 'wpscan' ), + 'color' => 'gray', + ), + 'description' => sprintf( + '

%s

', + __( 'Vulnerabilities can be exploited by hackers and cause harm to your website.', 'wpscan' ) + ), + 'actions' => '', + 'test' => 'wpscan_check', + ); + + /** + * If vulnerabilities found. + */ + if ( ! empty($report) && $total > 0 ) { + $result['status'] = 'critical'; + $result['label'] = sprintf( _n( 'Your site is affected by %d security vulnerability', 'Your site is affected by %d security vulnerabilities', $total, 'wpscan' ), $total ); + $result['description'] = 'WPScan detected the following security vulnerabilities in your site:'; + + foreach ( $vulns as $vuln ) { + $result['description'] .= '

'; + $result['description'] .= "  "; + $result['description'] .= wp_kses( $vuln, array( 'a' => array( 'href' => array() ) ) ); // Only allow a href HTML tags. + $result['description'] .= '

'; + } + } + + return $result; + } +} diff --git a/wp-content/plugins/wpscan/app/Summary.php b/wp-content/plugins/wpscan/app/Summary.php new file mode 100644 index 00000000..a5d36265 --- /dev/null +++ b/wp-content/plugins/wpscan/app/Summary.php @@ -0,0 +1,217 @@ +parent = $parent; + + add_action( 'admin_init', array( $this, 'add_meta_box_summary' ) ); + add_action( 'wp_ajax_wpscan_check_now', array( $this, 'ajax_check_now' ) ); + add_action( 'wp_ajax_wpscan_security_check_now', array( $this, 'ajax_security_check_now' ) ); + add_action( 'wp_ajax_' . $this->parent->WPSCAN_TRANSIENT_CRON, array( $this, 'ajax_doing_cron' ) ); + } + + /** + * Add meta box + * + * @return void + * @since 1.0.0 + * @access public + */ + public function add_meta_box_summary() { + $report = $this->parent->get_report(); + + add_meta_box( + 'wpscan-metabox-summary', + __( 'Summary', 'wpscan' ), + array( $this, 'do_meta_box_summary' ), + 'wpscan', + 'side', + 'high' + ); + } + + /** + * Render meta box + * + * @return string + * @since 1.0.0 + * @access public + */ + public function do_meta_box_summary() { + $report = $this->parent->get_report(); + $errors = get_option( $this->parent->OPT_ERRORS ); + $total = $this->parent->get_total_not_ignored(); + ?> + + parent->get_report() ) ) { + ?> + + ' . $err . '

'; + } + } elseif ( empty( $this->parent->get_report() ) ) { // No scan run yet. + echo '

' . __( 'No scan run yet!', 'wpscan' ) . '

'; + } elseif ( empty( $errors ) && 0 === $total ) { + echo '

' . __( 'No known vulnerabilities found', 'wpscan' ) . '

'; + } elseif ( ! get_option( $this->parent->OPT_API_TOKEN ) ) { + echo '

' . __( 'You need to add a WPScan API Token to the settings page', 'wpscan' ) . '

'; + } else { + echo '

' . __( 'Some vulnerabilities were found', 'wpscan' ) . '

'; + } + ?> + +

+ +

+

+ + + + + +

+ + parent->WPSCAN_SCHEDULE ) ) { ?> +

+ + parent->WPSCAN_SCHEDULE ) ); ?> +

+ + + + +

+ parent->OPT_API_TOKEN ) ) { + _e( 'Click the Run All button to run a full vulnerability scan against your WordPress website.', 'wpscan' ); + } else { + _e( 'Add your API token to the settings page to be able to run a full scan.', 'wpscan' ); + } + ?> +

+ + parent->OPT_API_TOKEN ) ) : ?> +

+ parent->WPSCAN_RUN_ALL ) ) { + $spinner_display = ' style="visibility: visible;"'; + $button_disabled = 'disabled'; + } + ?> + > + +

+ + + parent->WPSCAN_ROLE ) ) { + wp_redirect( home_url() ); + wp_die(); + } + + if ( false === as_next_scheduled_action( $this->parent->WPSCAN_RUN_ALL ) ) { + as_schedule_single_action( strtotime( 'now' ), $this->parent->WPSCAN_RUN_ALL ); + } + + wp_die(); + } + + /** + * Ajax scurity check now + * + * @return void + * @since 1.0.0 + * @access public + */ + public function ajax_security_check_now() { + check_ajax_referer( 'wpscan' ); + + if ( ! current_user_can( $this->parent->WPSCAN_ROLE ) ) { + wp_redirect( home_url() ); + wp_die(); + } + + $items_inline = get_option( $this->parent->WPSCAN_RUN_SECURITY ); + + $plugins = array(); + foreach ( $this->parent->classes['checks/system']->checks as $id => $data ) { + $plugins[ $id ] = array( + 'status' => $this->parent->classes['report']->get_status( 'security-checks', $id ), + 'vulnerabilities' => $this->parent->classes['checks/system']->get_check_vulnerabilities( $data['instance'] ), + 'security-check-actions' => $this->parent->classes['checks/system']->get_list_actions( $data['instance'] ), + ); + } + + $response = array( + 'inline' => $items_inline, + 'plugins' => $plugins, + ); + + wp_die( wp_json_encode( $response ) ); + } + + /** + * Ajax to check when the cron task has finished + * + * @return void + * @since 1.0.0 + * @access public + */ + public function ajax_doing_cron() { + check_ajax_referer( 'wpscan' ); + + if ( ! current_user_can( $this->parent->WPSCAN_ROLE ) ) { + wp_redirect( home_url() ); + wp_die(); + } + + // echo get_transient( $this->parent->WPSCAN_TRANSIENT_CRON ) ? 'YES' : 'NO'; + echo false !== as_next_scheduled_action( $this->parent->WPSCAN_RUN_ALL ) ? 'YES' : 'NO'; + + wp_die(); + } +} diff --git a/wp-content/plugins/wpscan/app/ignoreVulnerabilities.php b/wp-content/plugins/wpscan/app/ignoreVulnerabilities.php new file mode 100644 index 00000000..9f12c7a7 --- /dev/null +++ b/wp-content/plugins/wpscan/app/ignoreVulnerabilities.php @@ -0,0 +1,189 @@ +parent = $parent; + $this->page = 'wpscan_ignore_vulnerabilities'; + + add_action( 'admin_init', array( $this, 'admin_init' ) ); + add_action( 'admin_init', array( $this, 'add_meta_box_ignore_vulnerabilities' ) ); + } + + /** + * Ignore vulnerabilities option + * + * @since 1.0.0 + * @access public + * @return void + */ + public function admin_init() { + $total = $this->parent->get_total(); + + register_setting( $this->page, $this->parent->OPT_IGNORED, array( $this, 'sanitize_ignored' ) ); + + $section = $this->page . '_section'; + + add_settings_section( + $section, + null, + array( $this, 'introduction' ), + $this->page + ); + + if ( $total > 0 ) { + add_settings_field( + $this->parent->OPT_IGNORED, + null, + array( $this, 'field_ignored' ), + $this->page, + $section + ); + } + } + + /** + * Add meta box + * + * @since 1.0.0 + * @access public + * @return void + */ + public function add_meta_box_ignore_vulnerabilities() { + add_meta_box( + 'wpscan-metabox-ignore-vulnerabilities', + __( 'Ignore Vulnerabilities', 'wpscan' ), + array( $this, 'do_meta_box_ignore_vulnerabilities' ), + 'wpscan', + 'side', + 'low' + ); + } + + /** + * Render meta box + * + * @since 1.0.0 + * @access public + * @return string + */ + public function do_meta_box_ignore_vulnerabilities() { + echo '
'; + + settings_fields( $this->page ); + + do_settings_sections( $this->page ); + + submit_button(); + + echo '
'; + } + + /** + * Introduction + * + * @since 1.0.0 + * @access public + * @return void + */ + public function introduction() { } + + /** + * Ignored field + * + * @since 1.0.0 + * @access public + * @return void + */ + public function field_ignored() { + $this->list_vulnerabilities_to_ignore( 'wordpress', get_bloginfo( 'version' ) ); + + foreach ( get_plugins() as $name => $details ) { + $this->list_vulnerabilities_to_ignore( 'plugins', $this->parent->get_plugin_slug( $name, $details ) ); + } + + foreach ( wp_get_themes() as $name => $details ) { + $this->list_vulnerabilities_to_ignore( 'themes', $this->parent->get_theme_slug( $name, $details ) ); + } + + foreach ( $this->parent->classes['checks/system']->checks as $id => $data ) { + $this->list_vulnerabilities_to_ignore( 'security-checks', $id ); + } + } + + /** + * Sanitize ignored + * + * @since 1.0.0 + * @param string $value value. + * @access public + * @return string + */ + public function sanitize_ignored( $value ) { + if ( empty( $value ) ) { + return array(); + } + + return $value; + } + + /** + * List of vulnerabilities + * + * @since 1.0.0 + * + * @param string $type - Type of report: wordpress, plugins, themes. + * @param string $name - key name of the element. + * + * @access public + * @return string + */ + public function list_vulnerabilities_to_ignore( $type, $name ) { + $report = $this->parent->get_report(); + + if ( isset( $report[ $type ] ) && isset( $report[ $type ][ $name ] ) ) { + $report = $report[ $type ][ $name ]; + } + + if ( ! isset( $report['vulnerabilities'] ) ) { + return null; + } + + $ignored = $this->parent->get_ignored_vulnerabilities(); + + foreach ( $report['vulnerabilities'] as $item ) { + $id = 'security-checks' === $type ? $item['id'] : $item->id; + $title = 'security-checks' === $type ? $item['title'] : $this->parent->get_sanitized_vulnerability_title( $item ); + + echo sprintf( + '
', + esc_attr( $this->parent->OPT_IGNORED ), + esc_attr( $id ), + esc_html( in_array( $id, $ignored, true ) ? 'checked="checked"' : null ), + wp_kses( $title, array( 'a' => array( 'href' => array() ) ) ) // Only allow a href HTML tags. + ); + } + } +} \ No newline at end of file diff --git a/wp-content/plugins/wpscan/assets/css/deactivate.css b/wp-content/plugins/wpscan/assets/css/deactivate.css new file mode 100644 index 00000000..ad4f2817 --- /dev/null +++ b/wp-content/plugins/wpscan/assets/css/deactivate.css @@ -0,0 +1,57 @@ +.wpscan-model { + position: fixed; + overflow: auto; + height: 100%; + width: 100%; + top: 0; + left: 0; + z-index: 100000; + display: none; + background: rgba(0,0,0,0.6); +} + +.wpscan-model.active { + display: block; +} + +.wpscan-modal-dialog { + background: white; + z-index: 100001; + width: 500px; + margin: auto; + position: absolute; + top: -30px; + left: 0; + bottom: 0; + right: 0; + height: 60px; +} + +.wpscan-model-content { + background: #f2f2f2; + height: 100%; + padding: 15px 20px 20px 20px; + line-height: 1.6; +} + +h4 { + border-bottom: #eeeeee solid 1px; + background: #fbfbfb; + padding: 15px 20px; + position: relative; + text-transform: uppercase; + margin: 0; + font-size: 1.2em; + font-weight: bold; + color: #cacaca; + text-shadow: 1px 1px 1px #fff; + letter-spacing: 0.6px; +} + +.wpscan-model-footer { + border: 0; + background: #fefefe; + padding: 10px; + border-top: #eeeeee solid 1px; + text-align: right; +} \ No newline at end of file diff --git a/wp-content/plugins/wpscan/assets/css/settings.css b/wp-content/plugins/wpscan/assets/css/settings.css new file mode 100644 index 00000000..65ea2cf5 --- /dev/null +++ b/wp-content/plugins/wpscan/assets/css/settings.css @@ -0,0 +1,23 @@ +.wpscan-ignore-items-section { + display: block; + margin-bottom: 25px; + float: left; + width: 800px; +} + +.wpscan-ignore-items-section label { + width: 30%; + float: left; + margin-bottom: 12px; + padding-right: 20px; + line-break: anywhere; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + box-sizing: border-box; +} + +.blur-on-lose-focus:not(:focus) { + color: transparent; + text-shadow: 0 0 5px rgba(0,0,0,0.5); +} diff --git a/wp-content/plugins/wpscan/assets/css/style.css b/wp-content/plugins/wpscan/assets/css/style.css new file mode 100644 index 00000000..baf1cc0f --- /dev/null +++ b/wp-content/plugins/wpscan/assets/css/style.css @@ -0,0 +1,256 @@ + +/* Table list */ + +.wpscan-report-section { + margin: 0px 0px 20px 0px; +} + +.wp-list-table.plugins .plugin-title strong { + float: left; + margin-bottom: 5px; + margin-right: 12px; + white-space: normal !important; +} + +.column-name { + word-break: break-word; + width: 250px; +} + +.is-gray { + color: gray; +} + +.is-green { + color: green; +} + +.is-red { + color: crimson; +} + +@media screen and (max-width: 782px) { + .wp-list-table.plugins tr th.check-column { padding: 0 0 0 10px; } +} + +/* Summary */ + +#wpscan-metabox-summary .check-now { padding: 0; text-align: right; } +#wpscan-metabox-summary .spinner { float: none; margin-top: 0; } + +@media screen and (max-width: 850px) { + #wpscan-metabox-summary { margin-top: 20px; } +} + +/* Notification */ + +#wpscan-metabox-notification table, +#wpscan-metabox-notification tbody, +#wpscan-metabox-notification tr, +#wpscan-metabox-notification th, +#wpscan-metabox-notification td { display: block; width: 100%; } +#wpscan-metabox-notification th { padding: .5em 0; } +#wpscan-metabox-notification td { padding: 0; } +#wpscan-metabox-notification th, +#wpscan-metabox-notification td, +#wpscan-metabox-notification td p { font-size: 13px; } +#wpscan-metabox-notification input[type="text"] { width: 100%; } +#wpscan-metabox-notification .submit { padding: 0; text-align: right; } + +@media screen and (max-width: 782px) { + #wpscan-metabox-notification label { padding-left: 35px; } + #wpscan-metabox-notification input[type="checkbox"] { margin-left: -35px; } +} + +/* Ignore vulnerabilities */ + +#wpscan-metabox-ignore-vulnerabilities table, +#wpscan-metabox-ignore-vulnerabilities tbody, +#wpscan-metabox-ignore-vulnerabilities tr, +#wpscan-metabox-ignore-vulnerabilities th, +#wpscan-metabox-ignore-vulnerabilities td { display: block; width: 100%; } +#wpscan-metabox-ignore-vulnerabilities th { padding: .5em 0; } +#wpscan-metabox-ignore-vulnerabilities td { padding: 0; } +#wpscan-metabox-ignore-vulnerabilities th, +#wpscan-metabox-ignore-vulnerabilities td, +#wpscan-metabox-ignore-vulnerabilities td p { font-size: 13px; } +#wpscan-metabox-ignore-vulnerabilities input[type="text"] { width: 100%; } +#wpscan-metabox-ignore-vulnerabilities label { position: relative; display: block; padding-left: 25px; margin: 0 0 10px; } +#wpscan-metabox-ignore-vulnerabilities label + br { display: none; } +#wpscan-metabox-ignore-vulnerabilities input[type="checkbox"] { margin-left: -25px; } +#wpscan-metabox-ignore-vulnerabilities .submit { padding: 0; text-align: right; } + +@media screen and (max-width: 782px) { + #wpscan-metabox-ignore-vulnerabilities label { padding-left: 35px; } + #wpscan-metabox-ignore-vulnerabilities input[type="checkbox"] { margin-left: -35px; } +} + +/* Account */ + +#wpscan-account-summary ul li span { + float: right; + text-transform: capitalize; + min-width: 30px; + text-align: center; + border-radius: 3px; + padding: 0px 11px 1px 11px; + word-spacing: 1px; + color: #4e645a; + background: #cbe0ec; +} + +#wpscan-account-summary ul li { + width: 100%; + overflow: hidden; + line-height: 23px; + margin-bottom: 14px; +} + +#wpscan-account-summary ul { + margin: 10px 0px; +} + +#wpscan-account-summary .button { + float: right; + margin-top: 15px; +} + +#wpscan-account-summary .inside { + overflow: hidden; +} + +.wpscan-status-green { + background: #c3e6c1 !important; + color: #026624 !important; +} + +.wpscan-status-orange { + background: #ffd2a3 !important; + color: #d95200 !important; +} + +.wpscan-status-red { + background: #ffb6b6 !important; + color: #c00 !important; +} + +/* download report */ + +.toplevel_page_wpscan .download-report { + margin-top: 15px; +} + +/* Extra info */ + +.vulnerability { + margin-bottom: 12px; + float: left; + width: 100%; + line-height: 1.8; + line-height: 25px; +} + +.vulnerability a { + float: left; + max-width: 80%; +} + +.vulnerability:last-child { + margin-bottom: 5px; +} + +.vulnerability-severity { + float: left; + min-width: 60px; + margin-right: 20px; +} + +.vulnerability-title { + float: left; +} + +.vulnerability-severity span { + float: left; + text-transform: capitalize; + text-align: center; + border-radius: 3px; + font-size: 11px; + margin: 6px 0px 0px 0px; + line-height: 19px; + min-width: 60px; + color: #4e645a; + background: #c6e1d5; +} + +.item-closed { + float: left; + text-transform: capitalize; + min-width: 30px; + text-align: center; + border-radius: 3px; + padding: 0px 8px 1px 8px; + line-height: 20px; + font-size: 11px; + margin-bottom: 3px; + margin-top: 10px; + background: #e1dfdf !important; +} + +.item-version { + float: left; + width: 100%; +} + +.wpscan-info { + background: #c1e3e6 !important; + color: #304584 !important; +} + +.wpscan-low { + background: #c3e6c1 !important; + color: #026624 !important; +} + +.wpscan-medium { + background: #ffd2a3 !important; + color: #d95200 !important; +} + +.wpscan-high { + background: #ffb6b6 !important; + color: #c00 !important; +} + +.wpscan-critical { + background: #e1b8ff !important; + color: #66348a !important; +} + +.wpscan-ignored { + border-radius: 3px; + padding: 0px 8px 0px 8px; + line-height: 22px; + font-size: 12px; + float: left; + background: #c1e3e6 !important; + color: #304584 !important; +} + +.security-check-actions .spinner { + float: none; + position: absolute; +} + +.security-check-actions button { + margin-right: 5px !important; + margin-bottom: 5px !important; + width: 70px; +} + +.ui-tooltip { + padding: 6px 12px; + border-radius: 3px; + max-width: 350px; + background: #d7dade; + color: #2a2c31; +} \ No newline at end of file diff --git a/wp-content/plugins/wpscan/assets/js/deactivate.js b/wp-content/plugins/wpscan/assets/js/deactivate.js new file mode 100644 index 00000000..94f90ca9 --- /dev/null +++ b/wp-content/plugins/wpscan/assets/js/deactivate.js @@ -0,0 +1,19 @@ +jQuery(document).ready(function($) { + let link = $('#deactivate-wpscan'); + let deactivate = $('.wpscan-model .button-deactivate'); + let close = $('.wpscan-model .button-close'); + + deactivate.attr('href', link.attr('href')); + + link.on('click', function (e) { + e.preventDefault(); + + $('.wpscan-model').show() + }); + + close.on('click', function (e) { + e.preventDefault(); + + $('.wpscan-model').hide() + }); +}); \ No newline at end of file diff --git a/wp-content/plugins/wpscan/assets/js/download-report.js b/wp-content/plugins/wpscan/assets/js/download-report.js new file mode 100644 index 00000000..e0aa2ad2 --- /dev/null +++ b/wp-content/plugins/wpscan/assets/js/download-report.js @@ -0,0 +1,493 @@ +jQuery(document).ready(function ($) { + var wpscanReport = { + pageMargins: [0, 80, 0, 80], + + header: function () { + const date = new Date(); + const options = { + day: 'numeric', + month: 'long', + year: 'numeric', + }; + + return [ + { + canvas: [ + { + type: 'polyline', + color: '#fff', + points: [ + { x: 0, y: 0 }, + { x: 327, y: 0 }, + { x: 297, y: 59 }, + { x: 0, y: 59 }, + ], + }, + { + type: 'polyline', + color: '#006699', + points: [ + { x: 327, y: 0 }, + { x: 357, y: 0 }, + { x: 327, y: 59 }, + { x: 297, y: 59 }, + ], + }, + { + type: 'polyline', + color: '#33CC99', + points: [ + { x: 357, y: 0 }, + { x: 595.28, y: 0 }, + { x: 595.28, y: 59 }, + { x: 327, y: 59 }, + ], + }, + { + type: 'line', + x1: 0, + y1: 60, + x2: 595.28, + y2: 60, + lineWidth: 1, + color: '#D7DFE3', + }, + ], + }, + { + svg: ` + + + + + + + + + `, + width: 112, + absolutePosition: { x: 0, y: 0 }, + relativePosition: { x: 40, y: 10 }, + alignment: 'left', + }, + { + text: 'wpscan.com', + link: 'http://wpscan.com', + fontSize: 8, + absolutePosition: { x: 0, y: 0 }, + relativePosition: { x: 93, y: 35 }, + }, + { + text: 'Vulnerability Report', + fontSize: 16, + bold: true, + color: '#ffffff', + alignment: 'right', + absolutePosition: { x: 0, y: 0 }, + relativePosition: { x: -40, y: 13 }, + }, + { + text: new Intl.DateTimeFormat('en-GB', options).format(date), + fontSize: 10, + color: '#ffffff', + absolutePosition: { x: 0, y: 0 }, + relativePosition: { x: -40, y: 32 }, + alignment: 'right', + }, + ]; + }, + footer: function (currentPage) { + return [ + { + canvas: [ + { + type: 'polyline', + color: '#282d41', + points: [ + { x: 0, y: 26 }, + { x: 0, y: 80 }, + { x: 595.28, y: 80 }, + ], + }, + ], + }, + { + text: currentPage, + alignment: 'right', + fontSize: 8, + absolutePosition: { x: 0, y: 0 }, + relativePosition: { x: -40, y: 30 }, + }, + ]; + }, + content: [], + }; + + /** + * Fonts setup + */ + pdfMake.fonts = { + Montserrat: { + normal: 'Montserrat-Regular.ttf', + bold: 'Montserrat-Bold.ttf', + italics: 'Montserrat-Medium.ttf', + bolditalics: 'Montserrat-Medium.ttf', + }, + }; + + /** + * Background + */ + wpscanReport.background = function () { + return { + canvas: [ + { + type: 'rect', + x: 0, + y: 0, + w: 595.28, + h: 841.89, + color: '#f1f4f6', + }, + ], + }; + }; + + /** + * Styles + */ + wpscanReport.styles = { + wordpressHeader: { + fontSize: 14, + bold: true, + margin: [0, -15, 0, 0], + }, + header: { + fontSize: 14, + bold: true, + margin: [40, 20, 0, 0], + }, + tableLine: { + fillColor: '#006699 ', + margin: [0, -8], + fontSize: 1, + }, + WPTableLine: { + fillColor: '#32B488 ', + margin: [0, -8], + fontSize: 1, + }, + tableHeader: { + fillColor: '#f6f6f6', + margin: [10, 10], + fontSize: 10, + bold: true, + }, + resTable: { + margin: [10, 7, 10, 10], + fillColor: '#ffffff', + fontSize: 10, + italics: true, + }, + metadata: { + fontSize: 10, + bold: true, + color: '#333333', + }, + }; + + /** + * Default style + */ + wpscanReport.defaultStyle = { + color: '#333333', + font: 'Montserrat', + }; + + /** + * border color + */ + + var borderColor = ['#e5e5e5', '#e5e5e5', '#e5e5e5', '#e5e5e5']; + + /** + * Tables + */ + $('.wpscan-report-section').each(function () { + let is_security_checks = false; + let is_wordpress_section = + $(this).find('h3').first().text().trim() === 'WordPress'; + + // Table title + + const sectionTitle = () => { + if (!is_wordpress_section) { + wpscanReport.content.push({ + text: $(this).find('h3').first().text(), + style: 'header', + }); + } + }; + + const wordpressTitle = () => { + if (is_wordpress_section) { + return { + text: $(this).find('h3').first().text(), + style: 'wordpressHeader', + }; + } + }; + + if ($(this).hasClass('security-checks')) { + is_security_checks = true; + } + + /** + * Table setup + */ + + let table = { + table: { + headerRows: 2, + widths: [], + body: [[], []], + }, + }; + + let wordpressTable = { + stack: [ + { + canvas: [ + { + type: 'rect', + x: 0, + y: 00, + w: 595.28, + h: 30, + color: '#ECF8F1', + }, + ], + relativePosition: { x: 0, y: -25 }, + }, + { + table: { + widths: [32, '*', 32], + body: [ + [ + { + text: ' ', + border: [false, false, false, false], + fillColor: '#ECF8F1', + }, + { + text: ' ', + border: [false, false, false, false], + fillColor: '#ECF8F1', + }, + { + text: ' ', + border: [false, false, false, false], + fillColor: '#ECF8F1', + }, + ], + [ + { + text: ' ', + border: [false, false, false, false], + fillColor: '#ECF8F1', + }, + { + stack: [wordpressTitle(), table], + border: [false, false, false, false], + fillColor: '#ECF8F1', + }, + { + text: ' ', + border: [false, false, false, false], + fillColor: '#ECF8F1', + }, + ], + [ + { + text: ' ', + border: [false, false, false, true], + borderColor: ['#D7DFE3', '#D7DFE3', '#D7DFE3', '#D7DFE3'], + + margin: [0, 10], + fillColor: '#ECF8F1', + }, + { + text: ' ', + border: [false, false, false, true], + borderColor: ['#D7DFE3', '#D7DFE3', '#D7DFE3', '#D7DFE3'], + + margin: [0, 10], + fillColor: '#ECF8F1', + }, + { + text: ' ', + border: [false, false, false, true], + borderColor: ['#D7DFE3', '#D7DFE3', '#D7DFE3', '#D7DFE3'], + + margin: [0, 10], + fillColor: '#ECF8F1', + }, + ], + ], + }, + }, + ], + }; + + let mainTable = { + stack: [ + sectionTitle(), + { + table: { + widths: [32, '*', 32], + body: [[{}, table, {}]], + }, + layout: 'noBorders', + }, + ], + }; + + /** + * Table head + */ + + const colSpan = is_security_checks ? 2 : 3; + + const topTableBorder = is_wordpress_section ? 'WPTableLine' : 'tableLine'; + + // name + + table.table.body[1].push({ + text: 'Name', + style: 'tableHeader', + borderColor, + }); + table.table.widths.push(149); + + // version + if (!is_security_checks) { + table.table.body[1].push({ + text: 'Version', + style: 'tableHeader', + borderColor, + }); + table.table.widths.push(79); + } + + // Vulnerabilities + table.table.body[1].push({ + text: 'Vulnerabilities', + style: 'tableHeader', + borderColor, + }); + table.table.widths.push('*'); + + table.table.body[0].push({ + text: ' ', + style: topTableBorder, + colSpan: colSpan, + border: [false, false, false, false], + }); + + if (!is_security_checks) { + table.table.body[0].push({}); + } + + table.table.body[0].push({}); + + // Add rows + $(this) + .find('table tbody') + .children() + .each(function () { + let row = []; + + // Item title + let itemTitle = $(this).find('.plugin-title strong').text().trim(); + + if ($(this).find('.plugin-title .item-closed').length) { + itemTitle = + itemTitle + + ' - ' + + $(this).find('.plugin-title .item-closed').text(); + } + + row.push({ + text: itemTitle, + style: 'resTable', + borderColor, + lineHeight: 2, + }); + + // Item version + if (!is_security_checks) { + row.push({ + text: $(this) + .find('.plugin-title .item-version span') + .text() + .trim(), + style: 'resTable', + borderColor, + }); + } + + // Item vulnerabilities + if ($(this).find('.vulnerabilities .vulnerability').length) { + let col = { + stack: [], + style: 'resTable', + lineHeight: 2, + borderColor, + }; + + // for each vulnerability + $(this) + .find('.vulnerabilities .vulnerability') + .each(function () { + let item = $(this).clone(); + let linkText = + item.find('.vulnerability-severity span').text().trim() + ' - '; + item.find('.vulnerability-severity span').remove(); + linkText = linkText + item.text().trim(); + linkText = linkText.charAt(0).toUpperCase() + linkText.slice(1); + + col.stack.push({ + text: linkText, + link: $(this).attr('href'), + style: 'resTable', + lineHeight: 2, + borderColor, + }); + }); + + row.push(col); + } else { + // No vulnerabilities found + row.push({ + text: $(this).find('.vulnerabilities').text().trim(), + style: 'resTable', + borderColor, + }); + } + + table.table.body.push(row); + }); + + // push the table + is_wordpress_section + ? wpscanReport.content.push(wordpressTable) + : wpscanReport.content.push(mainTable); + }); + + // Download + $('.download-report').on('click', function () { + let dt = new Date().toJSON().slice(0, 10); + // pdfMake.createPdf(wpscanReport).open(); + pdfMake.createPdf(wpscanReport).download(dt + '-wpscan-report.pdf'); + }); +}); diff --git a/wp-content/plugins/wpscan/assets/js/scripts.js b/wp-content/plugins/wpscan/assets/js/scripts.js new file mode 100644 index 00000000..f8ea7a2a --- /dev/null +++ b/wp-content/plugins/wpscan/assets/js/scripts.js @@ -0,0 +1,141 @@ +// Actions for metabox Summary + +jQuery( document ).ready( + function( $ ) { + + let button_check = $( '#wpscan-metabox-summary .check-now button' ); + let security_check = $( '.security-check-actions .button' ); + let spinner = $( '#wpscan-metabox-summary .spinner' ); + let security_check_runnig = false; + let security_check_button = []; + + // Checks if a cron job is already running when the page loads + if ( wpscan.doing_cron === 'YES' ) { + button_check.attr( 'disabled', true ); + spinner.css( 'visibility', 'visible' ); + + check_cron(); + } + + if ( wpscan.doing_security_cron.length !== 0 ) { + check_security_cron(); + } + + // Starts the cron job + function do_check() { + button_check.attr( 'disabled', true ); + spinner.css( 'visibility', 'visible' ); + + $.ajax( + { + url: wpscan.ajaxurl, + method: 'POST', + data: { + action: wpscan.action_check, + _ajax_nonce: wpscan.ajax_nonce + }, + success: function( ) { + check_cron(); + }, + error: function () { + location.reload(); + } + } + ); + + } + + // Check every X seconds if cron has finished + function check_cron() { + + setTimeout( + function() { + $.ajax( + { + url: ajaxurl, + method: 'POST', + data: { + action: wpscan.action_cron, + _ajax_nonce: wpscan.ajax_nonce + }, + success: function( data ) { + if ( data === 'NO' ) { + location.reload(); + } else { + check_cron(); + } + }, + error: function ( ) { + location.reload(); + } + } + ); + }, + 1000 * 2 + ); + + } + + function check_security_cron() { + security_check_runnig = true; + security_check_button = []; + setTimeout( + function() { + $.ajax( + { + url: ajaxurl, + method: 'POST', + data: { + action: wpscan.action_security_check, + _ajax_nonce: wpscan.ajax_nonce + }, + success: function( data ) { + if ( data.length !== 0 ) { + var ajax_response = $.parseJSON( data ); + $.each( + ajax_response.inline, + function ( key, data ) { + security_check_button.push( key ); + } + ); + + $( '.security-check-actions button[data-action="run"]' ).each( + function() { + if ( $.inArray( $( this ).data( 'check-id' ), security_check_button ) === -1 && $( this ).attr( 'disabled' ) ) { + $( this ).closest( 'tr' ).find( '.check-column' ).html( ajax_response.plugins[$( this ).data( 'check-id' )]['status'] ); + $( this ).closest( 'tr' ).find( '.vulnerabilities' ).html( ajax_response.plugins[$( this ).data( 'check-id' )]['vulnerabilities'] ); + $( this ).closest( 'tr' ).find( '.security-check-actions' ).html( ajax_response.plugins[$( this ).data( 'check-id' )]['security-check-actions'] ); + } + } + ); + + if ( security_check_button.length !== 0 ) { + check_security_cron(); + } else { + location.reload(); + } + } + }, + error: function ( ) { + location.reload(); + } + } + ); + }, + 2000 + ); + + } + + // Button + button_check.on( 'click', do_check ); + if ( ! security_check_runnig ) { + security_check.one( 'click', check_security_cron ); + } + + // close postboxes that should be closed + $( '.if-js-closed' ).removeClass( 'if-js-closed' ).addClass( 'closed' ); + // postboxes setup + postboxes.add_postbox_toggles( 'wpscan' ); + } +); diff --git a/wp-content/plugins/wpscan/assets/js/security-checks.js b/wp-content/plugins/wpscan/assets/js/security-checks.js new file mode 100644 index 00000000..b7a9d8c9 --- /dev/null +++ b/wp-content/plugins/wpscan/assets/js/security-checks.js @@ -0,0 +1,58 @@ +jQuery( document ).ready( + function ($) { + + // Tooltips + $( "strong[title]" ).tooltip( + { + position: { + my: "left top", + at: "right+5 top-5", + collision: "none" + } + } + ); + + // Actions + $( '.security-check-actions button' ).on( + 'click', + function () { + + let btn = $( this ); + let check = btn.data( 'check-id' ); + let action_id = btn.data( 'action' ); + let should_confirm = btn.data( 'confirm' ); + + if (should_confirm && ! confirm( 'Are you sure?' )) { + return; + } + + btn.siblings( '.spinner' ).css( 'visibility', 'visible' ); + + $.ajax( + { + url: wpscan.ajaxurl, + method: 'POST', + data: { + action: 'wpscan_check_action', + action_id: action_id, + check, + _ajax_nonce: wpscan.ajax_nonce + }, + success: function (res) { + console.log( res ); + if (res.success && 'dismiss' === action_id) { + location.reload(); + } else if (res.success) { + console.log( $( this ) ); + btn.prop( 'disabled', true ).html( wpscan.running ).siblings( '.spinner' ).css( 'visibility', 'hidden' ); + } else { + alert( 'Something went wrong, please reload the page.' ); + } + } + } + ); + } + ); + + } +); diff --git a/wp-content/plugins/wpscan/assets/svg/logo.svg b/wp-content/plugins/wpscan/assets/svg/logo.svg new file mode 100644 index 00000000..5991e6a0 --- /dev/null +++ b/wp-content/plugins/wpscan/assets/svg/logo.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/wp-content/plugins/wpscan/assets/svg/menu-icon.svg b/wp-content/plugins/wpscan/assets/svg/menu-icon.svg new file mode 100644 index 00000000..b10f882c --- /dev/null +++ b/wp-content/plugins/wpscan/assets/svg/menu-icon.svg @@ -0,0 +1 @@ +Artboard 2 \ No newline at end of file diff --git a/wp-content/plugins/wpscan/assets/vendor/pdfmake/pdfmake.min.js b/wp-content/plugins/wpscan/assets/vendor/pdfmake/pdfmake.min.js new file mode 100644 index 00000000..7660f70e --- /dev/null +++ b/wp-content/plugins/wpscan/assets/vendor/pdfmake/pdfmake.min.js @@ -0,0 +1,3 @@ +/*! pdfmake v0.1.71, @license MIT, @link http://pdfmake.org */ +!function webpackUniversalModuleDefinition(i,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o();else if("function"==typeof define&&define.amd)define([],o);else{var u=o();for(var p in u)("object"==typeof exports?exports:i)[p]=u[p]}}("undefined"!=typeof self?self:this,(function(){return function(i){var o={};function __webpack_require__(u){if(o[u])return o[u].exports;var p=o[u]={i:u,l:!1,exports:{}};return i[u].call(p.exports,p,p.exports,__webpack_require__),p.l=!0,p.exports}return __webpack_require__.m=i,__webpack_require__.c=o,__webpack_require__.d=function(i,o,u){__webpack_require__.o(i,o)||Object.defineProperty(i,o,{enumerable:!0,get:u})},__webpack_require__.r=function(i){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},__webpack_require__.t=function(i,o){if(1&o&&(i=__webpack_require__(i)),8&o)return i;if(4&o&&"object"==typeof i&&i&&i.__esModule)return i;var u=Object.create(null);if(__webpack_require__.r(u),Object.defineProperty(u,"default",{enumerable:!0,value:i}),2&o&&"string"!=typeof i)for(var p in i)__webpack_require__.d(u,p,function(o){return i[o]}.bind(null,p));return u},__webpack_require__.n=function(i){var o=i&&i.__esModule?function getDefault(){return i.default}:function getModuleExports(){return i};return __webpack_require__.d(o,"a",o),o},__webpack_require__.o=function(i,o){return Object.prototype.hasOwnProperty.call(i,o)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=302)}([function(i,o,u){"use strict";function isArray(i){return Array.isArray(i)}i.exports={isString:function isString(i){return"string"==typeof i||i instanceof String},isNumber:function isNumber(i){return"number"==typeof i||i instanceof Number},isBoolean:function isBoolean(i){return"boolean"==typeof i},isArray:isArray,isFunction:function isFunction(i){return"function"==typeof i},isObject:function isObject(i){return null!==i&&"object"==typeof i},isNull:function isNull(i){return null===i},isUndefined:function isUndefined(i){return void 0===i},pack:function pack(){for(var i={},o=0,u=arguments.length;o>>2]>>>24-y%4*8&255;o[p+y>>>2]|=w<<24-(p+y)%4*8}else for(y=0;y>>2]=u[y>>>2];return this.sigBytes+=g,this},clamp:function(){var o=this.words,u=this.sigBytes;o[u>>>2]&=4294967295<<32-u%4*8,o.length=i.ceil(u/4)},clone:function(){var i=y.clone.call(this);return i.words=this.words.slice(0),i},random:function(o){for(var u,p=[],r=function(o){o=o;var u=987654321,p=4294967295;return function(){var g=((u=36969*(65535&u)+(u>>16)&p)<<16)+(o=18e3*(65535&o)+(o>>16)&p)&p;return g/=4294967296,(g+=.5)*(i.random()>.5?1:-1)}},g=0;g>>2]>>>24-g%4*8&255;p.push((y>>>4).toString(16)),p.push((15&y).toString(16))}return p.join("")},parse:function(i){for(var o=i.length,u=[],p=0;p>>3]|=parseInt(i.substr(p,2),16)<<24-p%8*4;return new w.init(u,o/2)}},k=_.Latin1={stringify:function(i){for(var o=i.words,u=i.sigBytes,p=[],g=0;g>>2]>>>24-g%4*8&255;p.push(String.fromCharCode(y))}return p.join("")},parse:function(i){for(var o=i.length,u=[],p=0;p>>2]|=(255&i.charCodeAt(p))<<24-p%4*8;return new w.init(u,o)}},P=_.Utf8={stringify:function(i){try{return decodeURIComponent(escape(k.stringify(i)))}catch(i){throw new Error("Malformed UTF-8 data")}},parse:function(i){return k.parse(unescape(encodeURIComponent(i)))}},E=g.BufferedBlockAlgorithm=y.extend({reset:function(){this._data=new w.init,this._nDataBytes=0},_append:function(i){"string"==typeof i&&(i=P.parse(i)),this._data.concat(i),this._nDataBytes+=i.sigBytes},_process:function(o){var u=this._data,p=u.words,g=u.sigBytes,y=this.blockSize,_=g/(4*y),x=(_=o?i.ceil(_):i.max((0|_)-this._minBufferSize,0))*y,k=i.min(4*x,g);if(x){for(var P=0;P0?g(p(i),9007199254740991):0}},function(i,o,u){var p=u(17),g=u(7),y=u(33),w=u(40),_=u(52),$export=function(i,o,u){var x,k,P,E=i&$export.F,O=i&$export.G,I=i&$export.S,B=i&$export.P,D=i&$export.B,R=i&$export.W,N=O?g:g[o]||(g[o]={}),U=N.prototype,W=O?p:I?p[o]:(p[o]||{}).prototype;for(x in O&&(u=o),u)(k=!E&&W&&void 0!==W[x])&&_(N,x)||(P=k?W[x]:u[x],N[x]=O&&"function"!=typeof W[x]?u[x]:D&&k?y(P,p):R&&W[x]==P?function(i){var F=function(o,u,p){if(this instanceof i){switch(arguments.length){case 0:return new i;case 1:return new i(o);case 2:return new i(o,u)}return new i(o,u,p)}return i.apply(this,arguments)};return F.prototype=i.prototype,F}(P):B&&"function"==typeof P?y(Function.call,P):P,B&&((N.virtual||(N.virtual={}))[x]=P,i&$export.R&&U&&!U[x]&&w(U,x,P)))};$export.F=1,$export.G=2,$export.S=4,$export.P=8,$export.B=16,$export.W=32,$export.U=64,$export.R=128,i.exports=$export},function(i,o,u){"use strict";(function(i){var p=u(304),g=u(305),y=u(201);function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(i,o){if(kMaxLength()=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|i}function byteLength(i,o){if(Buffer.isBuffer(i))return i.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(i)||i instanceof ArrayBuffer))return i.byteLength;"string"!=typeof i&&(i=""+i);var u=i.length;if(0===u)return 0;for(var p=!1;;)switch(o){case"ascii":case"latin1":case"binary":return u;case"utf8":case"utf-8":case void 0:return utf8ToBytes(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*u;case"hex":return u>>>1;case"base64":return base64ToBytes(i).length;default:if(p)return utf8ToBytes(i).length;o=(""+o).toLowerCase(),p=!0}}function slowToString(i,o,u){var p=!1;if((void 0===o||o<0)&&(o=0),o>this.length)return"";if((void 0===u||u>this.length)&&(u=this.length),u<=0)return"";if((u>>>=0)<=(o>>>=0))return"";for(i||(i="utf8");;)switch(i){case"hex":return hexSlice(this,o,u);case"utf8":case"utf-8":return utf8Slice(this,o,u);case"ascii":return asciiSlice(this,o,u);case"latin1":case"binary":return latin1Slice(this,o,u);case"base64":return base64Slice(this,o,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,o,u);default:if(p)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),p=!0}}function swap(i,o,u){var p=i[o];i[o]=i[u],i[u]=p}function bidirectionalIndexOf(i,o,u,p,g){if(0===i.length)return-1;if("string"==typeof u?(p=u,u=0):u>2147483647?u=2147483647:u<-2147483648&&(u=-2147483648),u=+u,isNaN(u)&&(u=g?0:i.length-1),u<0&&(u=i.length+u),u>=i.length){if(g)return-1;u=i.length-1}else if(u<0){if(!g)return-1;u=0}if("string"==typeof o&&(o=Buffer.from(o,p)),Buffer.isBuffer(o))return 0===o.length?-1:arrayIndexOf(i,o,u,p,g);if("number"==typeof o)return o&=255,Buffer.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?g?Uint8Array.prototype.indexOf.call(i,o,u):Uint8Array.prototype.lastIndexOf.call(i,o,u):arrayIndexOf(i,[o],u,p,g);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(i,o,u,p,g){var y,w=1,_=i.length,x=o.length;if(void 0!==p&&("ucs2"===(p=String(p).toLowerCase())||"ucs-2"===p||"utf16le"===p||"utf-16le"===p)){if(i.length<2||o.length<2)return-1;w=2,_/=2,x/=2,u/=2}function read(i,o){return 1===w?i[o]:i.readUInt16BE(o*w)}if(g){var k=-1;for(y=u;y<_;y++)if(read(i,y)===read(o,-1===k?0:y-k)){if(-1===k&&(k=y),y-k+1===x)return k*w}else-1!==k&&(y-=y-k),k=-1}else for(u+x>_&&(u=_-x),y=u;y>=0;y--){for(var P=!0,E=0;Eg&&(p=g):p=g;var y=o.length;if(y%2!=0)throw new TypeError("Invalid hex string");p>y/2&&(p=y/2);for(var w=0;w>8,g=u%256,y.push(g),y.push(p);return y}(o,i.length-u),i,u,p)}function base64Slice(i,o,u){return 0===o&&u===i.length?p.fromByteArray(i):p.fromByteArray(i.slice(o,u))}function utf8Slice(i,o,u){u=Math.min(i.length,u);for(var p=[],g=o;g239?4:k>223?3:k>191?2:1;if(g+E<=u)switch(E){case 1:k<128&&(P=k);break;case 2:128==(192&(y=i[g+1]))&&(x=(31&k)<<6|63&y)>127&&(P=x);break;case 3:y=i[g+1],w=i[g+2],128==(192&y)&&128==(192&w)&&(x=(15&k)<<12|(63&y)<<6|63&w)>2047&&(x<55296||x>57343)&&(P=x);break;case 4:y=i[g+1],w=i[g+2],_=i[g+3],128==(192&y)&&128==(192&w)&&128==(192&_)&&(x=(15&k)<<18|(63&y)<<12|(63&w)<<6|63&_)>65535&&x<1114112&&(P=x)}null===P?(P=65533,E=1):P>65535&&(P-=65536,p.push(P>>>10&1023|55296),P=56320|1023&P),p.push(P),g+=E}return function decodeCodePointsArray(i){var o=i.length;if(o<=4096)return String.fromCharCode.apply(String,i);var u="",p=0;for(;p0&&(i=this.toString("hex",0,u).match(/.{2}/g).join(" "),this.length>u&&(i+=" ... ")),""},Buffer.prototype.compare=function compare(i,o,u,p,g){if(!Buffer.isBuffer(i))throw new TypeError("Argument must be a Buffer");if(void 0===o&&(o=0),void 0===u&&(u=i?i.length:0),void 0===p&&(p=0),void 0===g&&(g=this.length),o<0||u>i.length||p<0||g>this.length)throw new RangeError("out of range index");if(p>=g&&o>=u)return 0;if(p>=g)return-1;if(o>=u)return 1;if(this===i)return 0;for(var y=(g>>>=0)-(p>>>=0),w=(u>>>=0)-(o>>>=0),_=Math.min(y,w),x=this.slice(p,g),k=i.slice(o,u),P=0;P<_;++P)if(x[P]!==k[P]){y=x[P],w=k[P];break}return yg)&&(u=g),i.length>0&&(u<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");p||(p="utf8");for(var y=!1;;)switch(p){case"hex":return hexWrite(this,i,o,u);case"utf8":case"utf-8":return utf8Write(this,i,o,u);case"ascii":return asciiWrite(this,i,o,u);case"latin1":case"binary":return latin1Write(this,i,o,u);case"base64":return base64Write(this,i,o,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,i,o,u);default:if(y)throw new TypeError("Unknown encoding: "+p);p=(""+p).toLowerCase(),y=!0}},Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function asciiSlice(i,o,u){var p="";u=Math.min(i.length,u);for(var g=o;gp)&&(u=p);for(var g="",y=o;yu)throw new RangeError("Trying to access beyond buffer length")}function checkInt(i,o,u,p,g,y){if(!Buffer.isBuffer(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(o>g||oi.length)throw new RangeError("Index out of range")}function objectWriteUInt16(i,o,u,p){o<0&&(o=65535+o+1);for(var g=0,y=Math.min(i.length-u,2);g>>8*(p?g:1-g)}function objectWriteUInt32(i,o,u,p){o<0&&(o=4294967295+o+1);for(var g=0,y=Math.min(i.length-u,4);g>>8*(p?g:3-g)&255}function checkIEEE754(i,o,u,p,g,y){if(u+p>i.length)throw new RangeError("Index out of range");if(u<0)throw new RangeError("Index out of range")}function writeFloat(i,o,u,p,y){return y||checkIEEE754(i,0,u,4),g.write(i,o,u,p,23,4),u+4}function writeDouble(i,o,u,p,y){return y||checkIEEE754(i,0,u,8),g.write(i,o,u,p,52,8),u+8}Buffer.prototype.slice=function slice(i,o){var u,p=this.length;if((i=~~i)<0?(i+=p)<0&&(i=0):i>p&&(i=p),(o=void 0===o?p:~~o)<0?(o+=p)<0&&(o=0):o>p&&(o=p),o0&&(g*=256);)p+=this[i+--o]*g;return p},Buffer.prototype.readUInt8=function readUInt8(i,o){return o||checkOffset(i,1,this.length),this[i]},Buffer.prototype.readUInt16LE=function readUInt16LE(i,o){return o||checkOffset(i,2,this.length),this[i]|this[i+1]<<8},Buffer.prototype.readUInt16BE=function readUInt16BE(i,o){return o||checkOffset(i,2,this.length),this[i]<<8|this[i+1]},Buffer.prototype.readUInt32LE=function readUInt32LE(i,o){return o||checkOffset(i,4,this.length),(this[i]|this[i+1]<<8|this[i+2]<<16)+16777216*this[i+3]},Buffer.prototype.readUInt32BE=function readUInt32BE(i,o){return o||checkOffset(i,4,this.length),16777216*this[i]+(this[i+1]<<16|this[i+2]<<8|this[i+3])},Buffer.prototype.readIntLE=function readIntLE(i,o,u){i|=0,o|=0,u||checkOffset(i,o,this.length);for(var p=this[i],g=1,y=0;++y=(g*=128)&&(p-=Math.pow(2,8*o)),p},Buffer.prototype.readIntBE=function readIntBE(i,o,u){i|=0,o|=0,u||checkOffset(i,o,this.length);for(var p=o,g=1,y=this[i+--p];p>0&&(g*=256);)y+=this[i+--p]*g;return y>=(g*=128)&&(y-=Math.pow(2,8*o)),y},Buffer.prototype.readInt8=function readInt8(i,o){return o||checkOffset(i,1,this.length),128&this[i]?-1*(255-this[i]+1):this[i]},Buffer.prototype.readInt16LE=function readInt16LE(i,o){o||checkOffset(i,2,this.length);var u=this[i]|this[i+1]<<8;return 32768&u?4294901760|u:u},Buffer.prototype.readInt16BE=function readInt16BE(i,o){o||checkOffset(i,2,this.length);var u=this[i+1]|this[i]<<8;return 32768&u?4294901760|u:u},Buffer.prototype.readInt32LE=function readInt32LE(i,o){return o||checkOffset(i,4,this.length),this[i]|this[i+1]<<8|this[i+2]<<16|this[i+3]<<24},Buffer.prototype.readInt32BE=function readInt32BE(i,o){return o||checkOffset(i,4,this.length),this[i]<<24|this[i+1]<<16|this[i+2]<<8|this[i+3]},Buffer.prototype.readFloatLE=function readFloatLE(i,o){return o||checkOffset(i,4,this.length),g.read(this,i,!0,23,4)},Buffer.prototype.readFloatBE=function readFloatBE(i,o){return o||checkOffset(i,4,this.length),g.read(this,i,!1,23,4)},Buffer.prototype.readDoubleLE=function readDoubleLE(i,o){return o||checkOffset(i,8,this.length),g.read(this,i,!0,52,8)},Buffer.prototype.readDoubleBE=function readDoubleBE(i,o){return o||checkOffset(i,8,this.length),g.read(this,i,!1,52,8)},Buffer.prototype.writeUIntLE=function writeUIntLE(i,o,u,p){(i=+i,o|=0,u|=0,p)||checkInt(this,i,o,u,Math.pow(2,8*u)-1,0);var g=1,y=0;for(this[o]=255&i;++y=0&&(y*=256);)this[o+g]=i/y&255;return o+u},Buffer.prototype.writeUInt8=function writeUInt8(i,o,u){return i=+i,o|=0,u||checkInt(this,i,o,1,255,0),Buffer.TYPED_ARRAY_SUPPORT||(i=Math.floor(i)),this[o]=255&i,o+1},Buffer.prototype.writeUInt16LE=function writeUInt16LE(i,o,u){return i=+i,o|=0,u||checkInt(this,i,o,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[o]=255&i,this[o+1]=i>>>8):objectWriteUInt16(this,i,o,!0),o+2},Buffer.prototype.writeUInt16BE=function writeUInt16BE(i,o,u){return i=+i,o|=0,u||checkInt(this,i,o,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[o]=i>>>8,this[o+1]=255&i):objectWriteUInt16(this,i,o,!1),o+2},Buffer.prototype.writeUInt32LE=function writeUInt32LE(i,o,u){return i=+i,o|=0,u||checkInt(this,i,o,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[o+3]=i>>>24,this[o+2]=i>>>16,this[o+1]=i>>>8,this[o]=255&i):objectWriteUInt32(this,i,o,!0),o+4},Buffer.prototype.writeUInt32BE=function writeUInt32BE(i,o,u){return i=+i,o|=0,u||checkInt(this,i,o,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[o]=i>>>24,this[o+1]=i>>>16,this[o+2]=i>>>8,this[o+3]=255&i):objectWriteUInt32(this,i,o,!1),o+4},Buffer.prototype.writeIntLE=function writeIntLE(i,o,u,p){if(i=+i,o|=0,!p){var g=Math.pow(2,8*u-1);checkInt(this,i,o,u,g-1,-g)}var y=0,w=1,_=0;for(this[o]=255&i;++y>0)-_&255;return o+u},Buffer.prototype.writeIntBE=function writeIntBE(i,o,u,p){if(i=+i,o|=0,!p){var g=Math.pow(2,8*u-1);checkInt(this,i,o,u,g-1,-g)}var y=u-1,w=1,_=0;for(this[o+y]=255&i;--y>=0&&(w*=256);)i<0&&0===_&&0!==this[o+y+1]&&(_=1),this[o+y]=(i/w>>0)-_&255;return o+u},Buffer.prototype.writeInt8=function writeInt8(i,o,u){return i=+i,o|=0,u||checkInt(this,i,o,1,127,-128),Buffer.TYPED_ARRAY_SUPPORT||(i=Math.floor(i)),i<0&&(i=255+i+1),this[o]=255&i,o+1},Buffer.prototype.writeInt16LE=function writeInt16LE(i,o,u){return i=+i,o|=0,u||checkInt(this,i,o,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[o]=255&i,this[o+1]=i>>>8):objectWriteUInt16(this,i,o,!0),o+2},Buffer.prototype.writeInt16BE=function writeInt16BE(i,o,u){return i=+i,o|=0,u||checkInt(this,i,o,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[o]=i>>>8,this[o+1]=255&i):objectWriteUInt16(this,i,o,!1),o+2},Buffer.prototype.writeInt32LE=function writeInt32LE(i,o,u){return i=+i,o|=0,u||checkInt(this,i,o,4,2147483647,-2147483648),Buffer.TYPED_ARRAY_SUPPORT?(this[o]=255&i,this[o+1]=i>>>8,this[o+2]=i>>>16,this[o+3]=i>>>24):objectWriteUInt32(this,i,o,!0),o+4},Buffer.prototype.writeInt32BE=function writeInt32BE(i,o,u){return i=+i,o|=0,u||checkInt(this,i,o,4,2147483647,-2147483648),i<0&&(i=4294967295+i+1),Buffer.TYPED_ARRAY_SUPPORT?(this[o]=i>>>24,this[o+1]=i>>>16,this[o+2]=i>>>8,this[o+3]=255&i):objectWriteUInt32(this,i,o,!1),o+4},Buffer.prototype.writeFloatLE=function writeFloatLE(i,o,u){return writeFloat(this,i,o,!0,u)},Buffer.prototype.writeFloatBE=function writeFloatBE(i,o,u){return writeFloat(this,i,o,!1,u)},Buffer.prototype.writeDoubleLE=function writeDoubleLE(i,o,u){return writeDouble(this,i,o,!0,u)},Buffer.prototype.writeDoubleBE=function writeDoubleBE(i,o,u){return writeDouble(this,i,o,!1,u)},Buffer.prototype.copy=function copy(i,o,u,p){if(u||(u=0),p||0===p||(p=this.length),o>=i.length&&(o=i.length),o||(o=0),p>0&&p=this.length)throw new RangeError("sourceStart out of bounds");if(p<0)throw new RangeError("sourceEnd out of bounds");p>this.length&&(p=this.length),i.length-o=0;--g)i[g+o]=this[g+u];else if(y<1e3||!Buffer.TYPED_ARRAY_SUPPORT)for(g=0;g>>=0,u=void 0===u?this.length:u>>>0,i||(i=0),"number"==typeof i)for(y=o;y55295&&u<57344){if(!g){if(u>56319){(o-=3)>-1&&y.push(239,191,189);continue}if(w+1===p){(o-=3)>-1&&y.push(239,191,189);continue}g=u;continue}if(u<56320){(o-=3)>-1&&y.push(239,191,189),g=u;continue}u=65536+(g-55296<<10|u-56320)}else g&&(o-=3)>-1&&y.push(239,191,189);if(g=null,u<128){if((o-=1)<0)break;y.push(u)}else if(u<2048){if((o-=2)<0)break;y.push(u>>6|192,63&u|128)}else if(u<65536){if((o-=3)<0)break;y.push(u>>12|224,u>>6&63|128,63&u|128)}else{if(!(u<1114112))throw new Error("Invalid code point");if((o-=4)<0)break;y.push(u>>18|240,u>>12&63|128,u>>6&63|128,63&u|128)}}return y}function base64ToBytes(i){return p.toByteArray(function base64clean(i){if((i=function stringtrim(i){return i.trim?i.trim():i.replace(/^\s+|\s+$/g,"")}(i).replace(w,"")).length<2)return"";for(;i.length%4!=0;)i+="=";return i}(i))}function blitBuffer(i,o,u,p){for(var g=0;g=o.length||g>=i.length);++g)o[g+u]=i[g];return g}}).call(this,u(27))},function(i,o){i.exports=function(i){return"object"==typeof i?null!==i:"function"==typeof i}},function(i,o,u){var p=u(11);i.exports=function(i){if(!p(i))throw TypeError(String(i)+" is not an object");return i}},function(i,o,u){var p=u(3);i.exports=!p((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(i,o,u){var p,g,y,w,_,x,k,P,E,O,I,B,D,R,N,U,W,G,j;i.exports=(p=u(2),u(50),void(p.lib.Cipher||(g=p,y=g.lib,w=y.Base,_=y.WordArray,x=y.BufferedBlockAlgorithm,k=g.enc,k.Utf8,P=k.Base64,E=g.algo.EvpKDF,O=y.Cipher=x.extend({cfg:w.extend(),createEncryptor:function(i,o){return this.create(this._ENC_XFORM_MODE,i,o)},createDecryptor:function(i,o){return this.create(this._DEC_XFORM_MODE,i,o)},init:function(i,o,u){this.cfg=this.cfg.extend(u),this._xformMode=i,this._key=o,this.reset()},reset:function(){x.reset.call(this),this._doReset()},process:function(i){return this._append(i),this._process()},finalize:function(i){return i&&this._append(i),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function selectCipherStrategy(i){return"string"==typeof i?j:W}return function(i){return{encrypt:function(o,u,p){return selectCipherStrategy(u).encrypt(i,o,u,p)},decrypt:function(o,u,p){return selectCipherStrategy(u).decrypt(i,o,u,p)}}}}()}),y.StreamCipher=O.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),I=g.mode={},B=y.BlockCipherMode=w.extend({createEncryptor:function(i,o){return this.Encryptor.create(i,o)},createDecryptor:function(i,o){return this.Decryptor.create(i,o)},init:function(i,o){this._cipher=i,this._iv=o}}),D=I.CBC=function(){var i=B.extend();function xorBlock(i,o,u){var p=this._iv;if(p){var g=p;this._iv=void 0}else g=this._prevBlock;for(var y=0;y>>2];i.sigBytes-=o}},y.BlockCipher=O.extend({cfg:O.cfg.extend({mode:D,padding:R}),reset:function(){O.reset.call(this);var i=this.cfg,o=i.iv,u=i.mode;if(this._xformMode==this._ENC_XFORM_MODE)var p=u.createEncryptor;else p=u.createDecryptor,this._minBufferSize=1;this._mode&&this._mode.__creator==p?this._mode.init(this,o&&o.words):(this._mode=p.call(u,this,o&&o.words),this._mode.__creator=p)},_doProcessBlock:function(i,o){this._mode.processBlock(i,o)},_doFinalize:function(){var i=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){i.pad(this._data,this.blockSize);var o=this._process(!0)}else o=this._process(!0),i.unpad(o);return o},blockSize:4}),N=y.CipherParams=w.extend({init:function(i){this.mixIn(i)},toString:function(i){return(i||this.formatter).stringify(this)}}),U=(g.format={}).OpenSSL={stringify:function(i){var o=i.ciphertext,u=i.salt;if(u)var p=_.create([1398893684,1701076831]).concat(u).concat(o);else p=o;return p.toString(P)},parse:function(i){var o=P.parse(i),u=o.words;if(1398893684==u[0]&&1701076831==u[1]){var p=_.create(u.slice(2,4));u.splice(0,4),o.sigBytes-=16}return N.create({ciphertext:o,salt:p})}},W=y.SerializableCipher=w.extend({cfg:w.extend({format:U}),encrypt:function(i,o,u,p){p=this.cfg.extend(p);var g=i.createEncryptor(u,p),y=g.finalize(o),w=g.cfg;return N.create({ciphertext:y,key:u,iv:w.iv,algorithm:i,mode:w.mode,padding:w.padding,blockSize:i.blockSize,formatter:p.format})},decrypt:function(i,o,u,p){return p=this.cfg.extend(p),o=this._parse(o,p.format),i.createDecryptor(u,p).finalize(o.ciphertext)},_parse:function(i,o){return"string"==typeof i?o.parse(i,this):i}}),G=(g.kdf={}).OpenSSL={execute:function(i,o,u,p){p||(p=_.random(8));var g=E.create({keySize:o+u}).compute(i,p),y=_.create(g.words.slice(o),4*u);return g.sigBytes=4*o,N.create({key:g,iv:y,salt:p})}},j=y.PasswordBasedCipher=W.extend({cfg:W.cfg.extend({kdf:G}),encrypt:function(i,o,u,p){var g=(p=this.cfg.extend(p)).kdf.execute(u,i.keySize,i.ivSize);p.iv=g.iv;var y=W.encrypt.call(this,i,o,g.key,p);return y.mixIn(g),y},decrypt:function(i,o,u,p){p=this.cfg.extend(p),o=this._parse(o,p.format);var g=p.kdf.execute(u,i.keySize,i.ivSize,o.salt);return p.iv=g.iv,W.decrypt.call(this,i,o,g.key,p)}}))))},function(i,o){var u={}.hasOwnProperty;i.exports=function(i,o){return u.call(i,o)}},function(i,o,u){var p=u(13),g=u(203),y=u(12),w=u(55),_=Object.defineProperty;o.f=p?_:function defineProperty(i,o,u){if(y(i),o=w(o,!0),y(u),g)try{return _(i,o,u)}catch(i){}if("get"in u||"set"in u)throw TypeError("Accessors not supported");return"value"in u&&(i[o]=u.value),i}},function(i,o){var u=i.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=u)},function(i,o,u){var p=u(13),g=u(16),y=u(41);i.exports=p?function(i,o,u){return g.f(i,o,y(1,u))}:function(i,o,u){return i[o]=u,i}},function(i,o,u){var p=u(35);i.exports=function(i){return Object(p(i))}},function(i,o,u){var p=u(185)("wks"),g=u(133),y=u(17).Symbol,w="function"==typeof y;(i.exports=function(i){return p[i]||(p[i]=w&&y[i]||(w?y:g)("Symbol."+i))}).store=p},function(i,o,u){var p=u(90),g=u(35);i.exports=function(i){return p(g(i))}},function(i,o,u){var p=u(93),g=u(90),y=u(19),w=u(8),_=u(212),x=[].push,createMethod=function(i){var o=1==i,u=2==i,k=3==i,P=4==i,E=6==i,O=7==i,I=5==i||E;return function(B,D,R,N){for(var U,W,G=y(B),j=g(G),X=p(D,R,3),K=w(j.length),Y=0,J=N||_,$=o?J(B,K):u||O?J(B,0):void 0;K>Y;Y++)if((I||Y in j)&&(W=X(U=j[Y],Y,G),i))if(o)$[Y]=W;else if(W)switch(i){case 3:return!0;case 5:return U;case 6:return Y;case 2:x.call($,U)}else switch(i){case 4:return!1;case 7:x.call($,U)}return E?-1:k||P?P:$}};i.exports={forEach:createMethod(0),map:createMethod(1),filter:createMethod(2),some:createMethod(3),every:createMethod(4),find:createMethod(5),findIndex:createMethod(6),filterOut:createMethod(7)}},function(i,o){i.exports=function(i){return"object"==typeof i?null!==i:"function"==typeof i}},function(i,o,u){i.exports=!u(53)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(i,o,u){var p=u(4),g=u(18),y=u(15),w=u(141),_=u(142),x=u(43),k=x.get,P=x.enforce,E=String(String).split("String");(i.exports=function(i,o,u,_){var x,k=!!_&&!!_.unsafe,O=!!_&&!!_.enumerable,I=!!_&&!!_.noTargetGet;"function"==typeof u&&("string"!=typeof o||y(u,"name")||g(u,"name",o),(x=P(u)).source||(x.source=E.join("string"==typeof o?o:""))),i!==p?(k?!I&&i[o]&&(O=!0):delete i[o],O?i[o]=u:g(i,o,u)):O?i[o]=u:w(o,u)})(Function.prototype,"toString",(function toString(){return"function"==typeof this&&k(this).source||_(this)}))},function(i,o,u){var p=u(29),g=u(254),y=u(179),w=Object.defineProperty;o.f=u(24)?Object.defineProperty:function defineProperty(i,o,u){if(p(i),o=y(o,!0),p(u),g)try{return w(i,o,u)}catch(i){}if("get"in u||"set"in u)throw TypeError("Accessors not supported!");return"value"in u&&(i[o]=u.value),i}},function(i,o){var u;u=function(){return this}();try{u=u||new Function("return this")()}catch(i){"object"==typeof window&&(u=window)}i.exports=u},function(i,o,u){"use strict";var p=u(21),g=u(153),y=u(94),w=u(43),_=u(217),x=w.set,k=w.getterFor("Array Iterator");i.exports=_(Array,"Array",(function(i,o){x(this,{type:"Array Iterator",target:p(i),index:0,kind:o})}),(function(){var i=k(this),o=i.target,u=i.kind,p=i.index++;return!o||p>=o.length?(i.target=void 0,{value:void 0,done:!0}):"keys"==u?{value:p,done:!1}:"values"==u?{value:o[p],done:!1}:{value:[p,o[p]],done:!1}}),"values"),y.Arguments=y.Array,g("keys"),g("values"),g("entries")},function(i,o,u){var p=u(23);i.exports=function(i){if(!p(i))throw TypeError(i+" is not an object!");return i}},function(i,o,u){var p=u(112),g=u(4),aFunction=function(i){return"function"==typeof i?i:void 0};i.exports=function(i,o){return arguments.length<2?aFunction(p[i])||aFunction(g[i]):p[i]&&p[i][o]||g[i]&&g[i][o]}},function(i,o){i.exports=function(i){if("function"!=typeof i)throw TypeError(String(i)+" is not a function");return i}},function(i,o,u){var p=u(150),g=u(25),y=u(323);p||g(Object.prototype,"toString",y,{unsafe:!0})},function(i,o,u){var p=u(98);i.exports=function(i,o,u){if(p(i),void 0===o)return i;switch(u){case 1:return function(u){return i.call(o,u)};case 2:return function(u,p){return i.call(o,u,p)};case 3:return function(u,p,g){return i.call(o,u,p,g)}}return function(){return i.apply(o,arguments)}}},function(i,o,u){var p=u(13),g=u(107),y=u(41),w=u(21),_=u(55),x=u(15),k=u(203),P=Object.getOwnPropertyDescriptor;o.f=p?P:function getOwnPropertyDescriptor(i,o){if(i=w(i),o=_(o,!0),k)try{return P(i,o)}catch(i){}if(x(i,o))return y(!g.f.call(i,o),i[o])}},function(i,o){i.exports=function(i){if(null==i)throw TypeError("Can't call method on "+i);return i}},function(i,o){var u=Math.ceil,p=Math.floor;i.exports=function(i){return isNaN(i=+i)?0:(i>0?p:u)(i)}},function(i,o,u){var p=u(12),g=u(31),y=u(6)("species");i.exports=function(i,o){var u,w=p(i).constructor;return void 0===w||null==(u=p(w)[y])?o:g(u)}},function(i,o,u){"use strict";(function(o){var p,g=u(10),y=g.Buffer,w={};for(p in g)g.hasOwnProperty(p)&&"SlowBuffer"!==p&&"Buffer"!==p&&(w[p]=g[p]);var _=w.Buffer={};for(p in y)y.hasOwnProperty(p)&&"allocUnsafe"!==p&&"allocUnsafeSlow"!==p&&(_[p]=y[p]);if(w.Buffer.prototype=y.prototype,_.from&&_.from!==Uint8Array.from||(_.from=function(i,o,u){if("number"==typeof i)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof i);if(i&&void 0===i.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i);return y(i,o,u)}),_.alloc||(_.alloc=function(i,o,u){if("number"!=typeof i)throw new TypeError('The "size" argument must be of type number. Received type '+typeof i);if(i<0||i>=2*(1<<30))throw new RangeError('The value "'+i+'" is invalid for option "size"');var p=y(i);return o&&0!==o.length?"string"==typeof u?p.fill(o,u):p.fill(o):p.fill(0),p}),!w.kStringMaxLength)try{w.kStringMaxLength=o.binding("buffer").kStringMaxLength}catch(i){}w.constants||(w.constants={MAX_LENGTH:w.kMaxLength},w.kStringMaxLength&&(w.constants.MAX_STRING_LENGTH=w.kStringMaxLength)),i.exports=w}).call(this,u(48))},function(i,o,u){(function(){var i,p;i=u(87).Number,o.resolveLength=function(o,u,p){var g;if("number"==typeof o?g=o:"function"==typeof o?g=o.call(p,p):p&&"string"==typeof o?g=p[o]:u&&o instanceof i&&(g=o.decode(u)),isNaN(g))throw new Error("Not a fixed size");return g},p=function p(i){var o,u;for(o in null==i&&(i={}),this.enumerable=!0,this.configurable=!0,i)u=i[o],this[o]=u},o.PropertyDescriptor=p}).call(this)},function(i,o,u){var p=u(26),g=u(97);i.exports=u(24)?function(i,o,u){return p.f(i,o,g(1,u))}:function(i,o,u){return i[o]=u,i}},function(i,o){i.exports=function(i,o){return{enumerable:!(1&i),configurable:!(2&i),writable:!(4&i),value:o}}},function(i,o){var u={}.toString;i.exports=function(i){return u.call(i).slice(8,-1)}},function(i,o,u){var p,g,y,w=u(310),_=u(4),x=u(11),k=u(18),P=u(15),E=u(143),O=u(108),I=u(111),B=_.WeakMap;if(w){var D=E.state||(E.state=new B),R=D.get,N=D.has,U=D.set;p=function(i,o){return o.facade=i,U.call(D,i,o),o},g=function(i){return R.call(D,i)||{}},y=function(i){return N.call(D,i)}}else{var W=O("state");I[W]=!0,p=function(i,o){return o.facade=i,k(i,W,o),o},g=function(i){return P(i,W)?i[W]:{}},y=function(i){return P(i,W)}}i.exports={set:p,get:g,has:y,enforce:function(i){return y(i)?g(i):p(i,{})},getterFor:function(i){return function(o){var u;if(!x(o)||(u=g(o)).type!==i)throw TypeError("Incompatible receiver, "+i+" required");return u}}}},function(i,o,u){var p=u(36),g=Math.max,y=Math.min;i.exports=function(i,o){var u=p(i);return u<0?g(u+o,0):y(u,o)}},function(i,o,u){var p,g=u(12),y=u(311),w=u(144),_=u(111),x=u(209),k=u(140),P=u(108),E=P("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(i){return" + {% endif %} + + \ No newline at end of file diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/docs/android-chrome-192x192.png b/wp-content/plugins/wpscan/libraries/action-scheduler/docs/android-chrome-192x192.png new file mode 100644 index 00000000..36475ecb Binary files /dev/null and b/wp-content/plugins/wpscan/libraries/action-scheduler/docs/android-chrome-192x192.png differ diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/docs/android-chrome-256x256.png b/wp-content/plugins/wpscan/libraries/action-scheduler/docs/android-chrome-256x256.png new file mode 100644 index 00000000..881cb440 Binary files /dev/null and b/wp-content/plugins/wpscan/libraries/action-scheduler/docs/android-chrome-256x256.png differ diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/docs/apple-touch-icon.png b/wp-content/plugins/wpscan/libraries/action-scheduler/docs/apple-touch-icon.png new file mode 100644 index 00000000..36475ecb Binary files /dev/null and b/wp-content/plugins/wpscan/libraries/action-scheduler/docs/apple-touch-icon.png differ diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/docs/assets/css/style.scss b/wp-content/plugins/wpscan/libraries/action-scheduler/docs/assets/css/style.scss new file mode 100644 index 00000000..a13de0d0 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/docs/assets/css/style.scss @@ -0,0 +1,57 @@ +--- +--- + +@import "{{ site.theme }}"; + +a { + text-shadow: none; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +header h1 a { + color: #b5e853; +} + +.container { + max-width: 700px; +} + +footer { + margin-top: 6em; + padding: 1.6em 0; + border-top: 1px dashed #b5e853; +} + +.footer-image { + text-align: center; + padding-top: 1em; +} + +.github-corner:hover .octo-arm { + animation:octocat-wave 560ms ease-in-out +} + +@keyframes octocat-wave { + 0%,100%{ + transform:rotate(0) + } + 20%,60%{ + transform:rotate(-25deg) + } + 40%,80%{ + transform:rotate(10deg) + } +} + +@media (max-width:500px){ + .github-corner:hover .octo-arm { + animation:none + } + .github-corner .octo-arm { + animation:octocat-wave 560ms ease-in-out + } +} \ No newline at end of file diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/docs/browserconfig.xml b/wp-content/plugins/wpscan/libraries/action-scheduler/docs/browserconfig.xml new file mode 100644 index 00000000..f6244e65 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/docs/browserconfig.xml @@ -0,0 +1,9 @@ + + + + + + #151515 + + + diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/docs/favicon-16x16.png b/wp-content/plugins/wpscan/libraries/action-scheduler/docs/favicon-16x16.png new file mode 100644 index 00000000..c46600f5 Binary files /dev/null and b/wp-content/plugins/wpscan/libraries/action-scheduler/docs/favicon-16x16.png differ diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/docs/favicon-32x32.png b/wp-content/plugins/wpscan/libraries/action-scheduler/docs/favicon-32x32.png new file mode 100644 index 00000000..7d088698 Binary files /dev/null and b/wp-content/plugins/wpscan/libraries/action-scheduler/docs/favicon-32x32.png differ diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/docs/favicon.ico b/wp-content/plugins/wpscan/libraries/action-scheduler/docs/favicon.ico new file mode 100644 index 00000000..03560e3a Binary files /dev/null and b/wp-content/plugins/wpscan/libraries/action-scheduler/docs/favicon.ico differ diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/docs/google14ef723abb376cd3.html b/wp-content/plugins/wpscan/libraries/action-scheduler/docs/google14ef723abb376cd3.html new file mode 100644 index 00000000..f3bf1712 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/docs/google14ef723abb376cd3.html @@ -0,0 +1 @@ +google-site-verification: google14ef723abb376cd3.html \ No newline at end of file diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/docs/mstile-150x150.png b/wp-content/plugins/wpscan/libraries/action-scheduler/docs/mstile-150x150.png new file mode 100644 index 00000000..3a3ed191 Binary files /dev/null and b/wp-content/plugins/wpscan/libraries/action-scheduler/docs/mstile-150x150.png differ diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/docs/safari-pinned-tab.svg b/wp-content/plugins/wpscan/libraries/action-scheduler/docs/safari-pinned-tab.svg new file mode 100644 index 00000000..b67c32ba --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/docs/safari-pinned-tab.svg @@ -0,0 +1,40 @@ + + + + +Created by potrace 1.11, written by Peter Selinger 2001-2013 + + + + + diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/docs/site.webmanifest b/wp-content/plugins/wpscan/libraries/action-scheduler/docs/site.webmanifest new file mode 100644 index 00000000..de65106f --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/docs/site.webmanifest @@ -0,0 +1,19 @@ +{ + "name": "", + "short_name": "", + "icons": [ + { + "src": "/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/android-chrome-256x256.png", + "sizes": "256x256", + "type": "image/png" + } + ], + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone" +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/functions.php b/wp-content/plugins/wpscan/libraries/action-scheduler/functions.php new file mode 100644 index 00000000..cc6d8d72 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/functions.php @@ -0,0 +1,275 @@ +async( $hook, $args, $group ); +} + +/** + * Schedule an action to run one time + * + * @param int $timestamp When the job will run. + * @param string $hook The hook to trigger. + * @param array $args Arguments to pass when the hook triggers. + * @param string $group The group to assign this job to. + * + * @return int The action ID. + */ +function as_schedule_single_action( $timestamp, $hook, $args = array(), $group = '' ) { + if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) { + return 0; + } + return ActionScheduler::factory()->single( $hook, $args, $timestamp, $group ); +} + +/** + * Schedule a recurring action + * + * @param int $timestamp When the first instance of the job will run. + * @param int $interval_in_seconds How long to wait between runs. + * @param string $hook The hook to trigger. + * @param array $args Arguments to pass when the hook triggers. + * @param string $group The group to assign this job to. + * + * @return int The action ID. + */ +function as_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args = array(), $group = '' ) { + if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) { + return 0; + } + return ActionScheduler::factory()->recurring( $hook, $args, $timestamp, $interval_in_seconds, $group ); +} + +/** + * Schedule an action that recurs on a cron-like schedule. + * + * @param int $base_timestamp The first instance of the action will be scheduled + * to run at a time calculated after this timestamp matching the cron + * expression. This can be used to delay the first instance of the action. + * @param string $schedule A cron-link schedule string + * @see http://en.wikipedia.org/wiki/Cron + * * * * * * * + * ┬ ┬ ┬ ┬ ┬ ┬ + * | | | | | | + * | | | | | + year [optional] + * | | | | +----- day of week (0 - 7) (Sunday=0 or 7) + * | | | +---------- month (1 - 12) + * | | +--------------- day of month (1 - 31) + * | +-------------------- hour (0 - 23) + * +------------------------- min (0 - 59) + * @param string $hook The hook to trigger. + * @param array $args Arguments to pass when the hook triggers. + * @param string $group The group to assign this job to. + * + * @return int The action ID. + */ +function as_schedule_cron_action( $timestamp, $schedule, $hook, $args = array(), $group = '' ) { + if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) { + return 0; + } + return ActionScheduler::factory()->cron( $hook, $args, $timestamp, $schedule, $group ); +} + +/** + * Cancel the next occurrence of a scheduled action. + * + * While only the next instance of a recurring or cron action is unscheduled by this method, that will also prevent + * all future instances of that recurring or cron action from being run. Recurring and cron actions are scheduled in + * a sequence instead of all being scheduled at once. Each successive occurrence of a recurring action is scheduled + * only after the former action is run. If the next instance is never run, because it's unscheduled by this function, + * then the following instance will never be scheduled (or exist), which is effectively the same as being unscheduled + * by this method also. + * + * @param string $hook The hook that the job will trigger. + * @param array $args Args that would have been passed to the job. + * @param string $group The group the job is assigned to. + * + * @return string|null The scheduled action ID if a scheduled action was found, or null if no matching action found. + */ +function as_unschedule_action( $hook, $args = array(), $group = '' ) { + if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) { + return 0; + } + $params = array(); + if ( is_array($args) ) { + $params['args'] = $args; + } + if ( !empty($group) ) { + $params['group'] = $group; + } + $job_id = ActionScheduler::store()->find_action( $hook, $params ); + + if ( ! empty( $job_id ) ) { + ActionScheduler::store()->cancel_action( $job_id ); + } + + return $job_id; +} + +/** + * Cancel all occurrences of a scheduled action. + * + * @param string $hook The hook that the job will trigger. + * @param array $args Args that would have been passed to the job. + * @param string $group The group the job is assigned to. + */ +function as_unschedule_all_actions( $hook, $args = array(), $group = '' ) { + if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) { + return; + } + if ( empty( $args ) ) { + if ( ! empty( $hook ) && empty( $group ) ) { + ActionScheduler_Store::instance()->cancel_actions_by_hook( $hook ); + return; + } + if ( ! empty( $group ) && empty( $hook ) ) { + ActionScheduler_Store::instance()->cancel_actions_by_group( $group ); + return; + } + } + do { + $unscheduled_action = as_unschedule_action( $hook, $args, $group ); + } while ( ! empty( $unscheduled_action ) ); +} + +/** + * Check if there is an existing action in the queue with a given hook, args and group combination. + * + * An action in the queue could be pending, in-progress or async. If the is pending for a time in + * future, its scheduled date will be returned as a timestamp. If it is currently being run, or an + * async action sitting in the queue waiting to be processed, in which case boolean true will be + * returned. Or there may be no async, in-progress or pending action for this hook, in which case, + * boolean false will be the return value. + * + * @param string $hook + * @param array $args + * @param string $group + * + * @return int|bool The timestamp for the next occurrence of a pending scheduled action, true for an async or in-progress action or false if there is no matching action. + */ +function as_next_scheduled_action( $hook, $args = NULL, $group = '' ) { + if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) { + return false; + } + $params = array(); + if ( is_array($args) ) { + $params['args'] = $args; + } + if ( !empty($group) ) { + $params['group'] = $group; + } + + $params['status'] = ActionScheduler_Store::STATUS_RUNNING; + $job_id = ActionScheduler::store()->find_action( $hook, $params ); + if ( ! empty( $job_id ) ) { + return true; + } + + $params['status'] = ActionScheduler_Store::STATUS_PENDING; + $job_id = ActionScheduler::store()->find_action( $hook, $params ); + if ( empty($job_id) ) { + return false; + } + $job = ActionScheduler::store()->fetch_action( $job_id ); + $scheduled_date = $job->get_schedule()->get_date(); + if ( $scheduled_date ) { + return (int) $scheduled_date->format( 'U' ); + } elseif ( NULL === $scheduled_date ) { // pending async action with NullSchedule + return true; + } + return false; +} + +/** + * Find scheduled actions + * + * @param array $args Possible arguments, with their default values: + * 'hook' => '' - the name of the action that will be triggered + * 'args' => NULL - the args array that will be passed with the action + * 'date' => NULL - the scheduled date of the action. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). Used in UTC timezone. + * 'date_compare' => '<=' - operator for testing "date". accepted values are '!=', '>', '>=', '<', '<=', '=' + * 'modified' => NULL - the date the action was last updated. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). Used in UTC timezone. + * 'modified_compare' => '<=' - operator for testing "modified". accepted values are '!=', '>', '>=', '<', '<=', '=' + * 'group' => '' - the group the action belongs to + * 'status' => '' - ActionScheduler_Store::STATUS_COMPLETE or ActionScheduler_Store::STATUS_PENDING + * 'claimed' => NULL - TRUE to find claimed actions, FALSE to find unclaimed actions, a string to find a specific claim ID + * 'per_page' => 5 - Number of results to return + * 'offset' => 0 + * 'orderby' => 'date' - accepted values are 'hook', 'group', 'modified', 'date' or 'none' + * 'order' => 'ASC' + * + * @param string $return_format OBJECT, ARRAY_A, or ids. + * + * @return array + */ +function as_get_scheduled_actions( $args = array(), $return_format = OBJECT ) { + if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) { + return array(); + } + $store = ActionScheduler::store(); + foreach ( array('date', 'modified') as $key ) { + if ( isset($args[$key]) ) { + $args[$key] = as_get_datetime_object($args[$key]); + } + } + $ids = $store->query_actions( $args ); + + if ( $return_format == 'ids' || $return_format == 'int' ) { + return $ids; + } + + $actions = array(); + foreach ( $ids as $action_id ) { + $actions[$action_id] = $store->fetch_action( $action_id ); + } + + if ( $return_format == ARRAY_A ) { + foreach ( $actions as $action_id => $action_object ) { + $actions[$action_id] = get_object_vars($action_object); + } + } + + return $actions; +} + +/** + * Helper function to create an instance of DateTime based on a given + * string and timezone. By default, will return the current date/time + * in the UTC timezone. + * + * Needed because new DateTime() called without an explicit timezone + * will create a date/time in PHP's timezone, but we need to have + * assurance that a date/time uses the right timezone (which we almost + * always want to be UTC), which means we need to always include the + * timezone when instantiating datetimes rather than leaving it up to + * the PHP default. + * + * @param mixed $date_string A date/time string. Valid formats are explained in http://php.net/manual/en/datetime.formats.php. + * @param string $timezone A timezone identifier, like UTC or Europe/Lisbon. The list of valid identifiers is available http://php.net/manual/en/timezones.php. + * + * @return ActionScheduler_DateTime + */ +function as_get_datetime_object( $date_string = null, $timezone = 'UTC' ) { + if ( is_object( $date_string ) && $date_string instanceof DateTime ) { + $date = new ActionScheduler_DateTime( $date_string->format( 'Y-m-d H:i:s' ), new DateTimeZone( $timezone ) ); + } elseif ( is_numeric( $date_string ) ) { + $date = new ActionScheduler_DateTime( '@' . $date_string, new DateTimeZone( $timezone ) ); + } else { + $date = new ActionScheduler_DateTime( $date_string, new DateTimeZone( $timezone ) ); + } + return $date; +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/lib/WP_Async_Request.php b/wp-content/plugins/wpscan/libraries/action-scheduler/lib/WP_Async_Request.php new file mode 100644 index 00000000..d7dea1c2 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/lib/WP_Async_Request.php @@ -0,0 +1,170 @@ +identifier = $this->prefix . '_' . $this->action; + + add_action( 'wp_ajax_' . $this->identifier, array( $this, 'maybe_handle' ) ); + add_action( 'wp_ajax_nopriv_' . $this->identifier, array( $this, 'maybe_handle' ) ); + } + + /** + * Set data used during the request + * + * @param array $data Data. + * + * @return $this + */ + public function data( $data ) { + $this->data = $data; + + return $this; + } + + /** + * Dispatch the async request + * + * @return array|WP_Error + */ + public function dispatch() { + $url = add_query_arg( $this->get_query_args(), $this->get_query_url() ); + $args = $this->get_post_args(); + + return wp_remote_post( esc_url_raw( $url ), $args ); + } + + /** + * Get query args + * + * @return array + */ + protected function get_query_args() { + if ( property_exists( $this, 'query_args' ) ) { + return $this->query_args; + } + + return array( + 'action' => $this->identifier, + 'nonce' => wp_create_nonce( $this->identifier ), + ); + } + + /** + * Get query URL + * + * @return string + */ + protected function get_query_url() { + if ( property_exists( $this, 'query_url' ) ) { + return $this->query_url; + } + + return admin_url( 'admin-ajax.php' ); + } + + /** + * Get post args + * + * @return array + */ + protected function get_post_args() { + if ( property_exists( $this, 'post_args' ) ) { + return $this->post_args; + } + + return array( + 'timeout' => 0.01, + 'blocking' => false, + 'body' => $this->data, + 'cookies' => $_COOKIE, + 'sslverify' => apply_filters( 'https_local_ssl_verify', false ), + ); + } + + /** + * Maybe handle + * + * Check for correct nonce and pass to handler. + */ + public function maybe_handle() { + // Don't lock up other requests while processing + session_write_close(); + + check_ajax_referer( $this->identifier, 'nonce' ); + + $this->handle(); + + wp_die(); + } + + /** + * Handle + * + * Override this method to perform any actions required + * during the async request. + */ + abstract protected function handle(); + + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression.php b/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression.php new file mode 100644 index 00000000..7f33c378 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression.php @@ -0,0 +1,318 @@ + + * @link http://en.wikipedia.org/wiki/Cron + */ +class CronExpression +{ + const MINUTE = 0; + const HOUR = 1; + const DAY = 2; + const MONTH = 3; + const WEEKDAY = 4; + const YEAR = 5; + + /** + * @var array CRON expression parts + */ + private $cronParts; + + /** + * @var CronExpression_FieldFactory CRON field factory + */ + private $fieldFactory; + + /** + * @var array Order in which to test of cron parts + */ + private static $order = array(self::YEAR, self::MONTH, self::DAY, self::WEEKDAY, self::HOUR, self::MINUTE); + + /** + * Factory method to create a new CronExpression. + * + * @param string $expression The CRON expression to create. There are + * several special predefined values which can be used to substitute the + * CRON expression: + * + * @yearly, @annually) - Run once a year, midnight, Jan. 1 - 0 0 1 1 * + * @monthly - Run once a month, midnight, first of month - 0 0 1 * * + * @weekly - Run once a week, midnight on Sun - 0 0 * * 0 + * @daily - Run once a day, midnight - 0 0 * * * + * @hourly - Run once an hour, first minute - 0 * * * * + * +*@param CronExpression_FieldFactory $fieldFactory (optional) Field factory to use + * + * @return CronExpression + */ + public static function factory($expression, CronExpression_FieldFactory $fieldFactory = null) + { + $mappings = array( + '@yearly' => '0 0 1 1 *', + '@annually' => '0 0 1 1 *', + '@monthly' => '0 0 1 * *', + '@weekly' => '0 0 * * 0', + '@daily' => '0 0 * * *', + '@hourly' => '0 * * * *' + ); + + if (isset($mappings[$expression])) { + $expression = $mappings[$expression]; + } + + return new self($expression, $fieldFactory ? $fieldFactory : new CronExpression_FieldFactory()); + } + + /** + * Parse a CRON expression + * + * @param string $expression CRON expression (e.g. '8 * * * *') + * @param CronExpression_FieldFactory $fieldFactory Factory to create cron fields + */ + public function __construct($expression, CronExpression_FieldFactory $fieldFactory) + { + $this->fieldFactory = $fieldFactory; + $this->setExpression($expression); + } + + /** + * Set or change the CRON expression + * + * @param string $value CRON expression (e.g. 8 * * * *) + * + * @return CronExpression + * @throws InvalidArgumentException if not a valid CRON expression + */ + public function setExpression($value) + { + $this->cronParts = preg_split('/\s/', $value, -1, PREG_SPLIT_NO_EMPTY); + if (count($this->cronParts) < 5) { + throw new InvalidArgumentException( + $value . ' is not a valid CRON expression' + ); + } + + foreach ($this->cronParts as $position => $part) { + $this->setPart($position, $part); + } + + return $this; + } + + /** + * Set part of the CRON expression + * + * @param int $position The position of the CRON expression to set + * @param string $value The value to set + * + * @return CronExpression + * @throws InvalidArgumentException if the value is not valid for the part + */ + public function setPart($position, $value) + { + if (!$this->fieldFactory->getField($position)->validate($value)) { + throw new InvalidArgumentException( + 'Invalid CRON field value ' . $value . ' as position ' . $position + ); + } + + $this->cronParts[$position] = $value; + + return $this; + } + + /** + * Get a next run date relative to the current date or a specific date + * + * @param string|DateTime $currentTime (optional) Relative calculation date + * @param int $nth (optional) Number of matches to skip before returning a + * matching next run date. 0, the default, will return the current + * date and time if the next run date falls on the current date and + * time. Setting this value to 1 will skip the first match and go to + * the second match. Setting this value to 2 will skip the first 2 + * matches and so on. + * @param bool $allowCurrentDate (optional) Set to TRUE to return the + * current date if it matches the cron expression + * + * @return DateTime + * @throws RuntimeException on too many iterations + */ + public function getNextRunDate($currentTime = 'now', $nth = 0, $allowCurrentDate = false) + { + return $this->getRunDate($currentTime, $nth, false, $allowCurrentDate); + } + + /** + * Get a previous run date relative to the current date or a specific date + * + * @param string|DateTime $currentTime (optional) Relative calculation date + * @param int $nth (optional) Number of matches to skip before returning + * @param bool $allowCurrentDate (optional) Set to TRUE to return the + * current date if it matches the cron expression + * + * @return DateTime + * @throws RuntimeException on too many iterations + * @see CronExpression::getNextRunDate + */ + public function getPreviousRunDate($currentTime = 'now', $nth = 0, $allowCurrentDate = false) + { + return $this->getRunDate($currentTime, $nth, true, $allowCurrentDate); + } + + /** + * Get multiple run dates starting at the current date or a specific date + * + * @param int $total Set the total number of dates to calculate + * @param string|DateTime $currentTime (optional) Relative calculation date + * @param bool $invert (optional) Set to TRUE to retrieve previous dates + * @param bool $allowCurrentDate (optional) Set to TRUE to return the + * current date if it matches the cron expression + * + * @return array Returns an array of run dates + */ + public function getMultipleRunDates($total, $currentTime = 'now', $invert = false, $allowCurrentDate = false) + { + $matches = array(); + for ($i = 0; $i < max(0, $total); $i++) { + $matches[] = $this->getRunDate($currentTime, $i, $invert, $allowCurrentDate); + } + + return $matches; + } + + /** + * Get all or part of the CRON expression + * + * @param string $part (optional) Specify the part to retrieve or NULL to + * get the full cron schedule string. + * + * @return string|null Returns the CRON expression, a part of the + * CRON expression, or NULL if the part was specified but not found + */ + public function getExpression($part = null) + { + if (null === $part) { + return implode(' ', $this->cronParts); + } elseif (array_key_exists($part, $this->cronParts)) { + return $this->cronParts[$part]; + } + + return null; + } + + /** + * Helper method to output the full expression. + * + * @return string Full CRON expression + */ + public function __toString() + { + return $this->getExpression(); + } + + /** + * Determine if the cron is due to run based on the current date or a + * specific date. This method assumes that the current number of + * seconds are irrelevant, and should be called once per minute. + * + * @param string|DateTime $currentTime (optional) Relative calculation date + * + * @return bool Returns TRUE if the cron is due to run or FALSE if not + */ + public function isDue($currentTime = 'now') + { + if ('now' === $currentTime) { + $currentDate = date('Y-m-d H:i'); + $currentTime = strtotime($currentDate); + } elseif ($currentTime instanceof DateTime) { + $currentDate = $currentTime->format('Y-m-d H:i'); + $currentTime = strtotime($currentDate); + } else { + $currentTime = new DateTime($currentTime); + $currentTime->setTime($currentTime->format('H'), $currentTime->format('i'), 0); + $currentDate = $currentTime->format('Y-m-d H:i'); + $currentTime = (int)($currentTime->getTimestamp()); + } + + return $this->getNextRunDate($currentDate, 0, true)->getTimestamp() == $currentTime; + } + + /** + * Get the next or previous run date of the expression relative to a date + * + * @param string|DateTime $currentTime (optional) Relative calculation date + * @param int $nth (optional) Number of matches to skip before returning + * @param bool $invert (optional) Set to TRUE to go backwards in time + * @param bool $allowCurrentDate (optional) Set to TRUE to return the + * current date if it matches the cron expression + * + * @return DateTime + * @throws RuntimeException on too many iterations + */ + protected function getRunDate($currentTime = null, $nth = 0, $invert = false, $allowCurrentDate = false) + { + if ($currentTime instanceof DateTime) { + $currentDate = $currentTime; + } else { + $currentDate = new DateTime($currentTime ? $currentTime : 'now'); + $currentDate->setTimezone(new DateTimeZone(date_default_timezone_get())); + } + + $currentDate->setTime($currentDate->format('H'), $currentDate->format('i'), 0); + $nextRun = clone $currentDate; + $nth = (int) $nth; + + // Set a hard limit to bail on an impossible date + for ($i = 0; $i < 1000; $i++) { + + foreach (self::$order as $position) { + $part = $this->getExpression($position); + if (null === $part) { + continue; + } + + $satisfied = false; + // Get the field object used to validate this part + $field = $this->fieldFactory->getField($position); + // Check if this is singular or a list + if (strpos($part, ',') === false) { + $satisfied = $field->isSatisfiedBy($nextRun, $part); + } else { + foreach (array_map('trim', explode(',', $part)) as $listPart) { + if ($field->isSatisfiedBy($nextRun, $listPart)) { + $satisfied = true; + break; + } + } + } + + // If the field is not satisfied, then start over + if (!$satisfied) { + $field->increment($nextRun, $invert); + continue 2; + } + } + + // Skip this match if needed + if ((!$allowCurrentDate && $nextRun == $currentDate) || --$nth > -1) { + $this->fieldFactory->getField(0)->increment($nextRun, $invert); + continue; + } + + return $nextRun; + } + + // @codeCoverageIgnoreStart + throw new RuntimeException('Impossible CRON expression'); + // @codeCoverageIgnoreEnd + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_AbstractField.php b/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_AbstractField.php new file mode 100644 index 00000000..f8d5c00a --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_AbstractField.php @@ -0,0 +1,100 @@ + + */ +abstract class CronExpression_AbstractField implements CronExpression_FieldInterface +{ + /** + * Check to see if a field is satisfied by a value + * + * @param string $dateValue Date value to check + * @param string $value Value to test + * + * @return bool + */ + public function isSatisfied($dateValue, $value) + { + if ($this->isIncrementsOfRanges($value)) { + return $this->isInIncrementsOfRanges($dateValue, $value); + } elseif ($this->isRange($value)) { + return $this->isInRange($dateValue, $value); + } + + return $value == '*' || $dateValue == $value; + } + + /** + * Check if a value is a range + * + * @param string $value Value to test + * + * @return bool + */ + public function isRange($value) + { + return strpos($value, '-') !== false; + } + + /** + * Check if a value is an increments of ranges + * + * @param string $value Value to test + * + * @return bool + */ + public function isIncrementsOfRanges($value) + { + return strpos($value, '/') !== false; + } + + /** + * Test if a value is within a range + * + * @param string $dateValue Set date value + * @param string $value Value to test + * + * @return bool + */ + public function isInRange($dateValue, $value) + { + $parts = array_map('trim', explode('-', $value, 2)); + + return $dateValue >= $parts[0] && $dateValue <= $parts[1]; + } + + /** + * Test if a value is within an increments of ranges (offset[-to]/step size) + * + * @param string $dateValue Set date value + * @param string $value Value to test + * + * @return bool + */ + public function isInIncrementsOfRanges($dateValue, $value) + { + $parts = array_map('trim', explode('/', $value, 2)); + $stepSize = isset($parts[1]) ? $parts[1] : 0; + if ($parts[0] == '*' || $parts[0] === '0') { + return (int) $dateValue % $stepSize == 0; + } + + $range = explode('-', $parts[0], 2); + $offset = $range[0]; + $to = isset($range[1]) ? $range[1] : $dateValue; + // Ensure that the date value is within the range + if ($dateValue < $offset || $dateValue > $to) { + return false; + } + + for ($i = $offset; $i <= $to; $i+= $stepSize) { + if ($i == $dateValue) { + return true; + } + } + + return false; + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_DayOfMonthField.php b/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_DayOfMonthField.php new file mode 100644 index 00000000..40c1d6c6 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_DayOfMonthField.php @@ -0,0 +1,110 @@ + + */ +class CronExpression_DayOfMonthField extends CronExpression_AbstractField +{ + /** + * Get the nearest day of the week for a given day in a month + * + * @param int $currentYear Current year + * @param int $currentMonth Current month + * @param int $targetDay Target day of the month + * + * @return DateTime Returns the nearest date + */ + private static function getNearestWeekday($currentYear, $currentMonth, $targetDay) + { + $tday = str_pad($targetDay, 2, '0', STR_PAD_LEFT); + $target = new DateTime("$currentYear-$currentMonth-$tday"); + $currentWeekday = (int) $target->format('N'); + + if ($currentWeekday < 6) { + return $target; + } + + $lastDayOfMonth = $target->format('t'); + + foreach (array(-1, 1, -2, 2) as $i) { + $adjusted = $targetDay + $i; + if ($adjusted > 0 && $adjusted <= $lastDayOfMonth) { + $target->setDate($currentYear, $currentMonth, $adjusted); + if ($target->format('N') < 6 && $target->format('m') == $currentMonth) { + return $target; + } + } + } + } + + /** + * {@inheritdoc} + */ + public function isSatisfiedBy(DateTime $date, $value) + { + // ? states that the field value is to be skipped + if ($value == '?') { + return true; + } + + $fieldValue = $date->format('d'); + + // Check to see if this is the last day of the month + if ($value == 'L') { + return $fieldValue == $date->format('t'); + } + + // Check to see if this is the nearest weekday to a particular value + if (strpos($value, 'W')) { + // Parse the target day + $targetDay = substr($value, 0, strpos($value, 'W')); + // Find out if the current day is the nearest day of the week + return $date->format('j') == self::getNearestWeekday( + $date->format('Y'), + $date->format('m'), + $targetDay + )->format('j'); + } + + return $this->isSatisfied($date->format('d'), $value); + } + + /** + * {@inheritdoc} + */ + public function increment(DateTime $date, $invert = false) + { + if ($invert) { + $date->modify('previous day'); + $date->setTime(23, 59); + } else { + $date->modify('next day'); + $date->setTime(0, 0); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function validate($value) + { + return (bool) preg_match('/[\*,\/\-\?LW0-9A-Za-z]+/', $value); + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_DayOfWeekField.php b/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_DayOfWeekField.php new file mode 100644 index 00000000..e9f68a7c --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_DayOfWeekField.php @@ -0,0 +1,124 @@ + + */ +class CronExpression_DayOfWeekField extends CronExpression_AbstractField +{ + /** + * {@inheritdoc} + */ + public function isSatisfiedBy(DateTime $date, $value) + { + if ($value == '?') { + return true; + } + + // Convert text day of the week values to integers + $value = str_ireplace( + array('SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'), + range(0, 6), + $value + ); + + $currentYear = $date->format('Y'); + $currentMonth = $date->format('m'); + $lastDayOfMonth = $date->format('t'); + + // Find out if this is the last specific weekday of the month + if (strpos($value, 'L')) { + $weekday = str_replace('7', '0', substr($value, 0, strpos($value, 'L'))); + $tdate = clone $date; + $tdate->setDate($currentYear, $currentMonth, $lastDayOfMonth); + while ($tdate->format('w') != $weekday) { + $tdate->setDate($currentYear, $currentMonth, --$lastDayOfMonth); + } + + return $date->format('j') == $lastDayOfMonth; + } + + // Handle # hash tokens + if (strpos($value, '#')) { + list($weekday, $nth) = explode('#', $value); + // Validate the hash fields + if ($weekday < 1 || $weekday > 5) { + throw new InvalidArgumentException("Weekday must be a value between 1 and 5. {$weekday} given"); + } + if ($nth > 5) { + throw new InvalidArgumentException('There are never more than 5 of a given weekday in a month'); + } + // The current weekday must match the targeted weekday to proceed + if ($date->format('N') != $weekday) { + return false; + } + + $tdate = clone $date; + $tdate->setDate($currentYear, $currentMonth, 1); + $dayCount = 0; + $currentDay = 1; + while ($currentDay < $lastDayOfMonth + 1) { + if ($tdate->format('N') == $weekday) { + if (++$dayCount >= $nth) { + break; + } + } + $tdate->setDate($currentYear, $currentMonth, ++$currentDay); + } + + return $date->format('j') == $currentDay; + } + + // Handle day of the week values + if (strpos($value, '-')) { + $parts = explode('-', $value); + if ($parts[0] == '7') { + $parts[0] = '0'; + } elseif ($parts[1] == '0') { + $parts[1] = '7'; + } + $value = implode('-', $parts); + } + + // Test to see which Sunday to use -- 0 == 7 == Sunday + $format = in_array(7, str_split($value)) ? 'N' : 'w'; + $fieldValue = $date->format($format); + + return $this->isSatisfied($fieldValue, $value); + } + + /** + * {@inheritdoc} + */ + public function increment(DateTime $date, $invert = false) + { + if ($invert) { + $date->modify('-1 day'); + $date->setTime(23, 59, 0); + } else { + $date->modify('+1 day'); + $date->setTime(0, 0, 0); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function validate($value) + { + return (bool) preg_match('/[\*,\/\-0-9A-Z]+/', $value); + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_FieldFactory.php b/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_FieldFactory.php new file mode 100644 index 00000000..556ba1a3 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_FieldFactory.php @@ -0,0 +1,55 @@ + + * @link http://en.wikipedia.org/wiki/Cron + */ +class CronExpression_FieldFactory +{ + /** + * @var array Cache of instantiated fields + */ + private $fields = array(); + + /** + * Get an instance of a field object for a cron expression position + * + * @param int $position CRON expression position value to retrieve + * + * @return CronExpression_FieldInterface + * @throws InvalidArgumentException if a position is not valid + */ + public function getField($position) + { + if (!isset($this->fields[$position])) { + switch ($position) { + case 0: + $this->fields[$position] = new CronExpression_MinutesField(); + break; + case 1: + $this->fields[$position] = new CronExpression_HoursField(); + break; + case 2: + $this->fields[$position] = new CronExpression_DayOfMonthField(); + break; + case 3: + $this->fields[$position] = new CronExpression_MonthField(); + break; + case 4: + $this->fields[$position] = new CronExpression_DayOfWeekField(); + break; + case 5: + $this->fields[$position] = new CronExpression_YearField(); + break; + default: + throw new InvalidArgumentException( + $position . ' is not a valid position' + ); + } + } + + return $this->fields[$position]; + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_FieldInterface.php b/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_FieldInterface.php new file mode 100644 index 00000000..5d5109b7 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_FieldInterface.php @@ -0,0 +1,39 @@ + + */ +interface CronExpression_FieldInterface +{ + /** + * Check if the respective value of a DateTime field satisfies a CRON exp + * + * @param DateTime $date DateTime object to check + * @param string $value CRON expression to test against + * + * @return bool Returns TRUE if satisfied, FALSE otherwise + */ + public function isSatisfiedBy(DateTime $date, $value); + + /** + * When a CRON expression is not satisfied, this method is used to increment + * or decrement a DateTime object by the unit of the cron field + * + * @param DateTime $date DateTime object to change + * @param bool $invert (optional) Set to TRUE to decrement + * + * @return CronExpression_FieldInterface + */ + public function increment(DateTime $date, $invert = false); + + /** + * Validates a CRON expression for a given field + * + * @param string $value CRON expression value to validate + * + * @return bool Returns TRUE if valid, FALSE otherwise + */ + public function validate($value); +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_HoursField.php b/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_HoursField.php new file mode 100644 index 00000000..088ca73c --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_HoursField.php @@ -0,0 +1,47 @@ + + */ +class CronExpression_HoursField extends CronExpression_AbstractField +{ + /** + * {@inheritdoc} + */ + public function isSatisfiedBy(DateTime $date, $value) + { + return $this->isSatisfied($date->format('H'), $value); + } + + /** + * {@inheritdoc} + */ + public function increment(DateTime $date, $invert = false) + { + // Change timezone to UTC temporarily. This will + // allow us to go back or forwards and hour even + // if DST will be changed between the hours. + $timezone = $date->getTimezone(); + $date->setTimezone(new DateTimeZone('UTC')); + if ($invert) { + $date->modify('-1 hour'); + $date->setTime($date->format('H'), 59); + } else { + $date->modify('+1 hour'); + $date->setTime($date->format('H'), 0); + } + $date->setTimezone($timezone); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function validate($value) + { + return (bool) preg_match('/[\*,\/\-0-9]+/', $value); + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_MinutesField.php b/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_MinutesField.php new file mode 100644 index 00000000..436acf2f --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_MinutesField.php @@ -0,0 +1,39 @@ + + */ +class CronExpression_MinutesField extends CronExpression_AbstractField +{ + /** + * {@inheritdoc} + */ + public function isSatisfiedBy(DateTime $date, $value) + { + return $this->isSatisfied($date->format('i'), $value); + } + + /** + * {@inheritdoc} + */ + public function increment(DateTime $date, $invert = false) + { + if ($invert) { + $date->modify('-1 minute'); + } else { + $date->modify('+1 minute'); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function validate($value) + { + return (bool) preg_match('/[\*,\/\-0-9]+/', $value); + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_MonthField.php b/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_MonthField.php new file mode 100644 index 00000000..d3deb129 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_MonthField.php @@ -0,0 +1,55 @@ + + */ +class CronExpression_MonthField extends CronExpression_AbstractField +{ + /** + * {@inheritdoc} + */ + public function isSatisfiedBy(DateTime $date, $value) + { + // Convert text month values to integers + $value = str_ireplace( + array( + 'JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', + 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC' + ), + range(1, 12), + $value + ); + + return $this->isSatisfied($date->format('m'), $value); + } + + /** + * {@inheritdoc} + */ + public function increment(DateTime $date, $invert = false) + { + if ($invert) { + // $date->modify('last day of previous month'); // remove for php 5.2 compat + $date->modify('previous month'); + $date->modify($date->format('Y-m-t')); + $date->setTime(23, 59); + } else { + //$date->modify('first day of next month'); // remove for php 5.2 compat + $date->modify('next month'); + $date->modify($date->format('Y-m-01')); + $date->setTime(0, 0); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function validate($value) + { + return (bool) preg_match('/[\*,\/\-0-9A-Z]+/', $value); + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_YearField.php b/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_YearField.php new file mode 100644 index 00000000..f11562e4 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/CronExpression_YearField.php @@ -0,0 +1,43 @@ + + */ +class CronExpression_YearField extends CronExpression_AbstractField +{ + /** + * {@inheritdoc} + */ + public function isSatisfiedBy(DateTime $date, $value) + { + return $this->isSatisfied($date->format('Y'), $value); + } + + /** + * {@inheritdoc} + */ + public function increment(DateTime $date, $invert = false) + { + if ($invert) { + $date->modify('-1 year'); + $date->setDate($date->format('Y'), 12, 31); + $date->setTime(23, 59, 0); + } else { + $date->modify('+1 year'); + $date->setDate($date->format('Y'), 1, 1); + $date->setTime(0, 0, 0); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function validate($value) + { + return (bool) preg_match('/[\*,\/\-0-9]+/', $value); + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/LICENSE b/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/LICENSE new file mode 100644 index 00000000..c6d88ac6 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/lib/cron-expression/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2011 Michael Dowling and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/license.txt b/wp-content/plugins/wpscan/libraries/action-scheduler/license.txt new file mode 100644 index 00000000..f288702d --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/license.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/package-lock.json b/wp-content/plugins/wpscan/libraries/action-scheduler/package-lock.json new file mode 100644 index 00000000..62379734 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/package-lock.json @@ -0,0 +1,2138 @@ +{ + "name": "action-scheduler", + "version": "3.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@babel/code-frame": { + "version": "7.5.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", + "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", + "dev": true, + "requires": { + "@babel/highlight": "^7.0.0" + } + }, + "@babel/highlight": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", + "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", + "dev": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^4.0.0" + } + }, + "@nodelib/fs.scandir": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz", + "integrity": "sha512-eGmwYQn3gxo4r7jdQnkrrN6bY478C3P+a/y72IJukF8LjB6ZHeB3c+Ehacj3sYeSmUXGlnA67/PmbM9CVwL7Dw==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.3", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.3.tgz", + "integrity": "sha512-bQBFruR2TAwoevBEd/NWMoAAtNGzTRgdrqnYCc7dhzfoNvqPzLyqlEQnzZ3kVnNrSp25iyxE00/3h2fqGAGArA==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.4.tgz", + "integrity": "sha512-1V9XOY4rDW0rehzbrcqAmHnz8e7SKvX27gh8Gt2WgB0+pdzdiLV83p72kZPU+jvMbS1qU5mauP2iOvO8rhmurQ==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.3", + "fastq": "^1.6.0" + } + }, + "@samverschueren/stream-to-observable": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.0.tgz", + "integrity": "sha512-MI4Xx6LHs4Webyvi6EbspgyAb4D2Q2VtnCQ1blOJcoLS6mVa8lNN2rkIy1CVxfTUpoyIbCTkXES1rLXztFD1lg==", + "dev": true, + "requires": { + "any-observable": "^0.3.0" + } + }, + "@types/events": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", + "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==", + "dev": true + }, + "@types/glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", + "integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==", + "dev": true, + "requires": { + "@types/events": "*", + "@types/minimatch": "*", + "@types/node": "*" + } + }, + "@types/minimatch": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", + "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", + "dev": true + }, + "@types/node": { + "version": "12.11.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.11.7.tgz", + "integrity": "sha512-JNbGaHFCLwgHn/iCckiGSOZ1XYHsKFwREtzPwSGCVld1SGhOlmZw2D4ZI94HQCrBHbADzW9m4LER/8olJTRGHA==", + "dev": true + }, + "@types/normalize-package-data": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==", + "dev": true + }, + "abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, + "aggregate-error": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz", + "integrity": "sha512-quoaXsZ9/BLNae5yiNoUz+Nhkwz83GhWwtYFglcjEQB2NDHCIpApbqXxIFnm4Pq/Nvhrsq5sYJFyohrrxnTGAA==", + "dev": true, + "requires": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + }, + "dependencies": { + "indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true + } + } + }, + "ansi-escapes": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", + "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==", + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "any-observable": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/any-observable/-/any-observable-0.3.0.tgz", + "integrity": "sha512-/FQM1EDkTsf63Ub2C6O7GuYFDsSXUwsaZDurV0np41ocwq0jthUAYCmhBX9f+KwlaCgIuWyr/4WlUQUBfKfZog==", + "dev": true + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + }, + "dependencies": { + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + } + } + }, + "array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", + "dev": true + }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "caller-callsite": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz", + "integrity": "sha1-hH4PzgoiN1CpoCfFSzNzGtMVQTQ=", + "dev": true, + "requires": { + "callsites": "^2.0.0" + } + }, + "caller-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-2.0.0.tgz", + "integrity": "sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ=", + "dev": true, + "requires": { + "caller-callsite": "^2.0.0" + } + }, + "callsites": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", + "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", + "dev": true + }, + "camelcase": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", + "dev": true + }, + "camelcase-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", + "dev": true, + "requires": { + "camelcase": "^2.0.0", + "map-obj": "^1.0.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true + }, + "clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true + }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "dev": true, + "requires": { + "restore-cursor": "^2.0.0" + } + }, + "cli-truncate": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-0.2.1.tgz", + "integrity": "sha1-nxXPuwcFAFNpIWxiasfQWrkN1XQ=", + "dev": true, + "requires": { + "slice-ansi": "0.0.4", + "string-width": "^1.0.1" + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "coffeescript": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/coffeescript/-/coffeescript-1.10.0.tgz", + "integrity": "sha1-56qDAZF+9iGzXYo580jc3R234z4=", + "dev": true + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "colors": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", + "dev": true + }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "cosmiconfig": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.2.1.tgz", + "integrity": "sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA==", + "dev": true, + "requires": { + "import-fresh": "^2.0.0", + "is-directory": "^0.3.1", + "js-yaml": "^3.13.1", + "parse-json": "^4.0.0" + }, + "dependencies": { + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + } + } + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", + "dev": true, + "requires": { + "array-find-index": "^1.0.1" + } + }, + "date-fns": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-1.30.1.tgz", + "integrity": "sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==", + "dev": true + }, + "dateformat": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.12.tgz", + "integrity": "sha1-nxJLZ1lMk3/3BpMuSmQsyo27/uk=", + "dev": true, + "requires": { + "get-stdin": "^4.0.1", + "meow": "^3.3.0" + } + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "dedent": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", + "integrity": "sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw=", + "dev": true + }, + "del": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/del/-/del-5.1.0.tgz", + "integrity": "sha512-wH9xOVHnczo9jN2IW68BabcecVPxacIA3g/7z6vhSU/4stOKQzeCRK0yD0A24WiAAUJmmVpWqrERcTxnLo3AnA==", + "dev": true, + "requires": { + "globby": "^10.0.1", + "graceful-fs": "^4.2.2", + "is-glob": "^4.0.1", + "is-path-cwd": "^2.2.0", + "is-path-inside": "^3.0.1", + "p-map": "^3.0.0", + "rimraf": "^3.0.0", + "slash": "^3.0.0" + }, + "dependencies": { + "glob": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.5.tgz", + "integrity": "sha512-J9dlskqUXK1OeTOYBEn5s8aMukWMwWfs+rPTn/jn50Ux4MNXVhubL1wu/j2t+H4NVI+cXEcCaYellqaPVGXNqQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "rimraf": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.0.tgz", + "integrity": "sha512-NDGVxTsjqfunkds7CqsOiEnxln4Bo7Nddl3XhS4pXg5OzwkLqJ971ZVAAnB+DDLnF76N+VnDEiBHaVV8I06SUg==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + }, + "dependencies": { + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + } + } + }, + "elegant-spinner": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/elegant-spinner/-/elegant-spinner-1.0.1.tgz", + "integrity": "sha1-2wQ1IcldfjA/2PNFvtwzSc+wcp4=", + "dev": true + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, + "eventemitter2": { + "version": "0.4.14", + "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz", + "integrity": "sha1-j2G3XN4BKy6esoTUVFWDtWQ7Yas=", + "dev": true + }, + "execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "dev": true, + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "dev": true + }, + "fast-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.1.0.tgz", + "integrity": "sha512-TrUz3THiq2Vy3bjfQUB2wNyPdGBeGmdjbzzBLhfHN4YFurYptCKwGq/TfiRavbGywFRzY6U2CdmQ1zmsY5yYaw==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.0", + "merge2": "^1.3.0", + "micromatch": "^4.0.2" + } + }, + "fastq": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.6.0.tgz", + "integrity": "sha512-jmxqQ3Z/nXoeyDmWAzF9kH1aGZSis6e/SbfPmJpUnyZ0ogr6iscHQaml4wsEepEWSdtmpy+eVXmCRIMpxaXqOA==", + "dev": true, + "requires": { + "reusify": "^1.0.0" + } + }, + "figures": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", + "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5", + "object-assign": "^4.1.0" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "findup-sync": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.3.0.tgz", + "integrity": "sha1-N5MKpdgWt3fANEXhlmzGeQpMCxY=", + "dev": true, + "requires": { + "glob": "~5.0.0" + }, + "dependencies": { + "glob": { + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", + "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", + "dev": true, + "requires": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + } + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "get-own-enumerable-property-symbols": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.1.tgz", + "integrity": "sha512-09/VS4iek66Dh2bctjRkowueRJbY1JDGR1L/zRxO1Qk8Uxs6PnqaNSqalpizPT+CDjre3hnEsuzvhgomz9qYrA==", + "dev": true + }, + "get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", + "dev": true + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "getobject": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/getobject/-/getobject-0.1.0.tgz", + "integrity": "sha1-BHpEl4n6Fg0Bj1SG7ZEyC27HiFw=", + "dev": true + }, + "glob": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.0.6.tgz", + "integrity": "sha1-IRuvr0nlJbjNkyYNFKsTYVKz9Xo=", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.2", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz", + "integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "globby": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/globby/-/globby-10.0.1.tgz", + "integrity": "sha512-sSs4inE1FB2YQiymcmTv6NWENryABjUNPeWhOvmn4SjtKybglsyPZxFB3U1/+L1bYi0rNZDqCLlHyLYDl1Pq5A==", + "dev": true, + "requires": { + "@types/glob": "^7.1.1", + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.0.3", + "glob": "^7.1.3", + "ignore": "^5.1.1", + "merge2": "^1.2.3", + "slash": "^3.0.0" + }, + "dependencies": { + "glob": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.5.tgz", + "integrity": "sha512-J9dlskqUXK1OeTOYBEn5s8aMukWMwWfs+rPTn/jn50Ux4MNXVhubL1wu/j2t+H4NVI+cXEcCaYellqaPVGXNqQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + } + } + }, + "graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", + "dev": true + }, + "grunt": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.0.4.tgz", + "integrity": "sha512-PYsMOrOC+MsdGEkFVwMaMyc6Ob7pKmq+deg1Sjr+vvMWp35sztfwKE7qoN51V+UEtHsyNuMcGdgMLFkBHvMxHQ==", + "dev": true, + "requires": { + "coffeescript": "~1.10.0", + "dateformat": "~1.0.12", + "eventemitter2": "~0.4.13", + "exit": "~0.1.1", + "findup-sync": "~0.3.0", + "glob": "~7.0.0", + "grunt-cli": "~1.2.0", + "grunt-known-options": "~1.1.0", + "grunt-legacy-log": "~2.0.0", + "grunt-legacy-util": "~1.1.1", + "iconv-lite": "~0.4.13", + "js-yaml": "~3.13.0", + "minimatch": "~3.0.2", + "mkdirp": "~0.5.1", + "nopt": "~3.0.6", + "path-is-absolute": "~1.0.0", + "rimraf": "~2.6.2" + }, + "dependencies": { + "grunt-cli": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.2.0.tgz", + "integrity": "sha1-VisRnrsGndtGSs4oRVAb6Xs1tqg=", + "dev": true, + "requires": { + "findup-sync": "~0.3.0", + "grunt-known-options": "~1.1.0", + "nopt": "~3.0.6", + "resolve": "~1.1.0" + } + }, + "resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "dev": true + } + } + }, + "grunt-checktextdomain": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/grunt-checktextdomain/-/grunt-checktextdomain-1.0.1.tgz", + "integrity": "sha1-slTQHh3pEwBdTbHFMD2QI7mD4Zs=", + "dev": true, + "requires": { + "chalk": "~0.2.1", + "text-table": "~0.2.0" + }, + "dependencies": { + "ansi-styles": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-0.2.0.tgz", + "integrity": "sha1-NZq0sV3NZLptdHNLcsNjYKmvLBk=", + "dev": true + }, + "chalk": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-0.2.1.tgz", + "integrity": "sha1-dhPhV1FFshOGSD9/SFql/6jL0Qw=", + "dev": true, + "requires": { + "ansi-styles": "~0.2.0", + "has-color": "~0.1.0" + } + } + } + }, + "grunt-known-options": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/grunt-known-options/-/grunt-known-options-1.1.1.tgz", + "integrity": "sha512-cHwsLqoighpu7TuYj5RonnEuxGVFnztcUqTqp5rXFGYL4OuPFofwC4Ycg7n9fYwvK6F5WbYgeVOwph9Crs2fsQ==", + "dev": true + }, + "grunt-legacy-log": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-2.0.0.tgz", + "integrity": "sha512-1m3+5QvDYfR1ltr8hjiaiNjddxGdQWcH0rw1iKKiQnF0+xtgTazirSTGu68RchPyh1OBng1bBUjLmX8q9NpoCw==", + "dev": true, + "requires": { + "colors": "~1.1.2", + "grunt-legacy-log-utils": "~2.0.0", + "hooker": "~0.2.3", + "lodash": "~4.17.5" + } + }, + "grunt-legacy-log-utils": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-2.0.1.tgz", + "integrity": "sha512-o7uHyO/J+i2tXG8r2bZNlVk20vlIFJ9IEYyHMCQGfWYru8Jv3wTqKZzvV30YW9rWEjq0eP3cflQ1qWojIe9VFA==", + "dev": true, + "requires": { + "chalk": "~2.4.1", + "lodash": "~4.17.10" + } + }, + "grunt-legacy-util": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-1.1.1.tgz", + "integrity": "sha512-9zyA29w/fBe6BIfjGENndwoe1Uy31BIXxTH3s8mga0Z5Bz2Sp4UCjkeyv2tI449ymkx3x26B+46FV4fXEddl5A==", + "dev": true, + "requires": { + "async": "~1.5.2", + "exit": "~0.1.1", + "getobject": "~0.1.0", + "hooker": "~0.2.3", + "lodash": "~4.17.10", + "underscore.string": "~3.3.4", + "which": "~1.3.0" + } + }, + "grunt-phpcs": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/grunt-phpcs/-/grunt-phpcs-0.4.0.tgz", + "integrity": "sha1-oI1iX8ZEZeRTsr2T+BCyqB6Uvao=", + "dev": true + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "has-color": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz", + "integrity": "sha1-ZxRKUmDDT8PMpnfQQdr1L+e3iy8=", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "hooker": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz", + "integrity": "sha1-uDT3I8xKJCqmWWNFnfbZhMXT2Vk=", + "dev": true + }, + "hosted-git-info": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.5.tgz", + "integrity": "sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg==", + "dev": true + }, + "husky": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/husky/-/husky-3.0.9.tgz", + "integrity": "sha512-Yolhupm7le2/MqC1VYLk/cNmYxsSsqKkTyBhzQHhPK1jFnC89mmmNVuGtLNabjDI6Aj8UNIr0KpRNuBkiC4+sg==", + "dev": true, + "requires": { + "chalk": "^2.4.2", + "ci-info": "^2.0.0", + "cosmiconfig": "^5.2.1", + "execa": "^1.0.0", + "get-stdin": "^7.0.0", + "opencollective-postinstall": "^2.0.2", + "pkg-dir": "^4.2.0", + "please-upgrade-node": "^3.2.0", + "read-pkg": "^5.2.0", + "run-node": "^1.0.0", + "slash": "^3.0.0" + }, + "dependencies": { + "get-stdin": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-7.0.0.tgz", + "integrity": "sha512-zRKcywvrXlXsA0v0i9Io4KDRaAw7+a1ZpjRwl9Wox8PFlVCCHra7E9c4kqXCoCM9nR5tBkaTTZRBoCm60bFqTQ==", + "dev": true + }, + "parse-json": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.0.tgz", + "integrity": "sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1", + "lines-and-columns": "^1.1.6" + } + }, + "read-pkg": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", + "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", + "dev": true, + "requires": { + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" + } + } + } + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ignore": { + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.4.tgz", + "integrity": "sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A==", + "dev": true + }, + "import-fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-2.0.0.tgz", + "integrity": "sha1-2BNVwVYS04bGH53dOSLUMEgipUY=", + "dev": true, + "requires": { + "caller-path": "^2.0.0", + "resolve-from": "^3.0.0" + } + }, + "indent-string": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "dev": true, + "requires": { + "repeating": "^2.0.0" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-directory": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/is-directory/-/is-directory-0.3.1.tgz", + "integrity": "sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE=", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", + "dev": true + }, + "is-observable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-observable/-/is-observable-1.1.0.tgz", + "integrity": "sha512-NqCa4Sa2d+u7BWc6CukaObG3Fh+CU9bvixbpcXYhy2VvYS7vVGIdAgnIS5Ks3A/cqk4rebLJ9s8zBstT2aKnIA==", + "dev": true, + "requires": { + "symbol-observable": "^1.1.0" + } + }, + "is-path-cwd": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz", + "integrity": "sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==", + "dev": true + }, + "is-path-inside": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.2.tgz", + "integrity": "sha512-/2UGPSgmtqwo1ktx8NDHjuPwZWmHhO+gj0f93EkhLB5RgW9RZevWYYlIkS6zePc6U2WpOdQYIwHe9YC4DWEBVg==", + "dev": true + }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "dev": true + }, + "is-regexp": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-1.0.0.tgz", + "integrity": "sha1-/S2INUXEa6xaYz57mgnof6LLUGk=", + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "lines-and-columns": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", + "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", + "dev": true + }, + "lint-staged": { + "version": "9.4.2", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-9.4.2.tgz", + "integrity": "sha512-OFyGokJSWTn2M6vngnlLXjaHhi8n83VIZZ5/1Z26SULRUWgR3ITWpAEQC9Pnm3MC/EpCxlwts/mQWDHNji2+zA==", + "dev": true, + "requires": { + "chalk": "^2.4.2", + "commander": "^2.20.0", + "cosmiconfig": "^5.2.1", + "debug": "^4.1.1", + "dedent": "^0.7.0", + "del": "^5.0.0", + "execa": "^2.0.3", + "listr": "^0.14.3", + "log-symbols": "^3.0.0", + "micromatch": "^4.0.2", + "normalize-path": "^3.0.0", + "please-upgrade-node": "^3.1.1", + "string-argv": "^0.3.0", + "stringify-object": "^3.3.0" + }, + "dependencies": { + "cross-spawn": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.1.tgz", + "integrity": "sha512-u7v4o84SwFpD32Z8IIcPZ6z1/ie24O6RU3RbtL5Y316l3KuHVPx9ItBgWQ6VlfAFnRnTtMUrsQ9MUUTuEZjogg==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "execa": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-2.1.0.tgz", + "integrity": "sha512-Y/URAVapfbYy2Xp/gb6A0E7iR8xeqOCXsuuaoMn7A5PzrXUK84E1gyiEfq0wQd/GHA6GsoHWwhNq8anb0mleIw==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^3.0.0", + "onetime": "^5.1.0", + "p-finally": "^2.0.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" + } + }, + "get-stream": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", + "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", + "dev": true + }, + "npm-run-path": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-3.1.0.tgz", + "integrity": "sha512-Dbl4A/VfiVGLgQv29URL9xshU8XDY1GeLy+fsaZ1AA8JDSfjvr5P5+pzRbWqRSBxk6/DW7MIh8lTM/PaGnP2kg==", + "dev": true, + "requires": { + "path-key": "^3.0.0" + } + }, + "p-finally": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-2.0.1.tgz", + "integrity": "sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw==", + "dev": true + }, + "path-key": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.0.tgz", + "integrity": "sha512-8cChqz0RP6SHJkMt48FW0A7+qUOn+OsnOsVtzI59tZ8m+5bCSk7hzwET0pulwOM2YMn9J1efb07KB9l9f30SGg==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "which": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.1.tgz", + "integrity": "sha512-N7GBZOTswtB9lkQBZA4+zAXrjEIWAUOB93AvzUiudRzRxhUdLURQ7D/gAIMY1gatT/LTbmbcv8SiYazy3eYB7w==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "listr": { + "version": "0.14.3", + "resolved": "https://registry.npmjs.org/listr/-/listr-0.14.3.tgz", + "integrity": "sha512-RmAl7su35BFd/xoMamRjpIE4j3v+L28o8CT5YhAXQJm1fD+1l9ngXY8JAQRJ+tFK2i5njvi0iRUKV09vPwA0iA==", + "dev": true, + "requires": { + "@samverschueren/stream-to-observable": "^0.3.0", + "is-observable": "^1.1.0", + "is-promise": "^2.1.0", + "is-stream": "^1.1.0", + "listr-silent-renderer": "^1.1.1", + "listr-update-renderer": "^0.5.0", + "listr-verbose-renderer": "^0.5.0", + "p-map": "^2.0.0", + "rxjs": "^6.3.3" + }, + "dependencies": { + "p-map": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz", + "integrity": "sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==", + "dev": true + } + } + }, + "listr-silent-renderer": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz", + "integrity": "sha1-kktaN1cVN3C/Go4/v3S4u/P5JC4=", + "dev": true + }, + "listr-update-renderer": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/listr-update-renderer/-/listr-update-renderer-0.5.0.tgz", + "integrity": "sha512-tKRsZpKz8GSGqoI/+caPmfrypiaq+OQCbd+CovEC24uk1h952lVj5sC7SqyFUm+OaJ5HN/a1YLt5cit2FMNsFA==", + "dev": true, + "requires": { + "chalk": "^1.1.3", + "cli-truncate": "^0.2.1", + "elegant-spinner": "^1.0.1", + "figures": "^1.7.0", + "indent-string": "^3.0.0", + "log-symbols": "^1.0.2", + "log-update": "^2.3.0", + "strip-ansi": "^3.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "indent-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", + "dev": true + }, + "log-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-1.0.2.tgz", + "integrity": "sha1-N2/3tY6jCGoPCfrMdGF+ylAeGhg=", + "dev": true, + "requires": { + "chalk": "^1.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, + "listr-verbose-renderer": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/listr-verbose-renderer/-/listr-verbose-renderer-0.5.0.tgz", + "integrity": "sha512-04PDPqSlsqIOaaaGZ+41vq5FejI9auqTInicFRndCBgE3bXG8D6W1I+mWhk+1nqbHmyhla/6BUrd5OSiHwKRXw==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "cli-cursor": "^2.1.0", + "date-fns": "^1.27.2", + "figures": "^2.0.0" + }, + "dependencies": { + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + } + } + }, + "load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "dev": true + }, + "log-symbols": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", + "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", + "dev": true, + "requires": { + "chalk": "^2.4.2" + } + }, + "log-update": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-2.3.0.tgz", + "integrity": "sha1-iDKP19HOeTiykoN0bwsbwSayRwg=", + "dev": true, + "requires": { + "ansi-escapes": "^3.0.0", + "cli-cursor": "^2.0.0", + "wrap-ansi": "^3.0.1" + } + }, + "loud-rejection": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "dev": true, + "requires": { + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" + } + }, + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true + }, + "meow": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", + "dev": true, + "requires": { + "camelcase-keys": "^2.0.0", + "decamelize": "^1.1.2", + "loud-rejection": "^1.0.0", + "map-obj": "^1.0.1", + "minimist": "^1.1.3", + "normalize-package-data": "^2.3.4", + "object-assign": "^4.0.1", + "read-pkg-up": "^1.0.1", + "redent": "^1.0.0", + "trim-newlines": "^1.0.0" + } + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "merge2": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.3.0.tgz", + "integrity": "sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw==", + "dev": true + }, + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + } + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "nopt": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "dev": true, + "requires": { + "abbrev": "1" + } + }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "^2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", + "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "opencollective-postinstall": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz", + "integrity": "sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw==", + "dev": true + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-limit": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz", + "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-map": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", + "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", + "dev": true, + "requires": { + "aggregate-error": "^3.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "requires": { + "pinkie-promise": "^2.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "picomatch": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.0.7.tgz", + "integrity": "sha512-oLHIdio3tZ0qH76NybpeneBhYVj0QFTfXEFTc/B3zKQspYfYYkWYgFsmzo+4kvId/bQRcNkVeguI3y+CD22BtA==", + "dev": true + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "^2.0.0" + } + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + }, + "dependencies": { + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + } + } + }, + "please-upgrade-node": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz", + "integrity": "sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg==", + "dev": true, + "requires": { + "semver-compare": "^1.0.0" + } + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "dev": true, + "requires": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + } + }, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "dev": true, + "requires": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + } + }, + "redent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", + "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", + "dev": true, + "requires": { + "indent-string": "^2.1.0", + "strip-indent": "^1.0.1" + } + }, + "repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "dev": true, + "requires": { + "is-finite": "^1.0.0" + } + }, + "resolve": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz", + "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + }, + "resolve-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", + "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", + "dev": true + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + }, + "dependencies": { + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + } + } + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + }, + "dependencies": { + "glob": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.5.tgz", + "integrity": "sha512-J9dlskqUXK1OeTOYBEn5s8aMukWMwWfs+rPTn/jn50Ux4MNXVhubL1wu/j2t+H4NVI+cXEcCaYellqaPVGXNqQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + } + } + }, + "run-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/run-node/-/run-node-1.0.0.tgz", + "integrity": "sha512-kc120TBlQ3mih1LSzdAJXo4xn/GWS2ec0l3S+syHDXP9uRr0JAT8Qd3mdMuyjqCzeZktgP3try92cEgf9Nks8A==", + "dev": true + }, + "run-parallel": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.9.tgz", + "integrity": "sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q==", + "dev": true + }, + "rxjs": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.3.tgz", + "integrity": "sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "semver-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", + "integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w=", + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "slice-ansi": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", + "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=", + "dev": true + }, + "spdx-correct": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", + "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz", + "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==", + "dev": true + }, + "sprintf-js": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", + "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==", + "dev": true + }, + "string-argv": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.1.tgz", + "integrity": "sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg==", + "dev": true + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "stringify-object": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-3.3.0.tgz", + "integrity": "sha512-rHqiFh1elqCQ9WPLIC8I0Q/g/wj5J1eMkyoiD6eoQApWHP0FtlK7rqnhmabL5VUY9JQCcqwwvlOaSuutekgyrw==", + "dev": true, + "requires": { + "get-own-enumerable-property-symbols": "^3.0.0", + "is-obj": "^1.0.1", + "is-regexp": "^1.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "^0.2.0" + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true + }, + "strip-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", + "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", + "dev": true, + "requires": { + "get-stdin": "^4.0.1" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "symbol-observable": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", + "integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==", + "dev": true + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "trim-newlines": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", + "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", + "dev": true + }, + "tslib": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", + "dev": true + }, + "type-fest": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", + "dev": true + }, + "underscore.string": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.3.5.tgz", + "integrity": "sha512-g+dpmgn+XBneLmXXo+sGlW5xQEt4ErkS3mgeN2GFbremYeMBSJKr9Wf2KJplQVaiPY/f7FN6atosWYNm9ovrYg==", + "dev": true, + "requires": { + "sprintf-js": "^1.0.3", + "util-deprecate": "^1.0.2" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "wrap-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-3.0.1.tgz", + "integrity": "sha1-KIoE2H7aXChuBg3+jxNc6NAH+Lo=", + "dev": true, + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + } + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/package.json b/wp-content/plugins/wpscan/libraries/action-scheduler/package.json new file mode 100644 index 00000000..ebf7ce27 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/package.json @@ -0,0 +1,39 @@ +{ + "name": "action-scheduler", + "title": "Action Scheduler", + "version": "3.1.6", + "homepage": "https://actionscheduler.org/", + "repository": { + "type": "git", + "url": "https://github.com/woocommerce/action-scheduler.git" + }, + "license": "GPL-3.0+", + "main": "Gruntfile.js", + "scripts": { + "build": "grunt", + "check-textdomain": "grunt checktextdomain", + "phpcs": "grunt phpcs" + }, + "devDependencies": { + "grunt": "1.0.4", + "grunt-checktextdomain": "1.0.1", + "grunt-phpcs": "0.4.0", + "husky": "3.0.9", + "lint-staged": "9.4.2" + }, + "engines": { + "node": ">=10.15.0", + "npm": ">=6.4.1" + }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "lint-staged": { + "*.php": [ + "php -d display_errors=1 -l", + "composer run-script phpcs-pre-commit" + ] + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/phpcs.xml b/wp-content/plugins/wpscan/libraries/action-scheduler/phpcs.xml new file mode 100644 index 00000000..be683d82 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/phpcs.xml @@ -0,0 +1,39 @@ + + + WooCommerce dev PHP_CodeSniffer ruleset. + + + docs/ + */node_modules/* + */vendor/* + + + + + + + + + + + + + + + + classes/* + deprecated/* + lib/* + tests/* + + + classes/* + deprecated/* + lib/* + tests/* + + + + tests/ + + diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/ActionScheduler_UnitTestCase.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/ActionScheduler_UnitTestCase.php new file mode 100644 index 00000000..8cd3429b --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/ActionScheduler_UnitTestCase.php @@ -0,0 +1,44 @@ +createResult(); + } + + if ( 'UTC' != ( $this->existing_timezone = date_default_timezone_get() ) ) { + date_default_timezone_set( 'UTC' ); + $result->run( $this ); + } + + date_default_timezone_set( 'Pacific/Fiji' ); // UTC+12 + $result->run( $this ); + + date_default_timezone_set( 'Pacific/Tahiti' ); // UTC-10: it's a magical place + $result->run( $this ); + + date_default_timezone_set( $this->existing_timezone ); + + return $result; + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/bin/install.sh b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/bin/install.sh new file mode 100644 index 00000000..0864ac19 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/bin/install.sh @@ -0,0 +1,151 @@ +#!/usr/bin/env bash +# See https://raw.githubusercontent.com/wp-cli/scaffold-command/master/templates/install-wp-tests.sh + +if [ $# -lt 3 ]; then + echo "usage: $0 [db-host] [wp-version] [skip-database-creation]" + exit 1 +fi + +DB_NAME=$1 +DB_USER=$2 +DB_PASS=$3 +DB_HOST=${4-localhost} +WP_VERSION=${5-latest} +SKIP_DB_CREATE=${6-false} + +TMPDIR=${TMPDIR-/tmp} +TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//") +WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib} +WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress/} + +download() { + if [ `which curl` ]; then + curl -s "$1" > "$2"; + elif [ `which wget` ]; then + wget -nv -O "$2" "$1" + fi +} + +if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+$ ]]; then + WP_TESTS_TAG="branches/$WP_VERSION" +elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then + if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then + # version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x + WP_TESTS_TAG="tags/${WP_VERSION%??}" + else + WP_TESTS_TAG="tags/$WP_VERSION" + fi +elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then + WP_TESTS_TAG="trunk" +else + # http serves a single offer, whereas https serves multiple. we only want one + download http://api.wordpress.org/core/version-check/1.7/ $TMPDIR/wp-latest.json + grep '[0-9]+\.[0-9]+(\.[0-9]+)?' $TMPDIR/wp-latest.json + LATEST_VERSION=$(grep -o '"version":"[^"]*' $TMPDIR/wp-latest.json | sed 's/"version":"//') + if [[ -z "$LATEST_VERSION" ]]; then + echo "Latest WordPress version could not be found" + exit 1 + fi + WP_TESTS_TAG="tags/$LATEST_VERSION" +fi + +set -ex + +install_wp() { + + if [ -d $WP_CORE_DIR ]; then + return; + fi + + mkdir -p $WP_CORE_DIR + + if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then + mkdir -p $TMPDIR/wordpress-nightly + download https://wordpress.org/nightly-builds/wordpress-latest.zip $TMPDIR/wordpress-nightly/wordpress-nightly.zip + unzip -q $TMPDIR/wordpress-nightly/wordpress-nightly.zip -d $TMPDIR/wordpress-nightly/ + mv $TMPDIR/wordpress-nightly/wordpress/* $WP_CORE_DIR + else + if [ $WP_VERSION == 'latest' ]; then + local ARCHIVE_NAME='latest' + elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+ ]]; then + # https serves multiple offers, whereas http serves single. + download https://api.wordpress.org/core/version-check/1.7/ $TMPDIR/wp-latest.json + if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then + # version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x + LATEST_VERSION=${WP_VERSION%??} + else + # otherwise, scan the releases and get the most up to date minor version of the major release + local VERSION_ESCAPED=`echo $WP_VERSION | sed 's/\./\\\\./g'` + LATEST_VERSION=$(grep -o '"version":"'$VERSION_ESCAPED'[^"]*' $TMPDIR/wp-latest.json | sed 's/"version":"//' | head -1) + fi + if [[ -z "$LATEST_VERSION" ]]; then + local ARCHIVE_NAME="wordpress-$WP_VERSION" + else + local ARCHIVE_NAME="wordpress-$LATEST_VERSION" + fi + else + local ARCHIVE_NAME="wordpress-$WP_VERSION" + fi + download https://wordpress.org/${ARCHIVE_NAME}.tar.gz $TMPDIR/wordpress.tar.gz + tar --strip-components=1 -zxmf $TMPDIR/wordpress.tar.gz -C $WP_CORE_DIR + fi + + download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php +} + +install_test_suite() { + # portable in-place argument for both GNU sed and Mac OSX sed + if [[ $(uname -s) == 'Darwin' ]]; then + local ioption='-i .bak' + else + local ioption='-i' + fi + + # set up testing suite if it doesn't yet exist + if [ ! -d $WP_TESTS_DIR ]; then + # set up testing suite + mkdir -p $WP_TESTS_DIR + svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes + svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data + fi + + if [ ! -f wp-tests-config.php ]; then + download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php + # remove all forward slashes in the end + WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::") + sed $ioption -E "s:(__DIR__ . '/src/'|dirname\( __FILE__ \) . '/src/'):'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php + fi + +} + +install_db() { + + if [ ${SKIP_DB_CREATE} = "true" ]; then + return 0 + fi + + # If we're trying to connect to a socket we want to handle it differently. + if [[ "$DB_HOST" == *.sock ]]; then + # create database using the socket + mysqladmin create $DB_NAME --socket="$DB_HOST" + else + # Decide whether or not there is a port. + local PARTS=(${DB_HOST//\:/ }) + if [[ ${PARTS[1]} =~ ^[0-9]+$ ]]; then + EXTRA=" --host=${PARTS[0]} --port=${PARTS[1]} --protocol=tcp" + else + EXTRA=" --host=$DB_HOST --protocol=tcp" + fi + + # create database + mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA + fi +} + +install_wp +install_test_suite +install_db diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/bootstrap.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/bootstrap.php new file mode 100644 index 00000000..60abf95a --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/bootstrap.php @@ -0,0 +1,31 @@ + + + + + + ./phpunit/migration + + + ./phpunit/jobstore/ActionScheduler_DBStoreMigrator_Test.php + ./phpunit/jobstore/ActionScheduler_DBStore_Test.php + ./phpunit/jobstore/ActionScheduler_HybridStore_Test.php + ./phpunit/logging/ActionScheduler_DBLogger_Test.php + + + ./phpunit/helpers + ./phpunit/jobs + ./phpunit/procedural_api + ./phpunit/runner + ./phpunit/schedules + ./phpunit/versioning + ./phpunit/logging/ActionScheduler_wpCommentLogger_Test.php + ./phpunit/jobstore/ActionScheduler_wpPostStore_Test.php + + + + + ignore + + + + + .. + + . + + + + diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/ActionScheduler_Mock_Async_Request_QueueRunner.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/ActionScheduler_Mock_Async_Request_QueueRunner.php new file mode 100644 index 00000000..5f372180 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/ActionScheduler_Mock_Async_Request_QueueRunner.php @@ -0,0 +1,19 @@ +createResult(); + } + + if ( 'UTC' != ( $this->existing_timezone = date_default_timezone_get() ) ) { + date_default_timezone_set( 'UTC' ); + $result->run( $this ); + } + + date_default_timezone_set( 'Pacific/Fiji' ); // UTC+12 + $result->run( $this ); + + date_default_timezone_set( 'Pacific/Tahiti' ); // UTC-10: it's a magical place + $result->run( $this ); + + date_default_timezone_set( $this->existing_timezone ); + + return $result; + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/helpers/ActionScheduler_TimezoneHelper_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/helpers/ActionScheduler_TimezoneHelper_Test.php new file mode 100644 index 00000000..03d8195e --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/helpers/ActionScheduler_TimezoneHelper_Test.php @@ -0,0 +1,100 @@ +getTimezone(); + $this->assertInstanceOf( 'DateTimeZone', $timezone ); + $this->assertEquals( $timezone_string, $timezone->getName() ); + + remove_filter( 'option_timezone_string', $timezone_filter ); + } + + public function local_timezone_provider() { + return array( + array( 'America/New_York' ), + array( 'Australia/Melbourne' ), + array( 'UTC' ), + ); + } + + /** + * Ensure that most GMT offsets don't return UTC as the timezone. + * + * @dataProvider local_timezone_offsets_provider + * + * @param $gmt_offset + */ + public function test_local_timezone_offsets( $gmt_offset ) { + $gmt_filter = function ( $gmt ) use ( $gmt_offset ) { + return $gmt_offset; + }; + + $date = new ActionScheduler_DateTime(); + + add_filter( 'option_gmt_offset', $gmt_filter ); + ActionScheduler_TimezoneHelper::set_local_timezone( $date ); + remove_filter( 'option_gmt_offset', $gmt_filter ); + + $offset_in_seconds = $gmt_offset * HOUR_IN_SECONDS; + + $this->assertEquals( $offset_in_seconds, $date->getOffset() ); + $this->assertEquals( $offset_in_seconds, $date->getOffsetTimestamp() - $date->getTimestamp() ); + } + + public function local_timezone_offsets_provider() { + return array( + array( '-11' ), + array( '-10.5' ), + array( '-10' ), + array( '-9' ), + array( '-8' ), + array( '-7' ), + array( '-6' ), + array( '-5' ), + array( '-4.5' ), + array( '-4' ), + array( '-3.5' ), + array( '-3' ), + array( '-2' ), + array( '-1' ), + array( '1' ), + array( '1.5' ), + array( '2' ), + array( '3' ), + array( '4' ), + array( '5' ), + array( '5.5' ), + array( '5.75' ), + array( '6' ), + array( '7' ), + array( '8' ), + array( '8.5' ), + array( '9' ), + array( '9.5' ), + array( '10' ), + array( '10.5' ), + array( '11' ), + array( '11.5' ), + array( '12' ), + array( '13' ), + ); + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/jobs/ActionScheduler_Action_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/jobs/ActionScheduler_Action_Test.php new file mode 100644 index 00000000..629f97f7 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/jobs/ActionScheduler_Action_Test.php @@ -0,0 +1,55 @@ +assertEquals( $schedule, $action->get_schedule() ); + } + + public function test_null_schedule() { + $action = new ActionScheduler_Action('my_hook'); + $this->assertInstanceOf( 'ActionScheduler_NullSchedule', $action->get_schedule() ); + } + + public function test_set_hook() { + $action = new ActionScheduler_Action('my_hook'); + $this->assertEquals( 'my_hook', $action->get_hook() ); + } + + public function test_args() { + $action = new ActionScheduler_Action('my_hook'); + $this->assertEmpty($action->get_args()); + + $action = new ActionScheduler_Action('my_hook', array(5,10,15)); + $this->assertEqualSets(array(5,10,15), $action->get_args()); + } + + public function test_set_group() { + $action = new ActionScheduler_Action('my_hook', array(), NULL, 'my_group'); + $this->assertEquals('my_group', $action->get_group()); + } + + public function test_execute() { + $mock = new MockAction(); + + $random = md5(rand()); + add_action( $random, array( $mock, 'action' ) ); + + $action = new ActionScheduler_Action( $random, array($random) ); + $action->execute(); + + remove_action( $random, array( $mock, 'action' ) ); + + $this->assertEquals( 1, $mock->get_call_count() ); + $events = $mock->get_events(); + $event = reset($events); + $this->assertEquals( $random, reset($event['args']) ); + } +} + \ No newline at end of file diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/jobs/ActionScheduler_NullAction_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/jobs/ActionScheduler_NullAction_Test.php new file mode 100644 index 00000000..90b12868 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/jobs/ActionScheduler_NullAction_Test.php @@ -0,0 +1,16 @@ +assertEmpty($action->get_hook()); + $this->assertEmpty($action->get_args()); + $this->assertNull( $action->get_schedule()->get_date() ); + } +} + \ No newline at end of file diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/jobstore/ActionScheduler_DBStoreMigrator_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/jobstore/ActionScheduler_DBStoreMigrator_Test.php new file mode 100644 index 00000000..0e97fdd0 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/jobstore/ActionScheduler_DBStoreMigrator_Test.php @@ -0,0 +1,26 @@ +save_action( $action, null, $last_attempt_date ); + $action_date = $store->get_date( $action_id ); + + $this->assertEquals( $last_attempt_date->format( 'U' ), $action_date->format( 'U' ) ); + + $action_id = $store->save_action( $action, $scheduled_date, $last_attempt_date ); + $action_date = $store->get_date( $action_id ); + + $this->assertEquals( $last_attempt_date->format( 'U' ), $action_date->format( 'U' ) ); + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/jobstore/ActionScheduler_DBStore_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/jobstore/ActionScheduler_DBStore_Test.php new file mode 100644 index 00000000..3db6b240 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/jobstore/ActionScheduler_DBStore_Test.php @@ -0,0 +1,444 @@ +save_action( $action ); + + $this->assertNotEmpty( $action_id ); + } + + public function test_create_action_with_scheduled_date() { + $time = as_get_datetime_object( strtotime( '-1 week' ) ); + $action = new ActionScheduler_Action( 'my_hook', [], new ActionScheduler_SimpleSchedule( $time ) ); + $store = new ActionScheduler_DBStore(); + $action_id = $store->save_action( $action, $time ); + $action_date = $store->get_date( $action_id ); + + $this->assertEquals( $time->format( 'U' ), $action_date->format( 'U' ) ); + } + + public function test_retrieve_action() { + $time = as_get_datetime_object(); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( 'my_hook', [], $schedule, 'my_group' ); + $store = new ActionScheduler_DBStore(); + $action_id = $store->save_action( $action ); + + $retrieved = $store->fetch_action( $action_id ); + $this->assertEquals( $action->get_hook(), $retrieved->get_hook() ); + $this->assertEqualSets( $action->get_args(), $retrieved->get_args() ); + $this->assertEquals( $action->get_schedule()->get_date()->format( 'U' ), $retrieved->get_schedule()->get_date()->format( 'U' ) ); + $this->assertEquals( $action->get_group(), $retrieved->get_group() ); + } + + public function test_cancel_action() { + $time = as_get_datetime_object(); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( 'my_hook', [], $schedule, 'my_group' ); + $store = new ActionScheduler_DBStore(); + $action_id = $store->save_action( $action ); + $store->cancel_action( $action_id ); + + $fetched = $store->fetch_action( $action_id ); + $this->assertInstanceOf( 'ActionScheduler_CanceledAction', $fetched ); + } + + public function test_cancel_actions_by_hook() { + $store = new ActionScheduler_DBStore(); + $actions = []; + $hook = 'by_hook_test'; + for ( $day = 1; $day <= 3; $day++ ) { + $delta = sprintf( '+%d day', $day ); + $time = as_get_datetime_object( $delta ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( $hook, [], $schedule, 'my_group' ); + $actions[] = $store->save_action( $action ); + } + $store->cancel_actions_by_hook( $hook ); + + foreach ( $actions as $action_id ) { + $fetched = $store->fetch_action( $action_id ); + $this->assertInstanceOf( 'ActionScheduler_CanceledAction', $fetched ); + } + } + + public function test_cancel_actions_by_group() { + $store = new ActionScheduler_DBStore(); + $actions = []; + $group = 'by_group_test'; + for ( $day = 1; $day <= 3; $day++ ) { + $delta = sprintf( '+%d day', $day ); + $time = as_get_datetime_object( $delta ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( 'my_hook', [], $schedule, $group ); + $actions[] = $store->save_action( $action ); + } + $store->cancel_actions_by_group( $group ); + + foreach ( $actions as $action_id ) { + $fetched = $store->fetch_action( $action_id ); + $this->assertInstanceOf( 'ActionScheduler_CanceledAction', $fetched ); + } + } + + public function test_claim_actions() { + $created_actions = []; + $store = new ActionScheduler_DBStore(); + for ( $i = 3; $i > - 3; $i -- ) { + $time = as_get_datetime_object( $i . ' hours' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( 'my_hook', [ $i ], $schedule, 'my_group' ); + + $created_actions[] = $store->save_action( $action ); + } + + $claim = $store->stake_claim(); + $this->assertInstanceof( 'ActionScheduler_ActionClaim', $claim ); + + $this->assertCount( 3, $claim->get_actions() ); + $this->assertEqualSets( array_slice( $created_actions, 3, 3 ), $claim->get_actions() ); + } + + public function test_claim_actions_order() { + + $store = new ActionScheduler_DBStore(); + $schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( '-1 hour' ) ); + $created_actions = array( + $store->save_action( new ActionScheduler_Action( 'my_hook', array( 1 ), $schedule, 'my_group' ) ), + $store->save_action( new ActionScheduler_Action( 'my_hook', array( 1 ), $schedule, 'my_group' ) ), + ); + + $claim = $store->stake_claim(); + $this->assertInstanceof( 'ActionScheduler_ActionClaim', $claim ); + + // Verify uniqueness of action IDs. + $this->assertEquals( 2, count( array_unique( $created_actions ) ) ); + + // Verify the count and order of the actions. + $claimed_actions = $claim->get_actions(); + $this->assertCount( 2, $claimed_actions ); + $this->assertEquals( $created_actions, $claimed_actions ); + + // Verify the reversed order doesn't pass. + $reversed_actions = array_reverse( $created_actions ); + $this->assertNotEquals( $reversed_actions, $claimed_actions ); + } + + public function test_claim_actions_by_hooks() { + $created_actions = $created_actions_by_hook = []; + $store = new ActionScheduler_DBStore(); + $unique_hook_one = 'my_unique_hook_one'; + $unique_hook_two = 'my_unique_hook_two'; + $unique_hooks = array( + $unique_hook_one, + $unique_hook_two, + ); + + for ( $i = 3; $i > - 3; $i -- ) { + foreach ( $unique_hooks as $unique_hook ) { + $time = as_get_datetime_object( $i . ' hours' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( $unique_hook, [ $i ], $schedule, 'my_group' ); + + $action_id = $store->save_action( $action ); + $created_actions[] = $created_actions_by_hook[ $unique_hook ][] = $action_id; + } + } + + $claim = $store->stake_claim( 10, null, $unique_hooks ); + $this->assertInstanceof( 'ActionScheduler_ActionClaim', $claim ); + $this->assertCount( 6, $claim->get_actions() ); + $this->assertEqualSets( array_slice( $created_actions, 6, 6 ), $claim->get_actions() ); + + $store->release_claim( $claim ); + + $claim = $store->stake_claim( 10, null, array( $unique_hook_one ) ); + $this->assertInstanceof( 'ActionScheduler_ActionClaim', $claim ); + $this->assertCount( 3, $claim->get_actions() ); + $this->assertEqualSets( array_slice( $created_actions_by_hook[ $unique_hook_one ], 3, 3 ), $claim->get_actions() ); + + $store->release_claim( $claim ); + + $claim = $store->stake_claim( 10, null, array( $unique_hook_two ) ); + $this->assertInstanceof( 'ActionScheduler_ActionClaim', $claim ); + $this->assertCount( 3, $claim->get_actions() ); + $this->assertEqualSets( array_slice( $created_actions_by_hook[ $unique_hook_two ], 3, 3 ), $claim->get_actions() ); + } + + public function test_claim_actions_by_group() { + $created_actions = []; + $store = new ActionScheduler_DBStore(); + $unique_group_one = 'my_unique_group_one'; + $unique_group_two = 'my_unique_group_two'; + $unique_groups = array( + $unique_group_one, + $unique_group_two, + ); + + for ( $i = 3; $i > - 3; $i -- ) { + foreach ( $unique_groups as $unique_group ) { + $time = as_get_datetime_object( $i . ' hours' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( 'my_hook', [ $i ], $schedule, $unique_group ); + + $created_actions[ $unique_group ][] = $store->save_action( $action ); + } + } + + $claim = $store->stake_claim( 10, null, array(), $unique_group_one ); + $this->assertInstanceof( 'ActionScheduler_ActionClaim', $claim ); + $this->assertCount( 3, $claim->get_actions() ); + $this->assertEqualSets( array_slice( $created_actions[ $unique_group_one ], 3, 3 ), $claim->get_actions() ); + + $store->release_claim( $claim ); + + $claim = $store->stake_claim( 10, null, array(), $unique_group_two ); + $this->assertInstanceof( 'ActionScheduler_ActionClaim', $claim ); + $this->assertCount( 3, $claim->get_actions() ); + $this->assertEqualSets( array_slice( $created_actions[ $unique_group_two ], 3, 3 ), $claim->get_actions() ); + } + + public function test_claim_actions_by_hook_and_group() { + $created_actions = $created_actions_by_hook = []; + $store = new ActionScheduler_DBStore(); + + $unique_hook_one = 'my_other_unique_hook_one'; + $unique_hook_two = 'my_other_unique_hook_two'; + $unique_hooks = array( + $unique_hook_one, + $unique_hook_two, + ); + + $unique_group_one = 'my_other_other_unique_group_one'; + $unique_group_two = 'my_other_unique_group_two'; + $unique_groups = array( + $unique_group_one, + $unique_group_two, + ); + + for ( $i = 3; $i > - 3; $i -- ) { + foreach ( $unique_hooks as $unique_hook ) { + foreach ( $unique_groups as $unique_group ) { + $time = as_get_datetime_object( $i . ' hours' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( $unique_hook, [ $i ], $schedule, $unique_group ); + + $action_id = $store->save_action( $action ); + $created_actions[ $unique_group ][] = $action_id; + $created_actions_by_hook[ $unique_hook ][ $unique_group ][] = $action_id; + } + } + } + + /** Test Both Hooks with Each Group */ + + $claim = $store->stake_claim( 10, null, $unique_hooks, $unique_group_one ); + $this->assertInstanceof( 'ActionScheduler_ActionClaim', $claim ); + $this->assertCount( 6, $claim->get_actions() ); + $this->assertEqualSets( array_slice( $created_actions[ $unique_group_one ], 6, 6 ), $claim->get_actions() ); + + $store->release_claim( $claim ); + + $claim = $store->stake_claim( 10, null, $unique_hooks, $unique_group_two ); + $this->assertInstanceof( 'ActionScheduler_ActionClaim', $claim ); + $this->assertCount( 6, $claim->get_actions() ); + $this->assertEqualSets( array_slice( $created_actions[ $unique_group_two ], 6, 6 ), $claim->get_actions() ); + + $store->release_claim( $claim ); + + /** Test Just One Hook with Group One */ + + $claim = $store->stake_claim( 10, null, array( $unique_hook_one ), $unique_group_one ); + $this->assertInstanceof( 'ActionScheduler_ActionClaim', $claim ); + $this->assertCount( 3, $claim->get_actions() ); + $this->assertEqualSets( array_slice( $created_actions_by_hook[ $unique_hook_one ][ $unique_group_one ], 3, 3 ), $claim->get_actions() ); + + $store->release_claim( $claim ); + + $claim = $store->stake_claim( 24, null, array( $unique_hook_two ), $unique_group_one ); + $this->assertInstanceof( 'ActionScheduler_ActionClaim', $claim ); + $this->assertCount( 3, $claim->get_actions() ); + $this->assertEqualSets( array_slice( $created_actions_by_hook[ $unique_hook_two ][ $unique_group_one ], 3, 3 ), $claim->get_actions() ); + + $store->release_claim( $claim ); + + /** Test Just One Hook with Group Two */ + + $claim = $store->stake_claim( 10, null, array( $unique_hook_one ), $unique_group_two ); + $this->assertInstanceof( 'ActionScheduler_ActionClaim', $claim ); + $this->assertCount( 3, $claim->get_actions() ); + $this->assertEqualSets( array_slice( $created_actions_by_hook[ $unique_hook_one ][ $unique_group_two ], 3, 3 ), $claim->get_actions() ); + + $store->release_claim( $claim ); + + $claim = $store->stake_claim( 24, null, array( $unique_hook_two ), $unique_group_two ); + $this->assertInstanceof( 'ActionScheduler_ActionClaim', $claim ); + $this->assertCount( 3, $claim->get_actions() ); + $this->assertEqualSets( array_slice( $created_actions_by_hook[ $unique_hook_two ][ $unique_group_two ], 3, 3 ), $claim->get_actions() ); + } + + /** + * The query used to claim actions explicitly ignores future pending actions, but it + * is still possible under unusual conditions (such as if MySQL runs out of temporary + * storage space) for such actions to be returned. + * + * When this happens, we still expect the store to filter them out, otherwise there is + * a risk that actions will be unexpectedly processed ahead of time. + * + * @see https://github.com/woocommerce/action-scheduler/issues/634 + */ + public function test_claim_filters_out_unexpected_future_actions() { + $group = __METHOD__; + $store = new ActionScheduler_DBStore(); + + // Create 4 actions: 2 that are already due (-3hrs and -1hrs) and 2 that are not yet due (+1hr and +3hrs). + for ( $i = -3; $i <= 3; $i += 2 ) { + $schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( $i . ' hours' ) ); + $action_ids[] = $store->save_action( new ActionScheduler_Action( 'test_' . $i, array(), $schedule, $group ) ); + } + + // This callback is used to simulate the unusual conditions whereby MySQL might unexpectedly return future + // actions, contrary to the conditions used by the store object when staking its claim. + $simulate_unexpected_db_behavior = function( $sql ) use ( $action_ids ) { + global $wpdb; + + // Look out for the claim update query, ignore all others. + if ( + 0 !== strpos( $sql, "UPDATE $wpdb->actionscheduler_actions" ) + || ! preg_match( "/claim_id = 0 AND scheduled_date_gmt <= '([0-9:\-\s]{19})'/", $sql, $matches ) + || count( $matches ) !== 2 + ) { + return $sql; + } + + // Now modify the query, forcing it to also return the future actions we created. + return str_replace( $matches[1], as_get_datetime_object( '+4 hours' )->format( 'Y-m-d H:i:s' ), $sql ); + }; + + add_filter( 'query', $simulate_unexpected_db_behavior ); + $claim = $store->stake_claim( 10, null, array(), $group ); + $claimed_actions = $claim->get_actions(); + $this->assertCount( 2, $claimed_actions ); + + // Cleanup. + remove_filter( 'query', $simulate_unexpected_db_behavior ); + $store->release_claim( $claim ); + } + + public function test_duplicate_claim() { + $created_actions = []; + $store = new ActionScheduler_DBStore(); + for ( $i = 0; $i > - 3; $i -- ) { + $time = as_get_datetime_object( $i . ' hours' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( 'my_hook', [ $i ], $schedule, 'my_group' ); + + $created_actions[] = $store->save_action( $action ); + } + + $claim1 = $store->stake_claim(); + $claim2 = $store->stake_claim(); + $this->assertCount( 3, $claim1->get_actions() ); + $this->assertCount( 0, $claim2->get_actions() ); + } + + public function test_release_claim() { + $created_actions = []; + $store = new ActionScheduler_DBStore(); + for ( $i = 0; $i > - 3; $i -- ) { + $time = as_get_datetime_object( $i . ' hours' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( 'my_hook', [ $i ], $schedule, 'my_group' ); + + $created_actions[] = $store->save_action( $action ); + } + + $claim1 = $store->stake_claim(); + + $store->release_claim( $claim1 ); + + $claim2 = $store->stake_claim(); + $this->assertCount( 3, $claim2->get_actions() ); + } + + public function test_search() { + $created_actions = []; + $store = new ActionScheduler_DBStore(); + for ( $i = - 3; $i <= 3; $i ++ ) { + $time = as_get_datetime_object( $i . ' hours' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( 'my_hook', [ $i ], $schedule, 'my_group' ); + + $created_actions[] = $store->save_action( $action ); + } + + $next_no_args = $store->find_action( 'my_hook' ); + $this->assertEquals( $created_actions[ 0 ], $next_no_args ); + + $next_with_args = $store->find_action( 'my_hook', [ 'args' => [ 1 ] ] ); + $this->assertEquals( $created_actions[ 4 ], $next_with_args ); + + $non_existent = $store->find_action( 'my_hook', [ 'args' => [ 17 ] ] ); + $this->assertNull( $non_existent ); + } + + public function test_search_by_group() { + $store = new ActionScheduler_DBStore(); + $schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( 'tomorrow' ) ); + + $abc = $store->save_action( new ActionScheduler_Action( 'my_hook', [ 1 ], $schedule, 'abc' ) ); + $def = $store->save_action( new ActionScheduler_Action( 'my_hook', [ 1 ], $schedule, 'def' ) ); + $ghi = $store->save_action( new ActionScheduler_Action( 'my_hook', [ 1 ], $schedule, 'ghi' ) ); + + $this->assertEquals( $abc, $store->find_action( 'my_hook', [ 'group' => 'abc' ] ) ); + $this->assertEquals( $def, $store->find_action( 'my_hook', [ 'group' => 'def' ] ) ); + $this->assertEquals( $ghi, $store->find_action( 'my_hook', [ 'group' => 'ghi' ] ) ); + } + + public function test_get_run_date() { + $time = as_get_datetime_object( '-10 minutes' ); + $schedule = new ActionScheduler_IntervalSchedule( $time, HOUR_IN_SECONDS ); + $action = new ActionScheduler_Action( 'my_hook', [], $schedule ); + $store = new ActionScheduler_DBStore(); + $action_id = $store->save_action( $action ); + + $this->assertEquals( $time->format( 'U' ), $store->get_date( $action_id )->format( 'U' ) ); + + $action = $store->fetch_action( $action_id ); + $action->execute(); + $now = as_get_datetime_object(); + $store->mark_complete( $action_id ); + + $this->assertEquals( $now->format( 'U' ), $store->get_date( $action_id )->format( 'U' ) ); + + $next = $action->get_schedule()->get_next( $now ); + $new_action_id = $store->save_action( $action, $next ); + + $this->assertEquals( (int) ( $now->format( 'U' ) ) + HOUR_IN_SECONDS, $store->get_date( $new_action_id )->format( 'U' ) ); + } + + public function test_get_status() { + $time = as_get_datetime_object('-10 minutes'); + $schedule = new ActionScheduler_IntervalSchedule($time, HOUR_IN_SECONDS); + $action = new ActionScheduler_Action('my_hook', array(), $schedule); + $store = new ActionScheduler_DBStore(); + $action_id = $store->save_action($action); + + $this->assertEquals( ActionScheduler_Store::STATUS_PENDING, $store->get_status( $action_id ) ); + + $store->mark_complete( $action_id ); + $this->assertEquals( ActionScheduler_Store::STATUS_COMPLETE, $store->get_status( $action_id ) ); + + $store->mark_failure( $action_id ); + $this->assertEquals( ActionScheduler_Store::STATUS_FAILED, $store->get_status( $action_id ) ); + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/jobstore/ActionScheduler_HybridStore_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/jobstore/ActionScheduler_HybridStore_Test.php new file mode 100644 index 00000000..c6b7fb08 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/jobstore/ActionScheduler_HybridStore_Test.php @@ -0,0 +1,273 @@ +init(); + } + update_option( ActionScheduler_HybridStore::DEMARKATION_OPTION, $this->demarkation_id ); + $hybrid = new ActionScheduler_HybridStore(); + $hybrid->set_autoincrement( '', ActionScheduler_StoreSchema::ACTIONS_TABLE ); + } + + public function tearDown() { + parent::tearDown(); + + // reset the autoincrement index + /** @var \wpdb $wpdb */ + global $wpdb; + $wpdb->query( "TRUNCATE TABLE {$wpdb->actionscheduler_actions}" ); + $wpdb->query( "TRUNCATE TABLE {$wpdb->actionscheduler_logs}" ); + delete_option( ActionScheduler_HybridStore::DEMARKATION_OPTION ); + } + + public function test_actions_are_migrated_on_find() { + $source_store = new PostStore(); + $destination_store = new ActionScheduler_DBStore(); + $source_logger = new CommentLogger(); + $destination_logger = new ActionScheduler_DBLogger(); + + $config = new Config(); + $config->set_source_store( $source_store ); + $config->set_source_logger( $source_logger ); + $config->set_destination_store( $destination_store ); + $config->set_destination_logger( $destination_logger ); + + $hybrid_store = new ActionScheduler_HybridStore( $config ); + + $time = as_get_datetime_object( '10 minutes ago' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( __FUNCTION__, [], $schedule ); + $source_id = $source_store->save_action( $action ); + + $found = $hybrid_store->find_action( __FUNCTION__, [] ); + + $this->assertNotEquals( $source_id, $found ); + $this->assertGreaterThanOrEqual( $this->demarkation_id, $found ); + + $found_in_source = $source_store->fetch_action( $source_id ); + $this->assertInstanceOf( NullAction::class, $found_in_source ); + } + + + public function test_actions_are_migrated_on_query() { + $source_store = new PostStore(); + $destination_store = new ActionScheduler_DBStore(); + $source_logger = new CommentLogger(); + $destination_logger = new ActionScheduler_DBLogger(); + + $config = new Config(); + $config->set_source_store( $source_store ); + $config->set_source_logger( $source_logger ); + $config->set_destination_store( $destination_store ); + $config->set_destination_logger( $destination_logger ); + + $hybrid_store = new ActionScheduler_HybridStore( $config ); + + $source_actions = []; + $destination_actions = []; + + for ( $i = 0; $i < 10; $i++ ) { + // create in instance in the source store + $time = as_get_datetime_object( ( $i * 10 + 1 ) . ' minutes' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( __FUNCTION__, [], $schedule ); + + $source_actions[] = $source_store->save_action( $action ); + + // create an instance in the destination store + $time = as_get_datetime_object( ( $i * 10 + 5 ) . ' minutes' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( __FUNCTION__, [], $schedule ); + + $destination_actions[] = $destination_store->save_action( $action ); + } + + $found = $hybrid_store->query_actions([ + 'hook' => __FUNCTION__, + 'per_page' => 6, + ] ); + + $this->assertCount( 6, $found ); + foreach ( $found as $key => $action_id ) { + $this->assertNotContains( $action_id, $source_actions ); + $this->assertGreaterThanOrEqual( $this->demarkation_id, $action_id ); + if ( $key % 2 == 0 ) { // it should have been in the source store + $this->assertNotContains( $action_id, $destination_actions ); + } else { // it should have already been in the destination store + $this->assertContains( $action_id, $destination_actions ); + } + } + + // six of the original 10 should have migrated to the new store + // even though only three were retrieve in the final query + $found_in_source = $source_store->query_actions( [ + 'hook' => __FUNCTION__, + 'per_page' => 10, + ] ); + $this->assertCount( 4, $found_in_source ); + } + + + public function test_actions_are_migrated_on_claim() { + $source_store = new PostStore(); + $destination_store = new ActionScheduler_DBStore(); + $source_logger = new CommentLogger(); + $destination_logger = new ActionScheduler_DBLogger(); + + $config = new Config(); + $config->set_source_store( $source_store ); + $config->set_source_logger( $source_logger ); + $config->set_destination_store( $destination_store ); + $config->set_destination_logger( $destination_logger ); + + $hybrid_store = new ActionScheduler_HybridStore( $config ); + + $source_actions = []; + $destination_actions = []; + + for ( $i = 0; $i < 10; $i++ ) { + // create in instance in the source store + $time = as_get_datetime_object( ( $i * 10 + 1 ) . ' minutes ago' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( __FUNCTION__, [], $schedule ); + + $source_actions[] = $source_store->save_action( $action ); + + // create an instance in the destination store + $time = as_get_datetime_object( ( $i * 10 + 5 ) . ' minutes ago' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( __FUNCTION__, [], $schedule ); + + $destination_actions[] = $destination_store->save_action( $action ); + } + + $claim = $hybrid_store->stake_claim( 6 ); + + $claimed_actions = $claim->get_actions(); + $this->assertCount( 6, $claimed_actions ); + $this->assertCount( 3, array_intersect( $destination_actions, $claimed_actions ) ); + + + // six of the original 10 should have migrated to the new store + // even though only three were retrieve in the final claim + $found_in_source = $source_store->query_actions( [ + 'hook' => __FUNCTION__, + 'per_page' => 10, + ] ); + $this->assertCount( 4, $found_in_source ); + + $this->assertEquals( 0, $source_store->get_claim_count() ); + $this->assertEquals( 1, $destination_store->get_claim_count() ); + $this->assertEquals( 1, $hybrid_store->get_claim_count() ); + + } + + public function test_fetch_respects_demarkation() { + $source_store = new PostStore(); + $destination_store = new ActionScheduler_DBStore(); + $source_logger = new CommentLogger(); + $destination_logger = new ActionScheduler_DBLogger(); + + $config = new Config(); + $config->set_source_store( $source_store ); + $config->set_source_logger( $source_logger ); + $config->set_destination_store( $destination_store ); + $config->set_destination_logger( $destination_logger ); + + $hybrid_store = new ActionScheduler_HybridStore( $config ); + + $source_actions = []; + $destination_actions = []; + + for ( $i = 0; $i < 2; $i++ ) { + // create in instance in the source store + $time = as_get_datetime_object( ( $i * 10 + 1 ) . ' minutes ago' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( __FUNCTION__, [], $schedule ); + + $source_actions[] = $source_store->save_action( $action ); + + // create an instance in the destination store + $time = as_get_datetime_object( ( $i * 10 + 5 ) . ' minutes ago' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( __FUNCTION__, [], $schedule ); + + $destination_actions[] = $destination_store->save_action( $action ); + } + + foreach ( $source_actions as $action_id ) { + $action = $hybrid_store->fetch_action( $action_id ); + $this->assertInstanceOf( ActionScheduler_Action::class, $action ); + $this->assertNotInstanceOf( NullAction::class, $action ); + } + + foreach ( $destination_actions as $action_id ) { + $action = $hybrid_store->fetch_action( $action_id ); + $this->assertInstanceOf( ActionScheduler_Action::class, $action ); + $this->assertNotInstanceOf( NullAction::class, $action ); + } + } + + public function test_mark_complete_respects_demarkation() { + $source_store = new PostStore(); + $destination_store = new ActionScheduler_DBStore(); + $source_logger = new CommentLogger(); + $destination_logger = new ActionScheduler_DBLogger(); + + $config = new Config(); + $config->set_source_store( $source_store ); + $config->set_source_logger( $source_logger ); + $config->set_destination_store( $destination_store ); + $config->set_destination_logger( $destination_logger ); + + $hybrid_store = new ActionScheduler_HybridStore( $config ); + + $source_actions = []; + $destination_actions = []; + + for ( $i = 0; $i < 2; $i++ ) { + // create in instance in the source store + $time = as_get_datetime_object( ( $i * 10 + 1 ) . ' minutes ago' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( __FUNCTION__, [], $schedule ); + + $source_actions[] = $source_store->save_action( $action ); + + // create an instance in the destination store + $time = as_get_datetime_object( ( $i * 10 + 5 ) . ' minutes ago' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( __FUNCTION__, [], $schedule ); + + $destination_actions[] = $destination_store->save_action( $action ); + } + + foreach ( $source_actions as $action_id ) { + $hybrid_store->mark_complete( $action_id ); + $action = $hybrid_store->fetch_action( $action_id ); + $this->assertInstanceOf( ActionScheduler_FinishedAction::class, $action ); + } + + foreach ( $destination_actions as $action_id ) { + $hybrid_store->mark_complete( $action_id ); + $action = $hybrid_store->fetch_action( $action_id ); + $this->assertInstanceOf( ActionScheduler_FinishedAction::class, $action ); + } + } +} \ No newline at end of file diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/jobstore/ActionScheduler_wpPostStore_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/jobstore/ActionScheduler_wpPostStore_Test.php new file mode 100644 index 00000000..c762df09 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/jobstore/ActionScheduler_wpPostStore_Test.php @@ -0,0 +1,466 @@ +save_action($action); + + $this->assertNotEmpty($action_id); + } + + public function test_create_action_with_scheduled_date() { + $time = as_get_datetime_object( strtotime( '-1 week' ) ); + $action = new ActionScheduler_Action( 'my_hook', array(), new ActionScheduler_SimpleSchedule( $time ) ); + $store = new ActionScheduler_wpPostStore(); + + $action_id = $store->save_action( $action, $time ); + $action_date = $store->get_date( $action_id ); + + $this->assertEquals( $time->getTimestamp(), $action_date->getTimestamp() ); + } + + public function test_retrieve_action() { + $time = as_get_datetime_object(); + $schedule = new ActionScheduler_SimpleSchedule($time); + $action = new ActionScheduler_Action('my_hook', array(), $schedule, 'my_group'); + $store = new ActionScheduler_wpPostStore(); + $action_id = $store->save_action($action); + + $retrieved = $store->fetch_action($action_id); + $this->assertEquals($action->get_hook(), $retrieved->get_hook()); + $this->assertEqualSets($action->get_args(), $retrieved->get_args()); + $this->assertEquals( $action->get_schedule()->get_date()->getTimestamp(), $retrieved->get_schedule()->get_date()->getTimestamp() ); + $this->assertEquals($action->get_group(), $retrieved->get_group()); + } + + /** + * @dataProvider provide_bad_args + * + * @param string $content + */ + public function test_action_bad_args( $content ) { + $store = new ActionScheduler_wpPostStore(); + $post_id = wp_insert_post( array( + 'post_type' => ActionScheduler_wpPostStore::POST_TYPE, + 'post_status' => ActionScheduler_Store::STATUS_PENDING, + 'post_content' => $content, + ) ); + + $fetched = $store->fetch_action( $post_id ); + $this->assertInstanceOf( 'ActionScheduler_NullSchedule', $fetched->get_schedule() ); + } + + public function provide_bad_args() { + return array( + array( '{"bad_json":true}}' ), + ); + } + + public function test_cancel_action() { + $time = as_get_datetime_object(); + $schedule = new ActionScheduler_SimpleSchedule($time); + $action = new ActionScheduler_Action('my_hook', array(), $schedule, 'my_group'); + $store = new ActionScheduler_wpPostStore(); + $action_id = $store->save_action($action); + $store->cancel_action( $action_id ); + + $fetched = $store->fetch_action( $action_id ); + $this->assertInstanceOf( 'ActionScheduler_CanceledAction', $fetched ); + } + + public function test_cancel_actions_by_hook() { + $store = new ActionScheduler_wpPostStore(); + $actions = array(); + $hook = 'by_hook_test'; + for ( $day = 1; $day <= 3; $day++ ) { + $delta = sprintf( '+%d day', $day ); + $time = as_get_datetime_object( $delta ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( $hook, array(), $schedule, 'my_group' ); + $actions[] = $store->save_action( $action ); + } + $store->cancel_actions_by_hook( $hook ); + + foreach ( $actions as $action_id ) { + $fetched = $store->fetch_action( $action_id ); + $this->assertInstanceOf( 'ActionScheduler_CanceledAction', $fetched ); + } + } + + public function test_cancel_actions_by_group() { + $store = new ActionScheduler_wpPostStore(); + $actions = array(); + $group = 'by_group_test'; + + for ( $day = 1; $day <= 3; $day++ ) { + $delta = sprintf( '+%d day', $day ); + $time = as_get_datetime_object( $delta ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( 'my_hook', array(), $schedule, $group ); + $actions[] = $store->save_action( $action ); + } + $store->cancel_actions_by_group( $group ); + + foreach ( $actions as $action_id ) { + $fetched = $store->fetch_action( $action_id ); + $this->assertInstanceOf( 'ActionScheduler_CanceledAction', $fetched ); + } + } + + public function test_claim_actions() { + $created_actions = array(); + $store = new ActionScheduler_wpPostStore(); + for ( $i = 3 ; $i > -3 ; $i-- ) { + $time = as_get_datetime_object($i.' hours'); + $schedule = new ActionScheduler_SimpleSchedule($time); + $action = new ActionScheduler_Action('my_hook', array($i), $schedule, 'my_group'); + $created_actions[] = $store->save_action($action); + } + + $claim = $store->stake_claim(); + $this->assertInstanceof( 'ActionScheduler_ActionClaim', $claim ); + + $this->assertCount( 3, $claim->get_actions() ); + $this->assertEqualSets( array_slice( $created_actions, 3, 3 ), $claim->get_actions() ); + } + + public function test_claim_actions_order() { + $store = new ActionScheduler_wpPostStore(); + $schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( '-1 hour' ) ); + $created_actions = array( + $store->save_action( new ActionScheduler_Action( 'my_hook', array( 1 ), $schedule, 'my_group' ) ), + $store->save_action( new ActionScheduler_Action( 'my_hook', array( 1 ), $schedule, 'my_group' ) ), + ); + + $claim = $store->stake_claim(); + $this->assertInstanceof( 'ActionScheduler_ActionClaim', $claim ); + + // Verify uniqueness of action IDs. + $this->assertEquals( 2, count( array_unique( $created_actions ) ) ); + + // Verify the count and order of the actions. + $claimed_actions = $claim->get_actions(); + $this->assertCount( 2, $claimed_actions ); + $this->assertEquals( $created_actions, $claimed_actions ); + + // Verify the reversed order doesn't pass. + $reversed_actions = array_reverse( $created_actions ); + $this->assertNotEquals( $reversed_actions, $claimed_actions ); + } + + public function test_duplicate_claim() { + $created_actions = array(); + $store = new ActionScheduler_wpPostStore(); + for ( $i = 0 ; $i > -3 ; $i-- ) { + $time = as_get_datetime_object($i.' hours'); + $schedule = new ActionScheduler_SimpleSchedule($time); + $action = new ActionScheduler_Action('my_hook', array($i), $schedule, 'my_group'); + $created_actions[] = $store->save_action($action); + } + + $claim1 = $store->stake_claim(); + $claim2 = $store->stake_claim(); + $this->assertCount( 3, $claim1->get_actions() ); + $this->assertCount( 0, $claim2->get_actions() ); + } + + public function test_release_claim() { + $created_actions = array(); + $store = new ActionScheduler_wpPostStore(); + for ( $i = 0 ; $i > -3 ; $i-- ) { + $time = as_get_datetime_object($i.' hours'); + $schedule = new ActionScheduler_SimpleSchedule($time); + $action = new ActionScheduler_Action('my_hook', array($i), $schedule, 'my_group'); + $created_actions[] = $store->save_action($action); + } + + $claim1 = $store->stake_claim(); + + $store->release_claim( $claim1 ); + + $claim2 = $store->stake_claim(); + $this->assertCount( 3, $claim2->get_actions() ); + } + + public function test_search() { + $created_actions = array(); + $store = new ActionScheduler_wpPostStore(); + for ( $i = -3 ; $i <= 3 ; $i++ ) { + $time = as_get_datetime_object($i.' hours'); + $schedule = new ActionScheduler_SimpleSchedule($time); + $action = new ActionScheduler_Action('my_hook', array($i), $schedule, 'my_group'); + $created_actions[] = $store->save_action($action); + } + + $next_no_args = $store->find_action( 'my_hook' ); + $this->assertEquals( $created_actions[0], $next_no_args ); + + $next_with_args = $store->find_action( 'my_hook', array( 'args' => array( 1 ) ) ); + $this->assertEquals( $created_actions[4], $next_with_args ); + + $non_existent = $store->find_action( 'my_hook', array( 'args' => array( 17 ) ) ); + $this->assertNull( $non_existent ); + } + + public function test_search_by_group() { + $store = new ActionScheduler_wpPostStore(); + $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('tomorrow')); + $abc = $store->save_action(new ActionScheduler_Action('my_hook', array(1), $schedule, 'abc')); + $def = $store->save_action(new ActionScheduler_Action('my_hook', array(1), $schedule, 'def')); + $ghi = $store->save_action(new ActionScheduler_Action('my_hook', array(1), $schedule, 'ghi')); + + $this->assertEquals( $abc, $store->find_action('my_hook', array('group' => 'abc'))); + $this->assertEquals( $def, $store->find_action('my_hook', array('group' => 'def'))); + $this->assertEquals( $ghi, $store->find_action('my_hook', array('group' => 'ghi'))); + } + + public function test_post_author() { + $current_user = get_current_user_id(); + + $time = as_get_datetime_object(); + $schedule = new ActionScheduler_SimpleSchedule($time); + $action = new ActionScheduler_Action('my_hook', array(), $schedule); + $store = new ActionScheduler_wpPostStore(); + $action_id = $store->save_action($action); + + $post = get_post($action_id); + $this->assertEquals(0, $post->post_author); + + $new_user = $this->factory->user->create_object(array( + 'user_login' => __FUNCTION__, + 'user_pass' => md5(rand()), + )); + wp_set_current_user( $new_user ); + + + $schedule = new ActionScheduler_SimpleSchedule($time); + $action = new ActionScheduler_Action('my_hook', array(), $schedule); + $action_id = $store->save_action($action); + $post = get_post($action_id); + $this->assertEquals(0, $post->post_author); + + wp_set_current_user($current_user); + } + + /** + * @issue 13 + */ + public function test_post_status_for_recurring_action() { + $time = as_get_datetime_object('10 minutes'); + $schedule = new ActionScheduler_IntervalSchedule($time, HOUR_IN_SECONDS); + $action = new ActionScheduler_Action('my_hook', array(), $schedule); + $store = new ActionScheduler_wpPostStore(); + $action_id = $store->save_action($action); + + $action = $store->fetch_action($action_id); + $action->execute(); + $store->mark_complete( $action_id ); + + $next = $action->get_schedule()->get_next( as_get_datetime_object() ); + $new_action_id = $store->save_action( $action, $next ); + + $this->assertEquals('publish', get_post_status($action_id)); + $this->assertEquals('pending', get_post_status($new_action_id)); + } + + public function test_get_run_date() { + $time = as_get_datetime_object('-10 minutes'); + $schedule = new ActionScheduler_IntervalSchedule($time, HOUR_IN_SECONDS); + $action = new ActionScheduler_Action('my_hook', array(), $schedule); + $store = new ActionScheduler_wpPostStore(); + $action_id = $store->save_action($action); + + $this->assertEquals( $store->get_date($action_id)->getTimestamp(), $time->getTimestamp() ); + + $action = $store->fetch_action($action_id); + $action->execute(); + $now = as_get_datetime_object(); + $store->mark_complete( $action_id ); + + $this->assertEquals( $store->get_date( $action_id )->getTimestamp(), $now->getTimestamp(), '', 1 ); // allow timestamp to be 1 second off for older versions of PHP + + $next = $action->get_schedule()->get_next( $now ); + $new_action_id = $store->save_action( $action, $next ); + + $this->assertEquals( (int)($now->getTimestamp()) + HOUR_IN_SECONDS, $store->get_date($new_action_id)->getTimestamp() ); + } + + public function test_get_status() { + $time = as_get_datetime_object('-10 minutes'); + $schedule = new ActionScheduler_IntervalSchedule($time, HOUR_IN_SECONDS); + $action = new ActionScheduler_Action('my_hook', array(), $schedule); + $store = new ActionScheduler_wpPostStore(); + $action_id = $store->save_action($action); + + $this->assertEquals( ActionScheduler_Store::STATUS_PENDING, $store->get_status( $action_id ) ); + + $store->mark_complete( $action_id ); + $this->assertEquals( ActionScheduler_Store::STATUS_COMPLETE, $store->get_status( $action_id ) ); + + $store->mark_failure( $action_id ); + $this->assertEquals( ActionScheduler_Store::STATUS_FAILED, $store->get_status( $action_id ) ); + } + + public function test_claim_actions_by_hooks() { + $hook1 = __FUNCTION__ . '_hook_1'; + $hook2 = __FUNCTION__ . '_hook_2'; + $store = new ActionScheduler_wpPostStore(); + $schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( '-1 hour' ) ); + + $action1 = $store->save_action( new ActionScheduler_Action( $hook1, array(), $schedule ) ); + $action2 = $store->save_action( new ActionScheduler_Action( $hook2, array(), $schedule ) ); + + // Claiming no hooks should include all actions. + $claim = $store->stake_claim( 10 ); + $this->assertEquals( 2, count( $claim->get_actions() ) ); + $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); + $this->assertTrue( in_array( $action2, $claim->get_actions() ) ); + $store->release_claim( $claim ); + + // Claiming a hook should claim only actions with that hook + $claim = $store->stake_claim( 10, null, array( $hook1 ) ); + $this->assertEquals( 1, count( $claim->get_actions() ) ); + $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); + $store->release_claim( $claim ); + + // Claiming two hooks should claim actions with either of those hooks + $claim = $store->stake_claim( 10, null, array( $hook1, $hook2 ) ); + $this->assertEquals( 2, count( $claim->get_actions() ) ); + $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); + $this->assertTrue( in_array( $action2, $claim->get_actions() ) ); + $store->release_claim( $claim ); + + // Claiming two hooks should claim actions with either of those hooks + $claim = $store->stake_claim( 10, null, array( __METHOD__ . '_hook_3' ) ); + $this->assertEquals( 0, count( $claim->get_actions() ) ); + $this->assertFalse( in_array( $action1, $claim->get_actions() ) ); + $this->assertFalse( in_array( $action2, $claim->get_actions() ) ); + $store->release_claim( $claim ); + } + + /** + * @issue 121 + */ + public function test_claim_actions_by_group() { + $group1 = md5( rand() ); + $store = new ActionScheduler_wpPostStore(); + $schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( '-1 hour' ) ); + + $action1 = $store->save_action( new ActionScheduler_Action( __METHOD__, array(), $schedule, $group1 ) ); + $action2 = $store->save_action( new ActionScheduler_Action( __METHOD__, array(), $schedule ) ); + + // Claiming no group should include all actions. + $claim = $store->stake_claim( 10 ); + $this->assertEquals( 2, count( $claim->get_actions() ) ); + $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); + $this->assertTrue( in_array( $action2, $claim->get_actions() ) ); + $store->release_claim( $claim ); + + // Claiming a group should claim only actions in that group. + $claim = $store->stake_claim( 10, null, array(), $group1 ); + $this->assertEquals( 1, count( $claim->get_actions() ) ); + $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); + $store->release_claim( $claim ); + } + + public function test_claim_actions_by_hook_and_group() { + $hook1 = __FUNCTION__ . '_hook_1'; + $hook2 = __FUNCTION__ . '_hook_2'; + $hook3 = __FUNCTION__ . '_hook_3'; + $group1 = 'group_' . md5( rand() ); + $group2 = 'group_' . md5( rand() ); + $store = new ActionScheduler_wpPostStore(); + $schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( '-1 hour' ) ); + + $action1 = $store->save_action( new ActionScheduler_Action( $hook1, array(), $schedule, $group1 ) ); + $action2 = $store->save_action( new ActionScheduler_Action( $hook2, array(), $schedule ) ); + $action3 = $store->save_action( new ActionScheduler_Action( $hook3, array(), $schedule, $group2 ) ); + + // Claiming no hooks or group should include all actions. + $claim = $store->stake_claim( 10 ); + $this->assertEquals( 3, count( $claim->get_actions() ) ); + $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); + $this->assertTrue( in_array( $action2, $claim->get_actions() ) ); + $store->release_claim( $claim ); + + // Claiming a group and hook should claim only actions in that group. + $claim = $store->stake_claim( 10, null, array( $hook1 ), $group1 ); + $this->assertEquals( 1, count( $claim->get_actions() ) ); + $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); + $store->release_claim( $claim ); + + // Claiming a group and hook should claim only actions with that hook in that group. + $claim = $store->stake_claim( 10, null, array( $hook2 ), $group1 ); + $this->assertEquals( 0, count( $claim->get_actions() ) ); + $this->assertFalse( in_array( $action1, $claim->get_actions() ) ); + $this->assertFalse( in_array( $action2, $claim->get_actions() ) ); + $store->release_claim( $claim ); + + // Claiming a group and hook should claim only actions with that hook in that group. + $claim = $store->stake_claim( 10, null, array( $hook1, $hook2 ), $group2 ); + $this->assertEquals( 0, count( $claim->get_actions() ) ); + $this->assertFalse( in_array( $action1, $claim->get_actions() ) ); + $this->assertFalse( in_array( $action2, $claim->get_actions() ) ); + $store->release_claim( $claim ); + } + + /** + * The query used to claim actions explicitly ignores future pending actions, but it + * is still possible under unusual conditions (such as if MySQL runs out of temporary + * storage space) for such actions to be returned. + * + * When this happens, we still expect the store to filter them out, otherwise there is + * a risk that actions will be unexpectedly processed ahead of time. + * + * @see https://github.com/woocommerce/action-scheduler/issues/634 + */ + public function test_claim_filters_out_unexpected_future_actions() { + $group = __METHOD__; + $store = new ActionScheduler_wpPostStore(); + + // Create 4 actions: 2 that are already due (-3hrs and -1hrs) and 2 that are not yet due (+1hr and +3hrs). + for ( $i = -3; $i <= 3; $i += 2 ) { + $schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( $i . ' hours' ) ); + $action_ids[] = $store->save_action( new ActionScheduler_Action( 'test_' . $i, array(), $schedule, $group ) ); + } + + // This callback is used to simulate the unusual conditions whereby MySQL might unexpectedly return future + // actions, contrary to the conditions used by the store object when staking its claim. + $simulate_unexpected_db_behavior = function( $sql ) use ( $action_ids ) { + global $wpdb; + + $post_type = ActionScheduler_wpPostStore::POST_TYPE; + $pending = ActionScheduler_wpPostStore::STATUS_PENDING; + + // Look out for the claim update query, ignore all others. + if ( + 0 !== strpos( $sql, "UPDATE $wpdb->posts" ) + || 0 !== strpos( $sql, "WHERE post_type = '$post_type' AND post_status = '$pending' AND post_password = ''" ) + || ! preg_match( "/AND post_date_gmt <= '([0-9:\-\s]{19})'/", $sql, $matches ) + || count( $matches ) !== 2 + ) { + return $sql; + } + + // Now modify the query, forcing it to also return the future actions we created. + return str_replace( $matches[1], as_get_datetime_object( '+4 hours' )->format( 'Y-m-d H:i:s' ), $sql ); + }; + + add_filter( 'query', $simulate_unexpected_db_behavior ); + $claim = $store->stake_claim( 10, null, array(), $group ); + $claimed_actions = $claim->get_actions(); + $this->assertCount( 2, $claimed_actions ); + + // Cleanup. + remove_filter( 'query', $simulate_unexpected_db_behavior ); + $store->release_claim( $claim ); + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/lock/ActionScheduler_OptionLock_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/lock/ActionScheduler_OptionLock_Test.php new file mode 100644 index 00000000..4ed6a23f --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/lock/ActionScheduler_OptionLock_Test.php @@ -0,0 +1,45 @@ +assertInstanceOf( 'ActionScheduler_Lock', $lock ); + $this->assertInstanceOf( 'ActionScheduler_OptionLock', $lock ); + } + + public function test_is_locked() { + $lock = ActionScheduler::lock(); + $lock_type = md5( rand() ); + + $this->assertFalse( $lock->is_locked( $lock_type ) ); + + $lock->set( $lock_type ); + $this->assertTrue( $lock->is_locked( $lock_type ) ); + } + + public function test_set() { + $lock = ActionScheduler::lock(); + $lock_type = md5( rand() ); + + $lock->set( $lock_type ); + $this->assertTrue( $lock->is_locked( $lock_type ) ); + } + + public function test_get_expiration() { + $lock = ActionScheduler::lock(); + $lock_type = md5( rand() ); + + $lock->set( $lock_type ); + + $expiration = $lock->get_expiration( $lock_type ); + $current_time = time(); + + $this->assertGreaterThanOrEqual( 0, $expiration ); + $this->assertGreaterThan( $current_time, $expiration ); + $this->assertLessThan( $current_time + MINUTE_IN_SECONDS + 1, $expiration ); + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/logging/ActionScheduler_DBLogger_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/logging/ActionScheduler_DBLogger_Test.php new file mode 100644 index 00000000..d9c26f01 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/logging/ActionScheduler_DBLogger_Test.php @@ -0,0 +1,132 @@ +assertInstanceOf( 'ActionScheduler_Logger', $logger ); + $this->assertInstanceOf( ActionScheduler_DBLogger::class, $logger ); + } + + public function test_add_log_entry() { + $action_id = as_schedule_single_action( time(), __METHOD__ ); + $logger = ActionScheduler::logger(); + $message = 'Logging that something happened'; + $log_id = $logger->log( $action_id, $message ); + $entry = $logger->get_entry( $log_id ); + + $this->assertEquals( $action_id, $entry->get_action_id() ); + $this->assertEquals( $message, $entry->get_message() ); + } + + public function test_storage_logs() { + $action_id = as_schedule_single_action( time(), __METHOD__ ); + $logger = ActionScheduler::logger(); + $logs = $logger->get_logs( $action_id ); + $expected = new ActionScheduler_LogEntry( $action_id, 'action created' ); + $this->assertCount( 1, $logs ); + $this->assertEquals( $expected->get_action_id(), $logs[0]->get_action_id() ); + $this->assertEquals( $expected->get_message(), $logs[0]->get_message() ); + } + + public function test_execution_logs() { + $action_id = as_schedule_single_action( time(), __METHOD__ ); + $logger = ActionScheduler::logger(); + $started = new ActionScheduler_LogEntry( $action_id, 'action started via Unit Tests' ); + $finished = new ActionScheduler_LogEntry( $action_id, 'action complete via Unit Tests' ); + + $runner = ActionScheduler_Mocker::get_queue_runner(); + $runner->run( 'Unit Tests' ); + + // Expect 3 logs with the correct action ID. + $logs = $logger->get_logs( $action_id ); + $this->assertCount( 3, $logs ); + foreach ( $logs as $log ) { + $this->assertEquals( $action_id, $log->get_action_id() ); + } + + // Expect created, then started, then completed. + $this->assertEquals( 'action created', $logs[0]->get_message() ); + $this->assertEquals( $started->get_message(), $logs[1]->get_message() ); + $this->assertEquals( $finished->get_message(), $logs[2]->get_message() ); + } + + public function test_failed_execution_logs() { + $hook = __METHOD__; + add_action( $hook, array( $this, '_a_hook_callback_that_throws_an_exception' ) ); + $action_id = as_schedule_single_action( time(), $hook ); + $logger = ActionScheduler::logger(); + $started = new ActionScheduler_LogEntry( $action_id, 'action started via Unit Tests' ); + $finished = new ActionScheduler_LogEntry( $action_id, 'action complete via Unit Tests' ); + $failed = new ActionScheduler_LogEntry( $action_id, 'action failed via Unit Tests: Execution failed' ); + + $runner = ActionScheduler_Mocker::get_queue_runner(); + $runner->run( 'Unit Tests' ); + + // Expect 3 logs with the correct action ID. + $logs = $logger->get_logs( $action_id ); + $this->assertCount( 3, $logs ); + foreach ( $logs as $log ) { + $this->assertEquals( $action_id, $log->get_action_id() ); + $this->assertNotEquals( $finished->get_message(), $log->get_message() ); + } + + // Expect created, then started, then failed. + $this->assertEquals( 'action created', $logs[0]->get_message() ); + $this->assertEquals( $started->get_message(), $logs[1]->get_message() ); + $this->assertEquals( $failed->get_message(), $logs[2]->get_message() ); + } + + public function test_fatal_error_log() { + $action_id = as_schedule_single_action( time(), __METHOD__ ); + $logger = ActionScheduler::logger(); + do_action( 'action_scheduler_unexpected_shutdown', $action_id, array( + 'type' => E_ERROR, + 'message' => 'Test error', + 'file' => __FILE__, + 'line' => __LINE__, + )); + + $logs = $logger->get_logs( $action_id ); + $found_log = FALSE; + foreach ( $logs as $l ) { + if ( strpos( $l->get_message(), 'unexpected shutdown' ) === 0 ) { + $found_log = TRUE; + } + } + $this->assertTrue( $found_log, 'Unexpected shutdown log not found' ); + } + + public function test_canceled_action_log() { + $action_id = as_schedule_single_action( time(), __METHOD__ ); + as_unschedule_action( __METHOD__ ); + $logger = ActionScheduler::logger(); + $logs = $logger->get_logs( $action_id ); + $expected = new ActionScheduler_LogEntry( $action_id, 'action canceled' ); + $this->assertEquals( $expected->get_message(), end( $logs )->get_message() ); + } + + public function test_deleted_action_cleanup() { + $time = as_get_datetime_object('-10 minutes'); + $schedule = new \ActionScheduler_SimpleSchedule($time); + $action = new \ActionScheduler_Action('my_hook', array(), $schedule); + $store = new ActionScheduler_DBStore(); + $action_id = $store->save_action($action); + + $logger = new ActionScheduler_DBLogger(); + $logs = $logger->get_logs( $action_id ); + $this->assertNotEmpty( $logs ); + + $store->delete_action( $action_id ); + $logs = $logger->get_logs( $action_id ); + $this->assertEmpty( $logs ); + } + + public function _a_hook_callback_that_throws_an_exception() { + throw new \RuntimeException('Execution failed'); + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/logging/ActionScheduler_wpCommentLogger_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/logging/ActionScheduler_wpCommentLogger_Test.php new file mode 100644 index 00000000..2c124453 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/logging/ActionScheduler_wpCommentLogger_Test.php @@ -0,0 +1,212 @@ +assertInstanceOf( 'ActionScheduler_Logger', $logger ); + if ( $this->using_comment_logger() ) { + $this->assertInstanceOf( 'ActionScheduler_wpCommentLogger', $logger ); + } else { + $this->assertNotInstanceOf( 'ActionScheduler_wpCommentLogger', $logger ); + } + } + + public function test_add_log_entry() { + $action_id = as_schedule_single_action( time(), 'a hook' ); + $logger = ActionScheduler::logger(); + $message = 'Logging that something happened'; + $log_id = $logger->log( $action_id, $message ); + $entry = $logger->get_entry( $log_id ); + + $this->assertEquals( $action_id, $entry->get_action_id() ); + $this->assertEquals( $message, $entry->get_message() ); + } + + public function test_add_log_datetime() { + $action_id = as_schedule_single_action( time(), 'a hook' ); + $logger = ActionScheduler::logger(); + $message = 'Logging that something happened'; + $date = new DateTime( 'now', new DateTimeZone( 'UTC' ) ); + $log_id = $logger->log( $action_id, $message, $date ); + $entry = $logger->get_entry( $log_id ); + + $this->assertEquals( $action_id, $entry->get_action_id() ); + $this->assertEquals( $message, $entry->get_message() ); + + $date = new ActionScheduler_DateTime( 'now', new DateTimeZone( 'UTC' ) ); + $log_id = $logger->log( $action_id, $message, $date ); + $entry = $logger->get_entry( $log_id ); + + $this->assertEquals( $action_id, $entry->get_action_id() ); + $this->assertEquals( $message, $entry->get_message() ); + } + + public function test_erroneous_entry_id() { + $comment = wp_insert_comment(array( + 'comment_post_ID' => 1, + 'comment_author' => 'test', + 'comment_content' => 'this is not a log entry', + )); + $logger = ActionScheduler::logger(); + $entry = $logger->get_entry( $comment ); + $this->assertEquals( '', $entry->get_action_id() ); + $this->assertEquals( '', $entry->get_message() ); + } + + public function test_storage_comments() { + $action_id = as_schedule_single_action( time(), 'a hook' ); + $logger = ActionScheduler::logger(); + $logs = $logger->get_logs( $action_id ); + $expected = new ActionScheduler_LogEntry( $action_id, 'action created' ); + $this->assertTrue( in_array( $this->log_entry_to_array( $expected ) , $this->log_entry_to_array( $logs ) ) ); + } + + protected function log_entry_to_array( $logs ) { + if ( $logs instanceof ActionScheduler_LogEntry ) { + return array( 'action_id' => $logs->get_action_id(), 'message' => $logs->get_message() ); + } + + foreach ( $logs as $id => $log) { + $logs[ $id ] = array( 'action_id' => $log->get_action_id(), 'message' => $log->get_message() ); + } + + return $logs; + } + + public function test_execution_comments() { + $action_id = as_schedule_single_action( time(), 'a hook' ); + $logger = ActionScheduler::logger(); + $started = new ActionScheduler_LogEntry( $action_id, 'action started via Unit Tests' ); + $finished = new ActionScheduler_LogEntry( $action_id, 'action complete via Unit Tests' ); + + $runner = ActionScheduler_Mocker::get_queue_runner(); + $runner->run( 'Unit Tests' ); + + $logs = $logger->get_logs( $action_id ); + $this->assertTrue( in_array( $this->log_entry_to_array( $started ), $this->log_entry_to_array( $logs ) ) ); + $this->assertTrue( in_array( $this->log_entry_to_array( $finished ), $this->log_entry_to_array( $logs ) ) ); + } + + public function test_failed_execution_comments() { + $hook = md5(rand()); + add_action( $hook, array( $this, '_a_hook_callback_that_throws_an_exception' ) ); + $action_id = as_schedule_single_action( time(), $hook ); + $logger = ActionScheduler::logger(); + $started = new ActionScheduler_LogEntry( $action_id, 'action started via Unit Tests' ); + $finished = new ActionScheduler_LogEntry( $action_id, 'action complete via Unit Tests' ); + $failed = new ActionScheduler_LogEntry( $action_id, 'action failed via Unit Tests: Execution failed' ); + + $runner = ActionScheduler_Mocker::get_queue_runner(); + $runner->run( 'Unit Tests' ); + + $logs = $logger->get_logs( $action_id ); + $this->assertTrue( in_array( $this->log_entry_to_array( $started ), $this->log_entry_to_array( $logs ) ) ); + $this->assertFalse( in_array( $this->log_entry_to_array( $finished ), $this->log_entry_to_array( $logs ) ) ); + $this->assertTrue( in_array( $this->log_entry_to_array( $failed ), $this->log_entry_to_array( $logs ) ) ); + } + + public function test_failed_schedule_next_instance_comments() { + $action_id = rand(); + $logger = ActionScheduler::logger(); + $log_entry = new ActionScheduler_LogEntry( $action_id, 'There was a failure scheduling the next instance of this action: Execution failed' ); + + try { + $this->_a_hook_callback_that_throws_an_exception(); + } catch ( Exception $e ) { + do_action( 'action_scheduler_failed_to_schedule_next_instance', $action_id, $e, new ActionScheduler_Action('my_hook') ); + } + + $logs = $logger->get_logs( $action_id ); + $this->assertTrue( in_array( $this->log_entry_to_array( $log_entry ), $this->log_entry_to_array( $logs ) ) ); + } + + public function test_fatal_error_comments() { + $hook = md5(rand()); + $action_id = as_schedule_single_action( time(), $hook ); + $logger = ActionScheduler::logger(); + do_action( 'action_scheduler_unexpected_shutdown', $action_id, array( + 'type' => E_ERROR, + 'message' => 'Test error', + 'file' => __FILE__, + 'line' => __LINE__, + )); + + $logs = $logger->get_logs( $action_id ); + $found_log = FALSE; + foreach ( $logs as $l ) { + if ( strpos( $l->get_message(), 'unexpected shutdown' ) === 0 ) { + $found_log = TRUE; + } + } + $this->assertTrue( $found_log, 'Unexpected shutdown log not found' ); + } + + public function test_canceled_action_comments() { + $action_id = as_schedule_single_action( time(), 'a hook' ); + as_unschedule_action( 'a hook' ); + $logger = ActionScheduler::logger(); + $logs = $logger->get_logs( $action_id ); + $expected = new ActionScheduler_LogEntry( $action_id, 'action canceled' ); + $this->assertTrue( in_array( $this->log_entry_to_array( $expected ), $this->log_entry_to_array( $logs ) ) ); + } + + public function _a_hook_callback_that_throws_an_exception() { + throw new RuntimeException('Execution failed'); + } + + public function test_filtering_of_get_comments() { + if ( ! $this->using_comment_logger() ) { + $this->assertTrue( true ); + return; + } + + $post_id = $this->factory->post->create_object(array( + 'post_title' => __FUNCTION__, + )); + $comment_id = $this->factory->comment->create_object(array( + 'comment_post_ID' => $post_id, + 'comment_author' => __CLASS__, + 'comment_content' => __FUNCTION__, + )); + + // Verify that we're getting the expected comment before we add logging comments + $comments = get_comments(); + $this->assertCount( 1, $comments ); + $this->assertEquals( $comment_id, $comments[0]->comment_ID ); + + + $action_id = as_schedule_single_action( time(), 'a hook' ); + $logger = ActionScheduler::logger(); + $message = 'Logging that something happened'; + $log_id = $logger->log( $action_id, $message ); + + + // Verify that logging comments are excluded from general comment queries + $comments = get_comments(); + $this->assertCount( 1, $comments ); + $this->assertEquals( $comment_id, $comments[0]->comment_ID ); + + // Verify that logging comments are returned when asking for them specifically + $comments = get_comments(array( + 'type' => ActionScheduler_wpCommentLogger::TYPE, + )); + // Expecting two: one when the action is created, another when we added our custom log + $this->assertCount( 2, $comments ); + $this->assertContains( $log_id, wp_list_pluck($comments, 'comment_ID')); + } + + private function using_comment_logger() { + if ( null === $this->use_comment_logger ) { + $this->use_comment_logger = ! ActionScheduler_DataController::dependencies_met(); + } + + return $this->use_comment_logger; + } +} + diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/migration/ActionMigrator_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/migration/ActionMigrator_Test.php new file mode 100644 index 00000000..44a5c585 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/migration/ActionMigrator_Test.php @@ -0,0 +1,145 @@ +init(); + } + } + + public function test_migrate_from_wpPost_to_db() { + $source = new ActionScheduler_wpPostStore(); + $destination = new ActionScheduler_DBStore(); + $migrator = new ActionMigrator( $source, $destination, $this->get_log_migrator() ); + + $time = as_get_datetime_object(); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( 'my_hook', [], $schedule, 'my_group' ); + $action_id = $source->save_action( $action ); + + $new_id = $migrator->migrate( $action_id ); + + // ensure we get the same record out of the new store as we stored in the old + $retrieved = $destination->fetch_action( $new_id ); + $this->assertEquals( $action->get_hook(), $retrieved->get_hook() ); + $this->assertEqualSets( $action->get_args(), $retrieved->get_args() ); + $this->assertEquals( $action->get_schedule()->get_date()->format( 'U' ), $retrieved->get_schedule()->get_date()->format( 'U' ) ); + $this->assertEquals( $action->get_group(), $retrieved->get_group() ); + $this->assertEquals( \ActionScheduler_Store::STATUS_PENDING, $destination->get_status( $new_id ) ); + + + // ensure that the record in the old store does not exist + $old_action = $source->fetch_action( $action_id ); + $this->assertInstanceOf( 'ActionScheduler_NullAction', $old_action ); + } + + public function test_does_not_migrate_missing_action_from_wpPost_to_db() { + $source = new ActionScheduler_wpPostStore(); + $destination = new ActionScheduler_DBStore(); + $migrator = new ActionMigrator( $source, $destination, $this->get_log_migrator() ); + + $action_id = rand( 100, 100000 ); + + $new_id = $migrator->migrate( $action_id ); + $this->assertEquals( 0, $new_id ); + + // ensure we get the same record out of the new store as we stored in the old + $retrieved = $destination->fetch_action( $new_id ); + $this->assertInstanceOf( 'ActionScheduler_NullAction', $retrieved ); + } + + public function test_migrate_completed_action_from_wpPost_to_db() { + $source = new ActionScheduler_wpPostStore(); + $destination = new ActionScheduler_DBStore(); + $migrator = new ActionMigrator( $source, $destination, $this->get_log_migrator() ); + + $time = as_get_datetime_object(); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( 'my_hook', [], $schedule, 'my_group' ); + $action_id = $source->save_action( $action ); + $source->mark_complete( $action_id ); + + $new_id = $migrator->migrate( $action_id ); + + // ensure we get the same record out of the new store as we stored in the old + $retrieved = $destination->fetch_action( $new_id ); + $this->assertEquals( $action->get_hook(), $retrieved->get_hook() ); + $this->assertEqualSets( $action->get_args(), $retrieved->get_args() ); + $this->assertEquals( $action->get_schedule()->get_date()->format( 'U' ), $retrieved->get_schedule()->get_date()->format( 'U' ) ); + $this->assertEquals( $action->get_group(), $retrieved->get_group() ); + $this->assertTrue( $retrieved->is_finished() ); + $this->assertEquals( \ActionScheduler_Store::STATUS_COMPLETE, $destination->get_status( $new_id ) ); + + // ensure that the record in the old store does not exist + $old_action = $source->fetch_action( $action_id ); + $this->assertInstanceOf( 'ActionScheduler_NullAction', $old_action ); + } + + public function test_migrate_failed_action_from_wpPost_to_db() { + $source = new ActionScheduler_wpPostStore(); + $destination = new ActionScheduler_DBStore(); + $migrator = new ActionMigrator( $source, $destination, $this->get_log_migrator() ); + + $time = as_get_datetime_object(); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( 'my_hook', [], $schedule, 'my_group' ); + $action_id = $source->save_action( $action ); + $source->mark_failure( $action_id ); + + $new_id = $migrator->migrate( $action_id ); + + // ensure we get the same record out of the new store as we stored in the old + $retrieved = $destination->fetch_action( $new_id ); + $this->assertEquals( $action->get_hook(), $retrieved->get_hook() ); + $this->assertEqualSets( $action->get_args(), $retrieved->get_args() ); + $this->assertEquals( $action->get_schedule()->get_date()->format( 'U' ), $retrieved->get_schedule()->get_date()->format( 'U' ) ); + $this->assertEquals( $action->get_group(), $retrieved->get_group() ); + $this->assertTrue( $retrieved->is_finished() ); + $this->assertEquals( \ActionScheduler_Store::STATUS_FAILED, $destination->get_status( $new_id ) ); + + // ensure that the record in the old store does not exist + $old_action = $source->fetch_action( $action_id ); + $this->assertInstanceOf( 'ActionScheduler_NullAction', $old_action ); + } + + public function test_migrate_canceled_action_from_wpPost_to_db() { + $source = new ActionScheduler_wpPostStore(); + $destination = new ActionScheduler_DBStore(); + $migrator = new ActionMigrator( $source, $destination, $this->get_log_migrator() ); + + $time = as_get_datetime_object(); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( 'my_hook', [], $schedule, 'my_group' ); + $action_id = $source->save_action( $action ); + $source->cancel_action( $action_id ); + + $new_id = $migrator->migrate( $action_id ); + + // ensure we get the same record out of the new store as we stored in the old + $retrieved = $destination->fetch_action( $new_id ); + $this->assertEquals( $action->get_hook(), $retrieved->get_hook() ); + $this->assertEqualSets( $action->get_args(), $retrieved->get_args() ); + $this->assertEquals( $action->get_schedule()->get_date()->format( 'U' ), $retrieved->get_schedule()->get_date()->format( 'U' ) ); + $this->assertEquals( $action->get_group(), $retrieved->get_group() ); + $this->assertTrue( $retrieved->is_finished() ); + $this->assertEquals( \ActionScheduler_Store::STATUS_CANCELED, $destination->get_status( $new_id ) ); + + // ensure that the record in the old store does not exist + $old_action = $source->fetch_action( $action_id ); + $this->assertInstanceOf( 'ActionScheduler_NullAction', $old_action ); + } + + private function get_log_migrator() { + return new LogMigrator( \ActionScheduler::logger(), new ActionScheduler_DBLogger() ); + } +} \ No newline at end of file diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/migration/BatchFetcher_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/migration/BatchFetcher_Test.php new file mode 100644 index 00000000..0a742334 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/migration/BatchFetcher_Test.php @@ -0,0 +1,76 @@ +init(); + } + } + + public function test_nothing_to_migrate() { + $store = new PostStore(); + $batch_fetcher = new BatchFetcher( $store ); + + $actions = $batch_fetcher->fetch(); + $this->assertEmpty( $actions ); + } + + public function test_get_due_before_future() { + $store = new PostStore(); + $due = []; + $future = []; + + for ( $i = 0; $i < 5; $i ++ ) { + $time = as_get_datetime_object( $i + 1 . ' minutes' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( 'my_hook', [], $schedule ); + $future[] = $store->save_action( $action ); + + $time = as_get_datetime_object( $i + 1 . ' minutes ago' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( 'my_hook', [], $schedule ); + $due[] = $store->save_action( $action ); + } + + $batch_fetcher = new BatchFetcher( $store ); + + $actions = $batch_fetcher->fetch(); + + $this->assertEqualSets( $due, $actions ); + } + + + public function test_get_future_before_complete() { + $store = new PostStore(); + $future = []; + $complete = []; + + for ( $i = 0; $i < 5; $i ++ ) { + $time = as_get_datetime_object( $i + 1 . ' minutes' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( 'my_hook', [], $schedule ); + $future[] = $store->save_action( $action ); + + $time = as_get_datetime_object( $i + 1 . ' minutes ago' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_FinishedAction( 'my_hook', [], $schedule ); + $complete[] = $store->save_action( $action ); + } + + $batch_fetcher = new BatchFetcher( $store ); + + $actions = $batch_fetcher->fetch(); + + $this->assertEqualSets( $future, $actions ); + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/migration/Config_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/migration/Config_Test.php new file mode 100644 index 00000000..054ff730 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/migration/Config_Test.php @@ -0,0 +1,33 @@ +expectException( \RuntimeException::class ); + $config->get_source_store(); + } + + public function test_source_logger_required() { + $config = new Config(); + $this->expectException( \RuntimeException::class ); + $config->get_source_logger(); + } + + public function test_destination_store_required() { + $config = new Config(); + $this->expectException( \RuntimeException::class ); + $config->get_destination_store(); + } + + public function test_destination_logger_required() { + $config = new Config(); + $this->expectException( \RuntimeException::class ); + $config->get_destination_logger(); + } +} \ No newline at end of file diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/migration/LogMigrator_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/migration/LogMigrator_Test.php new file mode 100644 index 00000000..2b4d3ab6 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/migration/LogMigrator_Test.php @@ -0,0 +1,44 @@ +init(); + } + } + + public function test_migrate_from_wpComment_to_db() { + $source = new ActionScheduler_wpCommentLogger(); + $destination = new ActionScheduler_DBLogger(); + $migrator = new LogMigrator( $source, $destination ); + $source_action_id = rand( 10, 10000 ); + $destination_action_id = rand( 10, 10000 ); + + $logs = []; + for ( $i = 0 ; $i < 3 ; $i++ ) { + for ( $j = 0 ; $j < 5 ; $j++ ) { + $logs[ $i ][ $j ] = md5(rand()); + if ( $i == 1 ) { + $source->log( $source_action_id, $logs[ $i ][ $j ] ); + } + } + } + + $migrator->migrate( $source_action_id, $destination_action_id ); + + $migrated = $destination->get_logs( $destination_action_id ); + $this->assertEqualSets( $logs[ 1 ], array_map( function( $log ) { return $log->get_message(); }, $migrated ) ); + + // no API for deleting logs, so we leave them for manual cleanup later + $this->assertCount( 5, $source->get_logs( $source_action_id ) ); + } +} \ No newline at end of file diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/migration/Runner_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/migration/Runner_Test.php new file mode 100644 index 00000000..2e6c0bbb --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/migration/Runner_Test.php @@ -0,0 +1,92 @@ +init(); + } + } + + public function test_migrate_batches() { + $source_store = new PostStore(); + $destination_store = new ActionScheduler_DBStore(); + $source_logger = new CommentLogger(); + $destination_logger = new ActionScheduler_DBLogger(); + + $config = new Config(); + $config->set_source_store( $source_store ); + $config->set_source_logger( $source_logger ); + $config->set_destination_store( $destination_store ); + $config->set_destination_logger( $destination_logger ); + + $runner = new Runner( $config ); + + $due = []; + $future = []; + $complete = []; + + for ( $i = 0; $i < 5; $i ++ ) { + $time = as_get_datetime_object( $i + 1 . ' minutes' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( 'my_hook', [], $schedule ); + $future[] = $source_store->save_action( $action ); + + $time = as_get_datetime_object( $i + 1 . ' minutes ago' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( 'my_hook', [], $schedule ); + $due[] = $source_store->save_action( $action ); + + $time = as_get_datetime_object( $i + 1 . ' minutes ago' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_FinishedAction( 'my_hook', [], $schedule ); + $complete[] = $source_store->save_action( $action ); + } + + $created = $source_store->query_actions( [ 'per_page' => 0 ] ); + $this->assertCount( 15, $created ); + + $runner->run( 10 ); + + // due actions should migrate in the first batch + $migrated = $destination_store->query_actions( [ 'per_page' => 0, 'hook' => 'my_hook' ] ); + $this->assertCount( 5, $migrated ); + + $remaining = $source_store->query_actions( [ 'per_page' => 0, 'hook' => 'my_hook' ] ); + $this->assertCount( 10, $remaining ); + + + $runner->run( 10 ); + + // pending actions should migrate in the second batch + $migrated = $destination_store->query_actions( [ 'per_page' => 0, 'hook' => 'my_hook' ] ); + $this->assertCount( 10, $migrated ); + + $remaining = $source_store->query_actions( [ 'per_page' => 0, 'hook' => 'my_hook' ] ); + $this->assertCount( 5, $remaining ); + + + $runner->run( 10 ); + + // completed actions should migrate in the third batch + $migrated = $destination_store->query_actions( [ 'per_page' => 0, 'hook' => 'my_hook' ] ); + $this->assertCount( 15, $migrated ); + + $remaining = $source_store->query_actions( [ 'per_page' => 0, 'hook' => 'my_hook' ] ); + $this->assertCount( 0, $remaining ); + + } + +} \ No newline at end of file diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/migration/Scheduler_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/migration/Scheduler_Test.php new file mode 100644 index 00000000..8a7b4a22 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/migration/Scheduler_Test.php @@ -0,0 +1,130 @@ +init(); + } + } + + public function test_migration_is_complete() { + ActionScheduler_DataController::mark_migration_complete(); + $this->assertTrue( ActionScheduler_DataController::is_migration_complete() ); + } + + public function test_migration_is_not_complete() { + $this->assertFalse( ActionScheduler_DataController::is_migration_complete() ); + update_option( ActionScheduler_DataController::STATUS_FLAG, 'something_random' ); + $this->assertFalse( ActionScheduler_DataController::is_migration_complete() ); + } + + public function test_migration_is_scheduled() { + // Clear the any existing migration hooks that have already been setup. + as_unschedule_all_actions( Scheduler::HOOK ); + + $scheduler = new Scheduler(); + $this->assertFalse( + $scheduler->is_migration_scheduled(), + 'Migration is not automatically scheduled when a new ' . Scheduler::class . ' instance is created.' + ); + + $scheduler->schedule_migration(); + $this->assertTrue( + $scheduler->is_migration_scheduled(), + 'Migration is scheduled only after schedule_migration() has been called.' + ); + } + + public function test_scheduler_runs_migration() { + $source_store = new PostStore(); + $destination_store = new ActionScheduler_DBStore(); + + $return_5 = function () { + return 5; + }; + add_filter( 'action_scheduler/migration_batch_size', $return_5 ); + + // Make sure successive migration actions are delayed so all actions aren't migrated at once on separate hooks + $return_60 = function () { + return 60; + }; + add_filter( 'action_scheduler/migration_interval', $return_60 ); + + for ( $i = 0; $i < 10; $i ++ ) { + $time = as_get_datetime_object( $i + 1 . ' minutes' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( 'my_hook', [], $schedule ); + $future[] = $source_store->save_action( $action ); + + $time = as_get_datetime_object( $i + 1 . ' minutes ago' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( 'my_hook', [], $schedule ); + $due[] = $source_store->save_action( $action ); + } + + $this->assertCount( 20, $source_store->query_actions( [ 'per_page' => 0 ] ) ); + + $scheduler = new Scheduler(); + $scheduler->unschedule_migration(); + $scheduler->schedule_migration( time() - 1 ); + + $queue_runner = ActionScheduler_Mocker::get_queue_runner( $destination_store ); + $queue_runner->run(); + + // 5 actions should have moved from the source store when the queue runner triggered the migration action + $this->assertCount( 15, $source_store->query_actions( [ 'per_page' => 0, 'hook' => 'my_hook' ] ) ); + + remove_filter( 'action_scheduler/migration_batch_size', $return_5 ); + remove_filter( 'action_scheduler/migration_interval', $return_60 ); + } + + public function test_scheduler_marks_itself_complete() { + $source_store = new PostStore(); + $destination_store = new ActionScheduler_DBStore(); + + for ( $i = 0; $i < 5; $i ++ ) { + $time = as_get_datetime_object( $i + 1 . ' minutes ago' ); + $schedule = new ActionScheduler_SimpleSchedule( $time ); + $action = new ActionScheduler_Action( 'my_hook', [], $schedule ); + $due[] = $source_store->save_action( $action ); + } + + $this->assertCount( 5, $source_store->query_actions( [ 'per_page' => 0 ] ) ); + + $scheduler = new Scheduler(); + $scheduler->unschedule_migration(); + $scheduler->schedule_migration( time() - 1 ); + + $queue_runner = ActionScheduler_Mocker::get_queue_runner( $destination_store ); + $queue_runner->run(); + + // All actions should have moved from the source store when the queue runner triggered the migration action + $this->assertCount( 0, $source_store->query_actions( [ 'per_page' => 0, 'hook' => 'my_hook' ] ) ); + + // schedule another so we can get it to run immediately + $scheduler->unschedule_migration(); + $scheduler->schedule_migration( time() - 1 ); + + // run again so it knows that there's nothing left to process + $queue_runner->run(); + + $scheduler->unhook(); + + // ensure the flag is set marking migration as complete + $this->assertTrue( ActionScheduler_DataController::is_migration_complete() ); + + // ensure that another instance has not been scheduled + $this->assertFalse( $scheduler->is_migration_scheduled() ); + + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/procedural_api/procedural_api_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/procedural_api/procedural_api_Test.php new file mode 100644 index 00000000..ffa5186d --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/procedural_api/procedural_api_Test.php @@ -0,0 +1,259 @@ +fetch_action($action_id); + $this->assertEquals( $time, $action->get_schedule()->get_date()->getTimestamp() ); + $this->assertEquals( $hook, $action->get_hook() ); + } + + public function test_recurring_action() { + $time = time(); + $hook = md5(rand()); + $action_id = as_schedule_recurring_action( $time, HOUR_IN_SECONDS, $hook ); + + $store = ActionScheduler::store(); + $action = $store->fetch_action($action_id); + $this->assertEquals( $time, $action->get_schedule()->get_date()->getTimestamp() ); + $this->assertEquals( $time + HOUR_IN_SECONDS + 2, $action->get_schedule()->get_next(as_get_datetime_object($time + 2))->getTimestamp()); + $this->assertEquals( $hook, $action->get_hook() ); + } + + public function test_cron_schedule() { + $time = as_get_datetime_object('2014-01-01'); + $hook = md5(rand()); + $action_id = as_schedule_cron_action( $time->getTimestamp(), '0 0 10 10 *', $hook ); + + $store = ActionScheduler::store(); + $action = $store->fetch_action($action_id); + $expected_date = as_get_datetime_object('2014-10-10'); + $this->assertEquals( $expected_date->getTimestamp(), $action->get_schedule()->get_date()->getTimestamp() ); + $this->assertEquals( $hook, $action->get_hook() ); + + $expected_date = as_get_datetime_object( '2015-10-10' ); + $this->assertEquals( $expected_date->getTimestamp(), $action->get_schedule()->get_next( as_get_datetime_object( '2015-01-02' ) )->getTimestamp() ); + } + + public function test_get_next() { + $time = as_get_datetime_object('tomorrow'); + $hook = md5(rand()); + as_schedule_recurring_action( $time->getTimestamp(), HOUR_IN_SECONDS, $hook ); + + $next = as_next_scheduled_action( $hook ); + + $this->assertEquals( $time->getTimestamp(), $next ); + } + + public function test_get_next_async() { + $hook = md5(rand()); + $action_id = as_enqueue_async_action( $hook ); + + $next = as_next_scheduled_action( $hook ); + + $this->assertTrue( $next ); + + $store = ActionScheduler::store(); + + // Completed async actions should still return false + $store->mark_complete( $action_id ); + $next = as_next_scheduled_action( $hook ); + $this->assertFalse( $next ); + + // Failed async actions should still return false + $store->mark_failure( $action_id ); + $next = as_next_scheduled_action( $hook ); + $this->assertFalse( $next ); + + // Cancelled async actions should still return false + $store->cancel_action( $action_id ); + $next = as_next_scheduled_action( $hook ); + $this->assertFalse( $next ); + } + + public function provider_time_hook_args_group() { + $time = time() + 60 * 2; + $hook = md5( rand() ); + $args = array( rand(), rand() ); + $group = 'test_group'; + + return array( + + // Test with no args or group + array( + 'time' => $time, + 'hook' => $hook, + 'args' => array(), + 'group' => '', + ), + + // Test with args but no group + array( + 'time' => $time, + 'hook' => $hook, + 'args' => $args, + 'group' => '', + ), + + // Test with group but no args + array( + 'time' => $time, + 'hook' => $hook, + 'args' => array(), + 'group' => $group, + ), + + // Test with args & group + array( + 'time' => $time, + 'hook' => $hook, + 'args' => $args, + 'group' => $group, + ), + ); + } + + /** + * @dataProvider provider_time_hook_args_group + */ + public function test_unschedule( $time, $hook, $args, $group ) { + + $action_id_unscheduled = as_schedule_single_action( $time, $hook, $args, $group ); + $action_scheduled_time = $time + 1; + $action_id_scheduled = as_schedule_single_action( $action_scheduled_time, $hook, $args, $group ); + + as_unschedule_action( $hook, $args, $group ); + + $next = as_next_scheduled_action( $hook, $args, $group ); + $this->assertEquals( $action_scheduled_time, $next ); + + $store = ActionScheduler::store(); + $unscheduled_action = $store->fetch_action( $action_id_unscheduled ); + + // Make sure the next scheduled action is unscheduled + $this->assertEquals( $hook, $unscheduled_action->get_hook() ); + $this->assertEquals( as_get_datetime_object($time), $unscheduled_action->get_schedule()->get_date() ); + $this->assertEquals( ActionScheduler_Store::STATUS_CANCELED, $store->get_status( $action_id_unscheduled ) ); + $this->assertNull( $unscheduled_action->get_schedule()->get_next( as_get_datetime_object() ) ); + + // Make sure other scheduled actions are not unscheduled + $this->assertEquals( ActionScheduler_Store::STATUS_PENDING, $store->get_status( $action_id_scheduled ) ); + $scheduled_action = $store->fetch_action( $action_id_scheduled ); + + $this->assertEquals( $hook, $scheduled_action->get_hook() ); + $this->assertEquals( $action_scheduled_time, $scheduled_action->get_schedule()->get_date()->getTimestamp() ); + } + + /** + * @dataProvider provider_time_hook_args_group + */ + public function test_unschedule_all( $time, $hook, $args, $group ) { + + $hook = md5( $hook ); + $action_ids = array(); + + for ( $i = 0; $i < 3; $i++ ) { + $action_ids[] = as_schedule_single_action( $time, $hook, $args, $group ); + } + + as_unschedule_all_actions( $hook, $args, $group ); + + $next = as_next_scheduled_action( $hook ); + $this->assertFalse($next); + + $after = as_get_datetime_object( $time ); + $after->modify( '+1 minute' ); + + $store = ActionScheduler::store(); + + foreach ( $action_ids as $action_id ) { + $action = $store->fetch_action($action_id); + + $this->assertEquals( $hook, $action->get_hook() ); + $this->assertEquals( as_get_datetime_object( $time ), $action->get_schedule()->get_date() ); + $this->assertEquals( ActionScheduler_Store::STATUS_CANCELED, $store->get_status( $action_id ) ); + $this->assertNull( $action->get_schedule()->get_next( $after ) ); + } + } + + public function test_as_get_datetime_object_default() { + + $utc_now = new ActionScheduler_DateTime(null, new DateTimeZone('UTC')); + $as_now = as_get_datetime_object(); + + // Don't want to use 'U' as timestamps will always be in UTC + $this->assertEquals($utc_now->format('Y-m-d H:i:s'),$as_now->format('Y-m-d H:i:s')); + } + + public function test_as_get_datetime_object_relative() { + + $utc_tomorrow = new ActionScheduler_DateTime('tomorrow', new DateTimeZone('UTC')); + $as_tomorrow = as_get_datetime_object('tomorrow'); + + $this->assertEquals($utc_tomorrow->format('Y-m-d H:i:s'),$as_tomorrow->format('Y-m-d H:i:s')); + + $utc_tomorrow = new ActionScheduler_DateTime('yesterday', new DateTimeZone('UTC')); + $as_tomorrow = as_get_datetime_object('yesterday'); + + $this->assertEquals($utc_tomorrow->format('Y-m-d H:i:s'),$as_tomorrow->format('Y-m-d H:i:s')); + } + + public function test_as_get_datetime_object_fixed() { + + $utc_tomorrow = new ActionScheduler_DateTime('29 February 2016', new DateTimeZone('UTC')); + $as_tomorrow = as_get_datetime_object('29 February 2016'); + + $this->assertEquals($utc_tomorrow->format('Y-m-d H:i:s'),$as_tomorrow->format('Y-m-d H:i:s')); + + $utc_tomorrow = new ActionScheduler_DateTime('1st January 2024', new DateTimeZone('UTC')); + $as_tomorrow = as_get_datetime_object('1st January 2024'); + + $this->assertEquals($utc_tomorrow->format('Y-m-d H:i:s'),$as_tomorrow->format('Y-m-d H:i:s')); + } + + public function test_as_get_datetime_object_timezone() { + + $timezone_au = 'Australia/Brisbane'; + $timezone_default = date_default_timezone_get(); + + date_default_timezone_set( $timezone_au ); + + $au_now = new ActionScheduler_DateTime(null); + $as_now = as_get_datetime_object(); + + // Make sure they're for the same time + $this->assertEquals($au_now->getTimestamp(),$as_now->getTimestamp()); + + // But not in the same timezone, as $as_now should be using UTC + $this->assertNotEquals($au_now->format('Y-m-d H:i:s'),$as_now->format('Y-m-d H:i:s')); + + $au_now = new ActionScheduler_DateTime(null); + $as_au_now = as_get_datetime_object(); + + $this->assertEquals( $au_now->getTimestamp(), $as_now->getTimestamp(), '', 2 ); + + // But not in the same timezone, as $as_now should be using UTC + $this->assertNotEquals($au_now->format('Y-m-d H:i:s'),$as_now->format('Y-m-d H:i:s')); + + // Just in cases + date_default_timezone_set( $timezone_default ); + } + + public function test_as_get_datetime_object_type() { + $f = 'Y-m-d H:i:s'; + $now = as_get_datetime_object(); + $this->assertInstanceOf( 'ActionScheduler_DateTime', $now ); + + $dateTime = new DateTime( 'now', new DateTimeZone( 'UTC' ) ); + $asDateTime = as_get_datetime_object( $dateTime ); + $this->assertEquals( $dateTime->format( $f ), $asDateTime->format( $f ) ); + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/procedural_api/wc_get_scheduled_actions_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/procedural_api/wc_get_scheduled_actions_Test.php new file mode 100644 index 00000000..af839d91 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/procedural_api/wc_get_scheduled_actions_Test.php @@ -0,0 +1,100 @@ +hooks[$i] = md5(rand()); + $this->args[$i] = md5(rand()); + $this->groups[$i] = md5(rand()); + } + + for ( $i = 0 ; $i < 10 ; $i++ ) { + for ( $j = 0 ; $j < 10 ; $j++ ) { + $schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( $j - 3 . 'days') ); + $group = $this->groups[ ( $i + $j ) % 10 ]; + $action = new ActionScheduler_Action( $this->hooks[$i], array($this->args[$j]), $schedule, $group ); + $store->save_action( $action ); + } + } + } + + public function test_date_queries() { + $actions = as_get_scheduled_actions(array( + 'date' => as_get_datetime_object(gmdate('Y-m-d 00:00:00')), + 'per_page' => -1, + ), 'ids'); + $this->assertCount(30, $actions); + + $actions = as_get_scheduled_actions(array( + 'date' => as_get_datetime_object(gmdate('Y-m-d 00:00:00')), + 'date_compare' => '>=', + 'per_page' => -1, + ), 'ids'); + $this->assertCount(70, $actions); + } + + public function test_hook_queries() { + $actions = as_get_scheduled_actions(array( + 'hook' => $this->hooks[2], + 'per_page' => -1, + ), 'ids'); + $this->assertCount(10, $actions); + + $actions = as_get_scheduled_actions(array( + 'hook' => $this->hooks[2], + 'date' => as_get_datetime_object(gmdate('Y-m-d 00:00:00')), + 'per_page' => -1, + ), 'ids'); + $this->assertCount(3, $actions); + } + + public function test_args_queries() { + $actions = as_get_scheduled_actions(array( + 'args' => array($this->args[5]), + 'per_page' => -1, + ), 'ids'); + $this->assertCount(10, $actions); + + $actions = as_get_scheduled_actions(array( + 'args' => array($this->args[5]), + 'hook' => $this->hooks[3], + 'per_page' => -1, + ), 'ids'); + $this->assertCount(1, $actions); + + $actions = as_get_scheduled_actions(array( + 'args' => array($this->args[5]), + 'hook' => $this->hooks[3], + 'date' => as_get_datetime_object(gmdate('Y-m-d 00:00:00')), + 'per_page' => -1, + ), 'ids'); + $this->assertCount(0, $actions); + } + + public function test_group_queries() { + $actions = as_get_scheduled_actions(array( + 'group' => $this->groups[1], + 'per_page' => -1, + ), 'ids'); + $this->assertCount(10, $actions); + + $actions = as_get_scheduled_actions(array( + 'group' => $this->groups[1], + 'hook' => $this->hooks[9], + 'per_page' => -1, + ), 'ids'); + $this->assertCount(1, $actions); + } +} + \ No newline at end of file diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/runner/ActionScheduler_QueueCleaner_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/runner/ActionScheduler_QueueCleaner_Test.php new file mode 100644 index 00000000..c34207ab --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/runner/ActionScheduler_QueueCleaner_Test.php @@ -0,0 +1,154 @@ +save_action( $action ); + } + + $runner->run(); + + add_filter( 'action_scheduler_retention_period', '__return_zero' ); // delete any finished job + $cleaner = new ActionScheduler_QueueCleaner( $store ); + $cleaner->delete_old_actions(); + remove_filter( 'action_scheduler_retention_period', '__return_zero' ); + + foreach ( $created_actions as $action_id ) { + $action = $store->fetch_action($action_id); + $this->assertFalse($action->is_finished()); // it's a NullAction + } + } + + public function test_delete_canceled_actions() { + $store = ActionScheduler::store(); + + $random = md5(rand()); + $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('1 day ago')); + + $created_actions = array(); + for ( $i = 0 ; $i < 5 ; $i++ ) { + $action = new ActionScheduler_Action( $random, array($random), $schedule ); + $action_id = $store->save_action( $action ); + $store->cancel_action( $action_id ); + $created_actions[] = $action_id; + } + + // track the actions that are deleted + $mock_action = new MockAction(); + add_action( 'action_scheduler_deleted_action', array( $mock_action, 'action' ), 10, 1 ); + add_filter( 'action_scheduler_retention_period', '__return_zero' ); // delete any finished job + + $cleaner = new ActionScheduler_QueueCleaner( $store ); + $cleaner->delete_old_actions(); + + remove_filter( 'action_scheduler_retention_period', '__return_zero' ); + remove_action( 'action_scheduler_deleted_action', array( $mock_action, 'action' ), 10 ); + + $deleted_actions = array(); + foreach ( $mock_action->get_args() as $action ) { + $deleted_actions[] = reset( $action ); + } + + $this->assertEqualSets( $created_actions, $deleted_actions ); + } + + public function test_do_not_delete_recent_actions() { + $store = ActionScheduler::store(); + $runner = ActionScheduler_Mocker::get_queue_runner( $store ); + + $random = md5(rand()); + $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('1 day ago')); + + $created_actions = array(); + for ( $i = 0 ; $i < 5 ; $i++ ) { + $action = new ActionScheduler_Action( $random, array($random), $schedule ); + $created_actions[] = $store->save_action( $action ); + } + + $runner->run(); + + $cleaner = new ActionScheduler_QueueCleaner( $store ); + $cleaner->delete_old_actions(); + + foreach ( $created_actions as $action_id ) { + $action = $store->fetch_action($action_id); + $this->assertTrue($action->is_finished()); // It's a FinishedAction + } + } + + public function test_reset_unrun_actions() { + $store = ActionScheduler::store(); + + $random = md5(rand()); + $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('1 day ago')); + + $created_actions = array(); + for ( $i = 0 ; $i < 5 ; $i++ ) { + $action = new ActionScheduler_Action( $random, array($random), $schedule ); + $created_actions[] = $store->save_action( $action ); + } + + $store->stake_claim(10); + + // don't actually process the jobs, to simulate a request that timed out + + add_filter( 'action_scheduler_timeout_period', '__return_zero' ); // delete any finished job + $cleaner = new ActionScheduler_QueueCleaner( $store ); + $cleaner->reset_timeouts(); + + remove_filter( 'action_scheduler_timeout_period', '__return_zero' ); + + $claim = $store->stake_claim(10); + $this->assertEqualSets($created_actions, $claim->get_actions()); + } + + public function test_do_not_reset_failed_action() { + $store = ActionScheduler::store(); + + $random = md5(rand()); + $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('1 day ago')); + + $created_actions = array(); + for ( $i = 0 ; $i < 5 ; $i++ ) { + $action = new ActionScheduler_Action( $random, array($random), $schedule ); + $created_actions[] = $store->save_action( $action ); + } + + $claim = $store->stake_claim(10); + foreach ( $claim->get_actions() as $action_id ) { + // simulate the first action interrupted by an uncatchable fatal error + $store->log_execution( $action_id ); + break; + } + + add_filter( 'action_scheduler_timeout_period', '__return_zero' ); // delete any finished job + $cleaner = new ActionScheduler_QueueCleaner( $store ); + $cleaner->reset_timeouts(); + remove_filter( 'action_scheduler_timeout_period', '__return_zero' ); + + $new_claim = $store->stake_claim(10); + $this->assertCount( 4, $new_claim->get_actions() ); + + add_filter( 'action_scheduler_failure_period', '__return_zero' ); + $cleaner->mark_failures(); + remove_filter( 'action_scheduler_failure_period', '__return_zero' ); + + $failed = $store->query_actions(array('status' => ActionScheduler_Store::STATUS_FAILED)); + $this->assertEquals( $created_actions[0], $failed[0] ); + $this->assertCount( 1, $failed ); + + + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/runner/ActionScheduler_QueueRunner_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/runner/ActionScheduler_QueueRunner_Test.php new file mode 100644 index 00000000..228379e8 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/runner/ActionScheduler_QueueRunner_Test.php @@ -0,0 +1,330 @@ +run(); + + $this->assertEquals( 0, $actions_run ); + } + + public function test_run() { + $store = ActionScheduler::store(); + $runner = ActionScheduler_Mocker::get_queue_runner( $store ); + + $mock = new MockAction(); + $random = md5(rand()); + add_action( $random, array( $mock, 'action' ) ); + $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('1 day ago')); + + for ( $i = 0 ; $i < 5 ; $i++ ) { + $action = new ActionScheduler_Action( $random, array($random), $schedule ); + $store->save_action( $action ); + } + + $actions_run = $runner->run(); + + remove_action( $random, array( $mock, 'action' ) ); + + $this->assertEquals( 5, $mock->get_call_count() ); + $this->assertEquals( 5, $actions_run ); + } + + public function test_run_with_future_actions() { + $store = ActionScheduler::store(); + $runner = ActionScheduler_Mocker::get_queue_runner( $store ); + + $mock = new MockAction(); + $random = md5(rand()); + add_action( $random, array( $mock, 'action' ) ); + $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('1 day ago')); + + for ( $i = 0 ; $i < 3 ; $i++ ) { + $action = new ActionScheduler_Action( $random, array($random), $schedule ); + $store->save_action( $action ); + } + + $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('tomorrow')); + for ( $i = 0 ; $i < 3 ; $i++ ) { + $action = new ActionScheduler_Action( $random, array($random), $schedule ); + $store->save_action( $action ); + } + + $actions_run = $runner->run(); + + remove_action( $random, array( $mock, 'action' ) ); + + $this->assertEquals( 3, $mock->get_call_count() ); + $this->assertEquals( 3, $actions_run ); + } + + public function test_completed_action_status() { + $store = ActionScheduler::store(); + $runner = ActionScheduler_Mocker::get_queue_runner( $store ); + + $random = md5(rand()); + $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('12 hours ago')); + + $action = new ActionScheduler_Action( $random, array(), $schedule ); + $action_id = $store->save_action( $action ); + + $runner->run(); + + $finished_action = $store->fetch_action( $action_id ); + + $this->assertTrue( $finished_action->is_finished() ); + } + + public function test_next_instance_of_cron_action() { + // Create an action with daily Cron expression (i.e. midnight each day) + $random = md5( rand() ); + $action_id = ActionScheduler::factory()->cron( $random, array(), null, '0 0 * * *' ); + $store = ActionScheduler::store(); + $runner = ActionScheduler_Mocker::get_queue_runner( $store ); + + // Make sure the 1st instance of the action is scheduled to occur tomorrow + $date = as_get_datetime_object( 'tomorrow' ); + $date->modify( '-1 minute' ); + $claim = $store->stake_claim( 10, $date ); + $this->assertCount( 0, $claim->get_actions() ); + + $store->release_claim( $claim ); + + $date->modify( '+1 minute' ); + + $claim = $store->stake_claim( 10, $date ); + $actions = $claim->get_actions(); + $this->assertCount( 1, $actions ); + + $fetched_action_id = reset( $actions ); + $fetched_action = $store->fetch_action( $fetched_action_id ); + + $this->assertEquals( $fetched_action_id, $action_id ); + $this->assertEquals( $random, $fetched_action->get_hook() ); + $this->assertEquals( $date->getTimestamp(), $fetched_action->get_schedule()->get_date()->getTimestamp(), '', 1 ); + + $store->release_claim( $claim ); + + // Make sure the 2nd instance of the cron action is scheduled to occur tomorrow still + $runner->process_action( $action_id ); + + $claim = $store->stake_claim( 10, $date ); + $actions = $claim->get_actions(); + $this->assertCount( 1, $actions ); + + $fetched_action_id = reset( $actions ); + $fetched_action = $store->fetch_action( $fetched_action_id ); + + $this->assertNotEquals( $fetched_action_id, $action_id ); + $this->assertEquals( $random, $fetched_action->get_hook() ); + $this->assertEquals( $date->getTimestamp(), $fetched_action->get_schedule()->get_date()->getTimestamp(), '', 1 ); + } + + public function test_next_instance_of_interval_action() { + // Create an action to recur every 24 hours, with the first instance scheduled to run 12 hours ago + $random = md5( rand() ); + $date = as_get_datetime_object( '12 hours ago' ); + $action_id = ActionScheduler::factory()->recurring( $random, array(), $date->getTimestamp(), DAY_IN_SECONDS ); + $store = ActionScheduler::store(); + $runner = ActionScheduler_Mocker::get_queue_runner( $store ); + + // Make sure the 1st instance of the action is scheduled to occur 12 hours ago + $claim = $store->stake_claim( 10, $date ); + $actions = $claim->get_actions(); + $this->assertCount( 1, $actions ); + + $fetched_action_id = reset( $actions ); + $fetched_action = $store->fetch_action( $fetched_action_id ); + + $this->assertEquals( $fetched_action_id, $action_id ); + $this->assertEquals( $random, $fetched_action->get_hook() ); + $this->assertEquals( $date->getTimestamp(), $fetched_action->get_schedule()->get_date()->getTimestamp(), '', 1 ); + + $store->release_claim( $claim ); + + // Make sure after the queue is run, the 2nd instance of the action is scheduled to occur in 24 hours + $runner->run(); + + $date = as_get_datetime_object( '+1 day' ); + $claim = $store->stake_claim( 10, $date ); + $actions = $claim->get_actions(); + $this->assertCount( 1, $actions ); + + $fetched_action_id = reset( $actions ); + $fetched_action = $store->fetch_action( $fetched_action_id ); + + $this->assertNotEquals( $fetched_action_id, $action_id ); + $this->assertEquals( $random, $fetched_action->get_hook() ); + $this->assertEquals( $date->getTimestamp(), $fetched_action->get_schedule()->get_date()->getTimestamp(), '', 1 ); + + $store->release_claim( $claim ); + + // Make sure the 3rd instance of the cron action is scheduled for 24 hours from now, as the action was run early, ahead of schedule + $runner->process_action( $fetched_action_id ); + $date = as_get_datetime_object( '+1 day' ); + + $claim = $store->stake_claim( 10, $date ); + $actions = $claim->get_actions(); + $this->assertCount( 1, $actions ); + + $fetched_action_id = reset( $actions ); + $fetched_action = $store->fetch_action( $fetched_action_id ); + + $this->assertNotEquals( $fetched_action_id, $action_id ); + $this->assertEquals( $random, $fetched_action->get_hook() ); + $this->assertEquals( $date->getTimestamp(), $fetched_action->get_schedule()->get_date()->getTimestamp(), '', 1 ); + } + + public function test_hooked_into_wp_cron() { + $next = wp_next_scheduled( ActionScheduler_QueueRunner::WP_CRON_HOOK, array( 'WP Cron' ) ); + $this->assertNotEmpty($next); + } + + public function test_batch_count_limit() { + $store = ActionScheduler::store(); + $runner = ActionScheduler_Mocker::get_queue_runner( $store ); + + $mock = new MockAction(); + $random = md5(rand()); + add_action( $random, array( $mock, 'action' ) ); + $schedule = new ActionScheduler_SimpleSchedule(new ActionScheduler_DateTime('1 day ago')); + + for ( $i = 0 ; $i < 2 ; $i++ ) { + $action = new ActionScheduler_Action( $random, array($random), $schedule ); + $store->save_action( $action ); + } + + $claim = $store->stake_claim(); + + $actions_run = $runner->run(); + + $this->assertEquals( 0, $mock->get_call_count() ); + $this->assertEquals( 0, $actions_run ); + + $store->release_claim( $claim ); + + $actions_run = $runner->run(); + + $this->assertEquals( 2, $mock->get_call_count() ); + $this->assertEquals( 2, $actions_run ); + + remove_action( $random, array( $mock, 'action' ) ); + } + + public function test_changing_batch_count_limit() { + $store = ActionScheduler::store(); + $runner = ActionScheduler_Mocker::get_queue_runner( $store ); + + $random = md5(rand()); + $schedule = new ActionScheduler_SimpleSchedule(new ActionScheduler_DateTime('1 day ago')); + + for ( $i = 0 ; $i < 30 ; $i++ ) { + $action = new ActionScheduler_Action( $random, array($random), $schedule ); + $store->save_action( $action ); + } + + $claims = array(); + + for ( $i = 0 ; $i < 5 ; $i++ ) { + $claims[] = $store->stake_claim( 5 ); + } + + $mock1 = new MockAction(); + add_action( $random, array( $mock1, 'action' ) ); + $actions_run = $runner->run(); + remove_action( $random, array( $mock1, 'action' ) ); + + $this->assertEquals( 0, $mock1->get_call_count() ); + $this->assertEquals( 0, $actions_run ); + + + add_filter( 'action_scheduler_queue_runner_concurrent_batches', array( $this, 'return_6' ) ); + + $mock2 = new MockAction(); + add_action( $random, array( $mock2, 'action' ) ); + $actions_run = $runner->run(); + remove_action( $random, array( $mock2, 'action' ) ); + + $this->assertEquals( 5, $mock2->get_call_count() ); + $this->assertEquals( 5, $actions_run ); + + remove_filter( 'action_scheduler_queue_runner_concurrent_batches', array( $this, 'return_6' ) ); + + for ( $i = 0 ; $i < 5 ; $i++ ) { // to make up for the actions we just processed + $action = new ActionScheduler_Action( $random, array($random), $schedule ); + $store->save_action( $action ); + } + + $mock3 = new MockAction(); + add_action( $random, array( $mock3, 'action' ) ); + $actions_run = $runner->run(); + remove_action( $random, array( $mock3, 'action' ) ); + + $this->assertEquals( 0, $mock3->get_call_count() ); + $this->assertEquals( 0, $actions_run ); + + remove_filter( 'action_scheduler_queue_runner_concurrent_batches', array( $this, 'return_6' ) ); + } + + public function return_6() { + return 6; + } + + public function test_store_fetch_action_failure_schedule_next_instance() { + $random = md5( rand() ); + $schedule = new ActionScheduler_IntervalSchedule( as_get_datetime_object( '12 hours ago' ), DAY_IN_SECONDS ); + $action = new ActionScheduler_Action( $random, array(), $schedule ); + $action_id = ActionScheduler::store()->save_action( $action ); + + // Set up a mock store that will throw an exception when fetching actions. + $store = $this + ->getMockBuilder( 'ActionScheduler_wpPostStore' ) + ->setMethods( array( 'fetch_action' ) ) + ->getMock(); + $store + ->method( 'fetch_action' ) + ->with( $action_id ) + ->will( $this->throwException( new Exception() ) ); + + // Set up a mock queue runner to verify that schedule_next_instance() + // isn't called for an undefined $action. + $runner = $this + ->getMockBuilder( 'ActionScheduler_QueueRunner' ) + ->setConstructorArgs( array( $store ) ) + ->setMethods( array( 'schedule_next_instance' ) ) + ->getMock(); + $runner + ->expects( $this->never() ) + ->method( 'schedule_next_instance' ); + + $runner->run(); + + // Set up a mock store that will throw an exception when fetching actions. + $store2 = $this + ->getMockBuilder( 'ActionScheduler_wpPostStore' ) + ->setMethods( array( 'fetch_action' ) ) + ->getMock(); + $store2 + ->method( 'fetch_action' ) + ->with( $action_id ) + ->willReturn( null ); + + // Set up a mock queue runner to verify that schedule_next_instance() + // isn't called for an undefined $action. + $runner2 = $this + ->getMockBuilder( 'ActionScheduler_QueueRunner' ) + ->setConstructorArgs( array( $store ) ) + ->setMethods( array( 'schedule_next_instance' ) ) + ->getMock(); + $runner2 + ->expects( $this->never() ) + ->method( 'schedule_next_instance' ); + + $runner2->run(); + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_CronSchedule_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_CronSchedule_Test.php new file mode 100644 index 00000000..1a0f0159 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_CronSchedule_Test.php @@ -0,0 +1,76 @@ +modify( '-1 hour' ); + $schedule = new ActionScheduler_CronSchedule( $start, $cron ); + $this->assertEquals( $time, $schedule->get_date() ); + $this->assertEquals( $start, $schedule->get_first_date() ); + + // Test delaying for a future start date + $start->modify( '+1 week' ); + $time->modify( '+1 week' ); + + $schedule = new ActionScheduler_CronSchedule( $start, $cron ); + $this->assertEquals( $time, $schedule->get_date() ); + $this->assertEquals( $start, $schedule->get_first_date() ); + } + + public function test_creation_with_first_date() { + $time = as_get_datetime_object( 'tomorrow' ); + $cron = CronExpression::factory( '@daily' ); + $start = clone $time; + $start->modify( '-1 hour' ); + $schedule = new ActionScheduler_CronSchedule( $start, $cron ); + $this->assertEquals( $time, $schedule->get_date() ); + $this->assertEquals( $start, $schedule->get_first_date() ); + + // Test delaying for a future start date + $first = clone $time; + $first->modify( '-1 day' ); + $start->modify( '+1 week' ); + $time->modify( '+1 week' ); + + $schedule = new ActionScheduler_CronSchedule( $start, $cron, $first ); + $this->assertEquals( $time, $schedule->get_date() ); + $this->assertEquals( $first, $schedule->get_first_date() ); + } + + public function test_next() { + $time = as_get_datetime_object('2013-06-14'); + $cron = CronExpression::factory('@daily'); + $schedule = new ActionScheduler_CronSchedule($time, $cron); + $this->assertEquals( as_get_datetime_object('tomorrow'), $schedule->get_next( as_get_datetime_object() ) ); + } + + public function test_is_recurring() { + $schedule = new ActionScheduler_CronSchedule(as_get_datetime_object('2013-06-14'), CronExpression::factory('@daily')); + $this->assertTrue( $schedule->is_recurring() ); + } + + public function test_cron_format() { + $time = as_get_datetime_object('2014-01-01'); + $cron = CronExpression::factory('0 0 10 10 *'); + $schedule = new ActionScheduler_CronSchedule($time, $cron); + $this->assertEquals( as_get_datetime_object('2014-10-10'), $schedule->get_date() ); + + $cron = CronExpression::factory('0 0 L 1/2 *'); + $schedule = new ActionScheduler_CronSchedule($time, $cron); + $this->assertEquals( as_get_datetime_object('2014-01-31'), $schedule->get_date() ); + $this->assertEquals( as_get_datetime_object('2014-07-31'), $schedule->get_next( as_get_datetime_object('2014-06-01') ) ); + $this->assertEquals( as_get_datetime_object('2028-11-30'), $schedule->get_next( as_get_datetime_object('2028-11-01') ) ); + + $cron = CronExpression::factory('30 14 * * MON#3 *'); + $schedule = new ActionScheduler_CronSchedule($time, $cron); + $this->assertEquals( as_get_datetime_object('2014-01-20 14:30:00'), $schedule->get_date() ); + $this->assertEquals( as_get_datetime_object('2014-05-19 14:30:00'), $schedule->get_next( as_get_datetime_object('2014-05-01') ) ); + } +} + \ No newline at end of file diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_IntervalSchedule_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_IntervalSchedule_Test.php new file mode 100644 index 00000000..983c60d6 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_IntervalSchedule_Test.php @@ -0,0 +1,37 @@ +assertEquals( $time, $schedule->get_date() ); + $this->assertEquals( $time, $schedule->get_first_date() ); + } + + public function test_creation_with_first_date() { + $first = as_get_datetime_object(); + $time = as_get_datetime_object( '+12 hours' ); + $schedule = new ActionScheduler_IntervalSchedule( $time, HOUR_IN_SECONDS, $first ); + $this->assertEquals( $time, $schedule->get_date() ); + $this->assertEquals( $first, $schedule->get_first_date() ); + } + + public function test_next() { + $now = time(); + $start = $now - 30; + $schedule = new ActionScheduler_IntervalSchedule( as_get_datetime_object("@$start"), MINUTE_IN_SECONDS ); + $this->assertEquals( $start, $schedule->get_date()->getTimestamp() ); + $this->assertEquals( $now + MINUTE_IN_SECONDS, $schedule->get_next(as_get_datetime_object())->getTimestamp() ); + $this->assertEquals( $start, $schedule->get_next( as_get_datetime_object( "@$start" ) )->getTimestamp() ); + } + + public function test_is_recurring() { + $start = time() - 30; + $schedule = new ActionScheduler_IntervalSchedule( as_get_datetime_object("@$start"), MINUTE_IN_SECONDS ); + $this->assertTrue( $schedule->is_recurring() ); + } +} diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_NullSchedule_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_NullSchedule_Test.php new file mode 100644 index 00000000..9324e6b5 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_NullSchedule_Test.php @@ -0,0 +1,18 @@ +assertNull( $schedule->get_date() ); + } + + public function test_is_recurring() { + $schedule = new ActionScheduler_NullSchedule(); + $this->assertFalse( $schedule->is_recurring() ); + } +} + \ No newline at end of file diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_SimpleSchedule_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_SimpleSchedule_Test.php new file mode 100644 index 00000000..06a14c5e --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_SimpleSchedule_Test.php @@ -0,0 +1,37 @@ +assertEquals( $time, $schedule->get_date() ); + } + + public function test_past_date() { + $time = as_get_datetime_object('-1 day'); + $schedule = new ActionScheduler_SimpleSchedule($time); + $this->assertEquals( $time, $schedule->get_date() ); + } + + public function test_future_date() { + $time = as_get_datetime_object('+1 day'); + $schedule = new ActionScheduler_SimpleSchedule($time); + $this->assertEquals( $time, $schedule->get_date() ); + } + + public function test_grace_period_for_next() { + $time = as_get_datetime_object('3 seconds ago'); + $schedule = new ActionScheduler_SimpleSchedule($time); + $this->assertEquals( $time, $schedule->get_date() ); + } + + public function test_is_recurring() { + $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('+1 day')); + $this->assertFalse( $schedule->is_recurring() ); + } +} + \ No newline at end of file diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/versioning/ActionScheduler_Versions_Test.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/versioning/ActionScheduler_Versions_Test.php new file mode 100644 index 00000000..9e79e024 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/phpunit/versioning/ActionScheduler_Versions_Test.php @@ -0,0 +1,43 @@ +register('1.0-dev', 'callback_1_dot_0_dev'); + $versions->register('1.0', 'callback_1_dot_0'); + + $registered = $versions->get_versions(); + + $this->assertArrayHasKey( '1.0-dev', $registered ); + $this->assertArrayHasKey( '1.0', $registered ); + $this->assertCount( 2, $registered ); + + $this->assertEquals( 'callback_1_dot_0_dev', $registered['1.0-dev'] ); + } + + public function test_duplicate_version() { + $versions = new ActionScheduler_Versions(); + $versions->register('1.0', 'callback_1_dot_0_a'); + $versions->register('1.0', 'callback_1_dot_0_b'); + + $registered = $versions->get_versions(); + + $this->assertArrayHasKey( '1.0', $registered ); + $this->assertCount( 1, $registered ); + } + + public function test_latest_version() { + $versions = new ActionScheduler_Versions(); + $this->assertEquals('__return_null', $versions->latest_version_callback() ); + $versions->register('1.2', 'callback_1_dot_2'); + $versions->register('1.3', 'callback_1_dot_3'); + $versions->register('1.0', 'callback_1_dot_0'); + + $this->assertEquals( '1.3', $versions->latest_version() ); + $this->assertEquals( 'callback_1_dot_3', $versions->latest_version_callback() ); + } +} + \ No newline at end of file diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/travis/setup.sh b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/travis/setup.sh new file mode 100644 index 00000000..068198af --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/travis/setup.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +# WordPress test setup script for Travis CI +# +# Author: Benjamin J. Balter ( ben@balter.com | ben.balter.com ) +# License: GPL3 + +export WP_CORE_DIR=/tmp/wordpress +export WP_TESTS_DIR=/tmp/wordpress-tests/tests/phpunit + +if [[ "$1" = "5.6" || "$1" > "5.6" ]] +then + wget -c https://phar.phpunit.de/phpunit-5.7.phar + chmod +x phpunit-5.7.phar + mv phpunit-5.7.phar `which phpunit` +fi + +plugin_slug=$(basename $(pwd)) +plugin_dir=$WP_CORE_DIR/wp-content/plugins/$plugin_slug + +# Init database +mysql -e 'CREATE DATABASE wordpress_test;' -uroot + +# Grab specified version of WordPress from github +wget -nv -O /tmp/wordpress.tar.gz https://github.com/WordPress/WordPress/tarball/$WP_VERSION +mkdir -p $WP_CORE_DIR +tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR + +# Grab testing framework +svn co --quiet https://develop.svn.wordpress.org/tags/$WP_VERSION/ /tmp/wordpress-tests + +# Put various components in proper folders +cp tests/travis/wp-tests-config.php $WP_TESTS_DIR/wp-tests-config.php + +cd .. +mv $plugin_slug $plugin_dir + +cd $plugin_dir diff --git a/wp-content/plugins/wpscan/libraries/action-scheduler/tests/travis/wp-tests-config.php b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/travis/wp-tests-config.php new file mode 100644 index 00000000..f626da09 --- /dev/null +++ b/wp-content/plugins/wpscan/libraries/action-scheduler/tests/travis/wp-tests-config.php @@ -0,0 +1,38 @@ + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. \ No newline at end of file diff --git a/wp-content/plugins/wpscan/readme.txt b/wp-content/plugins/wpscan/readme.txt new file mode 100644 index 00000000..1d6f594e --- /dev/null +++ b/wp-content/plugins/wpscan/readme.txt @@ -0,0 +1,217 @@ +=== WPScan - WordPress Security Scanner === +Contributors: ethicalhack3r, xfirefartx, erwanlr +Tags: wpscan, wpvulndb, security, vulnerability, hack, scan, exploit, secure, alerts +Requires at least: 3.4 +Tested up to: 5.6 +Stable tag: 1.15.1 +Requires PHP: 5.5 +License: GPLv3 +License URI: https://www.gnu.org/licenses/gpl.html + +WPScan WordPress Security Scanner - Scans your system for security vulnerabilities listed in the WPScan Vulnerability Database. + +== Description == + +The WPScan WordPress security plugin is unique in that it uses its own manually curated [WPScan WordPress Vulnerability Database](https://wpscan.com/). The vulnerability database has been around since 2014 and is updated on a daily basis by dedicated WordPress security specialists and the community at large. The database includes more than 21,000 known security vulnerabilities. The plugin uses this database to scan for [WordPress vulnerabilities](https://wpscan.com/wordpresses), [plugin vulnerabilities](https://wpscan.com/plugins) and [theme vulnerabilities](https://wpscan.com/themes), and has the options to schedule automated daily scans and to send email notifications. + +[youtube https://www.youtube.com/watch?v=Fa3lTIvBx10] + +WPScan has a Free API plan that should be suitable for most WordPress websites, however, also has paid plans for users who may need more API calls. To use the WPScan WordPress Security Plugin you will need to use a free API token by [registering here](https://wpscan.com/). + +The Free plan allows 25 API requests per day. View the different available [API plans](https://wpscan.com/api). + += How many API requests do you need? = + +* Our WordPress scanner makes one API request for the WordPress version, one request per installed plugin and one request per installed theme. +* On average, a WordPress website has 22 installed plugins. +* The Free plan should cover around 50% of all WordPress websites. + += Security Checks = + +The WPScan WordPress Security Plugin will also check for other security issues, which do not require an API token, such as: + +* Check for debug.log files +* Check for wp-config.php backup files +* Check if XML-RPC is enabled +* Check for code repository files +* Check if default secret keys are used +* Check for exported database files +* Weak passwords +* HTTPS enabled + += What does the plugin do? = + +* Scans for known WordPress vulnerabilities, plugin vulnerabilities and theme vulnerabilities; +* Does additional security checks; +* Shows an icon on the Admin Toolbar with the total number of security vulnerabilities found; +* Notifies you by mail when new security vulnerabilities are found. + += Further Reading = + +* [WPScan WordPress Vulnerability Database](https://wpscan.com/) +* [WPScan WordPress Security Scanner](https://wpscan.com/wordpress-security-scanner) +* [WPScan Twitter](https://twitter.com/_wpscan_) + +== Installation == + +1. Upload `wpscan.zip` content to the `/wp-content/plugins/` directory +2. Activate the plugin through the 'Plugins' menu in WordPress +3. [Register](https://wpscan.com/register) for a free API token +4. Save the API token to the WPScan settings page or within the wp-config.php file + +== Frequently Asked Questions == + += How many API calls are made? = + + There is one API call made for the WordPress version, one call for each installed plugin and one for each theme. By default there is one scan per day. The number of daily scans can be configured when configuring notifications. + += How can I configure the API token in the wp-config.php file? = + + To configure your API token in the wp-config.php file, use the following PHP code: `define( 'WPSCAN_API_TOKEN', '$your_api_token' );` + += How do I disable vulnerability scanning altogether? = + + You can set the following PHP constant in the wp-config.php file to disable scanning; `define( 'WPSCAN_DISABLE_SCANNING_INTERVAL', true );`. + += Why is the "Summary" section and the "Run All" button not showing? = + + The cron job did not run, which can be due to: + - The DISABLE_WP_CRON constant is set to true in the wp-config.php file, but no system cron has been set (crontab -e). + - A plugin's caching pages is enabled (see https://wordpress.stackexchange.com/questions/93570/wp-cron-doesnt-execute-when-time-elapses?answertab=active#tab-top). + - The blog is unable to make a loopback request, see the Tools->Site Health for details. + + If the issue can not be solved with the above, putting `define('ALTERNATE_WP_CRON', true);` in the wp-config.php could help, however, will reduce the SEO of the blog. + +== Screenshots == + +1. List of vulnerabilities and icon at Admin Bar. +2. Notification settings. +3. Site health page. + +== Changelog == + += 1.15.1 = +* Improved email alert text +* Improved PDF report download layout + += 1.15 = +* Fix memory_limit when using list_files() +* Use Action Scheduler +* Add security check remediation links + += 1.14.4 = +* Use new free API defaults +* Remove "Not found in database" message + += 1.14.3 = +* Don't use HTTP_HOST in db exports check + += 1.14.2 = +* Revert DISABLE_WP_CRON check +* Fix HTTPS check + += 1.14.1 = +* Use the wp_check_password() function to check for weak passwords + += 1.14 = +* Uses the status endpoint to get account data +* Fixes the account status not being updated unless a scan is performed when the API token is updated/set +* Adds vulnerability found hook +* New security check: Check for weak user passwords +* New security check: HTTPS +* Clear plan info if API Token set to null +* Fixes automated scanning when plugin deactivated and reactivated +* Fixes cron job not being created when using the WPSCAN_API_TOKEN constant +* Change default scanning time to the current time +* Many other small improvements + += 1.13.2 = +* Fix XML-RPC check false positive + += 1.13.1 = +* Fix potential WP_Error issue in XML-RPC check +* Add version to client side CSS and JS +* Work towards PHP WordPress coding standards + += 1.13 = +* Improve the XML-RPC security check +* No longer run a scan when adding an API token +* Other small improvements & bug fixes + += 1.12.3 = +* Improve WPScan API error handling +* Add status URL on WPScan API errors +* Delete doing_cron transient on plugin activation +* Replace the xmlrpc_encode_request() PHP function +* Blur API token setting input box + += 1.12.2 = +* Fix bug: case statement should 'break' + += 1.12.1 = +* Fix bug: Handle 404 API errors + += 1.12 = +* Code Refactoring +* Adds Security Check System +* Check for debug.log files +* Check for wp-config.php backups +* Check if XMLRPC is enabled +* Check if default keys are used in wp-config.php +* Check for code repo files .svn and .git +* Create a Vulnerabilities to Ignore meta-box +* Fixes Theme closed incorrect message and position in report +* Show message if API is not working +* Timeout cron jobs +* Fix 404 error in devtools + += 1.11 = +* Change references of wpvulndb to wpscan.com + += 1.10 = +* Add WPSCAN_DISABLE_SCANNING_INTERVAL constant to disable automated scanning +* Add an option in the settings to ignore items +* Add an option in the settings to set the scan time +* Show a not found in database message +* Other minor bug fixes + += 1.9 = +* Add scanning interval option to settings page +* Some other small improvements + += 1.8 = +* Show severity ratings for Enterprise users +* Show Plugin Closed label +* Add PDF report download +* Add account status meta box +* Add support for API token constant in wp-config.php file +* Show vulnerabilities in Site Health +* Update menu icon to monochrome + += 1.7 = +* Updated text and messages to reduce confusion +* Removed WPScan_JWT class as no longer required + += 1.6 = +* Use the new slug helper method on all items on the page + += 1.5 = +* Better slug detection before calling the API + += 1.4 = +* Prevent multiple tasks to run simultaneously +* Check Now Button disabled and Spinner icon displayed when a task is already running +* Results page automatically reloaded when Task is finished (checked every 10s) + += 1.3 = +* Use the /status API endpoint to determine if the Token is valid. As a result, a call is no longer consumed when setting/changing the API token. +* Trim and remove potential leading 'v' in versions when comparing then with the fixed_in values. + += 1.2 = +* Add notice about paid licenses + += 1.1 = +* Warn if API Limit was hit + += 1.0 = +* First release. diff --git a/wp-content/plugins/wpscan/screenshot-1.png b/wp-content/plugins/wpscan/screenshot-1.png new file mode 100644 index 00000000..78c189d0 Binary files /dev/null and b/wp-content/plugins/wpscan/screenshot-1.png differ diff --git a/wp-content/plugins/wpscan/screenshot-2.png b/wp-content/plugins/wpscan/screenshot-2.png new file mode 100644 index 00000000..704d3dd7 Binary files /dev/null and b/wp-content/plugins/wpscan/screenshot-2.png differ diff --git a/wp-content/plugins/wpscan/screenshot-3.png b/wp-content/plugins/wpscan/screenshot-3.png new file mode 100644 index 00000000..fbad41fa Binary files /dev/null and b/wp-content/plugins/wpscan/screenshot-3.png differ diff --git a/wp-content/plugins/wpscan/security-checks/database-exports/assets/db_exports.txt b/wp-content/plugins/wpscan/security-checks/database-exports/assets/db_exports.txt new file mode 100644 index 00000000..3a0b25e1 --- /dev/null +++ b/wp-content/plugins/wpscan/security-checks/database-exports/assets/db_exports.txt @@ -0,0 +1,36 @@ +{domain_name}.sql +{domain_name}.sql.gz +{domain_name}.zip +db.sql +site.sql +database.sql +data.sql +dump.sql +db_backup.sql +dbdump.sql +wordpress.sql +mysql.sql +backup/{domain_name}.sql +backup/{domain_name}.sql.gz +backup/{domain_name}.zip +backup/db.sql +backup/site.sql +backup/database.sql +backup/data.sql +backup/dump.sql +backup/db_backup.sql +backup/dbdump.sql +backup/wordpress.sql +backup/mysql.sql +backups/{domain_name}.sql +backups/{domain_name}.sql.gz +backups/{domain_name}.zip +backups/db.sql +backups/site.sql +backups/database.sql +backups/data.sql +backups/dump.sql +backups/db_backup.sql +backups/dbdump.sql +backups/wordpress.sql +backups/mysql.sql \ No newline at end of file diff --git a/wp-content/plugins/wpscan/security-checks/database-exports/check.php b/wp-content/plugins/wpscan/security-checks/database-exports/check.php new file mode 100644 index 00000000..75041d2b --- /dev/null +++ b/wp-content/plugins/wpscan/security-checks/database-exports/check.php @@ -0,0 +1,81 @@ +get_vulnerabilities(); + + $host = parse_url( get_site_url(), PHP_URL_HOST ); + $text = file_get_contents( $this->dir . '/assets/db_exports.txt' ); + $exports = str_replace( '{domain_name}', $host, $text ); + $names = explode( PHP_EOL, $exports ); + + foreach ( $names as $name ) { + $path = ABSPATH . $name; + $url = esc_url( get_site_url() . '/' . $name ); + + if ( file_exists( $path ) ) { + $response = wp_remote_head( $url, array( 'timeout' => 5 ) ); + $code = wp_remote_retrieve_response_code( $response ); + + if ( 200 === $code ) { + $this->add_vulnerability( __( 'A publicly accessible database file was found in', 'wpscan' ) . " $url.", 'high', sanitize_title( $name ), 'https://blog.wpscan.com/2021/01/28/wordpress-database-backup-files.html' ); + } + } + } + } +} diff --git a/wp-content/plugins/wpscan/security-checks/debuglog-files/check.php b/wp-content/plugins/wpscan/security-checks/debuglog-files/check.php new file mode 100644 index 00000000..806ecbfc --- /dev/null +++ b/wp-content/plugins/wpscan/security-checks/debuglog-files/check.php @@ -0,0 +1,75 @@ +get_vulnerabilities(); + + $file = ABSPATH . 'wp-content/debug.log'; + + if ( file_exists( $file ) ) { + $url = esc_url( get_site_url() . '/' . str_replace( ABSPATH, '', $file ) ); + $response = wp_remote_head( $url, array( 'timeout' => 5 ) ); + $code = wp_remote_retrieve_response_code( $response ); + + if ( 200 === $code ) { + $this->add_vulnerability( __( 'A publicly accessible debug.log file was found in', 'wpscan' ) . " $url.", 'high', sanitize_title( $file ), 'https://blog.wpscan.com/2021/03/18/wordpress-debug-log-files.html' ); + } + } + } +} diff --git a/wp-content/plugins/wpscan/security-checks/https/check.php b/wp-content/plugins/wpscan/security-checks/https/check.php new file mode 100644 index 00000000..750ba8d5 --- /dev/null +++ b/wp-content/plugins/wpscan/security-checks/https/check.php @@ -0,0 +1,72 @@ +get_vulnerabilities(); + + $wp_url = get_bloginfo( 'wpurl' ); + $site_url = get_bloginfo( 'url' ); + + // Check if the current page is using HTTPS. + if ( 'https' !== substr( $wp_url, 0, 5 ) || 'https' !== substr( $site_url, 0, 5 ) ) { + // No HTTPS used. + $this->add_vulnerability( __( 'The website does not seem to be using HTTPS (SSL/TLS) encryption for communications.', 'wpscan' ), 'high', 'https', 'https://blog.wpscan.com/2021/03/23/wordpress-ssl-tls-https.html' ); + } + } +} diff --git a/wp-content/plugins/wpscan/security-checks/secret-keys/check.php b/wp-content/plugins/wpscan/security-checks/secret-keys/check.php new file mode 100644 index 00000000..26a6ca77 --- /dev/null +++ b/wp-content/plugins/wpscan/security-checks/secret-keys/check.php @@ -0,0 +1,71 @@ +get_vulnerabilities(); + + $keys = array( 'AUTH_KEY', 'SECURE_AUTH_KEY', 'LOGGED_IN_KEY', 'NONCE_KEY', 'AUTH_SALT', 'SECURE_AUTH_SALT', 'LOGGED_IN_SALT', 'NONCE_SALT' ); + + foreach ( $keys as $key ) { + if ( defined( $key ) && constant( $key ) === 'put your unique phrase here' ) { + $this->add_vulnerability( __( 'The ' . esc_html( $key ) . ' secret key in the wp-config.php file was the default key. It should be changed to a random value using', 'wpscan' ) . " https://api.wordpress.org/secret-key/1.1/salt/.", 'high', sanitize_title( $key ), 'https://blog.wpscan.com/2021/03/23/wordpress-secret-keys.html' ); + } + } + } +} diff --git a/wp-content/plugins/wpscan/security-checks/version-control/check.php b/wp-content/plugins/wpscan/security-checks/version-control/check.php new file mode 100644 index 00000000..c92298c4 --- /dev/null +++ b/wp-content/plugins/wpscan/security-checks/version-control/check.php @@ -0,0 +1,78 @@ +get_vulnerabilities(); + + $files = array( '.svn', '.git' ); + + foreach ( $files as $file ) { + $url = esc_html( get_site_url() . '/' . $file ); + + if ( file_exists( ABSPATH . $file ) ) { + $response = wp_remote_head( $url, array( 'timeout' => 5 ) ); + $code = wp_remote_retrieve_response_code( $response ); + + if ( 200 === $code ) { + $this->add_vulnerability( __( 'A publicly accessible ' . esc_html( $file ) . ' file was found. The file could expose your websites\'s source code.', 'wpscan' ), 'high', sanitize_title( $file ), 'https://blog.wpscan.com/2021/03/23/wordpress-version-control-files.html' ); + } + } + } + } +} diff --git a/wp-content/plugins/wpscan/security-checks/weak-passwords/assets/passwords.txt b/wp-content/plugins/wpscan/security-checks/weak-passwords/assets/passwords.txt new file mode 100644 index 00000000..0690aabc --- /dev/null +++ b/wp-content/plugins/wpscan/security-checks/weak-passwords/assets/passwords.txt @@ -0,0 +1,208 @@ +123456 +password +123456789 +12345678 +12345 +qwerty +123123 +111111 +abc123 +1234567 +dragon +1q2w3e4r +sunshine +654321 +master +1234 +football +1234567890 +000000 +computer +666666 +superman +michael +internet +iloveyou +daniel +1qaz2wsx +monkey +shadow +jessica +letmein +baseball +whatever +princess +abcd1234 +123321 +starwars +121212 +thomas +zxcvbnm +trustno1 +killer +welcome +jordan +aaaaaa +123qwe +freedom +password1 +charlie +batman +jennifer +7777777 +michelle +diamond +oliver +mercedes +benjamin +11111111 +snoopy +samantha +victoria +matrix +george +alexander +secret +cookie +asdfgh +987654321 +123abc +orange +fuckyou +asdf1234 +pepper +hunter +silver +joshua +banana +1q2w3e +chelsea +1234qwer +summer +qwertyuiop +phoenix +andrew +q1w2e3r4 +elephant +rainbow +mustang +merlin +london +garfield +robert +chocolate +112233 +samsung +qazwsx +matthew +buster +jonathan +ginger +flower +555555 +test +caroline +amanda +maverick +midnight +martin +junior +88888888 +anthony +jasmine +creative +patrick +mickey +123 +qwerty123 +cocacola +chicken +passw0rd +forever +william +nicole +hello +yellow +nirvana +justin +friends +cheese +tigger +mother +liverpool +blink182 +asdfghjkl +andrea +spider +scooter +richard +soccer +rachel +purple +morgan +melissa +jackson +arsenal +222222 +qwe123 +gabriel +ferrari +jasper +danielle +bandit +angela +scorpion +prince +maggie +austin +veronica +nicholas +monster +dexter +carlos +thunder +success +hannah +ashley +131313 +stella +brandon +pokemon +joseph +asdfasdf +999999 +metallica +december +chester +taylor +sophie +samuel +rabbit +crystal +barney +xxxxxx +steven +ranger +patricia +christian +asshole +spiderman +sandra +hockey +angels +security +parker +heather +888888 +victor +harley +333333 +system +slipknot +november +jordan23 +canada +tennis +qwertyui +casper +admin diff --git a/wp-content/plugins/wpscan/security-checks/weak-passwords/check.php b/wp-content/plugins/wpscan/security-checks/weak-passwords/check.php new file mode 100644 index 00000000..1bb508a2 --- /dev/null +++ b/wp-content/plugins/wpscan/security-checks/weak-passwords/check.php @@ -0,0 +1,96 @@ +get_vulnerabilities(); + + // Password list from: https://github.com/danielmiessler/SecLists/blob/master/Passwords/probable-v2-top207.txt. + $users = get_users( array( 'role__in' => array( 'super_admin', 'administrator', 'editor', 'author', 'contributor' ) ) ); + $passwords = file( $this->dir . '/assets/passwords.txt', FILE_IGNORE_NEW_LINES ); + $found = array(); + + foreach ( $users as $user ) { + $username = $user->user_login; + + foreach ( $passwords as $password ) { + if ( wp_check_password( $password, $user->data->user_pass, $user->ID ) ) { + array_push( $found, $username ); + break; + } + } + } + + if ( ! empty( $found ) ) { + if ( 1 === count( $found ) ) { + $text = sprintf( + __( 'The %s user was found to have a weak password. The user\'s password should be updated immediately.', 'wpscan' ), + esc_html( $found[0] ) + ); + } else { + $found = implode( ', ', $found ); + $text = sprintf( + __( 'The %s users were found to have weak passwords. The users\' passwords should be updated immediately.', 'wpscan' ), + esc_html( $found ) + ); + } + + $this->add_vulnerability( $text, 'high', 'weak-passwords', 'https://blog.wpscan.com/wpscan/2019/09/17/wpscan-brute-force.html' ); + } + } +} diff --git a/wp-content/plugins/wpscan/security-checks/wpconfig-backups/check.php b/wp-content/plugins/wpscan/security-checks/wpconfig-backups/check.php new file mode 100644 index 00000000..c16e591a --- /dev/null +++ b/wp-content/plugins/wpscan/security-checks/wpconfig-backups/check.php @@ -0,0 +1,81 @@ +get_vulnerabilities(); + + $config_files = str_replace( ABSPATH, '', glob( ABSPATH . 'wp-config.*' ) ); + + foreach ( $config_files as $config_file ) { + if ( 'wp-config.php' === $config_file ) continue; // Ignore wp-config.php file. + + $path = ABSPATH . $config_file; + $url = esc_url( get_site_url() . '/' . $config_file ); + + if ( file_exists( $path ) ) { + $response = wp_remote_head( $url, array( 'timeout' => 5 ) ); + $code = wp_remote_retrieve_response_code( $response ); + + if ( 200 === $code ) { + $this->add_vulnerability( __( 'A publicly accessible wp-config.php backup file was found in', 'wpscan' ) . " $url.", 'high', sanitize_title( $path ), 'https://blog.wpscan.com/2021/04/01/wordpress-wp-config-backup-file.html' ); + } + } + } + } +} diff --git a/wp-content/plugins/wpscan/security-checks/xmlrpc-enabled/check.php b/wp-content/plugins/wpscan/security-checks/xmlrpc-enabled/check.php new file mode 100644 index 00000000..41392cef --- /dev/null +++ b/wp-content/plugins/wpscan/security-checks/xmlrpc-enabled/check.php @@ -0,0 +1,91 @@ +get_vulnerabilities(); + $url = get_site_url() . '/xmlrpc.php'; + + // First check if the xmlrpc.php file returns a 405 code. + $is_available = wp_remote_get( $url, array( 'timeout' => 5 ) ); + $is_available_code = wp_remote_retrieve_response_code( $is_available ); + + if ( 405 !== $is_available_code ) return; + + // Try an authenticated request. + $authenticated_body = 'wp.getUsers1usernamepassword'; + $authenticated_response = wp_remote_post( $url, array( 'body' => $authenticated_body ) ); + + if ( is_wp_error( $authenticated_response ) ) { + // The authenticated_response returned a WP_Error. + error_log( $authenticated_response->get_error_message() ); + } else { + if ( preg_match( '/Incorrect username or password.<\/string>/', $authenticated_response['body'] ) ) { + $this->add_vulnerability( __( 'The XML-RPC interface is enabled. This significantly increases your site\'s attack surface.', 'wpscan' ), 'medium', sanitize_title( $url ), 'https://blog.wpscan.com/2021/01/25/wordpress-xmlrpc-security.html' ); + return; + } else { + // Try an unauthenticated request. + $unauthenticated_body = 'demo.sayHello'; + $unauthenticated_response = wp_remote_post( $url, array( 'body' => $unauthenticated_body ) ); + + if ( preg_match( '/Hello!<\/string>/', $unauthenticated_response['body'] ) ) { + $this->add_vulnerability( __( 'The XML-RPC interface is partly disabled, but still allows unauthenticated requests.', 'wpscan' ), 'low', sanitize_title( $url ), 'https://blog.wpscan.com/2021/01/25/wordpress-xmlrpc-security.html' ); + } + } + } + } +} diff --git a/wp-content/plugins/wpscan/uninstall.php b/wp-content/plugins/wpscan/uninstall.php new file mode 100644 index 00000000..08209615 --- /dev/null +++ b/wp-content/plugins/wpscan/uninstall.php @@ -0,0 +1,29 @@ +get_results( "SELECT blog_id FROM {$wpdb->blogs}", ARRAY_A ); + if ( $blogs ) { + foreach ( $blogs as $blog ) { + switch_to_blog( $blog['blog_id'] ); + foreach ( wp_load_alloptions() as $option => $value ) { + if ( strpos( $option, 'wpscan_' ) === 0 ) { + delete_option( $option ); + } + } + } + restore_current_blog(); + } +} else { + foreach ( wp_load_alloptions() as $option => $value ) { + if ( strpos( $option, 'wpscan_' ) === 0 ) { + delete_option( $option ); + } + } +} diff --git a/wp-content/plugins/wpscan/vendor/autoload.php b/wp-content/plugins/wpscan/vendor/autoload.php new file mode 100644 index 00000000..46f3a809 --- /dev/null +++ b/wp-content/plugins/wpscan/vendor/autoload.php @@ -0,0 +1,7 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see http://www.php-fig.org/psr/psr-0/ + * @see http://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + // PSR-4 + private $prefixLengthsPsr4 = array(); + private $prefixDirsPsr4 = array(); + private $fallbackDirsPsr4 = array(); + + // PSR-0 + private $prefixesPsr0 = array(); + private $fallbackDirsPsr0 = array(); + + private $useIncludePath = false; + private $classMap = array(); + private $classMapAuthoritative = false; + private $missingClasses = array(); + private $apcuPrefix; + + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', $this->prefixesPsr0); + } + + return array(); + } + + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 base directories + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + } + + /** + * Unregisters this instance as an autoloader. + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return bool|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + includeFile($file); + + return true; + } + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + */ +function includeFile($file) +{ + include $file; +} diff --git a/wp-content/plugins/wpscan/vendor/composer/LICENSE b/wp-content/plugins/wpscan/vendor/composer/LICENSE new file mode 100644 index 00000000..f27399a0 --- /dev/null +++ b/wp-content/plugins/wpscan/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/wp-content/plugins/wpscan/vendor/composer/autoload_classmap.php b/wp-content/plugins/wpscan/vendor/composer/autoload_classmap.php new file mode 100644 index 00000000..7a91153b --- /dev/null +++ b/wp-content/plugins/wpscan/vendor/composer/autoload_classmap.php @@ -0,0 +1,9 @@ + array($baseDir . '/app'), +); diff --git a/wp-content/plugins/wpscan/vendor/composer/autoload_real.php b/wp-content/plugins/wpscan/vendor/composer/autoload_real.php new file mode 100644 index 00000000..136733f2 --- /dev/null +++ b/wp-content/plugins/wpscan/vendor/composer/autoload_real.php @@ -0,0 +1,55 @@ += 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); + if ($useStaticLoader) { + require_once __DIR__ . '/autoload_static.php'; + + call_user_func(\Composer\Autoload\ComposerStaticInit0c863ce01900e71a6f32c7e450b49179::getInitializer($loader)); + } else { + $map = require __DIR__ . '/autoload_namespaces.php'; + foreach ($map as $namespace => $path) { + $loader->set($namespace, $path); + } + + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } + + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + } + + $loader->register(true); + + return $loader; + } +} diff --git a/wp-content/plugins/wpscan/vendor/composer/autoload_static.php b/wp-content/plugins/wpscan/vendor/composer/autoload_static.php new file mode 100644 index 00000000..c8ca56d7 --- /dev/null +++ b/wp-content/plugins/wpscan/vendor/composer/autoload_static.php @@ -0,0 +1,31 @@ + + array ( + 'WPScan\\' => 7, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'WPScan\\' => + array ( + 0 => __DIR__ . '/../..' . '/app', + ), + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInit0c863ce01900e71a6f32c7e450b49179::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit0c863ce01900e71a6f32c7e450b49179::$prefixDirsPsr4; + + }, null, ClassLoader::class); + } +} diff --git a/wp-content/plugins/wpscan/vendor/composer/installed.json b/wp-content/plugins/wpscan/vendor/composer/installed.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/wp-content/plugins/wpscan/vendor/composer/installed.json @@ -0,0 +1 @@ +[] diff --git a/wp-content/plugins/wpscan/views/deactivate.php b/wp-content/plugins/wpscan/views/deactivate.php new file mode 100644 index 00000000..ccd2f396 --- /dev/null +++ b/wp-content/plugins/wpscan/views/deactivate.php @@ -0,0 +1,14 @@ +
+
+

+ +
+

+
+ + +
+
diff --git a/wp-content/plugins/wpscan/views/report.php b/wp-content/plugins/wpscan/views/report.php new file mode 100644 index 00000000..9f20c807 --- /dev/null +++ b/wp-content/plugins/wpscan/views/report.php @@ -0,0 +1,220 @@ +parent->OPT_IGNORE_ITEMS, []); + $ignored_msg = __('Ignored from the settings', 'wpscan'); +?> + +
+

+ parent->plugin_dir. 'assets/svg/logo.svg'); ?> +

+ +
+ + parent->is_interval_scanning_disabled() ) : ?> +
+

WPSCAN_DISABLE_SCANNING_INTERVAL constant. You can still run scans manually.', 'wpscan') ?>

+
+ + + parent->WPSCAN_TRANSIENT_CRON ) ) : ?> +
+

+
+ + + + +
+ +
+ +
+ +
+ +
+

+ + + + + + + + + + + + + + + + +
 
+ get_status( 'wordpress', get_bloginfo( 'version' ) ) ?> + WordPress + + %s', 'wpscan' ), get_bloginfo( 'version' ) ) ?> + + + list_api_vulnerabilities( 'wordpress', get_bloginfo( 'version' ) ); + } else { + echo $ignored_msg; + } + ?> +
+
+ +
+

+ + + + + + + + + + + $details ) { + $slug = $this->parent->get_plugin_slug( $name, $details ); + $is_closed = $this->is_item_closed('plugins', $slug); + ?> + + + + + + + + +
 
+ get_status( 'plugins', $slug ) ?> + + + + %s', 'wpscan' ), esc_html($details['Version']) ) ?> + + + Plugin Closed + + + list_api_vulnerabilities( 'plugins', $slug ); + } + else { + echo $ignored_msg; + } + ?> +
+ +
+ +
+

+ + + + + + + + + + + $details ): + $slug = $this->parent->get_theme_slug( $name, $details ); + $is_closed = $this->is_item_closed('themes', $slug); + ?> + + + + + + + +
 
+ get_status( 'themes', $slug ) ?> + + + %s', 'wpscan' ), esc_html($details['Version']) ) ?> + + + Theme Closed + + + list_api_vulnerabilities( 'themes', $slug ); + else { + echo $ignored_msg; + } + ?> +
+ +
+ +
+

+ + + + + + + + + + + + parent->classes['checks/system']->checks as $id => $data ) : ?> + + + + + + + + + +
+ get_status('security-checks', $id) ?> + + title()) ?> + + + parent->classes['checks/system']->list_check_vulnerabilities( $data['instance'] ) ?> + + parent->classes['checks/system']->list_actions($data['instance']) ?> + +
+
+ + parent->OPT_API_TOKEN ) ) { ?> + + + +
+ +
+ +
+ + +
+ +
+ +
+ +
+ +
\ No newline at end of file diff --git a/wp-content/plugins/wpscan/wpscan.php b/wp-content/plugins/wpscan/wpscan.php new file mode 100644 index 00000000..5f726694 --- /dev/null +++ b/wp-content/plugins/wpscan/wpscan.php @@ -0,0 +1,38 @@ +