- Added comprehensive AI Assistant system (aiassist/ directory): * Vector search and embedding capabilities * Typebot proxy integration * Elastic search functionality * Message classification and chat history * MCP proxy for external integrations - Implemented Court Status API (GetCourtStatus.php): * Real-time court document status checking * Integration with external court systems * Comprehensive error handling and logging - Enhanced S3 integration: * Improved file backup system with metadata * Batch processing capabilities * Enhanced error logging and recovery * Copy operations with URL fixing - Added Telegram contact creation API - Improved error logging across all modules - Enhanced callback system for AI responses - Extensive backup file storage with timestamps - Updated documentation and README files - File storage improvements: * Thousands of backup files with proper metadata * Fix operations for broken file references * Project-specific backup and recovery systems * Comprehensive file integrity checking Total: 26,461+ files added/modified including AWS SDK, vendor dependencies, and extensive backup system.
158 lines
2.7 KiB
PHP
158 lines
2.7 KiB
PHP
<?php
|
|
// Session Encryption by Ari Kuorikoski <ari.kuorikoski@finebyte.com>
|
|
class MD5Crypt{
|
|
function keyED($txt,$encrypt_key)
|
|
{
|
|
$encrypt_key = md5($encrypt_key);
|
|
$ctr=0;
|
|
$tmp = "";
|
|
for ($i=0;$i<strlen($txt);$i++){
|
|
if ($ctr==strlen($encrypt_key)) $ctr=0;
|
|
$tmp.= substr($txt,$i,1) ^ substr($encrypt_key,$ctr,1);
|
|
$ctr++;
|
|
}
|
|
return $tmp;
|
|
}
|
|
|
|
function Encrypt($txt,$key)
|
|
{
|
|
srand((double)microtime()*1000000);
|
|
$encrypt_key = md5(rand(0,32000));
|
|
$ctr=0;
|
|
$tmp = "";
|
|
for ($i=0;$i<strlen($txt);$i++)
|
|
{
|
|
if ($ctr==strlen($encrypt_key)) $ctr=0;
|
|
$tmp.= substr($encrypt_key,$ctr,1) .
|
|
(substr($txt,$i,1) ^ substr($encrypt_key,$ctr,1));
|
|
$ctr++;
|
|
}
|
|
return base64_encode($this->keyED($tmp,$key));
|
|
}
|
|
|
|
function Decrypt($txt,$key)
|
|
{
|
|
$txt = $this->keyED(base64_decode($txt),$key);
|
|
$tmp = "";
|
|
for ($i=0;$i<strlen($txt);$i++){
|
|
$md5 = substr($txt,$i,1);
|
|
$i++;
|
|
$tmp.= (substr($txt,$i,1) ^ $md5);
|
|
}
|
|
return $tmp;
|
|
}
|
|
|
|
function RandPass()
|
|
{
|
|
$randomPassword = "";
|
|
srand((double)microtime()*1000000);
|
|
for($i=0;$i<8;$i++)
|
|
{
|
|
$randnumber = rand(48,120);
|
|
|
|
while (($randnumber >= 58 && $randnumber <= 64) || ($randnumber >= 91 && $randnumber <= 96))
|
|
{
|
|
$randnumber = rand(48,120);
|
|
}
|
|
|
|
$randomPassword .= chr($randnumber);
|
|
}
|
|
return $randomPassword;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
class SHA1Crypt{
|
|
function keyED($txt,$encrypt_key)
|
|
{
|
|
|
|
$encrypt_key = sha1($encrypt_key);
|
|
$ctr=0;
|
|
$tmp = "";
|
|
|
|
for ($i=0;$i<strlen($txt);$i++){
|
|
if ($ctr==strlen($encrypt_key)) $ctr=0;
|
|
$tmp.= substr($txt,$i,1) ^ substr($encrypt_key,$ctr,1);
|
|
$ctr++;
|
|
}
|
|
return $tmp;
|
|
|
|
}
|
|
|
|
function Encrypt($txt,$key)
|
|
{
|
|
|
|
srand((double)microtime()*1000000);
|
|
$encrypt_key = sha1(rand(0,32000));
|
|
$ctr=0;
|
|
$tmp = "";
|
|
|
|
for ($i=0;$i<strlen($txt);$i++)
|
|
|
|
{
|
|
|
|
if ($ctr==strlen($encrypt_key)) $ctr=0;
|
|
|
|
$tmp.= substr($encrypt_key,$ctr,1) .
|
|
|
|
(substr($txt,$i,1) ^ substr($encrypt_key,$ctr,1));
|
|
|
|
$ctr++;
|
|
|
|
}
|
|
|
|
return base64_encode($this->keyED($tmp,$key));
|
|
|
|
}
|
|
|
|
|
|
|
|
function Decrypt($txt,$key)
|
|
{
|
|
|
|
$txt = $this->keyED(base64_decode($txt),$key);
|
|
|
|
$tmp = "";
|
|
|
|
for ($i=0;$i<strlen($txt);$i++){
|
|
|
|
$sha1 = substr($txt,$i,1);
|
|
|
|
$i++;
|
|
|
|
$tmp.= (substr($txt,$i,1) ^ $sha1);
|
|
|
|
}
|
|
|
|
return $tmp;
|
|
}
|
|
|
|
|
|
|
|
function RandPass()
|
|
{
|
|
$randomPassword = "";
|
|
srand((double)microtime()*1000000);
|
|
|
|
for($i=0;$i<8;$i++)
|
|
{
|
|
|
|
$randnumber = rand(48,120);
|
|
|
|
while (($randnumber >= 58 && $randnumber <= 64) || ($randnumber >= 91 && $randnumber <= 96))
|
|
{
|
|
$randnumber = rand(48,120);
|
|
}
|
|
|
|
$randomPassword .= chr($randnumber);
|
|
}
|
|
|
|
return $randomPassword;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|