You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

mfd-mount

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mfd-mount

Module for handling mounting and unmounting fileshares on different operating systems

1.8.0
pipPyPI
Maintainers
1

[!IMPORTANT]
This project is under development. All source code and features on the main branch are for the purpose of testing or evaluation and not production ready.

MFD Mount

Module for handling mounting fileshares on OS

Usage

You can create mounter objects in two ways:

  • use generic Mount class which will automatically detect OS type based on connected setup and instantiate proper subclass
  • use specific subclass e.g. PosixMount if you know beforehand which OS runs on connected setup
from mfd_connect import LocalConnection, RPyCConnection
from mfd_mount import Mount, ESXiMount, PosixMount, WindowsMount, FreeBSDMount

mounter_generic = Mount(connection=LocalConnection())  # will automatically instantiate proper subclass

mounter_windows = WindowsMount(connection=LocalConnection())
mounter_windows.mount_nfs(mount_point="Z:", share_path="10.10.10.10:/shared")
mounter_windows.is_mounted(mount_point="Z:")

mounter_posix = PosixMount(connection=LocalConnection())
mounter_posix.mount_nfs(mount_point="/mnt/shared", share_path="10.10.10.10:/shared")
mounter_posix.mount_cifs(mount_point="/mnt/shared", share_path="//10.10.10.10/shared", username='user', password='pass')
mounter_posix.mount_tmpfs(mount_point="/mnt/shared", share_path="//10.10.10.10/shared", params='-o param')
mounter_posix.mount_hugetlbfs(mount_point="/mnt/shared", share_path="//10.10.10.10/shared", params='-o param')
mounter_posix.is_mounted(mount_point="/mnt/shared")
# or
with mounter_posix.mount_nfs(mount_point="/mnt/shared", share_path="10.10.10.10:/shared"):
    mounter_posix.is_mounted(mount_point="/mnt/shared")  # will automatically unmount share afterwards
with mounter_posix.mount_cifs(mount_point="/mnt/shared", share_path="//10.10.10.10/shared", username='user', password='pass'):
    mounter_posix.is_mounted(mount_point="/mnt/shared")  # will automatically unmount share afterwards
with mounter_posix.mount_tmpfs(mount_point="/mnt/shared", share_path="//10.10.10.10/shared", params='-o param'):
    mounter_posix.is_mounted(mount_point="/mnt/shared")  # will automatically unmount share afterwards
with mounter_posix.mount_hugetlbfs(mount_point="/mnt/shared", share_path="//10.10.10.10/shared", params='-o param'):
    mounter_posix.is_mounted(mount_point="/mnt/shared")  # will automatically unmount share afterwards    
mounter_esxi = ESXiMount(connection=LocalConnection())
mounter_esxi.mount_nfs(mount_point="NFSVolume", share_path="10.10.10.10:/shared")
mounter_esxi.is_mounted(mount_point="NFSVolume")
mounter_posix.umount(mount_point="/mnt/shared")
mounter_freebsd = FreeBSDMount(connection=RPyCConnection(ip='11.11.11.11', port=18813))
mounter_freebsd.mount_cifs(mount_point="/mnt/shared", share_path="10.10.10.10/shared", username='user', password='pass')
# or 
with mounter_freebsd.mount_cifs(mount_point="/mnt/shared", share_path="10.10.10.10/shared", username='user', password='pass'):
    mounter_freebsd.is_mounted(mount_point="/mnt/shared")

API documentation

Mount NFS share:

mount_nfs(self, *, mount_point: Union[Path, str],
                  share_path: Union[Path, str],
                  username: Optional[str],
                  password: Optional[str]
                  ) -> None:

Mount CIFS share:

mount_cifs(self, *, mount_point: Union[Path, str],
                   share_path: Union[Path, str],
                   username: Optional[str],
                   password: Optional[str]
                   ) -> None:
  • Currently only implemented in POSIX class. Mount TMPFS share:
mount_tmpfs(self, *, mount_point: Union[Path, str],
                   share_path: Union[Path, str],
                   params: Optional[str]) -> None:

Mount HUGETLBFS share:

mount_hugetlbfs(self, *, mount_point: Union[Path, str],
                   share_path: Union[Path, str],
                   params: Optional[str]) -> None:

Check if given mountpoint is mounted:

is_mounted(self, mount_point: Union[Path, str]) -> bool:

Unmount share:

umount(self, mount_point: Union[Path, str]) -> None:

Raises UnmountException on failure

ESXi with NFS

Username and password are unused. Mount_point is name of new volume. share_path must be in correct format <host>/<share> or <host>:/<share> eg. 10.10.10.10:/to_share or 10.10.10.10/to_share

SSHFS

SSHFS is not built-in system tool. It requires previous installation.

On POSIX OS'es: <package-manager> install sshfs

OS supported:

  • WINDOWS
  • LINUX
  • FreeBSD
  • ESXi
WINDOWSLINUXFreeBSDESXi
CIFSSupported :white_check_mark:Supported :white_check_mark:Supported :white_check_mark:Not Supported :red_circle:
NFSSupported :white_check_mark:Supported :white_check_mark:Supported :white_check_mark:Supported :white_check_mark:
SSHFSNot Supported :red_circle:Supported :white_check_mark:Not Supported :red_circle:Not Supported :red_circle:
TMPFSNot Supported :red_circle:Supported :white_check_mark:Not Supported :red_circle:Not Supported :red_circle:
HUGELBFSNot Supported :red_circle:Supported :white_check_mark:Not Supported :red_circle:Not Supported :red_circle:

Issue reporting

If you encounter any bugs or have suggestions for improvements, you're welcome to contribute directly or open an issue here.

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.