!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/usr/share/nodejs/coveralls/lib/   drwxr-xr-x
Free 26.44 GB of 117.98 GB (22.41%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     detectLocalGit.js (1.37 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
'use strict';

const fs = require('fs');
const path = require('path');

// branch naming only has a few excluded characters, see git-check-ref-format(1)
const REGEX_BRANCH = /^ref: refs\/heads\/([^?*[\\~^:]+)$/;

function detectLocalGit() {
  let dir = process.cwd();
  let gitDir;

  while (path.resolve('/') !== dir) {
    gitDir = path.join(dir, '.git');
    if (fs.existsSync(path.join(gitDir, 'HEAD'))) {
      break;
    }

    dir = path.dirname(dir);
  }

  if (path.resolve('/') === dir) {
    return;
  }

  const head = fs.readFileSync(path.join(dir, '.git', 'HEAD'), 'utf-8').trim();
  const branch = (head.match(REGEX_BRANCH) || [])[1];
  if (!branch) {
    return { git_commit: head };
  }

  const commit = _parseCommitHashFromRef(dir, branch);

  return {
    git_commit: commit,
    git_branch: branch
  };
}

function _parseCommitHashFromRef(dir, branch) {
  const ref = path.join(dir, '.git', 'refs', 'heads', branch);
  if (fs.existsSync(ref)) {
    return fs.readFileSync(ref, 'utf-8').trim();
  }

  // ref does not exist; get it from packed-refs
  let commit = '';
  const packedRefs = path.join(dir, '.git', 'packed-refs');
  const packedRefsText = fs.readFileSync(packedRefs, 'utf-8');
  packedRefsText.split('\n').forEach(line => {
    if (line.match(`refs/heads/${branch}`)) {
      commit = line.split(' ')[0];
    }
  });
  return commit;
}

module.exports = detectLocalGit;

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