命令注入漏洞:去除安装snap接口...
This commit is contained in:
parent
60692ed11a
commit
e8a1f38cd3
|
@ -618,42 +618,6 @@ class UpdateManagerDbusController(dbus.service.Object):
|
|||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
|
||||
# dbus接口:安装本地snap包
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE, in_signature='s', out_signature='b', sender_keyword='sender')
|
||||
def InstallSnap(self, path, sender=None):
|
||||
|
||||
logging.info(COLORMETHOR_PREFIX+'method'+COLORLOG_SUFFIX+" Install Snap Packages(%s)...",path)
|
||||
try:
|
||||
status= subprocess.getstatusoutput("snap install " +path+" --dangerous")
|
||||
except Exception as e:
|
||||
logging.error("Install Snap Packages occur error:%s",str(e))
|
||||
msg = {"statue": "Fail", "errorcode": str(0), "error_message": _("Command execution error")}
|
||||
kwarg = {"error_message": str(msg)}
|
||||
|
||||
self.KumSnapSignal("snap_error", kwarg)
|
||||
return False
|
||||
|
||||
#安装成功
|
||||
if status[0]==0:
|
||||
logging.info("Install Snap Packages(%s) is success",path)
|
||||
msg = {"statue": "Success", "errorcode": str(0), "error_message": ""}
|
||||
kwarg = {"action": str(msg)}
|
||||
self.KumSnapSignal("snap_finish", kwarg)
|
||||
return True
|
||||
else:
|
||||
#失败之后的处理
|
||||
logging.info("Install Snap Packages(%s) is Failed",path)
|
||||
if "supported architectures" in status[1]:
|
||||
logging.error("Supported architectures does not match")
|
||||
msg = {"statue": "Fail", "errorcode": str(0), "error_message": _("Unsupported architecture")}
|
||||
else:
|
||||
logging.error("Other Error...")
|
||||
msg = {"statue": "Fail", "errorcode": str(0), "error_message": _("Other Error")}
|
||||
kwarg = {"error_message": str(msg)}
|
||||
|
||||
self.KumSnapSignal("snap_error", kwarg)
|
||||
return False
|
||||
|
||||
## dbus接口: 开启或关闭预下载功能
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE, in_signature='b', out_signature='b')
|
||||
def SetPreDownloadState(self, _state):
|
||||
|
@ -747,41 +711,41 @@ class UpdateManagerDbusController(dbus.service.Object):
|
|||
logging.error(str(e))
|
||||
return propertyValue
|
||||
|
||||
# dbus接口:安装本地snap包
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE, in_signature='s', out_signature='b', sender_keyword='sender')
|
||||
def InstallSnap(self, path, sender=None):
|
||||
# # dbus接口:安装本地snap包
|
||||
# @dbus.service.method(UPDATER_DBUS_INTERFACE, in_signature='s', out_signature='b', sender_keyword='sender')
|
||||
# def InstallSnap(self, path, sender=None):
|
||||
|
||||
logging.info(COLORMETHOR_PREFIX+'Method'+COLORLOG_SUFFIX+" Install Snap Packages(%s)...",path)
|
||||
try:
|
||||
status= subprocess.getstatusoutput("snap install " +path+" --dangerous")
|
||||
except Exception as e:
|
||||
logging.error("Install Snap Packages occur error:%s",str(e))
|
||||
msg = {"statue": "Fail", "errorcode": str(0), "error_message": _("Command execution error")}
|
||||
kwarg = {"error_message": str(msg)}
|
||||
# logging.info(COLORMETHOR_PREFIX+'Method'+COLORLOG_SUFFIX+" Install Snap Packages(%s)...",path)
|
||||
# try:
|
||||
# status= subprocess.getstatusoutput("snap install " +path+" --dangerous")
|
||||
# except Exception as e:
|
||||
# logging.error("Install Snap Packages occur error:%s",str(e))
|
||||
# msg = {"statue": "Fail", "errorcode": str(0), "error_message": _("Command execution error")}
|
||||
# kwarg = {"error_message": str(msg)}
|
||||
|
||||
self.KumSnapSignal("snap_error", kwarg)
|
||||
return False
|
||||
# self.KumSnapSignal("snap_error", kwarg)
|
||||
# return False
|
||||
|
||||
#安装成功
|
||||
if status[0]==0:
|
||||
logging.info("Install Snap Packages(%s) is success",path)
|
||||
msg = {"statue": "Success", "errorcode": str(0), "error_message": ""}
|
||||
kwarg = {"action": str(msg)}
|
||||
self.KumSnapSignal("snap_finish", kwarg)
|
||||
return True
|
||||
else:
|
||||
#失败之后的处理
|
||||
logging.info("Install Snap Packages(%s) is Failed",path)
|
||||
if "supported architectures" in status[1]:
|
||||
logging.error("Supported architectures does not match")
|
||||
msg = {"statue": "Fail", "errorcode": str(0), "error_message": _("Unsupported architecture")}
|
||||
else:
|
||||
logging.error("Other Error...")
|
||||
msg = {"statue": "Fail", "errorcode": str(0), "error_message": _("Other Error")}
|
||||
kwarg = {"error_message": str(msg)}
|
||||
# #安装成功
|
||||
# if status[0]==0:
|
||||
# logging.info("Install Snap Packages(%s) is success",path)
|
||||
# msg = {"statue": "Success", "errorcode": str(0), "error_message": ""}
|
||||
# kwarg = {"action": str(msg)}
|
||||
# self.KumSnapSignal("snap_finish", kwarg)
|
||||
# return True
|
||||
# else:
|
||||
# #失败之后的处理
|
||||
# logging.info("Install Snap Packages(%s) is Failed",path)
|
||||
# if "supported architectures" in status[1]:
|
||||
# logging.error("Supported architectures does not match")
|
||||
# msg = {"statue": "Fail", "errorcode": str(0), "error_message": _("Unsupported architecture")}
|
||||
# else:
|
||||
# logging.error("Other Error...")
|
||||
# msg = {"statue": "Fail", "errorcode": str(0), "error_message": _("Other Error")}
|
||||
# kwarg = {"error_message": str(msg)}
|
||||
|
||||
self.KumSnapSignal("snap_error", kwarg)
|
||||
return False
|
||||
# self.KumSnapSignal("snap_error", kwarg)
|
||||
# return False
|
||||
|
||||
# 监控是否需要重启的操作
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE, in_signature='s', out_signature='b')
|
||||
|
|
Loading…
Reference in New Issue