|
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 | : | 23.01 GB of 70.42 GB (32.68%) |
|
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/
monitor/
- drwxr-xr-x
|
Viewing file: aptpreferences.py (1.99 KB) -rw-r--r--Select action/file-type:  ( +) |  ( +) |  ( +) | Code ( +) | Session ( +) |  ( +) | SDB ( +) |  ( +) |  ( +) |  ( +) |  ( +) |  ( +) |
import os
from landscape.constants import APT_PREFERENCES_SIZE_LIMIT
from landscape.monitor.plugin import DataWatcher
class AptPreferences(DataWatcher): """ Report the system APT preferences configuration. """
persist_name = "apt-preferences" message_type = "apt-preferences" message_key = "data" run_interval = 900 # 15 minutes size_limit = APT_PREFERENCES_SIZE_LIMIT
def __init__(self, etc_apt_directory="/etc/apt"): self._etc_apt_directory = etc_apt_directory
def get_data(self): """Return a C{dict} mapping APT preferences files to their contents.
If no APT preferences configuration is set at all on the system, then simply return C{None} """ data = {}
def read_file(filename): fd = open(filename, "r") content = fd.read() fd.close() return unicode(content)
preferences_filename = os.path.join(self._etc_apt_directory, u"preferences") if os.path.exists(preferences_filename): data[preferences_filename] = read_file(preferences_filename)
preferences_directory = os.path.join(self._etc_apt_directory, u"preferences.d") if os.path.isdir(preferences_directory): for entry in os.listdir(preferences_directory): filename = os.path.join(preferences_directory, entry) if os.path.isfile(filename): data[filename] = read_file(filename)
if data == {}: return None
item_size_limit = self.size_limit / len(data.keys()) for filename, contents in data.iteritems(): if len(filename) + len(contents) > item_size_limit: truncated_contents_size = item_size_limit - len(filename) data[filename] = data[filename][0:truncated_contents_size]
return data
def run(self): return self.exchange(urgent=True)
|