new ACHWPA_Scan_Bootstrap(), 'MU-plugin' => new ACHWPA_Scan_MUPlugins(), 'Database' => new ACHWPA_Scan_Database(), 'Cron' => new ACHWPA_Scan_Cron(), '.htaccess' => new ACHWPA_Scan_Htaccess(), 'Users' => new ACHWPA_Scan_Users(), 'REST' => new ACHWPA_Scan_REST(), ); } public function run_stage( $category ) { $map = self::scanner_map(); if ( ! isset( $map[ $category ] ) ) { return array(); } $result = $map[ $category ]->run(); if ( empty( $result ) ) { return array( $this->pass_finding( $category ) ); } return $result; } public function correlate( array $findings ) { $correlator = new ACHWPA_Correlation(); $correlations = $correlator->run( $findings ); if ( empty( $correlations ) ) { return array( new ACHWPA_Finding( array( 'category' => 'Correlation', 'level' => 'Pass', 'indicator' => __( 'No cross-layer correlation detected', 'aiutocomputerhelp-persistence-audit' ), 'explanation' => __( 'No shared artifact or meaningful identifier was observed across multiple persistence layers in this scan.', 'aiutocomputerhelp-persistence-audit' ), ) ), ); } return $correlations; } public function pass_finding( $category ) { return new ACHWPA_Finding( array( 'category' => $category, 'level' => 'Pass', 'location' => '', 'indicator' => __( 'No notable persistence indicator detected', 'aiutocomputerhelp-persistence-audit' ), 'explanation' => __( 'The current read-only checks completed without producing a notable finding in this category.', 'aiutocomputerhelp-persistence-audit' ), ) ); } public function run( $filesystem_budget = 6000 ) { $started = microtime( true ); $findings = array(); foreach ( array_keys( self::scanner_map() ) as $category ) { $findings = array_merge( $findings, $this->run_stage( $category ) ); } $filesystem = new ACHWPA_Scan_Filesystem(); $fs = $filesystem->run( $filesystem_budget ); $findings = array_merge( $findings, empty( $fs ) ? array( $this->pass_finding( 'Filesystem' ) ) : $fs ); $findings = array_merge( $findings, $this->correlate( $findings ) ); return array( 'version' => ACHWPA_VERSION, 'generated_at' => gmdate( 'c' ), 'duration_ms' => (int) round( ( microtime( true ) - $started ) * 1000 ), 'findings' => $findings, ); } }