From 48ce8a1b0e05ae40ec6c07fde0b3884cbb213345 Mon Sep 17 00:00:00 2001 From: PYDT <85057800+87owo@users.noreply.github.com> Date: Fri, 10 Mar 2023 10:50:35 +0800 Subject: [PATCH] Add files via upload --- PYAS.py | 37 ++++++++++++++++++++---------------- PYAS_English.py | 50 +++++++++++++++++++------------------------------ 2 files changed, 40 insertions(+), 47 deletions(-) diff --git a/PYAS.py b/PYAS.py index 2b6092b..52ba135 100644 --- a/PYAS.py +++ b/PYAS.py @@ -858,7 +858,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow): self.Virus_List = [] self.Virus_List_output.setStringList(self.Virus_List) self.ui.Virus_Scan_output.setModel(self.Virus_List_output) - self.ui.Virus_Scan_text.setText(self.text_Translate('✔成功: 已執行成功。')) + self.ui.Virus_Scan_text.setText(self.text_Translate('成功: 已執行成功。')) self.ui.Virus_Scan_Solve_Button.hide() self.ui.State_icon.setPixmap(QtGui.QPixmap(":/icon/Icon/check.png")) self.ui.State_title.setText(self.text_Translate("這部裝置已受到保護")) @@ -866,7 +866,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow): except Exception as e: pyas_bug_log(e) self.Safe = False - self.ui.Virus_Scan_text.setText(self.text_Translate("✖錯誤: 執行失敗。")) + self.ui.Virus_Scan_text.setText(self.text_Translate("錯誤: 執行失敗。")) def sign_scan(self, file): try: @@ -923,7 +923,6 @@ class MainWindow_Controller(QtWidgets.QMainWindow): print('[SCAN] Malware has been detected') self.Virus_List_output.setStringList(self.Virus_List) self.ui.Virus_Scan_output.setModel(self.Virus_List_output) - self.ui.State_output.append(str(time.strftime('%Y/%m/%d %H:%M:%S')) + self.text_Translate(" > [病毒掃描] 掃描出") + str(len(self.Virus_List)) + self.text_Translate("個病毒")) self.ui.State_icon.setPixmap(QtGui.QPixmap(":/icon/Icon/X2.png")) self.ui.State_title.setText(self.text_Translate("這部裝置目前不安全")) self.ui.Virus_Scan_Solve_Button.show() @@ -931,16 +930,18 @@ class MainWindow_Controller(QtWidgets.QMainWindow): self.ui.Virus_Scan_Break_Button.hide() self.Virus_Scan = False self.Safe = False - ToastNotifier().show_toast("PYAS Security",self.text_Translate("✖當前已發現惡意軟體共{}項。").format(len(self.Virus_List)),icon_path="Library/PYAS/Icon/ICON.ico",threaded=True) - self.ui.Virus_Scan_text.setText(self.text_Translate("✖當前已發現惡意軟體共{}項。").format(len(self.Virus_List))) + text = self.text_Translate("當前已發現惡意軟體共{}項。").format(len(self.Virus_List)) else: print('[SCAN] No malware currently found') self.ui.Virus_Scan_Break_Button.hide() self.ui.Virus_Scan_choose_Button.show() self.Virus_Scan = False self.Safe = True - ToastNotifier().show_toast("PYAS Security",self.text_Translate('✔當前未發現惡意軟體。'),icon_path="Library/PYAS/Icon/ICON.ico",threaded=True) - self.ui.Virus_Scan_text.setText(self.text_Translate('✔當前未發現惡意軟體。')) + text = self.text_Translate('當前未發現惡意軟體。') + now_time = time.strftime('%Y/%m/%d %H:%M:%S') + self.ui.Virus_Scan_text.setText(text) + self.ui.State_output.append(f'[{now_time}] {text}') + ToastNotifier().show_toast(now_time,text,icon_path="Library/PYAS/Icon/ICON.ico",threaded=True) def Virus_Scan_Choose_Menu(self): if self.ui.Virus_Scan_choose_widget.isHidden(): @@ -1075,7 +1076,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow): def Repair_System_Permission(self): #QMessageBox跟tkinter.messagebox是差不多的東西 yes的回傳值為16384 question = QMessageBox.warning(self,self.text_Translate('修復系統權限'),self.text_Translate("您確定要修復系統權限嗎?"),QMessageBox.Yes|QMessageBox.No,QMessageBox.Yes) - if question == 16384 and self.pyas_protect_system_repair(): + if question == 16384 and self.protect_system_reg_repair(): QMessageBox.information(self,self.text_Translate('完成'),self.text_Translate("修復完成!"),QMessageBox.Ok,QMessageBox.Ok) else: QMessageBox.critical(self,self.text_Translate('錯誤'),self.text_Translate('錯誤: ')+self.text_Translate("修復失敗"),QMessageBox.Ok) @@ -1431,7 +1432,9 @@ class MainWindow_Controller(QtWidgets.QMainWindow): self.ui.Protection_switch_Button.setStyleSheet(""" QPushButton{border:none;background-color:rgba(20,20,20,30);border-radius: 15px;} QPushButton:hover{background-color:rgba(20,20,20,50);}""") - self.ui.State_output.append(str(time.strftime('%Y/%m/%d %H:%M:%S')) + self.text_Translate(' > [提示] 尚未啟用實時防護')) + text = self.text_Translate('尚未啟用實時防護') + now_time = time.strftime('%Y/%m/%d %H:%M:%S') + self.ui.State_output.append(f'[{now_time}] {text}') QApplication.processEvents() else: self.ui.Protection_illustrate.setText(self.text_Translate("正在初始化中,請稍後...")) @@ -1445,8 +1448,9 @@ class MainWindow_Controller(QtWidgets.QMainWindow): f.seek(0) f.write(self.mbr_value) return True + return False - def pyas_protect_system_repair(self): + def protect_system_reg_repair(self): rp_reg = True try: Permission = ['NoControlPanel', 'NoDrives', 'NoControlPanel', 'NoFileMenu', 'NoFind', 'NoRealMode', 'NoRecentDocsMenu','NoSetFolders', \ @@ -1495,7 +1499,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow): QPushButton{border:none;background-color:rgba(20,200,20,100);border-radius: 15px;} QPushButton:hover{background-color:rgba(20,200,20,120);}""") while os.path.isfile('Library/PYAS/Temp/PYASP.tmp'): - self.pyas_protect_system_repair() + self.protect_system_reg_repair() self.protect_system_mbr_repair() for p in psutil.process_iter(): try: @@ -1506,11 +1510,12 @@ class MainWindow_Controller(QtWidgets.QMainWindow): continue elif self.sign_scan(file) or self.api_scan('md5', file): if subprocess.call(f'taskkill /f /im "{name}" /t',shell=True) == 0: - text = self.text_Translate('{} > [實時防護] 成功攔截了一個惡意軟體:').format(time.strftime('%Y/%m/%d %H:%M:%S'))+name + text = self.text_Translate('成功攔截惡意軟體: ')+name else: - text = self.text_Translate('{} > [實時防護] 惡意軟體攔截失敗:').format(time.strftime('%Y/%m/%d %H:%M:%S'))+name - self.ui.State_output.append(text) - ToastNotifier().show_toast("PYAS Security",text,icon_path="Library/PYAS/Icon/ICON.ico",duration=10,threaded=True) + text = self.text_Translate('惡意軟體攔截失敗: ')+name + now_time = time.strftime('%Y/%m/%d %H:%M:%S') + self.ui.State_output.append(f'[{now_time}] {text}') + ToastNotifier().show_toast(now_time,text,icon_path="Library/PYAS/Icon/ICON.ico",duration=10,threaded=True) except: continue except Exception as e: @@ -1681,7 +1686,7 @@ if __name__ == '__main__': create_lib() remove_tmp() remove_rtp() - pyas_version, pyae_version = "2.6.1", "2.2.5" + pyas_version, pyae_version = "2.6.2", "2.2.5" QtCore.QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling)# 自適應窗口縮放 QtGui.QGuiApplication.setAttribute(Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)# 自適應窗口縮放 app = QtWidgets.QApplication(sys.argv) diff --git a/PYAS_English.py b/PYAS_English.py index ef2e2f8..e5e0efe 100644 --- a/PYAS_English.py +++ b/PYAS_English.py @@ -3,33 +3,27 @@ english_list = {"提示":"Tips", "已开启":"On", "已关闭":"Off", "On":"On", "Off":"Off", "存取被拒":"Access denied", -"存取被拒":"Access denied", "添加數據庫":"Add database", -"✖掃描失敗。":"✖Scan failed.", -'正在掃描: ':'Scanning: ', -'正在扫描: ':'Scanning: ', -"病毒掃描":"Virus scan", "個病毒":" Virus", -" > [病毒掃描] 掃描出":" > [Virus Scan] scan out ", -"這部裝置目前不安全":"This device is currently unsafe", -"✖當前已發現惡意軟體共{}項。":"✖A total of {} items of malware have been found so far.", -'✔當前未發現惡意軟體。':'✔ No malware currently found.', -"正在初始化中,請稍後...":"Initializing, please wait...", -"✖當前已發現惡意軟體。":"✖Malware has currently been detected.", -"正在刪除: ":"Deleting: ", "正在删除: ":"Deleting: ", -"錯誤":"Error", "錯誤: ":"Error: ", "[錯誤] ":"[Error] ", -"安全密鑰錯誤":"Security Key Error", "安全密钥错误":"Security Key Error", -" > [提示] 尚未啟用實時防護":" > [Tips] Real-time Protect is not enabled", -" > [提示] 尚未启用实时防护":" > [Tips] Real-time Protect is not enabled", -"請輸入需要尋找的檔案":"Please enter the file you want to find", -"请输入需要寻找的档案":"Please enter the file you want to find", -"✔成功: 已執行成功。":"✔Success: Executed successfully.", -"這部裝置已受到保護":"This device has been protected", -"✖錯誤: 執行失敗。":"✖Error: Execution failed.", +'正在掃描: ':'Scanning: ', +"掃描失敗。":"Scan failed.", +"病毒掃描":"Virus scan", +"正在刪除: ":"Deleting: ", "請選擇掃描方式":"Please select a scan method", +"正在初始化中,請稍後...":"Initializing, please wait...", +'當前未發現惡意軟體。':'No malware currently found.', +"這部裝置已受到保護":"This device has been protected", +"這部裝置目前不安全":"This device is currently unsafe", +"當前已發現惡意軟體共{}項。":"A total of {} items of malware have been found so far.", +"錯誤":"Error", "錯誤: ":"Error: ", +"安全密鑰錯誤":"Security Key Error", +"尚未啟用實時防護":"Real-time Protect is not enabled", +"請輸入需要尋找的檔案":"Please enter the file you want to find", +"成功: 已執行成功。":"Success: Executed successfully.", +"錯誤: 執行失敗。":"Error: Execution failed.", +"完成":'Finish', "您確定要修復系統權限嗎?":"Are you sure you want to fix system permissions?", "修復完成!":"Repair complete!", -"完成":'Finish', "您確定要修復系統檔案嗎?":"Are you sure you want to repair the system files?", "修復系統檔案":'Repair System Files', "修復失敗":"Repair failed", @@ -72,13 +66,7 @@ english_list = {"提示":"Tips", "關於":"About", "結束進程":"End process", "啟用該選項可以實時監控進程中的惡意軟體並清除。":"Enable this option to monitor and remove malware in the system in real time.", -"启用该选项可以实时监控进程中的恶意软件并清除。":"Enable this option to monitor and remove malware in the system in real time.", "啟用該選項可以提高掃描靈敏度,但這也可能會造成誤殺。":"Enable this option can improve scanning sensitivity, but it can also cause manslaughter.", -"启用该选项可以提高扫描灵敏度,但这也可能会造成误杀。":"Enable this option can improve scanning sensitivity, but it can also cause manslaughter.", -'{} > [實時防護] 成功攔截了一個惡意軟體:':'{} > [Real-Time Protect] Malware blocking success:', -'{} > [實時防護] 成功攔截了一個惡意行為:':'{} > [Real-Time Protect] Action blocking success:', -'{} > [實時防護] 惡意軟體攔截失敗:':'{} > [Real-Time Protect] Malware blocking failed:', -'{} > [實時防護] 正在檢測檔案安全性:':'{} > [Real-time Protect] Checking file security:', -'{} > [實時防護] 未檢測到可疑檔案:':'{} > [Real-time Protect] No suspicious files detected:', -'修復系統權限':"Repair System Permissions", -'啟用該選項可以實時監控系統的檔案讀寫變更行為。':"Enable this option can improve scanning sensitivity, but it can also cause manslaughter."} +'成功攔截惡意軟體: ':'Malware blocking success: ', +'惡意軟體攔截失敗: ':'Malware blocking failed: ', +'修復系統權限':"Repair System Permissions",}