/** * This method will start and check the scan. wp-cron access only. */ public static function checkWpScan() { wssLog(__METHOD__ . '() called.'); $scanState = WsdWPScanSettings::getSetting('SCAN_STATE'); if ($scanState != WsdWPScanSettings::SCAN_STATE_WAITING) { $failReason = "Could not start scan. Invalid scan state provided. Expecting: SCAN_STATE_WAITING (" . WsdWPScanSettings::SCAN_STATE_WAITING . ") received: " . $scanState; wssLog($failReason); WpScan::stopScan(false, $failReason); return false; } //#! Start scan WpScan::startScan(); }
function wssPlugin_shutdown() { $error = error_get_last(); if (!empty($error)) { // Only fatal errors, otherwise it will kill every scan if ($error['type'] === E_ERROR) { if (!empty($error['message'])) { $data = array('type' => $error["type"], 'file' => empty($error["file"]) ? '' : $error["file"], 'line' => empty($error["line"]) ? '' : $error["line"], 'message' => $error["message"]); wssLog(__FUNCTION__ . '() triggered.'); wssLog('Shutdown function called by system.', $data); WpScan::stopScan(false, $data['message']); } } } }