|
|
|
@@ -49,6 +49,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
|
|
|
|
self.pyas_opacity = 0
|
|
|
|
|
self.ui.Theme_White.setChecked(True)
|
|
|
|
|
self.pyas = str(sys.argv[0]).replace("\\", "/")
|
|
|
|
|
self.md5_key = self.pyas_key()
|
|
|
|
|
self.pyasConfig = self.init_config_json()
|
|
|
|
|
self.init_config_lang()
|
|
|
|
|
self.init_config_sens()
|
|
|
|
@@ -160,6 +161,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
|
|
|
|
self.ui.Virus_Scan_choose_widget.raise_()
|
|
|
|
|
self.Process_sim = QStringListModel()
|
|
|
|
|
self.Process_quantity = []
|
|
|
|
|
self.Process_list_all_pid = []
|
|
|
|
|
self.Process_Timer = QTimer()
|
|
|
|
|
self.Process_Timer.timeout.connect(self.Process_list)
|
|
|
|
|
self.ui.License_terms.setText('''Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.''')
|
|
|
|
@@ -211,7 +213,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
|
|
|
|
|
|
|
|
|
def lang_init_refresh(self):
|
|
|
|
|
self.ui.State_title.setText(self.text_Translate("此裝置已受到防護" if self.Safe else "此裝置當前不安全"))
|
|
|
|
|
self.ui.Window_title.setText(self.text_Translate(f"PYAS V{pyas_version} {self.pyas_key()}"))
|
|
|
|
|
self.ui.Window_title.setText(self.text_Translate(f"PYAS V{pyas_version} {self.md5_key}"))
|
|
|
|
|
self.ui.PYAS_CopyRight.setText(self.text_Translate(f"Copyright© 2020-{max(int(time.strftime('%Y')), 2020)} PYAS Security"))
|
|
|
|
|
self.ui.State_Button.setText(self.text_Translate("狀態"))
|
|
|
|
|
self.ui.Virus_Scan_Button.setText(self.text_Translate("掃描"))
|
|
|
|
@@ -250,7 +252,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
|
|
|
|
self.ui.Enable_Safe_Mode_Button.setText(self.text_Translate("啟用安全模式"))
|
|
|
|
|
self.ui.Disable_Safe_Mode_Button.setText(self.text_Translate("禁用安全模式"))
|
|
|
|
|
self.ui.About_Back.setText(self.text_Translate("返回"))
|
|
|
|
|
self.ui.PYAS_Version.setText(self.text_Translate(f"PYAS V{pyas_version} {self.pyas_key()}"))
|
|
|
|
|
self.ui.PYAS_Version.setText(self.text_Translate(f"PYAS V{pyas_version} {self.md5_key}"))
|
|
|
|
|
self.ui.GUI_Made_title.setText(self.text_Translate("介面製作:"))
|
|
|
|
|
self.ui.GUI_Made_Name.setText(self.text_Translate("87owo"))
|
|
|
|
|
self.ui.Core_Made_title.setText(self.text_Translate("核心製作:"))
|
|
|
|
@@ -367,10 +369,9 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
|
|
|
|
widget.setGraphicsEffect(self.opacity)
|
|
|
|
|
else:
|
|
|
|
|
self.timer.stop()
|
|
|
|
|
self.timer.deleteLater()
|
|
|
|
|
self.timer = QTimer()
|
|
|
|
|
self.timer.timeout.connect(timeout)
|
|
|
|
|
self.timer.start()
|
|
|
|
|
self.timer.start(5)
|
|
|
|
|
|
|
|
|
|
def Change_to_State_widget(self):
|
|
|
|
|
if self.ui.State_widget.isHidden():
|
|
|
|
@@ -522,8 +523,8 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
|
|
|
|
self.mbr_protect = False
|
|
|
|
|
self.reg_protect = False
|
|
|
|
|
self.enh_protect = False
|
|
|
|
|
self.tray_icon.hide()
|
|
|
|
|
self.hideWindow()
|
|
|
|
|
self.tray_icon.hide()
|
|
|
|
|
app.quit()
|
|
|
|
|
event.ignore()
|
|
|
|
|
|
|
|
|
@@ -855,7 +856,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
|
|
|
|
def repair_system_icon(self):
|
|
|
|
|
try:
|
|
|
|
|
for file_type in ['exefile', 'comfile', 'txtfile', 'dllfile', 'inifile', 'VBSfile']:
|
|
|
|
|
time.sleep(0.01)
|
|
|
|
|
time.sleep(0.001)
|
|
|
|
|
try:
|
|
|
|
|
key = win32api.RegOpenKey(win32con.HKEY_CLASSES_ROOT, file_type, 0, win32con.KEY_ALL_ACCESS)
|
|
|
|
|
win32api.RegSetValue(key, 'DefaultIcon', win32con.REG_SZ, '%1')
|
|
|
|
@@ -875,7 +876,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
|
|
|
|
count = win32api.RegQueryInfoKey(key)[0]
|
|
|
|
|
while count >= 0:
|
|
|
|
|
try:
|
|
|
|
|
time.sleep(0.01)
|
|
|
|
|
time.sleep(0.001)
|
|
|
|
|
subKeyName = win32api.RegEnumKey(key, count)
|
|
|
|
|
win32api.RegDeleteKey(key, subKeyName)
|
|
|
|
|
except:
|
|
|
|
@@ -887,18 +888,17 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
|
|
|
|
def repair_system_file_type(self):
|
|
|
|
|
try:
|
|
|
|
|
data = [('jpegfile', 'JPEG Image'),('.exe', 'exefile'),('exefile', 'Application'),('.com', 'comfile'),('comfile', 'MS-DOS Application'),
|
|
|
|
|
('.scr', 'scrfile'),('scrfile', 'Screen saver'),('.zip', 'CompressedFolder'),('.dll', 'dllfile'),('dllfile', 'Application Extension'),
|
|
|
|
|
('.sys', 'sysfile'),('sysfile', 'System file'),('.bat', 'batfile'),('batfile', 'Windows Batch File'),('VBS', 'VB Script Language'),
|
|
|
|
|
('VBSfile', 'VBScript Script File'),('.txt', 'txtfile'),('txtfile', 'Text Document'),('.ini', 'inifile'),
|
|
|
|
|
('inifile', 'Configuration Settings'),('.msc', 'MSCfile'),('MSCfile', 'Microsoft Common Console Document')]
|
|
|
|
|
('.zip', 'CompressedFolder'),('.dll', 'dllfile'),('dllfile', 'Application Extension'),('.sys', 'sysfile'),('sysfile', 'System file'),
|
|
|
|
|
('.bat', 'batfile'),('batfile', 'Windows Batch File'),('VBS', 'VB Script Language'),('VBSfile', 'VBScript Script File'),
|
|
|
|
|
('.txt', 'txtfile'),('txtfile', 'Text Document'),('.ini', 'inifile'),('inifile', 'Configuration Settings')]
|
|
|
|
|
key = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE, 'SOFTWARE\Classes', 0, win32con.KEY_ALL_ACCESS)# HKEY_LOCAL_MACHINE
|
|
|
|
|
for ext, value in data:
|
|
|
|
|
time.sleep(0.01)
|
|
|
|
|
time.sleep(0.001)
|
|
|
|
|
win32api.RegSetValue(key, ext, win32con.REG_SZ, value)
|
|
|
|
|
win32api.RegCloseKey(key)
|
|
|
|
|
key = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, 'SOFTWARE\Classes', 0, win32con.KEY_ALL_ACCESS)# HKEY_CURRENT_USER
|
|
|
|
|
for ext, value in data:
|
|
|
|
|
time.sleep(0.01)
|
|
|
|
|
time.sleep(0.001)
|
|
|
|
|
win32api.RegSetValue(key, ext, win32con.REG_SZ, value)
|
|
|
|
|
try:
|
|
|
|
|
keyopen = win32api.RegOpenKey(key, ext + r'\shell\open', 0, win32con.KEY_ALL_ACCESS)
|
|
|
|
@@ -910,18 +910,18 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
|
|
|
|
key = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts', 0, win32con.KEY_ALL_ACCESS)# HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts
|
|
|
|
|
extensions = ['.exe', '.zip', '.dll', '.sys', '.bat', '.txt', '.msc']
|
|
|
|
|
for ext in extensions:
|
|
|
|
|
time.sleep(0.01)
|
|
|
|
|
time.sleep(0.001)
|
|
|
|
|
win32api.RegSetValue(key, ext, win32con.REG_SZ, '')
|
|
|
|
|
win32api.RegCloseKey(key)
|
|
|
|
|
key = win32api.RegOpenKey(win32con.HKEY_CLASSES_ROOT, None, 0, win32con.KEY_ALL_ACCESS)# HKEY_CLASSES_ROOT
|
|
|
|
|
for ext, value in data:
|
|
|
|
|
time.sleep(0.01)
|
|
|
|
|
time.sleep(0.001)
|
|
|
|
|
win32api.RegSetValue(key, ext, win32con.REG_SZ, value)
|
|
|
|
|
if ext in ['.cmd', '.vbs']:
|
|
|
|
|
win32api.RegSetValue(key, ext + 'file', win32con.REG_SZ, 'Windows Command Script')
|
|
|
|
|
try:
|
|
|
|
|
keyopen = win32api.RegOpenKey(key, ext + r'\shell\open', 0, win32con.KEY_ALL_ACCESS)
|
|
|
|
|
win32api.RegSetValue(keyopen, 'command', win32con.REG_SZ, '"%1" /S')
|
|
|
|
|
win32api.RegSetValue(keyopen, 'command', win32con.REG_SZ, '"%1" %*')
|
|
|
|
|
win32api.RegCloseKey(keyopen)
|
|
|
|
|
except:
|
|
|
|
|
pass
|
|
|
|
@@ -931,7 +931,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
|
|
|
|
|
|
|
|
|
def repair_system_restrictions(self):
|
|
|
|
|
try:
|
|
|
|
|
Permission = ["NoControlPanel", "NoDrives", "NoControlPanel", "NoFileMenu", "NoFind", "NoRealMode", "NoRecentDocsMenu","NoSetFolders",
|
|
|
|
|
Permission = ["NoControlPanel", "NoDrives", "NoFileMenu", "NoFind", "NoRealMode", "NoRecentDocsMenu","NoSetFolders",
|
|
|
|
|
"NoSetFolderOptions", "NoViewOnDrive", "NoClose", "NoRun", "NoDesktop", "NoLogOff", "NoFolderOptions", "RestrictRun","DisableCMD",
|
|
|
|
|
"NoViewContexMenu", "HideClock", "NoStartMenuMorePrograms", "NoStartMenuMyGames", "NoStartMenuMyMusic" "NoStartMenuNetworkPlaces",
|
|
|
|
|
"NoStartMenuPinnedList", "NoActiveDesktop", "NoSetActiveDesktop", "NoActiveDesktopChanges", "NoChangeStartMenu", "ClearRecentDocsOnExit",
|
|
|
|
@@ -958,7 +958,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
|
|
|
|
for key in keys:
|
|
|
|
|
for i in Permission:
|
|
|
|
|
try:
|
|
|
|
|
time.sleep(0.01)
|
|
|
|
|
time.sleep(0.001)
|
|
|
|
|
win32api.RegDeleteValue(key,i)
|
|
|
|
|
except:
|
|
|
|
|
pass
|
|
|
|
@@ -990,6 +990,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
|
|
|
|
if QMessageBox.warning(self,self.text_Translate("清理系統垃圾"),self.text_Translate("您確定要清理系統垃圾嗎?"),QMessageBox.Yes|QMessageBox.No) == 16384:
|
|
|
|
|
self.total_deleted_size = 0
|
|
|
|
|
self.traverse_temp_files(f"C:/Users/{os.getlogin()}/AppData/Local/Temp")
|
|
|
|
|
self.traverse_temp_files(f"C:/Windows/Temp")
|
|
|
|
|
self.traverse_temp_files(f"C:/$Recycle.Bin")
|
|
|
|
|
QMessageBox.information(self,self.text_Translate("完成"),self.text_Translate(f"成功清理了 {self.total_deleted_size} 位元的系統垃圾"),QMessageBox.Ok)
|
|
|
|
|
except Exception as e:
|
|
|
|
@@ -1003,8 +1004,9 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
|
|
|
|
if os.path.isdir(fullpath):
|
|
|
|
|
self.traverse_temp_files(fullpath)
|
|
|
|
|
else:
|
|
|
|
|
self.total_deleted_size += os.path.getsize(fullpath)
|
|
|
|
|
file_size = os.path.getsize(fullpath)
|
|
|
|
|
os.remove(fullpath)
|
|
|
|
|
self.total_deleted_size += file_size
|
|
|
|
|
except:
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
@@ -1033,22 +1035,18 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
|
|
|
|
def Process_list(self):
|
|
|
|
|
try:
|
|
|
|
|
self.Process_list_app = []
|
|
|
|
|
self.Process_list_app_exe = []
|
|
|
|
|
self.Process_list_app_pid = []
|
|
|
|
|
self.Process_list_app_name = []
|
|
|
|
|
self.Process_list_app_user = []
|
|
|
|
|
for p in psutil.process_iter():
|
|
|
|
|
self.Process_list_iter = psutil.process_iter()
|
|
|
|
|
for p in self.Process_list_iter:
|
|
|
|
|
try:
|
|
|
|
|
self.Process_list_app.append(f"{p.name()} ({p.pid}) > {p.exe()}")
|
|
|
|
|
self.Process_list_app_pid.append(p.pid)
|
|
|
|
|
self.Process_list_app_exe.append(p.exe())
|
|
|
|
|
self.Process_list_app_name.append(p.name())
|
|
|
|
|
self.Process_list_app_user.append(p.username())
|
|
|
|
|
QApplication.processEvents()
|
|
|
|
|
except:
|
|
|
|
|
pass
|
|
|
|
|
if len(self.Process_list_app_name) != self.Process_quantity:
|
|
|
|
|
self.Process_quantity = len(self.Process_list_app_name)
|
|
|
|
|
self.Process_list_all_pid = self.Process_list_app_pid
|
|
|
|
|
if len(self.Process_list_app_pid) != self.Process_quantity:
|
|
|
|
|
self.Process_quantity = len(self.Process_list_app_pid)
|
|
|
|
|
self.ui.Process_Total_View.setText(str(self.Process_quantity))
|
|
|
|
|
self.Process_sim.setStringList(self.Process_list_app)
|
|
|
|
|
self.ui.Process_list.setModel(self.Process_sim)
|
|
|
|
@@ -1057,17 +1055,12 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
|
|
|
|
|
|
|
|
|
def Process_list_Menu(self,pos):
|
|
|
|
|
try:
|
|
|
|
|
self.item = self.ui.Process_list.selectedIndexes()
|
|
|
|
|
for i in self.item:
|
|
|
|
|
item = i.row()
|
|
|
|
|
self.pid = self.Process_list_app_pid[item]
|
|
|
|
|
self.exefile = self.Process_list_app_exe[item]
|
|
|
|
|
self.exename = self.Process_list_app_name[item]
|
|
|
|
|
for i in self.ui.Process_list.selectedIndexes():
|
|
|
|
|
self.pid = self.Process_list_all_pid[i.row()]
|
|
|
|
|
self.Process_popMenu = QMenu()
|
|
|
|
|
self.kill_Process = QAction(self.text_Translate("結束進程"),self)
|
|
|
|
|
self.Process_popMenu.addAction(self.kill_Process)
|
|
|
|
|
ques = self.Process_popMenu.exec_(self.ui.Process_list.mapToGlobal(pos))
|
|
|
|
|
if ques == self.kill_Process:
|
|
|
|
|
if self.Process_popMenu.exec_(self.ui.Process_list.mapToGlobal(pos)) == self.kill_Process:
|
|
|
|
|
for p in psutil.process_iter():
|
|
|
|
|
if p.pid == self.pid:
|
|
|
|
|
p.kill()
|
|
|
|
@@ -1196,7 +1189,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
|
|
|
|
elif action and str(os.path.splitext(file)[1]).lower() in sflist:
|
|
|
|
|
if self.sign_scan(file) and self.api_scan(file):
|
|
|
|
|
os.remove(file)
|
|
|
|
|
self.system_notification(self.text_Translate("病毒刪除: ")+file)
|
|
|
|
|
self.system_notification(self.text_Translate("惡意軟體刪除: ")+file)
|
|
|
|
|
except:
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
@@ -1229,7 +1222,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
pyas_version = "2.7.1"
|
|
|
|
|
pyas_version = "2.7.2"
|
|
|
|
|
QtCore.QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
|
|
|
|
|
QtGui.QGuiApplication.setAttribute(Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)
|
|
|
|
|
app = QtWidgets.QApplication(sys.argv)
|
|
|
|
|