!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)

/usr/local/lib/node_modules/pm2/node_modules/@pm2/js-api/src/auth_strategies/   drwxr-xr-x
Free 13.09 GB of 57.97 GB (22.59%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     browser_strategy.js (2.47 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
/* global URLSearchParams, URL, localStorage */
'use strict'

const AuthStrategy = require('./strategy')

module.exports = class BrowserFlow extends AuthStrategy {
  removeUrlToken (refreshToken) {
    let url = window.location.href
    let params = `?access_token=${refreshToken}&token_type=refresh_token`
    let newUrl = url.replace(params, '')
    window.history.pushState('', '', newUrl)
  }

  retrieveTokens (km, cb) {
    let verifyToken = (refresh) => {
      return km.auth.retrieveToken({
        client_id: this.client_id,
        refresh_token: refresh
      })
    }

    // parse the url since it can contain tokens
    let url = new URL(window.location)
    this.response_mode = this.response_mode === 'query' ? 'search' : this.response_mode
    let params = new URLSearchParams(url[this.response_mode])

    if (params.get('access_token') !== null) {
      // verify that the access_token in parameters is valid
      verifyToken(params.get('access_token'))
        .then((res) => {
          this.removeUrlToken(res.data.refresh_token)
          // Save refreshToken in localstorage
          localStorage.setItem('km_refresh_token', params.get('access_token'))
          let tokens = res.data
          return cb(null, tokens)
        }).catch(cb)
    } else if (typeof localStorage !== 'undefined' && localStorage.getItem('km_refresh_token') !== null) {
      // maybe in the local storage ?
      verifyToken(localStorage.getItem('km_refresh_token'))
        .then((res) => {
          this.removeUrlToken(res.data.refresh_token)
          let tokens = res.data
          return cb(null, tokens)
        }).catch(cb)
    } else {
      // otherwise we need to get a refresh token
      window.location = `${this.oauth_endpoint}${this.oauth_query}&redirect_uri=${window.location}`
    }
  }

  deleteTokens (km) {
    return new Promise((resolve, reject) => {
      // revoke the refreshToken
      km.auth.revoke()
        .then(res => console.log('Token successfuly revoked!'))
        .catch(err => console.error(`Error when trying to revoke token: ${err.message}`))
      // We need to remove from storage and redirect user in every case (cf. https://github.com/keymetrics/pm2-io-js-api/issues/49)
      // remove the token from the localStorage
      localStorage.removeItem('km_refresh_token')
      setTimeout(_ => {
        // redirect after few miliseconds so any user code will run
        window.location = `${this.oauth_endpoint}${this.oauth_query}`
      }, 500)
      return resolve()
    })
  }
}

:: 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.0048 ]--