AnonSec Shell
Server IP : 172.67.216.113  /  Your IP : 104.23.243.33   [ Reverse IP ]
Web Server : Apache
System : Linux cpanel01wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.59.el6.x86_64 #1 SMP Thu Dec 6 05:11:00 EST 2018 x86_64
User : cp648411 ( 1354)
PHP Version : 7.2.34
Disable Function : NONE
Domains : 0 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/2388321/cwd/3rdparty/roundcube/public_html/plugins/mixpanel_analytics/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /proc/2388321/cwd/3rdparty/roundcube/public_html/plugins/mixpanel_analytics/mixpanel_analytics.php
<?php

/**
* This plugin adds Mixpanel analytics to Roundcube.
**/

class mixpanel_analytics extends rcube_plugin
{
  function enabledGlobally() {
      return file_exists('/var/cpanel/feature_toggles/analytics_ui_includes');
  }

  function versionCheck() {
      $version = file_get_contents('/usr/local/cpanel/version');
      $pieces = explode( ".", $version );

      if ( $pieces[1] >= 117 ) {
          return true;
      }
      return false;
  }

  function getEnvDetails() {
      $cpnatStat = @stat('/var/cpanel/cpnat');
      $isNat = ( $cpnatStat && $cpnatStat[7] );

      $isPrivate = false;
      $mainIp = file_get_contents('/var/cpanel/mainip');
      if ( preg_match( '/^10\./', $mainIp) ) {
          $isPrivate = true;
      }

      $companyId = readlink('/var/cpanel/companyid.fast');

      $envDetails = [
          "mainIp"           => $mainIp,
          "companyId"        => $companyId,
          "isDevEnvironment" => false,
      ];

      if ( file_exists('/var/cpanel/dev_sandbox') || !$isNat && $isPrivate ) {
          $envDetails['isDevEnvironment'] = true;
      }

      return $envDetails;
  }

  function init()
  {
    if ( $this->enabledGlobally() && $this->versionCheck() ) {
        $this->include_script('mixpanel_analytics_include.js');
        $this->add_hook('render_page', array($this, 'addConfigurationJS'));
    }
  }

  function addConfigurationJS() {
    $envDetailsJSON = json_encode($this->getEnvDetails());

    # Examples:
    #   Webmail-Roundcube-Mail
    #   Webmail-Roundcube-Mail-Compose
    #   Webmail-Roundcube-Addressbook
    $event = 'Webmail-Roundcube';
    if (array_key_exists('_task', $_GET)) {
        $event .= '-' . ucfirst($_GET['_task']);
        if (array_key_exists('_action', $_GET)) {
            $event .= '-' . ucfirst($_GET['_action']);
        }
    }
    $eventJSON = json_encode($event);

    $debug = false;
    if (array_key_exists('debug', $_GET) && $_GET['debug']) {
        $debug = true;
    }
    $debugJSON = json_encode($debug);

    $js = <<<EOF
        <script type="text/javascript">
        var envDetails = $envDetailsJSON; // envDetails value interpolated from mixpanel_analytics.php

        var event = $eventJSON;
        var debugMode = $debugJSON;

        var mixpanelToken = envDetails.isDevEnvironment ? 'c7c6f1b1bc8e7b3d8254ebe545861955' : '2cca34424fe0e8ad6897d354b9591c45';

        var loadedFunc = function(mixp) {
            if (mixp.has_opted_in_tracking()) {

                // Add these two properties that are among the most important of the super properties added by mixpanel-utils.service.ts,
                // but without having access to the full data normally gathered by Cpanel/Template/Plugin/UIAnalytics.pm
                mixp.register(
                    {
                        "server_main_ip": envDetails.mainIp,
                        "company_id": [envDetails.companyId], // array wrapper matches what's done elsewhere
                    }
                );

                mixp.track(event);
            }
        };

        if (window.mixpanel) {
            window.mixpanel.init(
                mixpanelToken,
                {
                    debug: debugMode,
                    persistence: "localStorage",
                    opt_out_of_tracking_by_default: true,
                    track_pageview: false,
                    property_blacklist: [
                        "\$initial_referrer",
                        "\$referrer",
                        "\$current_url",
                        "url",
                    ],
                    ip: false,
                    autotrack: false,
                    api_host: "https://api-eu.mixpanel.com",
                    loaded: loadedFunc,
                }
            );
        }
        </script>
    EOF;

    rcube::get_instance()->output->add_footer($js);
  }

}

?>

Anon7 - 2022
AnonSec Team