Compare commits

...
4 Commits
Author SHA1 Message Date
PYDT 939cf7c0df Add files via upload 2022-12-26 16:17:09 +08:00
PYDT 9f2256b547 Add files via upload 2022-12-26 13:02:19 +08:00
PYDT b301b9fb95 Add files via upload 2022-12-23 15:49:00 +08:00
PYDT a61c49cf68 Add files via upload 2022-12-23 12:54:50 +08:00
2 changed files with 114 additions and 236 deletions

No files matched your search

+113 -235
View File
@@ -5,9 +5,24 @@
# PYAS Web: https://pyantivirus.wixsite.com/pyas
#
# PYAS is managed by PYDT (Python Development Team)
# Copyright© 2020-2022 87owo (PYAS Security)
# Copyright© 2020-2023 87owo (PYAS Security)
####################################################################################
#
##################################### 載入必要模組 ###################################
import time
start_m = time.time()
import os, sys, psutil, subprocess, threading, configparser
from pefile import PE, DIRECTORY_ENTRY
from win10toast import ToastNotifier
from hashlib import md5, sha1, sha256
from PYAS_English import english_list
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5 import QtWidgets, QtGui, QtCore
from PYAS_UI import Ui_MainWindow
###################################### 錯誤日誌 #####################################
def pyas_bug_log(e):
@@ -19,27 +34,6 @@ def pyas_bug_log(e):
except:
pass
##################################### 載入必要模組 ###################################
try:
import time
start_m = time.time()
import os, sys, psutil, subprocess, threading, configparser, datetime
from pefile import PE, DIRECTORY_ENTRY
from win10toast import ToastNotifier
from hashlib import md5, sha1, sha256
from PYAS_English import english_list
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5 import QtWidgets, QtGui, QtCore
from PYAS_UI import Ui_MainWindow
#from watchdog.events import FileSystemEventHandler #Beta Not Cplt
#from watchdog.observers import Observer
except Exception as e:
pyas_bug_log(e)
print('[LOAD] Mods: '+str(time.time()-start_m)+' sec')
##################################### 移除暫存檔 ####################################
def pyasb_remove():
@@ -62,8 +56,6 @@ def pyas_library():
os.makedirs('Library/PYAS/Temp')
if not os.path.isdir('Library/PYAS/Setup'):
os.makedirs('Library/PYAS/Setup')
if not os.path.isdir('Library/PYAS/Audio'):
os.makedirs('Library/PYAS/Audio')
if not os.path.isdir('Library/PYAS/Icon'):
os.makedirs('Library/PYAS/Icon')
if not os.path.isdir('Library/PYAE/Function'):
@@ -83,7 +75,6 @@ def pyas_vl_update():
v = 0
try:
import requests as req
start = time.time()
for i in range(int(v),10000):
try:
x = 5 - len(str(i))
@@ -122,7 +113,6 @@ def pyas_vl_update():
###################################### 密鑰認證 #####################################
def pyas_key():
start = time.time()
try:
if os.path.isfile('Library/PYAS/Setup/PYAS.key'):
try:
@@ -140,10 +130,8 @@ def pyas_key():
fe = ft.read()
ft.close()
if fe == readable_hash:
print('[LOAD] Key: '+str(time.time()-start)+' sec')
return True
else:
print('[LOAD] Key: '+str(time.time()-start)+' sec')
return False
except:
pass
@@ -151,14 +139,12 @@ def pyas_key():
return False
except Exception as e:
pyas_bug_log(e)
print('[LOAD] Key: '+str(time.time()-start)+' sec')
return False
###################################### 主要程式 #####################################
class MainWindow_Controller(QtWidgets.QMainWindow):#,FileSystemEventHandler):
def __init__(self):
start = time.time()
super(MainWindow_Controller, self).__init__()
self.ui = Ui_MainWindow() #繼承
self.ui.pyas_opacity = 100
@@ -167,14 +153,12 @@ class MainWindow_Controller(QtWidgets.QMainWindow):#,FileSystemEventHandler):
#self.setWindowFlags(Qt.WindowStaysOnTopHint|self.windowFlags()) #窗口置頂
self.ui.setupUi(self)
self.setup_control()
print('[LOAD] GUI: '+str(time.time()-start)+' sec')
def resizeEvent(self, event):
width, height = event.size().width(), event.size().height()
print('[INFO] '+str(event.size()))
def setup_control(self):
# TODO
def setup_control(self):# TODO
self.init()#調用本地函數"init"
self.ui.Close_Button.clicked.connect(self.close)#讓物件名稱"Close_Button"連接到函數"close"
self.ui.Minimize_Button.clicked.connect(self.showMinimized)
@@ -217,10 +201,8 @@ class MainWindow_Controller(QtWidgets.QMainWindow):#,FileSystemEventHandler):
self.ui.Customize_REG_Command_Button.clicked.connect(lambda:self.Change_Tools(self.ui.Customize_REG_Command_widget))
self.ui.Change_Users_Password_Button.clicked.connect(lambda:self.Change_Tools(self.ui.Change_Users_Password_widget))
self.ui.Change_Users_Password_Back.clicked.connect(lambda:self.Back_To_More_Tools(self.ui.Change_Users_Password_widget))
self.ui.About_Back.clicked.connect(self.ui.About_widget.hide)
self.ui.Setting_Back.clicked.connect(self.Setting_Back)
self.ui.Repair_System_Permission_Button.clicked.connect(self.Repair_System_Permission)
self.ui.Repair_System_Files_Button.clicked.connect(self.Repair_System_Files)
self.ui.Clean_System_Files_Button.clicked.connect(self.Clean_System_Files)
@@ -235,7 +217,6 @@ class MainWindow_Controller(QtWidgets.QMainWindow):#,FileSystemEventHandler):
self.ui.Internet_location_Query_Button.clicked.connect(self.Internet_location_Query)
self.ui.Rework_Network_Configuration_Button.clicked.connect(self.reset_network)
self.ui.Customize_REG_Command_Run_Button.clicked.connect(self.Customize_REG_Command)
self.ui.Process_list.setContextMenuPolicy(Qt.CustomContextMenu)
self.ui.Process_list.customContextMenuRequested.connect(self.Process_list_Menu)
#Protection
@@ -265,18 +246,9 @@ class MainWindow_Controller(QtWidgets.QMainWindow):#,FileSystemEventHandler):
self.Safe = True
self.Process_Timer=QTimer()
self.Process_Timer.timeout.connect(self.Process_list)
self.pause = False
self.ini_config = configparser.RawConfigParser()
try:
self.ini_config.read(r"Library/PYAS/Setup/PYAS.ini")
except:
try:
with open(r"Library/PYAS/Setup/PYAS.ini",mode="w",encoding="utf-8") as file:
file.write("[Setting]\nhigh_sensitivity = 0\nlanguage = english")
file.close()
except Exception as e:
pyas_bug_log(e)
try:
if self.ini_config.get("Setting","language") == "zh_TW":
self.language = "zh_TW"
self.lang_init_zh_tw()
@@ -289,8 +261,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):#,FileSystemEventHandler):
self.language = "english"
self.lang_init_en()
self.ui.Languahe_English.setChecked(True)
except Exception as e:
pyas_bug_log(e)
except:
try:
with open(r"Library/PYAS/Setup/PYAS.ini",mode="w",encoding="utf-8") as file:
file.write("[Setting]\nhigh_sensitivity = 0\nlanguage = english")
@@ -301,45 +272,32 @@ class MainWindow_Controller(QtWidgets.QMainWindow):#,FileSystemEventHandler):
self.lang_init_en()
self.ui.Languahe_English.setChecked(True)
try:
threading.Thread(target = pyas_vl_update).start()
if protect_autorun:
threading.Thread(target = self.pyas_protect_init_zh).start()
if self.ini_config.getint("Setting","high_sensitivity") == 1:
if self.ini_config.get("Setting","language") == "zh_TW":
self.show_virus_scan_progress_bar = 1
self.ui.Show_Virus_Scan_Progress_Bar_switch_Button.setText(self.text_Translate("已開啟"))
self.ui.Show_Virus_Scan_Progress_Bar_switch_Button.setStyleSheet("""
QPushButton{
border:none;
background-color:rgba(20,200,20,100);
border-radius: 15px;}
QPushButton:hover{
background-color:rgba(20,200,20,120);}""")
QPushButton{border:none;background-color:rgba(20,200,20,100);border-radius: 15px;}
QPushButton:hover{background-color:rgba(20,200,20,120);}""")
else:
self.show_virus_scan_progress_bar = 1
self.ui.Show_Virus_Scan_Progress_Bar_switch_Button.setText(self.text_Translate("已开启"))
self.ui.Show_Virus_Scan_Progress_Bar_switch_Button.setStyleSheet("""
QPushButton{
border:none;
background-color:rgba(20,200,20,100);
border-radius: 15px;}
QPushButton:hover{
background-color:rgba(20,200,20,120);}""")
QPushButton{border:none;background-color:rgba(20,200,20,100);border-radius: 15px;}
QPushButton:hover{background-color:rgba(20,200,20,120);}""")
else:
self.show_virus_scan_progress_bar = 0
except Exception as e:
pyas_bug_log(e)
except:
self.show_virus_scan_progress_bar = 0
###################################### 許可條款 #####################################
self.ui.License_terms.setText('''Copyright (C) 2020-2022 87owo (PYAS Security)
=====================================================
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.''')
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.''')
self.effect_shadow = QtWidgets.QGraphicsDropShadowEffect(self)
self.effect_shadow.setOffset(0,0) # 偏移
self.effect_shadow.setBlurRadius(10) # 阴影半径
self.effect_shadow.setColor(QtCore.Qt.gray) # 阴影颜色
self.ui.widget_2.setGraphicsEffect(self.effect_shadow) # 将设置套用到widget窗口中
self.effect_shadow.setBlurRadius(10) # 陰影半徑
self.effect_shadow.setColor(QtCore.Qt.gray) # 陰影颜色
self.ui.widget_2.setGraphicsEffect(self.effect_shadow)
self.effect_shadow2 = QtWidgets.QGraphicsDropShadowEffect(self)
self.effect_shadow2.setOffset(0,0)
self.effect_shadow2.setBlurRadius(10)
@@ -350,7 +308,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
self.effect_shadow3.setBlurRadius(7)
self.effect_shadow3.setColor(QtCore.Qt.gray)
self.ui.Window_widget.setGraphicsEffect(self.effect_shadow3)
self.ui.Virus_Scan_choose_widget.hide()#hide()函數的用意是隱藏物件
self.ui.Virus_Scan_widget.hide()
self.ui.Tools_widget.hide()
@@ -382,8 +339,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if self.pyas_scan_start(event.src_path, rfp):
try:
os.remove(str(event.src_path))
#self.ui.State_output.clear()
#self.ui.State_output.append(self.text_Translate('{} > [行為防護] 成功攔截了惡意檔案創建行為。').format(str(datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S'))))
except Exception as e:
pyas_bug_log(e)
pass
@@ -399,20 +354,19 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
##################################### 英文初始化 ####################################
def lang_init_en(self):
start = time.time()
_translate = QtCore.QCoreApplication.translate
if pyas_key():
self.ui.State_output.clear()
self.ui.Window_title.setText(_translate("MainWindow", "PYAS V"+pyas_version))
now_time = datetime.datetime.now()
if not os.path.isfile('Library/PYAS/Temp/PYASP.tmp'):
if not protect_autorun:
self.ui.State_output.clear()
self.ui.State_output.append(str(time.strftime('%Y/%m/%d %H:%M:%S')) + ' > [Tips] Real-time Protect is not enabled')
else:
self.ui.State_output.clear()
self.ui.State_output.append(str(now_time.strftime('%Y/%m/%d %H:%M:%S')) + ' > [Tips] Real-time Protect is not enabled')
else:
self.ui.Window_title.setText(_translate("MainWindow", "PYAS V"+pyas_version+" (Security Key Error)"))
now_time = datetime.datetime.now()
self.ui.State_output.clear()
self.ui.State_output.append(str(now_time.strftime('%Y/%m/%d %H:%M:%S')) + ' > [Warning] PYAS Security Key Error')
self.ui.State_output.append(str(time.strftime('%Y/%m/%d %H:%M:%S')) + ' > [Warning] PYAS Security Key Error')
self.ui.State_Button.setText(_translate("MainWindow", "State"))
self.ui.Virus_Scan_Button.setText(_translate("MainWindow", "Scan"))
self.ui.Tools_Button.setText(_translate("MainWindow", "Tools"))
@@ -486,11 +440,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
self.ui.GUI_Made_Name.setText(_translate("MainWindow", "mtkiao129"))
self.ui.Core_Made_title.setText(_translate("MainWindow", "Core Make:"))
self.ui.Core_Made_Name.setText(_translate("MainWindow", "87owo"))
self.ui.Testers_title.setText(_translate("MainWindow", "Data Make:"))
self.ui.Testers_title.setText(_translate("MainWindow", "Testers:"))
self.ui.Testers_Name.setText(_translate("MainWindow", "yang5487"))
self.ui.PYAS_URL_title.setText(_translate("MainWindow", "Website:"))
self.ui.PYAS_URL.setText(_translate("MainWindow", "<html><head/><body><p><a href=\"https://pyantivirus.wixsite.com/pyas?lang=en\"><span style= \" text-decoration: underline; color:#0000ff;\">https://pyantivirus.wixsite.com/pyas</span></a></p></body></html>"))
cy = datetime.datetime.now().strftime('%Y')
cy = time.strftime('%Y')
if int(cy) < 2020:
cy = str('2020')
self.ui.PYAS_CopyRight.setText(_translate("MainWindow", "Copyright© 2020-"+str(cy)+" 87owo (PYAS Security)"))
@@ -533,25 +487,21 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
self.ui.Theme_Red.setText(_translate("MainWindow", "Red"))
self.ui.Theme_Green.setText(_translate("MainWindow", "Green"))
self.ui.Theme_Blue.setText(_translate("MainWindow", "Blue"))
print('[LOAD] Lang: '+str(time.time()-start)+' sec')
##################################### 簡中初始化 ####################################
def lang_init_zh_cn(self):
start = time.time()
_translate = QtCore.QCoreApplication.translate
if pyas_key():
self.ui.State_output.clear()
self.ui.Window_title.setText(_translate("MainWindow", "PYAS V"+pyas_version))
now_time = datetime.datetime.now()
if not os.path.isfile('Library/PYAS/Temp/PYASP.tmp'):
if not protect_autorun:
self.ui.State_output.clear()
self.ui.State_output.append(str(now_time.strftime('%Y/%m/%d %H:%M:%S')) + ' > [提示] 尚未启用实时防护')
self.ui.State_output.append(str(time.strftime('%Y/%m/%d %H:%M:%S')) + ' > [提示] 尚未启用实时防护')
else:
self.ui.Window_title.setText(_translate("MainWindow", "PYAS V"+pyas_version+" (安全密钥错误)"))
now_time = datetime.datetime.now()
self.ui.State_output.clear()
self.ui.State_output.append(str(now_time.strftime('%Y/%m/%d %H:%M:%S')) + ' > [警告] PYAS 安全密钥错误')
self.ui.State_output.append(str(time.strftime('%Y/%m/%d %H:%M:%S')) + ' > [警告] PYAS 安全密钥错误')
self.ui.State_Button.setText(_translate("MainWindow", "状态"))
self.ui.Virus_Scan_Button.setText(_translate("MainWindow", "扫描"))
self.ui.Tools_Button.setText(_translate("MainWindow", "工具"))
@@ -625,11 +575,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
self.ui.GUI_Made_Name.setText(_translate("MainWindow", "mtkiao129"))
self.ui.Core_Made_title.setText(_translate("MainWindow", "核心制作:"))
self.ui.Core_Made_Name.setText(_translate("MainWindow", "87owo"))
self.ui.Testers_title.setText(_translate("MainWindow", "数据整理:"))
self.ui.Testers_title.setText(_translate("MainWindow", "测试人员:"))
self.ui.Testers_Name.setText(_translate("MainWindow", "yang5487"))
self.ui.PYAS_URL_title.setText(_translate("MainWindow", "官方网站:"))
self.ui.PYAS_URL.setText(_translate("MainWindow", "<html><head/><body><p><a href=\"https://pyantivirus.wixsite.com/pyas\"><span style=\" text-decoration: underline; color:#0000ff;\">https://pyantivirus.wixsite.com/pyas</span></a></p></body></html>"))
cy = datetime.datetime.now().strftime('%Y')
cy = time.strftime('%Y')
if int(cy) < 2020:
cy = str('2020')
self.ui.PYAS_CopyRight.setText(_translate("MainWindow", "Copyright© 2020-"+str(cy)+" 87owo (PYAS Security)"))
@@ -672,25 +622,21 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
self.ui.Theme_Red.setText(_translate("MainWindow", "红色主题"))
self.ui.Theme_Green.setText(_translate("MainWindow", "绿色主题"))
self.ui.Theme_Blue.setText(_translate("MainWindow", "蓝色主题"))
print('[LOAD] Lang: '+str(time.time()-start)+' sec')
##################################### 繁中初始化 ####################################
def lang_init_zh_tw(self):
start = time.time()
_translate = QtCore.QCoreApplication.translate
if pyas_key():
self.ui.State_output.clear()
self.ui.Window_title.setText(_translate("MainWindow", "PYAS V"+pyas_version))
now_time = datetime.datetime.now()
if not os.path.isfile('Library/PYAS/Temp/PYASP.tmp'):
if not protect_autorun:
self.ui.State_output.clear()
self.ui.State_output.append(str(now_time.strftime('%Y/%m/%d %H:%M:%S')) + ' > [提示] 尚未啟用實時防護')
self.ui.State_output.append(str(time.strftime('%Y/%m/%d %H:%M:%S')) + ' > [提示] 尚未啟用實時防護')
else:
self.ui.Window_title.setText(_translate("MainWindow", "PYAS V"+pyas_version+" (安全密鑰錯誤)"))
now_time = datetime.datetime.now()
self.ui.State_output.clear()
self.ui.State_output.append(str(now_time.strftime('%Y/%m/%d %H:%M:%S')) + ' > [警告] PYAS 安全密鑰錯誤')
self.ui.State_output.append(str(time.strftime('%Y/%m/%d %H:%M:%S')) + ' > [警告] PYAS 安全密鑰錯誤')
self.ui.State_Button.setText(_translate("MainWindow", "狀態"))
self.ui.Virus_Scan_Button.setText(_translate("MainWindow", "掃描"))
self.ui.Tools_Button.setText(_translate("MainWindow", "工具"))
@@ -764,11 +710,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
self.ui.GUI_Made_Name.setText(_translate("MainWindow", "mtkiao129"))
self.ui.Core_Made_title.setText(_translate("MainWindow", "核心製作:"))
self.ui.Core_Made_Name.setText(_translate("MainWindow", "87owo"))
self.ui.Testers_title.setText(_translate("MainWindow", "數據整理:"))
self.ui.Testers_title.setText(_translate("MainWindow", "測試人員:"))
self.ui.Testers_Name.setText(_translate("MainWindow", "yang5487"))
self.ui.PYAS_URL_title.setText(_translate("MainWindow", "官方網站:"))
self.ui.PYAS_URL.setText(_translate("MainWindow", "<html><head/><body><p><a href=\"https://pyantivirus.wixsite.com/pyas\"><span style=\" text-decoration: underline; color:#0000ff;\">https://pyantivirus.wixsite.com/pyas</span></a></p></body></html>"))
cy = datetime.datetime.now().strftime('%Y')
cy = time.strftime('%Y')
if int(cy) < 2020:
cy = str('2020')
self.ui.PYAS_CopyRight.setText(_translate("MainWindow", "Copyright© 2020-"+str(cy)+" 87owo (PYAS Security)"))
@@ -811,7 +757,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
self.ui.Theme_Red.setText(_translate("MainWindow", "紅色主題"))
self.ui.Theme_Green.setText(_translate("MainWindow", "綠色主題"))
self.ui.Theme_Blue.setText(_translate("MainWindow", "藍色主題"))
print('[LOAD] Lang: '+str(time.time()-start)+' sec')
##################################### 繁簡中翻譯 ####################################
@@ -878,7 +823,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
def Change_animation_3(self,widget,time):
#這裡是設定透明度
if self.Virus_Scan != 1:
if 1:#self.Virus_Scan != 1:
self.opacity = QtWidgets.QGraphicsOpacityEffect()
self.opacity.setOpacity(0)
widget.setGraphicsEffect(self.opacity)
@@ -924,7 +869,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if self.ui.State_widget.isHidden():#isHidden()函數用意是偵測物件是否在隱藏狀態
self.Change_animation_2(25,41)
self.Change_animation_3(self.ui.State_widget,1)
self.Change_animation_3(self.ui.State_widget,0.5)
self.Change_animation(self.ui.State_widget)
self.ui.State_widget.show()#show()函數用意是讓隱藏函數顯示出來
@@ -950,7 +895,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if self.ui.Virus_Scan_widget.isHidden():
self.Change_animation_2(25,164)
self.Change_animation_3(self.ui.Virus_Scan_widget,1)
self.Change_animation_3(self.ui.Virus_Scan_widget,0.5)
self.Change_animation(self.ui.Virus_Scan_widget)
self.ui.State_widget.hide()
@@ -976,7 +921,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if self.ui.Tools_widget.isHidden():
self.Change_animation_2(25,287)
self.Change_animation_3(self.ui.Tools_widget,1)
self.Change_animation_3(self.ui.Tools_widget,0.5)
self.Change_animation(self.ui.Tools_widget)
self.ui.State_widget.hide()
@@ -1002,7 +947,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if self.ui.Protection_widget.isHidden():
self.Change_animation_2(25,410)
self.Change_animation_3(self.ui.Protection_widget,1)
self.Change_animation_3(self.ui.Protection_widget,0.5)
self.Change_animation(self.ui.Protection_widget)
self.ui.State_widget.hide()
@@ -1036,7 +981,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
self.Process_Timer.start(200)
elif widget == self.ui.System_Info_widget:
self.System_Info_update()
self.Change_animation_3(widget,1)
self.Change_animation_3(widget,0.5)
self.Change_animation(widget)
widget.show()
@@ -1044,7 +989,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
widget.hide()
if widget == self.ui.Process_widget:
self.Process_Timer.stop()
self.Change_animation_3(self.ui.Tools_widget,1)
self.Change_animation_3(self.ui.Tools_widget,0.5)
self.Change_animation(self.ui.Tools_widget)
self.ui.Tools_widget.show()
@@ -1088,9 +1033,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
else:
all_files.append(os.path.join(path,file))
return all_files
except Exception as e:
pyas_bug_log(e)
return 0
except:
return False
def pyas_scan_start(self,file,rfp):#MD5較驗
try:
@@ -1135,8 +1079,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
ft.close()
self.Virus_List_output.setStringList(self.Virus_List)
self.ui.Virus_Scan_output.setModel(self.Virus_List_output)
now_time = datetime.datetime.now()
self.ui.State_output.append(str(now_time.strftime('%Y/%m/%d %H:%M:%S')) + self.text_Translate(" > [病毒掃描] 掃描出") + str(len(self.Virus_List)) + self.text_Translate("個病毒"))
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()
@@ -1174,10 +1117,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
def File_Scan(self):
print('[SCAN] Start Scan Action (File Scan)')
self.pyas_del_virus_temp()
self.Virus_List = []
self.ui.Virus_Scan_choose_widget.hide()
self.ui.Virus_Scan_Solve_Button.hide()
self.ui.Virus_Scan_ProgressBar.hide()
self.Virus_List = []
self.Virus_List_output=QStringListModel()
self.Virus_List_output.setStringList(self.Virus_List)
self.ui.Virus_Scan_output.setModel(self.Virus_List_output)
@@ -1242,8 +1185,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
self.ini_config = configparser.RawConfigParser()
try:
self.ini_config.read(r"Library/PYAS/Setup/PYAS.ini")
except Exception as e:
pyas_bug_log(e)
except:
pass
self.Virus_List = []
self.Virus_List_output=QStringListModel()
self.Virus_List_output.setStringList(self.Virus_List)
@@ -1823,10 +1766,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
def find_files_info_zh(self,ffile):
try:
start = time.time()
for d in range(26):
self.findfile_zh(str(chr(65+d))+':/',ffile,start)
end = time.time()
if os.path.isfile('Library/PYAS/Temp/PYASF.tmp'):
try:
ft = open('Library/PYAS/Temp/PYASF.tmp','r',encoding="utf-8")
@@ -1985,44 +1926,30 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
##################################### 實時防護 #####################################
def protect_threading_init_zh(self):
pyasp_remove()
if self.ui.Protection_switch_Button.text() == self.text_Translate("已開啟"):
pyasp_remove()
self.ui.Protection_switch_Button.setText(self.text_Translate("已關閉"))
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);}""")
QPushButton{border:none;background-color:rgba(20,20,20,30);border-radius: 15px;}
QPushButton:hover{background-color:rgba(20,20,20,50);}""")
self.Virus_Scan = 0
self.ui.State_output.clear()
now_time = datetime.datetime.now()
self.ui.State_output.append(str(now_time.strftime('%Y/%m/%d %H:%M:%S')) + self.text_Translate(' > [提示] 尚未啟用實時防護'))
self.ui.State_output.append(str(time.strftime('%Y/%m/%d %H:%M:%S')) + self.text_Translate(' > [提示] 尚未啟用實時防護'))
QApplication.processEvents()
self.pause = True
elif self.ui.Protection_switch_Button.text() == self.text_Translate("已开启"):
pyasp_remove()
self.ui.Protection_switch_Button.setText(self.text_Translate("已关闭"))
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);}""")
QPushButton{border:none;background-color:rgba(20,20,20,30);border-radius: 15px;}
QPushButton:hover{background-color:rgba(20,20,20,50);}""")
self.Virus_Scan = 0
self.ui.State_output.clear()
now_time = datetime.datetime.now()
self.ui.State_output.append(str(now_time.strftime('%Y/%m/%d %H:%M:%S')) + self.text_Translate(' > [提示] 尚未启用实时防护'))
self.ui.State_output.append(str(time.strftime('%Y/%m/%d %H:%M:%S')) + self.text_Translate(' > [提示] 尚未启用实时防护'))
QApplication.processEvents()
self.pause = True
else:
try:
if pyas_key():
self.ui.State_output.clear()
self.ui.Protection_illustrate.setText(self.text_Translate("正在初始化中,請稍後..."))
self.pause = False
QApplication.processEvents()
threading.Thread(target = self.pyas_protect_init_zh).start()
else:
@@ -2036,75 +1963,44 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
ft = open('Library/PYAS/Temp/PYASP.tmp','w',encoding='utf-8')
ft.write('')
ft.close()
except Exception as e:
pyas_bug_log(e)
except:
pass
#try:
#print('[INFO] Reading Viruslist Database')
#with open('Library/PYAE/Hashes/Viruslist.md5','r') as fp:
#rfp = fp.read()
#fp.close()
#except Exception as e:
#pyas_bug_log(e)
self.Virus_Scan = 1
if self.ui.Protection_switch_Button.text() == self.text_Translate("已關閉"):
self.ui.Protection_illustrate.setText(self.text_Translate("啟用該選項可以實時監控進程中的惡意軟體並清除。"))
self.ui.Protection_switch_Button.setText(self.text_Translate("已開啟"))
self.ui.Protection_switch_Button.setStyleSheet("""
QPushButton{
border:none;
background-color:rgba(20,200,20,100);
border-radius: 15px;}
QPushButton:hover{
background-color:rgba(20,200,20,120);}""")
QPushButton{border:none;background-color:rgba(20,200,20,100);border-radius: 15px;}
QPushButton:hover{background-color:rgba(20,200,20,120);}""")
else:
self.ui.Protection_illustrate.setText(self.text_Translate("启用该选项可以实时监控进程中的恶意软件并清除。"))
self.ui.Protection_switch_Button.setText(self.text_Translate("已开启"))
self.ui.Protection_switch_Button.setStyleSheet("""
QPushButton{
border:none;
background-color:rgba(20,200,20,100);
border-radius: 15px;}
QPushButton:hover{
background-color:rgba(20,200,20,120);}""")
while not self.pause:
if not os.path.isfile('Library/PYAS/Temp/PYASP.tmp'):
self.pause = True
break
else:
self.Virus_Scan = 1
for p in psutil.process_iter():
try:
time.sleep(0.0001)
QApplication.processEvents()
file = str(p.exe())
if '' == file or 'C:\Windows' in file or 'C:\Program' in file or 'AppData' in file or 'MemCompression' in file or 'Registry' in file:
pass
else:
if self.pyas_sign_start(file) and 'PYAS' not in file:
try:
if subprocess.call('taskkill /f /im "'+str(p.name())+'" /t',shell=True) == 0:
print('[INFO] Malware blocking success: '+str(p.name()))
self.ui.State_output.append(self.text_Translate('{} > [實時防護] 成功攔截了一個惡意軟體:').format(str(datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S')))+str(p.name()))
toaster = ToastNotifier()
toaster.show_toast("PYAS Security",self.text_Translate('{} > [實時防護] 成功攔截了一個惡意軟體:').format(str(datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S')))+str(p.name()),icon_path="Library/PYAS/Icon/ICON.ico",duration=5,threaded=True)
else:
print('[INFO] Malware blocking failed: '+str(p.name()))
self.ui.State_output.append(self.text_Translate('{} > [實時防護] 惡意軟體攔截失敗:').format(datetime.datetime.now())+str(p.name()))
toaster = ToastNotifier()
toaster.show_toast("PYAS Security",self.text_Translate('{} > [實時防護] 惡意軟體攔截失敗:').format(str(datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S')))+str(p.name()),icon_path="Library/PYAS/Icon/ICON.ico",duration=5,threaded=True)
#os.remove(str(p.exe()))
#try:
#observer = Observer()
#observer.schedule(MainWindow_Controller(), os.path.dirname(p.exe()), False)
#observer.start()
#except Exception as e:
#pass
except Exception as e:
pyas_bug_log(e)
pass
except:
continue
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'):
for p in psutil.process_iter():
try:
time.sleep(0.0001)
QApplication.processEvents()
file = str(p.exe())
if '' == file or 'C:\Windows' in file or 'C:\Program' in file or 'AppData' in file or 'MemCompression' in file or 'Registry' in file:
pass
else:
if self.pyas_sign_start(file) and 'PYAS' not in file:
try:
if subprocess.call('taskkill /f /im "'+str(p.name())+'" /t',shell=True) == 0:
print('[INFO] Malware blocking success: '+str(p.name()))
self.ui.State_output.append(self.text_Translate('{} > [實時防護] 成功攔截了一個惡意軟體:').format(str(time.strftime('%Y/%m/%d %H:%M:%S')))+str(p.name()))
ToastNotifier().show_toast("PYAS Security",self.text_Translate('{} > [實時防護] 成功攔截了一個惡意軟體:').format(str(time.strftime('%Y/%m/%d %H:%M:%S')))+str(p.name()),icon_path="Library/PYAS/Icon/ICON.ico",duration=5,threaded=True)
else:
print('[INFO] Malware blocking failed: '+str(p.name()))
self.ui.State_output.append(self.text_Translate('{} > [實時防護] 惡意軟體攔截失敗:').format(time.strftime('%Y/%m/%d %H:%M:%S'))+str(p.name()))
ToastNotifier().show_toast("PYAS Security",self.text_Translate('{} > [實時防護] 惡意軟體攔截失敗:').format(str(time.strftime('%Y/%m/%d %H:%M:%S')))+str(p.name()),icon_path="Library/PYAS/Icon/ICON.ico",duration=5,threaded=True)
except:
pass
except:
continue
##################################### 系統設置 #####################################
@@ -2150,12 +2046,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
pyas_bug_log(e)
self.ui.Show_Virus_Scan_Progress_Bar_switch_Button.setText(self.text_Translate("已開啟"))
self.ui.Show_Virus_Scan_Progress_Bar_switch_Button.setStyleSheet("""
QPushButton{
border:none;
background-color:rgba(20,200,20,100);
border-radius: 15px;}
QPushButton:hover{
background-color:rgba(20,200,20,120);}""")
QPushButton{border:none;background-color:rgba(20,200,20,100);border-radius: 15px;}
QPushButton:hover{background-color:rgba(20,200,20,120);}""")
self.show_virus_scan_progress_bar = 1
elif self.ui.Show_Virus_Scan_Progress_Bar_switch_Button.text() == self.text_Translate("已关闭"):
self.ini_config.set("Setting", "high_sensitivity", 1)
@@ -2165,12 +2057,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
pyas_bug_log(e)
self.ui.Show_Virus_Scan_Progress_Bar_switch_Button.setText(self.text_Translate("已开启"))
self.ui.Show_Virus_Scan_Progress_Bar_switch_Button.setStyleSheet("""
QPushButton{
border:none;
background-color:rgba(20,200,20,100);
border-radius: 15px;}
QPushButton:hover{
background-color:rgba(20,200,20,120);}""")
QPushButton{border:none;background-color:rgba(20,200,20,100);border-radius: 15px;}
QPushButton:hover{background-color:rgba(20,200,20,120);}""")
self.show_virus_scan_progress_bar = 1
elif self.ui.Show_Virus_Scan_Progress_Bar_switch_Button.text() == self.text_Translate("已开启"):
self.ini_config.set("Setting", "high_sensitivity", 0)
@@ -2180,12 +2068,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
pyas_bug_log(e)
self.ui.Show_Virus_Scan_Progress_Bar_switch_Button.setText(self.text_Translate("已关闭"))
self.ui.Show_Virus_Scan_Progress_Bar_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);}""")
QPushButton{border:none;background-color:rgba(20,20,20,30);border-radius: 15px;}
QPushButton:hover{background-color:rgba(20,20,20,50);}""")
self.show_virus_scan_progress_bar = 0
elif self.ui.Show_Virus_Scan_Progress_Bar_switch_Button.text() == self.text_Translate("已開啟"):
self.ini_config.set("Setting", "high_sensitivity", 0)
@@ -2195,12 +2079,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
pyas_bug_log(e)
self.ui.Show_Virus_Scan_Progress_Bar_switch_Button.setText(self.text_Translate("已關閉"))
self.ui.Show_Virus_Scan_Progress_Bar_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);}""")
QPushButton{border:none;background-color:rgba(20,20,20,30);border-radius: 15px;}
QPushButton:hover{background-color:rgba(20,20,20,50);}""")
self.show_virus_scan_progress_bar = 0
else:
self.ini_config.set("Setting", "high_sensitivity", 0)
@@ -2210,12 +2090,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
pyas_bug_log(e)
self.ui.Show_Virus_Scan_Progress_Bar_switch_Button.setText(self.text_Translate("已關閉"))
self.ui.Show_Virus_Scan_Progress_Bar_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);}""")
QPushButton{border:none;background-color:rgba(20,20,20,30);border-radius: 15px;}
QPushButton:hover{background-color:rgba(20,20,20,50);}""")
self.show_virus_scan_progress_bar = 0
except Exception as e:
pyas_bug_log(e)
@@ -2349,23 +2225,25 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if __name__ == '__main__':
try:
pyas_version = "2.5.2"
pyae_version = "2.2.1"
print('[INFO] PYAS V'+pyas_version+' , PYAE V'+pyae_version)
protect_autorun = False
pyas_library()
pyasb_remove()
pyasp_remove()
pyas_version = "2.5.1"
pyae_version = "2.2.1"
threading.Thread(target = pyas_vl_update).start()
if pyas_key() and os.path.isfile('Library/PYAS/Temp/PYASP.tmp'):
pyasp_remove()
protect_autorun = True
QtCore.QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling)# 自適應窗口縮放
QtGui.QGuiApplication.setAttribute(Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)# 自適應窗口縮放
app = QtWidgets.QApplication(sys.argv)
window = MainWindow_Controller()
window.setWindowOpacity(1)
window.show()
print('[INFO] PYAS V'+pyas_version+' , PYAE V'+pyae_version)
print('[LOAD] Total: '+str(time.time()-start_m)+' sec')
sys.exit(app.exec_())
except Exception as e:
pyas_bug_log(e)
####################################################################################
#Copyright© 2020-2022 87owo (PYAS Security)
#Copyright© 2020-2023 87owo (PYAS Security)
+1 -1
View File
@@ -1,7 +1,7 @@
import pyinstaller_versionfile
pyinstaller_versionfile.create_versionfile(
output_file="versionfile.txt",
version='2.5.1',
version='2.5.2',
company_name="PYAS Security",
file_description="Python Antivirus Software",
internal_name="PYAS",