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

Software: Apache. PHP/7.3.33 

uname -a: Linux acloudg.aryanict.com 4.18.0-513.9.1.lve.el8.x86_64 #1 SMP Mon Dec 4 15:01:22 UTC
2023 x86_64
 

uid=1095(katebhospital) gid=1098(katebhospital) groups=1098(katebhospital) 

Safe-mode: OFF (not secure)

/opt/cloudlinux/venv/lib/python3.11/site-packages/dodgy/   drwxr-xr-x
Free 294.18 GB of 429.69 GB (68.46%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     run.py (3.08 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
import json
import mimetypes
import os
import re
import sys
from argparse import ArgumentParser

from dodgy.checks import check_file

IGNORE_PATHS = [
    re.compile(patt % {"sep": re.escape(os.path.sep)})
    for patt in (
        r"(^|%(sep)s)\.[^\.]",  # ignores any files or directories starting with '.'
        r"^tests?%(sep)s?",
        r"%(sep)stests?(%(sep)s|$)",
        # Ignore foo_test(s)/.
        r"_tests?(%(sep)s|$)",
    )
]


def list_files(start_path):
    filepaths = []
    for root, _, files in os.walk(start_path):
        for file_name in files:
            filepaths.append(os.path.join(root, file_name))
    return filepaths


def run_checks(directory, ignore_paths=None):
    warnings = []

    ignore_paths = ignore_paths or []
    ignore_paths = [re.compile(patt) for patt in ignore_paths]
    ignore_paths += IGNORE_PATHS

    filepaths = list_files(directory)
    for filepath in filepaths:
        relpath = os.path.relpath(filepath, directory)
        if any([ignore.search(relpath) for ignore in ignore_paths]):
            continue

        # this is a naive check to skip binary files, it's probably okay for now
        mimetype = mimetypes.guess_type(filepath)
        if mimetype[0] is None or not mimetype[0].startswith("text/"):
            continue

        try:
            for msg_parts in check_file(filepath):
                warnings.append(
                    {
                        "path": relpath,
                        "line": msg_parts[0],
                        "code": msg_parts[1],
                        "message": msg_parts[2],
                    }
                )
        except UnicodeDecodeError as err:
            # This is a file which cannot be opened using codecs with UTF-8
            print("Unable to read {!r}: {}".format(filepath, err))

    return warnings


def run(ignore_paths=None, zero_exit=False):
    warnings = run_checks(os.getcwd(), ignore_paths=ignore_paths)

    output = json.dumps({"warnings": warnings}, indent=2)
    sys.stdout.write(output + "\n")

    if zero_exit:
        sys.exit(0)
    sys.exit(1 if warnings else 0)

def main(argv=None):
    argv = argv or sys.argv
    desc = (
        'A very basic tool to run against your codebase to search for "dodgy" looking values. '
        "It is a series of simple regular expressions designed to detect things such as "
        "accidental SCM diff checkins, or passwords/secret keys hardcoded into files."
    )
    parser = ArgumentParser("dodgy", description=desc)
    parser.add_argument(
        "--ignore-paths",
        "-i",
        nargs="+",
        type=str,
        dest="ignore",
        default=None,
        metavar="IGNORE_PATH",
        help="Paths to ignore",
    )
    parser.add_argument(
        "--zero-exit",
        "-0",
        dest="zero_exit",
        help="Dodgy will exit with a code of 1 if problems are found. This flag ensures that it always returns with 0 unless an exception is raised.",
        action="store_true",
    )

    args, _ = parser.parse_known_args(argv)

    run(ignore_paths=args.ignore, zero_exit=args.zero_exit)

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.0038 ]--