Changeset 3135233
- Timestamp:
- 08/14/2024 03:37:17 AM (16 months ago)
- Location:
- wpscan
- Files:
-
- 12 edited
- 1 copied
-
tags/1.16 (copied) (copied from wpscan/trunk)
-
tags/1.16/app/Notification.php (modified) (8 diffs)
-
tags/1.16/app/Plugin.php (modified) (1 diff)
-
tags/1.16/assets/js/download-report.js (modified) (1 diff)
-
tags/1.16/readme.txt (modified) (2 diffs)
-
tags/1.16/views/report.php (modified) (1 diff)
-
tags/1.16/wpscan.php (modified) (1 diff)
-
trunk/app/Notification.php (modified) (8 diffs)
-
trunk/app/Plugin.php (modified) (1 diff)
-
trunk/assets/js/download-report.js (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/views/report.php (modified) (1 diff)
-
trunk/wpscan.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wpscan/tags/1.16/app/Notification.php
r2529086 r3135233 17 17 private $page; 18 18 19 /** @var Plugin $parent */ 20 private $parent; 21 19 22 /** 20 23 * Class constructor. … … 43 46 $total = $this->parent->get_total(); 44 47 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 47 52 48 53 $section = $this->page . '_section'; … … 63 68 ); 64 69 70 $webhook_section = $this->page . '_webhook_section'; 71 add_settings_section( $webhook_section, null, array( $this, 'webhook_intro' ), $this->page ); 65 72 add_settings_field( 66 $this->parent->OPT_ INTERVAL,73 $this->parent->OPT_WEBHOOK, 67 74 __( 'Send Alerts', 'wpscan' ), 68 array( $this, 'field_ interval' ),75 array( $this, 'field_webhook' ), 69 76 $this->page, 70 $ section77 $webhook_section 71 78 ); 72 79 } … … 117 124 */ 118 125 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>'; 120 127 } 121 128 … … 161 168 162 169 /** 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 /** 163 196 * Sanitize email 164 197 * … … 201 234 202 235 /** 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 /** 203 254 * Send the notification 204 255 * … … 212 263 } 213 264 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 } 216 274 217 275 // Check email or if notifications are disabled. … … 302 360 } 303 361 } 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 304 379 305 380 /** -
wpscan/tags/1.16/app/Plugin.php
r2982148 r3135233 28 28 public $OPT_INTERVAL = 'wpscan_interval'; 29 29 public $OPT_IGNORED = 'wpscan_ignored'; 30 public $OPT_WEBHOOK = 'wpscan_webhook'; 30 31 31 32 // Report. -
wpscan/tags/1.16/assets/js/download-report.js
r2540542 r3135233 485 485 486 486 // Download 487 $('.download- report').on('click', function () {487 $('.download-pdf-report').on('click', function () { 488 488 let dt = new Date().toJSON().slice(0, 10); 489 489 // pdfMake.createPdf(wpscanReport).open(); -
wpscan/tags/1.16/readme.txt
r2982148 r3135233 3 3 Tags: wpscan, wpvulndb, security, vulnerability, hack, scan, exploit, secure, alerts 4 4 Requires at least: 3.4 5 Tested up to: 6. 3.26 Stable tag: 1.1 5.75 Tested up to: 6.6 6 Stable tag: 1.16 7 7 Requires PHP: 5.5 8 8 License: GPLv3 … … 92 92 93 93 == Changelog == 94 95 = 1.16 = 96 * Allow report to be POST-ed to webhook URL or downloaded as JSON. 94 97 95 98 = 1.15.7 = -
wpscan/tags/1.16/views/report.php
r2559208 r3135233 201 201 202 202 <?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> 204 208 <?php } ?> 205 209 -
wpscan/tags/1.16/wpscan.php
r2982148 r3135233 4 4 * Plugin URI: http://wordpress.org/plugins/wpscan/ 5 5 * Description: WPScan WordPress Security Scanner. Scans your system for security vulnerabilities listed in the WPScan Vulnerability Database. 6 * Version: 1.1 5.76 * Version: 1.16 7 7 * Author: WPScan Team 8 8 * Author URI: https://wpscan.com/ -
wpscan/trunk/app/Notification.php
r2529086 r3135233 17 17 private $page; 18 18 19 /** @var Plugin $parent */ 20 private $parent; 21 19 22 /** 20 23 * Class constructor. … … 43 46 $total = $this->parent->get_total(); 44 47 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 47 52 48 53 $section = $this->page . '_section'; … … 63 68 ); 64 69 70 $webhook_section = $this->page . '_webhook_section'; 71 add_settings_section( $webhook_section, null, array( $this, 'webhook_intro' ), $this->page ); 65 72 add_settings_field( 66 $this->parent->OPT_ INTERVAL,73 $this->parent->OPT_WEBHOOK, 67 74 __( 'Send Alerts', 'wpscan' ), 68 array( $this, 'field_ interval' ),75 array( $this, 'field_webhook' ), 69 76 $this->page, 70 $ section77 $webhook_section 71 78 ); 72 79 } … … 117 124 */ 118 125 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>'; 120 127 } 121 128 … … 161 168 162 169 /** 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 /** 163 196 * Sanitize email 164 197 * … … 201 234 202 235 /** 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 /** 203 254 * Send the notification 204 255 * … … 212 263 } 213 264 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 } 216 274 217 275 // Check email or if notifications are disabled. … … 302 360 } 303 361 } 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 304 379 305 380 /** -
wpscan/trunk/app/Plugin.php
r2982148 r3135233 28 28 public $OPT_INTERVAL = 'wpscan_interval'; 29 29 public $OPT_IGNORED = 'wpscan_ignored'; 30 public $OPT_WEBHOOK = 'wpscan_webhook'; 30 31 31 32 // Report. -
wpscan/trunk/assets/js/download-report.js
r2540542 r3135233 485 485 486 486 // Download 487 $('.download- report').on('click', function () {487 $('.download-pdf-report').on('click', function () { 488 488 let dt = new Date().toJSON().slice(0, 10); 489 489 // pdfMake.createPdf(wpscanReport).open(); -
wpscan/trunk/readme.txt
r2982148 r3135233 3 3 Tags: wpscan, wpvulndb, security, vulnerability, hack, scan, exploit, secure, alerts 4 4 Requires at least: 3.4 5 Tested up to: 6. 3.26 Stable tag: 1.1 5.75 Tested up to: 6.6 6 Stable tag: 1.16 7 7 Requires PHP: 5.5 8 8 License: GPLv3 … … 92 92 93 93 == Changelog == 94 95 = 1.16 = 96 * Allow report to be POST-ed to webhook URL or downloaded as JSON. 94 97 95 98 = 1.15.7 = -
wpscan/trunk/views/report.php
r2559208 r3135233 201 201 202 202 <?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> 204 208 <?php } ?> 205 209 -
wpscan/trunk/wpscan.php
r2982148 r3135233 4 4 * Plugin URI: http://wordpress.org/plugins/wpscan/ 5 5 * Description: WPScan WordPress Security Scanner. Scans your system for security vulnerabilities listed in the WPScan Vulnerability Database. 6 * Version: 1.1 5.76 * Version: 1.16 7 7 * Author: WPScan Team 8 8 * Author URI: https://wpscan.com/
Note: See TracChangeset
for help on using the changeset viewer.