Plugin Directory

Changeset 3135233


Ignore:
Timestamp:
08/14/2024 03:37:17 AM (16 months ago)
Author:
njweller
Message:

New 1.16 version release

Location:
wpscan
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • wpscan/tags/1.16/app/Notification.php

    r2529086 r3135233  
    1717    private $page;
    1818
     19    /** @var Plugin $parent */
     20    private $parent;
     21
    1922    /**
    2023     * Class constructor.
     
    4346        $total = $this->parent->get_total();
    4447
    45         register_setting( $this->page, $this->parent->OPT_EMAIL, array( $this, 'sanitize_email' ) );
    46         register_setting( $this->page, $this->parent->OPT_INTERVAL, array( $this, 'sanitize_interval' ) );
     48        \register_setting( $this->page, $this->parent->OPT_EMAIL, array( $this, 'sanitize_email' ) );
     49        \register_setting( $this->page, $this->parent->OPT_INTERVAL, array( $this, 'sanitize_interval' ) );
     50        \register_setting( $this->page, $this->parent->OPT_WEBHOOK, array( $this, 'sanitize_url' ) );
     51
    4752
    4853        $section = $this->page . '_section';
     
    6368        );
    6469
     70        $webhook_section = $this->page . '_webhook_section';
     71        add_settings_section( $webhook_section, null, array( $this, 'webhook_intro' ), $this->page );
    6572        add_settings_field(
    66             $this->parent->OPT_INTERVAL,
     73            $this->parent->OPT_WEBHOOK,
    6774            __( 'Send Alerts', 'wpscan' ),
    68             array( $this, 'field_interval' ),
     75            array( $this, 'field_webhook' ),
    6976            $this->page,
    70             $section
     77            $webhook_section
    7178        );
    7279    }
     
    117124     */
    118125    public function introduction() {
    119         echo '<p>' . __( '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' ) . '</p>';
     126        echo '<p>' . __( 'Enter one or more email addresses (separated by a comma) to be notified by email about new vulnerabilities.', 'wpscan' ) . '</p>';
    120127    }
    121128
     
    161168
    162169    /**
     170     * Instructions for the webhook setting field
     171     *
     172     * @since 1.0.0
     173     * @access public
     174     * @return string
     175     */
     176    public function webhook_intro() {
     177        echo '<p>' . __( 'Enter a webhook URL to receive report data as JSON.', 'wpscan' ) . '</p>';
     178    }
     179
     180    /**
     181     * Email field
     182     *
     183     * @since 1.0.0
     184     * @access public
     185     * @return string
     186     */
     187    public function field_webhook() {
     188        echo sprintf(
     189            '<input type="text" name="%s" value="%s" class="regular-text" placeholder="https://example.com/wpscan-webhook-receiver">',
     190            esc_attr( $this->parent->OPT_WEBHOOK ),
     191            esc_attr( get_option( $this->parent->OPT_WEBHOOK, '' ) )
     192        );
     193    }
     194
     195    /**
    163196     * Sanitize email
    164197     *
     
    201234
    202235    /**
     236     * Sanitize URL
     237     * @since 1.15.8
     238     * @access public
     239     *
     240     * @param string $value The URL to sanitize
     241     * @return string
     242     */
     243     public function sanitize_url( $value ) {
     244        if ( ! empty( $value ) ) {
     245            if ( ! filter_var( $value, FILTER_VALIDATE_URL ) ) {
     246                add_settings_error( $this->parent->OPT_WEBHOOK, 'invalid-url', __( 'You have entered an invalid webhook URL.', 'wpscan' ) );
     247                $value = '';
     248            }
     249        }
     250        return $value;
     251    }
     252
     253    /**
    203254     * Send the notification
    204255     *
     
    212263        }
    213264
    214         $email    = get_option( $this->parent->OPT_EMAIL );
    215         $interval = get_option( $this->parent->OPT_INTERVAL, 'd' );
     265        $email       = get_option( $this->parent->OPT_EMAIL );
     266        $interval    = get_option( $this->parent->OPT_INTERVAL, 'd' );
     267        $report      = get_option( $this->parent->OPT_REPORT );
     268        $webhook_url = get_option( $this->parent->OPT_WEBHOOK );
     269
     270        // Check if the webhook is set.
     271        if ( ! empty( $webhook_url ) ) {
     272            $this->send_webhook_notification( $webhook_url, $report );
     273        }
    216274
    217275        // Check email or if notifications are disabled.
     
    302360        }
    303361    }
     362
     363    /**
     364     * Send the webhook notification
     365     *
     366     * @since 1.0.0
     367     * @access public
     368     * @return void
     369     */
     370    public function send_webhook_notification( $url, $report ) {
     371        wp_safe_remote_post( $url, array(
     372            'body'    => json_encode( $report ),
     373            'headers' => array(
     374                'Content-Type' => 'application/json',
     375            ),
     376        ) );
     377    }
     378
    304379
    305380    /**
  • wpscan/tags/1.16/app/Plugin.php

    r2982148 r3135233  
    2828    public $OPT_INTERVAL = 'wpscan_interval';
    2929    public $OPT_IGNORED = 'wpscan_ignored';
     30    public $OPT_WEBHOOK = 'wpscan_webhook';
    3031
    3132    // Report.
  • wpscan/tags/1.16/assets/js/download-report.js

    r2540542 r3135233  
    485485
    486486  // Download
    487   $('.download-report').on('click', function () {
     487  $('.download-pdf-report').on('click', function () {
    488488    let dt = new Date().toJSON().slice(0, 10);
    489489    // pdfMake.createPdf(wpscanReport).open();
  • wpscan/tags/1.16/readme.txt

    r2982148 r3135233  
    33Tags: wpscan, wpvulndb, security, vulnerability, hack, scan, exploit, secure, alerts
    44Requires at least: 3.4
    5 Tested up to: 6.3.2
    6 Stable tag: 1.15.7
     5Tested up to: 6.6
     6Stable tag: 1.16
    77Requires PHP: 5.5
    88License: GPLv3
     
    9292
    9393== Changelog ==
     94
     95= 1.16 =
     96* Allow report to be POST-ed to webhook URL or downloaded as JSON.
    9497
    9598= 1.15.7 =
  • wpscan/tags/1.16/views/report.php

    r2559208 r3135233  
    201201       
    202202          <?php if ( get_option( $this->parent->OPT_API_TOKEN ) ) { ?>
    203             <a href="#" class='button button-secondary download-report'><?php _e( 'Download as PDF', 'wpscan' ) ?></a>
     203            <a href="#" class='button button-secondary download-report download-pdf-report'><?php _e( 'Download as PDF', 'wpscan' ) ?></a>
     204          <?php } ?>
     205
     206          <?php if ( get_option( $this->parent->OPT_API_TOKEN ) ) { ?>
     207            <a href="data:application/json,<?php echo esc_attr( urlencode( json_encode( get_option( $this->parent->OPT_REPORT ) ) ) ) ?>" download="report.json" class='button button-secondary download-report'><?php _e( 'Download as Json', 'wpscan' ) ?></a>
    204208          <?php } ?>
    205209       
  • wpscan/tags/1.16/wpscan.php

    r2982148 r3135233  
    44 * Plugin URI:    http://wordpress.org/plugins/wpscan/
    55 * Description:   WPScan WordPress Security Scanner. Scans your system for security vulnerabilities listed in the WPScan Vulnerability Database.
    6  * Version:       1.15.7
     6 * Version:       1.16
    77 * Author:        WPScan Team
    88 * Author URI:    https://wpscan.com/
  • wpscan/trunk/app/Notification.php

    r2529086 r3135233  
    1717    private $page;
    1818
     19    /** @var Plugin $parent */
     20    private $parent;
     21
    1922    /**
    2023     * Class constructor.
     
    4346        $total = $this->parent->get_total();
    4447
    45         register_setting( $this->page, $this->parent->OPT_EMAIL, array( $this, 'sanitize_email' ) );
    46         register_setting( $this->page, $this->parent->OPT_INTERVAL, array( $this, 'sanitize_interval' ) );
     48        \register_setting( $this->page, $this->parent->OPT_EMAIL, array( $this, 'sanitize_email' ) );
     49        \register_setting( $this->page, $this->parent->OPT_INTERVAL, array( $this, 'sanitize_interval' ) );
     50        \register_setting( $this->page, $this->parent->OPT_WEBHOOK, array( $this, 'sanitize_url' ) );
     51
    4752
    4853        $section = $this->page . '_section';
     
    6368        );
    6469
     70        $webhook_section = $this->page . '_webhook_section';
     71        add_settings_section( $webhook_section, null, array( $this, 'webhook_intro' ), $this->page );
    6572        add_settings_field(
    66             $this->parent->OPT_INTERVAL,
     73            $this->parent->OPT_WEBHOOK,
    6774            __( 'Send Alerts', 'wpscan' ),
    68             array( $this, 'field_interval' ),
     75            array( $this, 'field_webhook' ),
    6976            $this->page,
    70             $section
     77            $webhook_section
    7178        );
    7279    }
     
    117124     */
    118125    public function introduction() {
    119         echo '<p>' . __( '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' ) . '</p>';
     126        echo '<p>' . __( 'Enter one or more email addresses (separated by a comma) to be notified by email about new vulnerabilities.', 'wpscan' ) . '</p>';
    120127    }
    121128
     
    161168
    162169    /**
     170     * Instructions for the webhook setting field
     171     *
     172     * @since 1.0.0
     173     * @access public
     174     * @return string
     175     */
     176    public function webhook_intro() {
     177        echo '<p>' . __( 'Enter a webhook URL to receive report data as JSON.', 'wpscan' ) . '</p>';
     178    }
     179
     180    /**
     181     * Email field
     182     *
     183     * @since 1.0.0
     184     * @access public
     185     * @return string
     186     */
     187    public function field_webhook() {
     188        echo sprintf(
     189            '<input type="text" name="%s" value="%s" class="regular-text" placeholder="https://example.com/wpscan-webhook-receiver">',
     190            esc_attr( $this->parent->OPT_WEBHOOK ),
     191            esc_attr( get_option( $this->parent->OPT_WEBHOOK, '' ) )
     192        );
     193    }
     194
     195    /**
    163196     * Sanitize email
    164197     *
     
    201234
    202235    /**
     236     * Sanitize URL
     237     * @since 1.15.8
     238     * @access public
     239     *
     240     * @param string $value The URL to sanitize
     241     * @return string
     242     */
     243     public function sanitize_url( $value ) {
     244        if ( ! empty( $value ) ) {
     245            if ( ! filter_var( $value, FILTER_VALIDATE_URL ) ) {
     246                add_settings_error( $this->parent->OPT_WEBHOOK, 'invalid-url', __( 'You have entered an invalid webhook URL.', 'wpscan' ) );
     247                $value = '';
     248            }
     249        }
     250        return $value;
     251    }
     252
     253    /**
    203254     * Send the notification
    204255     *
     
    212263        }
    213264
    214         $email    = get_option( $this->parent->OPT_EMAIL );
    215         $interval = get_option( $this->parent->OPT_INTERVAL, 'd' );
     265        $email       = get_option( $this->parent->OPT_EMAIL );
     266        $interval    = get_option( $this->parent->OPT_INTERVAL, 'd' );
     267        $report      = get_option( $this->parent->OPT_REPORT );
     268        $webhook_url = get_option( $this->parent->OPT_WEBHOOK );
     269
     270        // Check if the webhook is set.
     271        if ( ! empty( $webhook_url ) ) {
     272            $this->send_webhook_notification( $webhook_url, $report );
     273        }
    216274
    217275        // Check email or if notifications are disabled.
     
    302360        }
    303361    }
     362
     363    /**
     364     * Send the webhook notification
     365     *
     366     * @since 1.0.0
     367     * @access public
     368     * @return void
     369     */
     370    public function send_webhook_notification( $url, $report ) {
     371        wp_safe_remote_post( $url, array(
     372            'body'    => json_encode( $report ),
     373            'headers' => array(
     374                'Content-Type' => 'application/json',
     375            ),
     376        ) );
     377    }
     378
    304379
    305380    /**
  • wpscan/trunk/app/Plugin.php

    r2982148 r3135233  
    2828    public $OPT_INTERVAL = 'wpscan_interval';
    2929    public $OPT_IGNORED = 'wpscan_ignored';
     30    public $OPT_WEBHOOK = 'wpscan_webhook';
    3031
    3132    // Report.
  • wpscan/trunk/assets/js/download-report.js

    r2540542 r3135233  
    485485
    486486  // Download
    487   $('.download-report').on('click', function () {
     487  $('.download-pdf-report').on('click', function () {
    488488    let dt = new Date().toJSON().slice(0, 10);
    489489    // pdfMake.createPdf(wpscanReport).open();
  • wpscan/trunk/readme.txt

    r2982148 r3135233  
    33Tags: wpscan, wpvulndb, security, vulnerability, hack, scan, exploit, secure, alerts
    44Requires at least: 3.4
    5 Tested up to: 6.3.2
    6 Stable tag: 1.15.7
     5Tested up to: 6.6
     6Stable tag: 1.16
    77Requires PHP: 5.5
    88License: GPLv3
     
    9292
    9393== Changelog ==
     94
     95= 1.16 =
     96* Allow report to be POST-ed to webhook URL or downloaded as JSON.
    9497
    9598= 1.15.7 =
  • wpscan/trunk/views/report.php

    r2559208 r3135233  
    201201       
    202202          <?php if ( get_option( $this->parent->OPT_API_TOKEN ) ) { ?>
    203             <a href="#" class='button button-secondary download-report'><?php _e( 'Download as PDF', 'wpscan' ) ?></a>
     203            <a href="#" class='button button-secondary download-report download-pdf-report'><?php _e( 'Download as PDF', 'wpscan' ) ?></a>
     204          <?php } ?>
     205
     206          <?php if ( get_option( $this->parent->OPT_API_TOKEN ) ) { ?>
     207            <a href="data:application/json,<?php echo esc_attr( urlencode( json_encode( get_option( $this->parent->OPT_REPORT ) ) ) ) ?>" download="report.json" class='button button-secondary download-report'><?php _e( 'Download as Json', 'wpscan' ) ?></a>
    204208          <?php } ?>
    205209       
  • wpscan/trunk/wpscan.php

    r2982148 r3135233  
    44 * Plugin URI:    http://wordpress.org/plugins/wpscan/
    55 * Description:   WPScan WordPress Security Scanner. Scans your system for security vulnerabilities listed in the WPScan Vulnerability Database.
    6  * Version:       1.15.7
     6 * Version:       1.16
    77 * Author:        WPScan Team
    88 * Author URI:    https://wpscan.com/
Note: See TracChangeset for help on using the changeset viewer.