uawdijnntqw1x1x1
IP : 18.217.212.222
Hostname : axolotl
Kernel : Linux axolotl 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64
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,
OS : Linux
PATH:
/
var
/
www
/
axolotl
/
data
/
www
/
yar.axolotls.ru
/
bitrix
/
modules
/
imconnector
/
lib
/
connectors
/
imessage.php
/
/
<?php namespace Bitrix\ImConnector\Connectors; use \Bitrix\Main\IO\File, \Bitrix\Main\Security\Cipher, \Bitrix\Main\Localization\Loc; use \Bitrix\ImConnector\Library, \Bitrix\ImConnector\Input\ReceivingMessage; class IMessage extends Base { //User /** * Preparation of new user fields before saving or adding. * * @param array $user An array describing the user. * @return array Given the right format array description user. */ public function preparationNewUserFields($user): array { $fields = $this->getBasicFieldsNewUser($user); $userNumber = $user['id']; if(\CGlobalCounter::Increment($this->idConnector)) { $userNumber = \CGlobalCounter::GetValue($this->idConnector); } $fields['NAME'] = Loc::getMessage('IMCONNECTOR_IMESSAGE_DEFAULT_USER_NAME') . $userNumber; return $fields; } /** * Preparation of user fields before saving or adding. * * @param array $user An array describing the user. * @return array Given the right format array description user. */ public function preparationUserFields($user): array { //The hash of the data return [ 'UF_CONNECTOR_MD5' => md5(serialize($user)) ]; } //File /** * Save file * * @param $file * @return bool|int|mixed|string * @throws \Bitrix\Main\IO\FileNotFoundException */ public function saveFile($file) { $result = false; if (!empty($file['key'])) { $key = $file['key']; $file = ReceivingMessage::downloadFile($file); if($file) { $file = self::getDecryptedFile($file, $key); $result = \CFile::SaveFile( $file, Library::MODULE_ID ); } } return $result; } /** * Returns file array of decrypted file * * @param array $file * @param mixed $key * @return mixed */ protected static function getDecryptedFile($file, $key) { $key = self::convertFileKey($key); $newFile = $file; $content = File::getFileContents($file['tmp_name']); $decryptedContent = self::decryptContent($content, $key); $newFilePath = self::getNewFilePath($file['tmp_name']); File::putFileContents($newFilePath, $decryptedContent); $newFile['tmp_name'] = $newFilePath; return $newFile; } /** * Implements decrypting of aes/ctr-encrypted content * decrypt with AES/CTR/NoPadding algorithm * * @param string $content * @param string $key * @return string */ protected static function decryptContent($content, $key): string { $decryptedContent = openssl_decrypt($content, 'AES-256-CTR', $key, OPENSSL_RAW_DATA, self::getIv()); return $decryptedContent; } /** * Return iv for business chat encryption requirements * * @return string */ protected static function getIv(): string { $iv = '0000000000000000'; $ivLength = strlen($iv); $ivResult = ''; for ($i = 0; $i < $ivLength; $i++) { $ivResult .= chr($iv[$i]); } return $ivResult; } /** * Converts received file key for file decrypt * * @param string $key * @return bool|float|int|string */ protected static function convertFileKey($key) { $result = substr($key, 2); $result = pack('H*', $result); return $result; } /** * Implements encrypting content with aes/ctr * * @param string $content * @param string $key * @return bool|string * @throws \Bitrix\Main\Security\SecurityException */ protected static function encryptContent($content, $key) { $content = base64_encode($content); $cipher = new Cipher(); $decryptedContent = $cipher->encrypt($content, $key); //$decryptedContent = base64_decode($decryptedContent); return $decryptedContent; } /** * Makes new file path from encrypted file path * * @param string $filePath * @return string */ protected static function getNewFilePath($filePath): string { $pointPosition = strrpos($filePath, '.'); $fileName = substr($filePath, 0, $pointPosition); $fileExtension = substr($filePath, $pointPosition); $newFilePath = $fileName . '-decrypted' . $fileExtension; return $newFilePath; } }
/var/www/axolotl/data/www/yar.axolotls.ru/bitrix/modules/imconnector/lib/connectors/imessage.php