PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /home/trave494/mytube.pm/wp-content/plugins/wp-simple-firewall/src/lib/src/Scans/Wpv/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : /home/trave494/mytube.pm/wp-content/plugins/wp-simple-firewall/src/lib/src/Scans/Wpv/Scan.php

<?php

namespace FernleafSystems\Wordpress\Plugin\Shield\Scans\Wpv;

use FernleafSystems\Wordpress\Plugin\Shield;
use FernleafSystems\Wordpress\Services\Services;
use FernleafSystems\Wordpress\Services\Utilities\Integrations\WpHashes\Vulnerabilities;

class Scan extends Shield\Scans\Base\BaseScan {

	protected function scanSlice() {
		/** @var ScanActionVO $action */
		$action = $this->getScanActionVO();
		$tmpResults = $action->getNewResultsSet();

		$copier = new Shield\Scans\Helpers\CopyResultsSets();
		foreach ( $action->items as $file => $context ) {
			$results = $this->scanItem( $context, $file );
			if ( $results instanceof Shield\Scans\Base\ResultsSet ) {
				$copier->copyTo( $results, $tmpResults );
			}
		}
		$items = [];
		if ( $tmpResults->hasItems() ) {
			foreach ( $tmpResults->getAllItems() as $item ) {
				$items[] = $item->getRawData();
			}
		}
		$action->results = $items;
	}

	/**
	 * @param string $context
	 * @param string $file
	 * @return ResultsSet
	 */
	protected function scanItem( $context, $file ) {
		$results = new ResultsSet();

		$sApiToken = $this->getCon()
						  ->getModule_License()
						  ->getWpHashesTokenManager()
						  ->getToken();

		if ( $context == 'plugins' ) {
			$WPP = Services::WpPlugins();
			$slug = $WPP->getSlug( $file );
			if ( empty( $slug ) ) {
				$slug = dirname( $file );
			}
			$version = $WPP->getPluginAsVo( $file )->Version;
			$lookerUpper = new Vulnerabilities\Plugin( $sApiToken );
		}
		else {
			$slug = $file;
			$version = Services::WpThemes()->getTheme( $slug )->get( 'Version' );
			$lookerUpper = new Vulnerabilities\Theme( $sApiToken );
		}

		$rawVuls = $lookerUpper->getVulnerabilities( $slug, $version );
		if ( is_array( $rawVuls ) && !empty( $rawVuls[ 'meta' ] ) && $rawVuls[ 'meta' ][ 'total' ] > 0 ) {

			foreach ( array_filter( $rawVuls[ 'vulnerabilities' ] ) as $vul ) {
				$VO = ( new Shield\Scans\Wpv\WpVulnDb\VulnVO() )->applyFromArray( $vul );
				$VO->provider = $rawVuls[ 'meta' ][ 'provider' ];

				$item = new ResultItem();
				$item->slug = $file;
				$item->context = $context;
				$item->wpvuln_id = $VO->id;
				$item->wpvuln_vo = $VO->getRawData();

				$results->addItem( $item );
			}
		}

		return $results;
	}
}