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:21.96 GB of 70.42 GB (31.18%)
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/ lib/ python2.7/ dist-packages/ landscape/ manager/ - drwxr-xr-x

Directory:
Viewing file:     store.py (2.75 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
try:
    import sqlite3
except ImportError:
    from pysqlite2 import dbapi2 as sqlite3

from landscape.package.store import with_cursor


class ManagerStore(object):

    def __init__(self, filename):
        self._db = sqlite3.connect(filename)
        ensure_schema(self._db)

    @with_cursor
    def get_graph(self, cursor, graph_id):
        cursor.execute(
            "SELECT graph_id, filename, user FROM graph WHERE graph_id=?",
            (graph_id,))
        return cursor.fetchone()

    @with_cursor
    def get_graphs(self, cursor):
        cursor.execute("SELECT graph_id, filename, user FROM graph")
        return cursor.fetchall()

    @with_cursor
    def add_graph(self, cursor, graph_id, filename, user):
        cursor.execute(
            "SELECT graph_id FROM graph WHERE graph_id=?",
            (graph_id,))
        if cursor.fetchone():
            cursor.execute(
                "UPDATE graph SET filename=?, user=? WHERE graph_id=?",
                (filename, user, graph_id))
        else:
            cursor.execute(
                "INSERT INTO graph (graph_id, filename, user) VALUES (?, ?, ?)",
                (graph_id, filename, user))

    @with_cursor
    def remove_graph(self, cursor, graph_id):
        cursor.execute("DELETE FROM graph WHERE graph_id=?", (graph_id,))

    @with_cursor
    def set_graph_accumulate(self, cursor, graph_id, timestamp, value):
        cursor.execute(
            "SELECT graph_id, graph_timestamp, graph_value FROM "
            "graph_accumulate WHERE graph_id=?", (graph_id,))
        graph_accumulate = cursor.fetchone()
        if graph_accumulate:
            cursor.execute(
                "UPDATE graph_accumulate SET graph_timestamp = ?, "
                "graph_value = ? WHERE graph_id=?",
                (timestamp, value, graph_id))
        else:
            cursor.execute(
                "INSERT INTO graph_accumulate (graph_id, graph_timestamp, "
                "graph_value) VALUES (?, ?, ?)", (graph_id, timestamp, value))

    @with_cursor
    def get_graph_accumulate(self, cursor, graph_id):
        cursor.execute(
            "SELECT graph_id, graph_timestamp, graph_value FROM "
            "graph_accumulate WHERE graph_id=?", (graph_id,))
        return cursor.fetchone()


def ensure_schema(db):
    cursor = db.cursor()
    try:
        cursor.execute("CREATE TABLE graph"
                       " (graph_id INTEGER PRIMARY KEY,"
                       " filename TEXT NOT NULL, user TEXT)")
        cursor.execute("CREATE TABLE graph_accumulate"
                       " (graph_id INTEGER PRIMARY KEY,"
                       " graph_timestamp INTEGER, graph_value FLOAT)")
    except sqlite3.OperationalError:
        cursor.close()
        db.rollback()
    else:
        cursor.close()
        db.commit()
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.3815 seconds