|
System | : | Linux MiraNet 3.0.0-14-generic-pae #23-Ubuntu SMP Mon Nov 21 22:07:10 UTC 2011 i686 |
Software | : | Apache. PHP/5.3.6-13ubuntu3.10 |
ID | : | uid=65534(nobody) gid=65534(nogroup) groups=65534(nogroup)
|
|
Safe Mode | : | OFF |
Open_Basedir | : | OFF |
Freespace | : | 24.01 GB of 70.42 GB (34.09%) |
|
MySQL: ON MSSQL: OFF Oracle: OFF PostgreSQL: OFF Curl: OFF Sockets: ON Fetch: OFF Wget: ON Perl: ON |
Disabled Functions: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
|
[ System Info ]
[ Processes ]
[ SQL Manager ]
[ Eval ]
[ Encoder ]
[ Mailer ]
[ Back Connection ]
[ Backdoor Server ]
[ Kernel Exploit Search ]
[ MD5 Decrypter ]
[ Reverse IP ]
[ Kill Shell ]
[ FTP Brute-Force ]
|
|
/
usr/
share/
pyshared/
landscape/
lib/
- drwxr-xr-x
|
Viewing file: disk.py (2.85 KB) -rw-r--r--Select action/file-type:  ( +) |  ( +) |  ( +) | Code ( +) | Session ( +) |  ( +) | SDB ( +) |  ( +) |  ( +) |  ( +) |  ( +) |  ( +) |
from __future__ import division
import os import statvfs
def get_mount_info(mounts_file, statvfs_, filesystems_whitelist=None): """ This is a generator that yields information about mounted filesystems.
@param mounts_file: A file with information about mounted filesystems, such as C{/proc/mounts}. @param statvfs_: A function to get file status information. @param filesystems_whitelist: Optionally, a list of which filesystems to stat. @return: A C{dict} with C{device}, C{mount-point}, C{filesystem}, C{total-space} and C{free-space} keys. If the filesystem information is not available, C{None} is returned. Both C{total-space} and C{free-space} are in megabytes. """ for line in open(mounts_file): try: device, mount_point, filesystem = line.split()[:3] mount_point = mount_point.decode("string-escape") except ValueError: continue if (filesystems_whitelist is not None and filesystem not in filesystems_whitelist): continue megabytes = 1024 * 1024 try: stats = statvfs_(mount_point) except OSError: continue block_size = stats[statvfs.F_BSIZE] total_space = (stats[statvfs.F_BLOCKS] * block_size) // megabytes free_space = (stats[statvfs.F_BFREE] * block_size) // megabytes yield {"device": device, "mount-point": mount_point, "filesystem": filesystem, "total-space": total_space, "free-space": free_space}
def get_filesystem_for_path(path, mounts_file, statvfs_, filesystems_whitelist=None): """ Tries to determine to which of the mounted filesystem C{path} belongs to, and then returns information about that filesystem or C{None} if it couldn't be determined.
@param path: The path we want filesystem information about. @param mounts_file: A file with information about mounted filesystems, such as C{/proc/mounts}. @param statvfs_: A function to get file status information. @param filesystems_whitelist: Optionally, a list of which filesystems to stat. @return: A C{dict} with C{device}, C{mount-point}, C{filesystem}, C{total-space} and C{free-space} keys. If the filesystem information is not available, C{None} is returned. Both C{total-space} and C{free-space} are in megabytes. """ candidate = None path = os.path.realpath(path) path_segments = path.split("/") for info in get_mount_info(mounts_file, statvfs_, filesystems_whitelist): mount_segments = info["mount-point"].split("/") if path.startswith(info["mount-point"]): if ((not candidate) or path_segments[:len(mount_segments)] == mount_segments): candidate = info return candidate
|