|
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 | : | 30.78 GB of 70.42 GB (43.71%) |
|
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/
computerjanitor/
- drwxr-xr-x
|
Viewing file: cruft.py (4.75 KB) -rw-r--r--Select action/file-type:  ( +) |  ( +) |  ( +) | Code ( +) | Session ( +) |  ( +) | SDB ( +) |  ( +) |  ( +) |  ( +) |  ( +) |  ( +) |
# cruft.py - base class for different kinds of cruft # Copyright (C) 2008 Canonical, Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, version 3 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>.
import computerjanitor
class Cruft(object):
"""One piece of cruft to be cleaned out.
A piece of cruft can be a file, a package, a configuration tweak that is missing, or something else. This is a base class, which does nothing. Subclasses do the actual work. """
def get_prefix(self): """Return the unique prefix used to group this type of cruft. For example, the .deb package called 'foo' would have a prefix of 'deb'. This way, the package foo is not confused with the file foo, or the username foo. Subclasses SHOULD define this. The default implementation returns the name of the class, which is rarely useful to the user. """ return self.__class__.__name__ def get_prefix_description(self): """Return human-readable description of class of cruft.""" return self.get_description() def get_shortname(self): """Return the name of this piece of cruft. The name should be something that the user will understand. For example, it might be the name of a package, or the full path to a file. The name should be unique within the unique prefix returned by get_prefix. The prefix MUST NOT be included by this method, the get_name() method does that instead. The intent is that get_shortname() will be used by the user interface in contexts where the prefix is shown separately from the short name, and get_name() when a single string is used. Subclasses MUST define this. The default implementation raises an exception. """
raise computerjanitor.UnimplementedMethod(self.get_shortname)
def get_name(self): """Return prefix plus name. See get_prefix() and get_shortname() for a discussion of the prefix and the short name. This method will return the prefix, a colon, and the short name.
The long name will used to store state/configuration data: _this_ package should not be removed. """
return "%s:%s" % (self.get_prefix(), self.get_shortname()) def get_description(self): """Return a description of this piece of cruft. This may be arbitrarily long. The user interface will take care of breaking it into lines or otherwise presenting it to the user in a nice manner. The description should be plain text, in UTF-8. The default implementation returns the empty string. Subclasses MAY override this as they wish. """ return "" def get_disk_usage(self): """Return amount of disk space reserved by this piece of cruft. The unit is bytes. The disk space in question should be the amount that will be freed if the cruft is cleaned up. The amount may be an estimate (read: guess). It is intended to be shown to the user to help them decide what to remove and what to keep. This will also be used by the user interface to better estimate how much remaining time there is when cleaning up a lot of cruft. For some types of cruft, this is not applicable and they should return None. The base class implementation does that, so subclasses MUST define this method if it is useful for them to return something else. The user interface will distinguish between None (not applicable) and 0 (no disk space being used). """ return None def cleanup(self): """Clean up this piece of cruft. Depending on the type of cruft, this may mean removing files, packages, modifying configuration files, or something else. The default implementation raises an exception. Subclasses MUST override this. """ raise computerjanitor.UnimplementedMethod(self.cleanup)
|