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

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/jiff/app/Http/Middleware/   drwxr-xr-x
Free 13.14 GB of 57.97 GB (22.68%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     LogApiRequests.php (6.07 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
namespace App\Http\Middleware;
use 
GuzzleHttp\Client;

use 
App\Models\Request;
use 
Closure;
use 
Illuminate\Http\Request as HttpRequest;
use 
Illuminate\Support\Facades\Auth;

class 
LogApiRequests
{
    public function 
handle(HttpRequest $requestClosure $next)
    {
        
$excludedRoutes = [
            
'fb_user',
            
'live',
            
'start_live',
            
'end_live',
            
'schedule',
            
'post',
            
'delete_post'
        
];
        
$response $next($request);
        
\Log::info('Middleware executed for route: ' $request->path());

        
app()->instance('acc_response',$response);

        if (
$response->getStatusCode() ==200 && $request->method()=="get") {
            
$res_content="{}";
        }else {
            
$res_content=$response->getContent();
        }
        if (!
in_array($request->path(), $excludedRoutes)) {
            if (
$response->getStatusCode()==200) {
                return 
$response;
            }else if (
$response->getStatusCode()==500){
                return 
response()->json(['error' => 'true''message' =>"Something is Wrong, Please Try Again"],500);
            }else if (
$response->getStatusCode()==402) {
                return 
response()->json(['error' => 'true''message' =>"Bad Request"],400);
            }else{
                return 
response($res_content,$response->getStatusCode());
            }
        }else {
            
// return $response;
            
$data=json_decode($response->getContent(), true);
            if (
$response->getStatusCode()==400) {
                
// return response()->json(["data"=>$data['code']]);
                
return $this->handleFacebookGraphAPIError($data['code']);
            }else if(
$response->getStatusCode()==402){
                return 
response()->json(['error' => 'true''message' =>"Bad Request"],400);
            }else if (
$response->getStatusCode()==500) {
                return 
response()->json(['error' => 'true''message' =>"Something is Wrong, Please Try Again"],500);
            }else {
                return 
$response;
            }
        }
    }
    public function 
terminate($request$response){
        try {
            
$response app('acc_response');
            
// $start = microtime(true);
            // $end = microtime(true);
            // $responseTime = round(($end - $start) * 1000, 2);
            
$responseTime microtime(true) - LUMEN_START;

            
$ipAddress $request->ip();
            
// Make a request to the IP geolocation service
            
$client = new Client();
            
$resp $client->get("http://ip-api.com/json/{$ipAddress}");
            
// Retrieve the response body
            
$body $resp->getBody();
            
// Parse the JSON response
            
$location json_decode($body);
            
// if (Auth::user()->last_country==$location->country) {
            //     //same
            // }else {
            //     //not same
            // }

            
$token="xaat-af523ddf-b600-46aa-a804-cab5d82bcadd";
            
$client = new Client();
            
$headers = [
                
'Authorization' => 'Bearer ' $token,        
                
'Accept'        => 'application/json',
                
// 'X-Foo' => ['Bar', 'Baz'],
                
'X-Axiom-Org-ID' => "jiff-7ijc",
            ];
            
// if ($response->getStatusCode()!==200 || isset($response->original['error'])) {
            
if ($response->getStatusCode() ==200 && $request->method()=="get") {
                
$res_content="{}";
            }else {
                
$res_content=$response->getContent();
            }
            
$res $client->request('POST''https://api.axiom.co/v1/datasets/api_logs/ingest', [ 
                
'headers' => $headers,
                
'json' => [
                    [
                        
'duration_ms' => $responseTime,
                        
'ip_address' => $ipAddress,
                        
'location' =>$location,
                        
'url' => $request->url(),
                        
'path' => $request->path(),
                        
'http_method' => $request->method(),
                        
'request_parameters' => json_encode($request->all()),
                        
'response_code' => $response->getStatusCode() == 402 400 $response->getStatusCode(),
                        
'response_body' => $res_content
                    
]
                ]
            ]);
        } catch (
\Exception $exception) {
            
\Log::info($exception->getMessage());
        }
    }
    private function 
handleFacebookGraphAPIError($errorCode)
    {
        
// $errorCode = $error['code'] ?? null;
        // $errorMessage = $error['message'] ?? 'An error occurred';

        
if(in_array($errorCode,[492,467,463,458,102,190])){
            return 
response()->json(['error' => "true""message"=>'Invalid or expired access token.',"type"=>"token"], 400);
        } else if(
in_array($errorCode,[4,17,341,368])) {
            return 
response()->json(['error' => "true""message"=>'Rate limit reached. Please retry later.',"type"=>"limit"], 400);
        }else if(
in_array($errorCode,[506])) {
            return 
response()->json(['error' => "true""message"=> 'Rate limit reached. Please retry later.',"type"=>"duplicate"], 400);
        }else if(
$errorCode==10 || ($errorCode >= 200 && $errorCode <= 299) ) {
            return 
response()->json(['error' =>"true""message"=>'Something went wrong, please contact with your service proivder''type'=>"admin"], 400);
        }else if(
in_array($errorCode,[100])) {
            return 
response()->json(['error' => "true""message"=> 'Invalid parameter','type'=>"invalid"], 400);
        }else if(
in_array($errorCode,[2500])) {
            return 
response()->json(['error' => "true""message"=> 'Facebook API is currently undergoing maintenance. Please try again later.','type'=>"facebook"], 400);
        }else {
            return 
response()->json(['error' => "true""message"=>'Something went wrong, please try again later.','type'=>"retry"],400);
        }
        
    }
}

?>

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

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

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