[ Avaa Bypassed ]




Upload:

Command:

www-data@3.144.158.54: ~ $
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# (c) Copyright 2003-2015 HP Development Company, L.P.
#
# 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
#
# Author: Don Welch
#
# Thanks to Henrique M. Holschuh <hmh@debian.org> for various security patches
#

__version__ = '15.0'
__mod__ = 'hp-toolbox'
__title__ = 'HP Device Manager'
__doc__ = """The HP Device Manager (aka "Toolbox") for HPLIP supported devices. Provides access to status, tools, and supplies levels."""

# Std Lib
import sys
import os
import getopt
import signal


# Local
from base.g import *
#from . import base.utils as utils
import base.utils as utils
from base import status, tui, module

try:
    from importlib import import_module
except ImportError as e:
    log.debug(e)
    from base.utils import dyn_import_mod as import_module


w = None # write pipe
app = None
toolbox  = None
session_bus = None


def handle_session_signal(*args, **kwds):
    if kwds['interface'] == 'com.hplip.Toolbox' and \
        kwds['member'] == 'Event':

        event = device.Event(*args)
        event.debug()

        if event.event_code > EVENT_MAX_EVENT:
            event.event_code = status.MapPJLErrorCode(event.event_code)

        # regular user/device status event
        log.debug("Received event notifier: %d" % event.event_code)

        if not event.send_via_pipe(w, 'toolbox ui'):
            sys.exit(1)
            # if this fails, then hp-toolbox must be killed.
            # No need to continue running...


mod = module.Module(__mod__, __title__, __version__, __doc__, None,
                    (GUI_MODE,), (UI_TOOLKIT_QT3, UI_TOOLKIT_QT4, UI_TOOLKIT_QT5))
mod.lockInstance()

mod.setUsage(module.USAGE_FLAG_NONE,
             extra_options=[("Disable dbus (Qt3 only):", "-x or --disable-dbus", "option", False)],
             see_also_list = ['hp-align', 'hp-clean', 'hp-colorcal', 'hp-devicesettings',
                              'hp-faxsetup', 'hp-firmware', 'hp-info', 'hp-levels',
                              'hp-linefeedcal', 'hp-makecopies', 'hp-plugin',
                              'hp-pqdiag', 'hp-print', 'hp-printsettings', 'hp-scan',
                              'hp-sendfax', 'hp-testpage', 'hp-timedate', 'hp-unload'])

opts, device_uri, printer_name, mode, ui_toolkit, loc = \
    mod.parseStdOpts('x', ['disable-dbus'])

disable_dbus = False

for o, a in opts:
    if o in ('-x', '--disable-dbus') and ui_toolkit == 'qt3':
        disable_dbus = True

if ui_toolkit == 'qt3':
    if not utils.canEnterGUIMode():
        log.error("%s requires GUI support. Exiting." % __mod__)
        sys.exit(1)
elif ui_toolkit == 'qt4':
    if not utils.canEnterGUIMode4():
        log.error("%s requires GUI support. Exiting." % __mod__)
        sys.exit(1)

child_pid, w, r = 0, 0, 0

if ui_toolkit == 'qt3':
    try:
        from dbus import SessionBus
        import dbus.service
        from dbus.mainloop.glib import DBusGMainLoop, threads_init
        from gobject import MainLoop
        import glib
        glib.threads_init()
        dbus.mainloop.glib.threads_init()
    except ImportError:
        log.error("Unable to load dbus - Automatic status updates in HPLIP Device Manager will be disabled.")
        disable_dbus = True

    if not disable_dbus:
        r, w = os.pipe()
        parent_pid = os.getpid()
        log.debug("Parent PID=%d" % parent_pid)
        child_pid = os.fork()

    if disable_dbus or child_pid: # qt3/ui
        # parent (UI)
        log.set_module("hp-toolbox(UI)")

        if w:
            os.close(w)

        try:
            from qt import *
            from ui.devmgr4 import DevMgr4
        except ImportError:
            log.error("Unable to load Qt3 support. Is it installed?")
            sys.exit(1)

        # create the main application object
        app = QApplication(sys.argv)

        if loc is None:
            loc = user_conf.get('ui', 'loc', 'system')
            if loc.lower() == 'system':
                loc = str(QTextCodec.locale())
                log.debug("Using system locale: %s" % loc)

        if loc.lower() != 'c':
            e = 'utf8'
            try:
                l, x = loc.split('.')
                loc = '.'.join([l, e])
            except ValueError:
                l = loc
                loc = '.'.join([loc, e])

            log.debug("Trying to load .qm file for %s locale." % loc)
            trans = QTranslator(None)

            qm_file = 'hplip_%s.qm' % l
            log.debug("Name of .qm file: %s" % qm_file)
            loaded = trans.load(qm_file, prop.localization_dir)

            if loaded:
                app.installTranslator(trans)
            else:
                loc = 'c'

        if loc == 'c':
            log.debug("Using default 'C' locale")
        else:
            log.debug("Using locale: %s" % loc)
            QLocale.setDefault(QLocale(loc))
            prop.locale = loc
            try:
                locale.setlocale(locale.LC_ALL, locale.normalize(loc))
            except locale.Error:
                pass

        toolbox = DevMgr4(r, __version__, device_uri, disable_dbus)
        app.setMainWidget(toolbox)

        toolbox.show()

        try:
            try:
                log.debug("Starting GUI loop...")
                app.exec_loop()
            except KeyboardInterrupt:
                sys.exit(0)

        finally:
            if child_pid:
                log.debug("Killing child toolbox process (pid=%d)..." % child_pid)
                try:
                    os.kill(child_pid, signal.SIGKILL)
                except OSError as e:
                    log.debug("Failed: %s" % e.message)

            mod.unlockInstance()
            sys.exit(0)

    elif not disable_dbus: # qt3/dbus
        # dBus
        log.set_module("hp-toolbox(dbus)")
        from base import device

        try:
            # child (dbus connector)
            os.close(r)

            dbus_loop = DBusGMainLoop(set_as_default=True)

            try:
                session_bus = dbus.SessionBus()
            except dbus.exceptions.DBusException as e:
                if os.getuid() != 0:
                    log.error("Unable to connect to dbus session bus. Exiting.")
                    sys.exit(1)
                else:
                    log.error("Unable to connect to dbus session bus (running as root?)")
                    sys.exit(1)

            # Receive events from the session bus
            session_bus.add_signal_receiver(handle_session_signal, sender_keyword='sender',
                destination_keyword='dest', interface_keyword='interface',
                member_keyword='member', path_keyword='path')

            log.debug("Entering main loop...")

            try:
                MainLoop().run()
            except KeyboardInterrupt:
                log.debug("Ctrl-C: Exiting...")

        finally:
            if parent_pid:
                log.debug("Killing parent toolbox process (pid=%d)..." % parent_pid)
                try:
                    os.kill(parent_pid, signal.SIGKILL)
                except OSError as e:
                    log.debug("Failed: %s" % e.message)

            mod.unlockInstance()

        sys.exit(0)

