!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/usr/lib/python3/dist-packages/UpdateManager/Core/   drwxr-xr-x
Free 28.53 GB of 117.98 GB (24.18%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     LivePatchSocket.py (3.71 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
# LivePatchSocket.py
# -*- Mode: Python; indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
#
#  Copyright (c) 2017 Canonical
#
#  Author: Andrea Azzarone <andrea.azzarone@canonical.com>
#
#  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; either version 2 of the
#  License, or (at your option) any later version.
#
#  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, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
#  USA

from gi.repository import GLib
import http.client
import socket
import threading
import yaml

HOST_NAME = '/var/snap/canonical-livepatch/current/livepatchd.sock'


class UHTTPConnection(http.client.HTTPConnection):

    def __init__(self, path):
        http.client.HTTPConnection.__init__(self, 'localhost')
        self.path = path

    def connect(self):
        sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
        sock.connect(self.path)
        self.sock = sock


class LivePatchSocket(object):

    def __init__(self, http_conn=None):
        if http_conn is None:
            self.conn = UHTTPConnection(HOST_NAME)
        else:
            self.conn = http_conn

    def get_status(self, on_done):

        def do_call():
            try:
                self.conn.request('GET', '/status?verbose=True')
                r = self.conn.getresponse()
                active = r.status == 200
                data = yaml.safe_load(r.read())
            except Exception:
                active = False
                data = dict()
            check_state = LivePatchSocket.get_check_state(data)
            patch_state = LivePatchSocket.get_patch_state(data)
            fixes = LivePatchSocket.get_fixes(data)
            GLib.idle_add(lambda: on_done(
                active, check_state, patch_state, fixes))

        thread = threading.Thread(target=do_call)
        thread.start()

    @staticmethod
    def get_check_state(data):
        try:
            status = data['status']
            kernel = next((k for k in status if k['running']), None)
            return kernel['livepatch']['checkState']
        except Exception:
            return 'check-failed'

    @staticmethod
    def get_patch_state(data):
        try:
            status = data['status']
            kernel = next((k for k in status if k['running']), None)
            return kernel['livepatch']['patchState']
        except Exception:
            return 'unknown'

    @staticmethod
    def get_fixes(data):
        try:
            status = data['status']
            kernel = next((k for k in status if k['running']), None)
            fixes = kernel['livepatch']['fixes']
            return [LivePatchFix(f)
                    for f in fixes.replace('* ', '').split('\n') if len(f) > 0]
        except Exception:
            return list()


class LivePatchFix(object):

    def __init__(self, text):
        patched_pattern = ' (unpatched)'
        self.patched = text.find(patched_pattern) == -1
        self.name = text.replace(patched_pattern, '')

    def __eq__(self, other):
        if isinstance(other, LivePatchFix):
            return self.name == other.name and self.patched == other.patched
        return NotImplemented

    def __ne__(self, other):
        result = self.__eq__(other)
        if result is NotImplemented:
            return result
        return not result

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

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

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

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0042 ]--