!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache/2.2.16 (Debian). PHP/5.3.3-7+squeeze19 

uname -a: Linux mail.tri-specialutilitydistrict.com 2.6.32-5-amd64 #1 SMP Tue May 13 16:34:35 UTC
2014 x86_64
 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/usr/share/pyshared/coherence/extern/   drwxr-xr-x
Free 129.9 GB of 142.11 GB (91.41%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     simple_plugin.py (2.4 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
# -*- coding: utf-8 -*-

# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php

# Copyright 2007, Frank Scholz <coherence@beebits.net>

""" real simple plugin system
    meant as a replacement when setuptools/pkg_resources
    are not available
"""

import os
import sys

class Plugin(object):
    """ a new style class that
        betrays all its sub-classes
    """
    pass

class Reception(object):

    """ singleton class which holds information
        about known plugins

        currently a singleton, and even a class,
        seems to be overkill for this, but maybe
        we'll add some more functionality later
    """

    _instance_ = None  # Singleton

    def __new__(cls, *args, **kwargs):
        """ creates the singleton """
        obj = getattr(cls,'_instance_',None)
        if obj is not None:
            return obj
        else:
            obj = super(Reception, cls).__new__(cls, *args, **kwargs)
            cls._instance_ = obj
            return obj

    def __init__(self,plugin_path=None,log=None):
        """ initializes the class and
            checks in if a path is provided
        """
        self.log = log
        if plugin_path is not None:
            self.checkin(plugin_path)

    def checkin(self,plugin_path):
        """ import all valid files from plugin_path """
        if not plugin_path in sys.path:
            sys.path.insert(0, plugin_path)
        for plugin in os.listdir(plugin_path):
            p = os.path.join(plugin_path, plugin)
            if plugin != '__init__.py' and os.path.isfile(p) and os.path.splitext(p)[1] == '.py':
                try:
                    __import__(os.path.splitext(plugin)[0], None, None, [''])
                except Exception, msg:
                    if self.log is None:
                        print "can't import %r - %s" % (os.path.splitext(plugin)[0], msg)
                    else:
                        self.log("can't import %r - %r" % (os.path.splitext(plugin)[0], msg))


    def guestlist(self, plugin_class=Plugin):
        """ returns a list of all Plugin subclasses """
        found = []

        def get_subclass(klass, subclasses):
            if len(subclasses) == 0:
                found.append(klass)
            else:
                for k in subclasses:
                    get_subclass(k,k.__subclasses__())

        get_subclass(plugin_class, plugin_class.__subclasses__())

        return found

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0084 ]--