else: # qt4
    # if utils.ui_status[1] == "PyQt4":
    #     try:
    #         from PyQt4.QtGui import QApplication
    #         from ui4.devmgr5 import DevMgr5
    #     except ImportError as e:
    #         log.error(e)
    #         sys.exit(1)
    # elif utils.ui_status[1] == "PyQt5":
    #     try:
    #         from PyQt5.QtWidgets import QApplication
    #         from ui5.devmgr5 import DevMgr5
    #     except ImportError as e:
    #         log.error(e)
    #         import traceback
    #         traceback.print_exc()
    #         sys.exit(1)
    # else:
    #     log.error("Unable to load Qt support")
    #     sys.exit(1)
    QApplication, ui_package = utils.import_dialog(ui_toolkit)
    ui = import_module(ui_package + ".devmgr5")



    log.set_module("hp-toolbox(UI)")

    if 1:
    #try:
        app = QApplication(sys.argv)

        toolbox = ui.DevMgr5(__version__, device_uri,  None)
        toolbox.show()
        try:
            log.debug("Starting GUI loop...")
            app.exec_()
        except KeyboardInterrupt:
            sys.exit(0)

    if 1:
    #finally:
        mod.unlockInstance()
        sys.exit(0)

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
base Folder 0755
copier Folder 0755
data Folder 0755
fax Folder 0755
installer Folder 0755
pcard Folder 0755
prnt Folder 0755
scan Folder 0755
ui5 Folder 0755
__init__.py File 808 B 0755
align.py File 9.14 KB 0755
check-plugin.py File 9.8 KB 0755
check.py File 39.17 KB 0755
clean.py File 7.05 KB 0755
colorcal.py File 9.08 KB 0755
config_usb_printer.py File 6.98 KB 0755
devicesettings.py File 2.68 KB 0755
diagnose_plugin.py File 3.77 KB 0755
diagnose_queues.py File 3.65 KB 0755
doctor.py File 12.69 KB 0755
fab.py File 24.38 KB 0755
faxsetup.py File 2.56 KB 0755
firmware.py File 6.47 KB 0755
hpdio.py File 7.04 KB 0755
hplip_clean.sh File 1.81 KB 0644
hpssd.py File 20.37 KB 0755
info.py File 6.26 KB 0755
levels.py File 6.85 KB 0755
linefeedcal.py File 2.53 KB 0755
logcapture.py File 12.15 KB 0755
makecopies.py File 11.41 KB 0755
makeuri.py File 5.6 KB 0755
pkservice.py File 3.13 KB 0755
plugin.py File 13.62 KB 0755
pqdiag.py File 2.44 KB 0755
print.py File 4.23 KB 0755
printsettings.py File 2.95 KB 0755
probe.py File 7.98 KB 0755
query.py File 4.94 KB 0755
scan.py File 86.87 KB 0755
sendfax.py File 21.62 KB 0755
setup.py File 37.25 KB 0755
signing-key.asc File 1.63 KB 0644
systray.py File 4.95 KB 0755
testpage.py File 5.98 KB 0755
timedate.py File 3.31 KB 0755
toolbox.py File 8.79 KB 0755
uiscan.py File 2.18 KB 0755
uninstall.py File 3.27 KB 0755
unload.py File 24.3 KB 0755
wificonfig.py File 2.79 KB 0755