ShellBanner
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 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,

/ usr/ share/ pyshared/ landscape/ package/ - drwxr-xr-x

Directory:
Viewing file:     interface.py (2.44 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
import logging
import types
import sys

from smart.interface import Interface
from smart.const import ERROR, WARNING, INFO, DEBUG

import smart.interfaces


class LandscapeInterface(Interface):

    __output = ""
    __failed = False

    def reset_for_landscape(self):
        """Reset output and failed flag."""
        self.__failed = False
        self.__output = u""

    def get_output_for_landscape(self):
        """showOutput() is cached, and returned by this method."""
        return self.__output

    def has_failed_for_landscape(self):
        """Return true if any error() messages were logged."""
        return self.__failed

    def error(self, msg):
        self.__failed = True
        # Calling these logging.* functions here instead of message()
        # below will output the message or not depending on the debug
        # level set in landscape-client, rather than the one set in
        # Smart's configuration.
        logging.error("[Smart] %s", msg)
        super(LandscapeInterface, self).error(msg)

    def warning(self, msg):
        logging.warning("[Smart] %s", msg)
        super(LandscapeInterface, self).warning(msg)

    def info(self, msg):
        logging.info("[Smart] %s", msg)
        super(LandscapeInterface, self).info(msg)

    def debug(self, msg):
        logging.debug("[Smart] %s", msg)
        super(LandscapeInterface, self).debug(msg)

    def message(self, level, msg):
        prefix = {ERROR: "ERROR", WARNING: "WARNING",
                  INFO: "INFO", DEBUG: "DEBUG"}.get(level)
        self.showOutput("%s: %s\n" % (prefix, msg))

    def showOutput(self, output):
        if not isinstance(output, unicode):
            try:
                output = output.decode("utf-8")
            except UnicodeDecodeError:
                output = output.decode("ascii", "replace")
        self.__output += output




class LandscapeInterfaceModule(types.ModuleType):

    def __init__(self):
        super(LandscapeInterfaceModule, self).__init__("landscape")

    def create(self, ctrl, command=None, argv=None):
        return LandscapeInterface(ctrl)


def install_landscape_interface():
    if "smart.interfaces.landscape" not in sys.modules:
        # Plug the interface in a place Smart will recognize.
        smart.interfaces.landscape = LandscapeInterfaceModule()
        sys.modules["smart.interfaces.landscape"] = smart.interfaces.landscape

def uninstall_landscape_interface():
    sys.modules.pop("smart.interfaces.landscape", None)
Command:
Quick Commands:
Upload:
[Read-Only] Max size: 100MB
PHP Filesystem: <@ Ú
Search File:
regexp
Create File:
Overwrite [Read-Only]
View File:
Mass Defacement:
[+] Main Directory: [+] Defacement Url:
LmfaoX Shell - Private Build [BETA] - v0.1 -; Generated: 0.5194 seconds