| Server IP : 23.111.136.34 / Your IP : 216.73.216.136 Web Server : Apache System : Linux servidor.eurohost.com.br 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : meusitei ( 1072) PHP Version : 5.6.40 Disable Function : show_source, system, shell_exec, passthru, proc_open MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/meusitei/public_html/painel/assets/apicpanel2/src/cPanel/ |
Upload File : |
<?php
namespace cPanel;
/**************************************************************************************
* Copyright (c) 2013, cPanel, Inc. *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without modification, *
* are permitted provided that the following conditions are met: *
* *
* Redistributions of source code must retain the above copyright notice, this list *
* of conditions and the following disclaimer. Redistributions in binary form must *
* reproduce the above copyright notice, this list of conditions and the following *
* disclaimer in the documentation and/or other materials provided with the *
* distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE *
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS *
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN *
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
* PHP implementation of cPanel's LogMeIn.pm by Kevin Mark *
**************************************************************************************/
class LogMeIn {
// The available services with their HTTPS ports
// The available services with their HTTPS ports
private static $servicePorts = array('cpanel' => 2083, 'whm' => 2087, 'webmail' => 2096);
public static function getLoggedInUrl($user, $pass, $hostname, $service, $goto = '/') {
// If no valid service has been given, default to cPanel
$port = isset(self::$servicePorts[$service]) ? self::$servicePorts[$service] : 2083;
$ch = curl_init();
$fields = array('user' => $user, 'pass' => $pass, 'goto_uri' => $goto);
// Sets the POST URL to something like: https://example.com:2083/login/
curl_setopt($ch, CURLOPT_URL, 'https://' . $hostname . ':' . $port . '/login/');
curl_setopt($ch, CURLOPT_POST, true);
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
// Turn our array of fields into a url encoded query string i.e.: ?user=foo&pass=bar
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields));
// RFC 2616 14.10 compliance
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection' => 'close'));
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
// Execute POST query returning both the response headers and content into $page
$page = curl_exec($ch);
//$pageh = curl_getinfo($ch);
curl_close($ch);
$session = $token = array();
// Find the session cookie in the page headers
if(!preg_match('/session=([^\;]+)/', $page, $session)) {
// This will also fail if the login authentication failed. No need to explicitly check for it.
return '1';
}
// Find the cPanel session token in the page content
if(!preg_match('|<META HTTP-EQUIV="refresh"[^>]+URL=/(cpsess\d+)/|i', $page, $token)) {
return '2';
}
// Append the goto_uri to the query string if it's been manually set
$extra = $goto == '/' ? '' : '&goto_uri=' . urlencode($goto);
return 'https://' . $hostname . ':' . $port . '/' . $token[1] . '/login/?session=' . $session[1] . $extra;
/////////
/*
* a:26:{s:3:"url";s:22:"HTTP://62.210.248.210/";s:12:"content_type";s:26:"text/html; charset="utf-8"";s:9:"http_code";i:301;s:11:"header_size";
* i:238;s:12:"request_size";i:111;s:8:"filetime";i:-1;s:17:"ssl_verify_result";i:0;s:14:"redirect_count";i:0;
* s:10:"total_time";d:0.2261130000000000084270368461147882044315338134765625;
* s:15:"namelookup_time";d:0.00011600000000000000068001160258290838100947439670562744140625;
* s:12:"connect_time";d:0.11185299999999999409627804425326758064329624176025390625;
* s:16:"pretransfer_time";d:0.111924999999999996713739847109536640346050262451171875;
* s:11:"size_upload";d:0;s:13:"size_download";d:119;s:14:"speed_download";d:526;
* s:12:"speed_upload";d:0;s:23:"download_content_length";d:119;s:21:"upload_content_length";d:-1;
* s:18:"starttransfer_time";d:0.22605699999999995242205841350369155406951904296875;s:13:"redirect_time";d:0;
* s:12:"redirect_url";s:35:"https://server.eurohost.com.br:2083";s:10:"primary_ip";s:14:"62.210.248.210";
* s:8:"certinfo";a:0:{}s:12:"primary_port";i:2083;s:8:"local_ip";s:15:"104.238.136.221";s:10:"local_port";i:42450;}
*/
}
}