!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache. PHP/5.6.40 

uname -a: Linux cpanel06wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.80.el6.x86_64 #1 SMP Thu Sep 24
01:42:00 EDT 2020 x86_64
 

uid=851(cp949260) gid=853(cp949260) groups=853(cp949260) 

Safe-mode: OFF (not secure)

/usr/lib64/python2.6/site-packages/Cheetah/   drwxr-xr-x
Free 201.31 GB of 981.82 GB (20.5%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     DirectiveAnalyzer.py (2.39 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |

import os
import pprint

try:
    from functools import reduce
except ImportError:
    # Assume we have reduce
    pass

from Cheetah import Parser
from Cheetah import Compiler
from Cheetah import Template

class Analyzer(Parser.Parser):
    def __init__(self, *args, **kwargs):
        self.calls = {}
        super(Analyzer, self).__init__(*args, **kwargs)

    def eatDirective(self):
        directive = self.matchDirective()
        try:
            self.calls[directive] += 1
        except KeyError:
            self.calls[directive] = 1
        super(Analyzer, self).eatDirective()

class AnalysisCompiler(Compiler.ModuleCompiler):
    parserClass = Analyzer


def analyze(source):
    klass = Template.Template.compile(source, compilerClass=AnalysisCompiler)
    return klass._CHEETAH_compilerInstance._parser.calls

def main_file(f):
    fd = open(f, 'r')
    try:
        print u'>>> Analyzing %s' % f
        calls = analyze(fd.read())
        return calls
    finally:
        fd.close()


def _find_templates(directory, suffix):
    for root, dirs, files in os.walk(directory):
        for f in files:
            if not f.endswith(suffix):
                continue
            yield root + os.path.sep + f

def _analyze_templates(iterable):
    for template in iterable:
        yield main_file(template)

def main_dir(opts):
    results = _analyze_templates(_find_templates(opts.dir, opts.suffix))
    totals = {}
    for series in results:
        if not series:
            continue
        for k, v in series.iteritems():
            try:
                totals[k] += v
            except KeyError:
                totals[k] = v
    return totals


def main():
    from optparse import OptionParser
    op = OptionParser()
    op.add_option('-f', '--file', dest='file', default=None,
            help='Specify a single file to analyze')
    op.add_option('-d', '--dir', dest='dir', default=None, 
            help='Specify a directory of templates to analyze')
    op.add_option('--suffix', default='tmpl', dest='suffix', 
            help='Specify a custom template file suffix for the -d option (default: "tmpl")')
    opts, args = op.parse_args()

    if not opts.file and not opts.dir:
        op.print_help()
        return

    results = None
    if opts.file:
        results = main_file(opts.file)
    if opts.dir:
        results = main_dir(opts)

    pprint.pprint(results)


if __name__ == '__main__':
    main()


:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0591 ]--