|
|
|
@@ -11,7 +11,7 @@
|
|
|
|
|
##################################### 載入必要模組 ###################################
|
|
|
|
|
|
|
|
|
|
import time
|
|
|
|
|
start_m = time.time()
|
|
|
|
|
start_m = time.process_time()
|
|
|
|
|
import os, sys, psutil, subprocess, threading, configparser
|
|
|
|
|
from pefile import PE, DIRECTORY_ENTRY
|
|
|
|
|
from win10toast import ToastNotifier
|
|
|
|
@@ -329,27 +329,6 @@ class MainWindow_Controller(QtWidgets.QMainWindow):#,FileSystemEventHandler):
|
|
|
|
|
self.ui.Change_Users_Password_widget.hide()
|
|
|
|
|
self.ui.Customize_REG_Command_widget.hide()
|
|
|
|
|
self.ui.Setting_widget.hide()
|
|
|
|
|
|
|
|
|
|
#################################### 檔案行為防護 ####################################
|
|
|
|
|
|
|
|
|
|
def on_created(self, event): #不穩定(已停用)
|
|
|
|
|
print("File Create: "+str(event.src_path))
|
|
|
|
|
with open('Library/PYAE/Hashes/Viruslist.md5','r') as fp:
|
|
|
|
|
rfp = fp.read()
|
|
|
|
|
if self.pyas_scan_start(event.src_path, rfp):
|
|
|
|
|
try:
|
|
|
|
|
os.remove(str(event.src_path))
|
|
|
|
|
except Exception as e:
|
|
|
|
|
pyas_bug_log(e)
|
|
|
|
|
pass
|
|
|
|
|
rfp = ""
|
|
|
|
|
fp.close()
|
|
|
|
|
|
|
|
|
|
#def on_deleted(self, event):
|
|
|
|
|
#print("檔案被刪除: "+str(event.src_path))
|
|
|
|
|
|
|
|
|
|
#def on_modified(self, event):
|
|
|
|
|
#print("檔案被編輯: "+str(event.src_path))
|
|
|
|
|
|
|
|
|
|
##################################### 英文初始化 ####################################
|
|
|
|
|
|
|
|
|
@@ -1088,6 +1067,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):#,FileSystemEventHandler):
|
|
|
|
|
self.Virus_Scan = 0
|
|
|
|
|
self.Safe = False
|
|
|
|
|
print('[SCAN] Malware has been detected')
|
|
|
|
|
ToastNotifier().show_toast("PYAS Security",self.text_Translate("✖當前已發現惡意軟體共{}項。").format(len(self.Virus_List)),icon_path="Library/PYAS/Icon/ICON.ico",duration=5,threaded=True)
|
|
|
|
|
return self.text_Translate("✖當前已發現惡意軟體共{}項。").format(len(self.Virus_List))
|
|
|
|
|
except:
|
|
|
|
|
self.ui.Virus_Scan_Break_Button.hide()
|
|
|
|
@@ -1095,6 +1075,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):#,FileSystemEventHandler):
|
|
|
|
|
self.Virus_Scan = 0
|
|
|
|
|
self.Safe = True
|
|
|
|
|
print('[SCAN] No malware currently found')
|
|
|
|
|
ToastNotifier().show_toast("PYAS Security",self.text_Translate('✔當前未發現惡意軟體。'),icon_path="Library/PYAS/Icon/ICON.ico",duration=5,threaded=True)
|
|
|
|
|
return self.text_Translate('✔當前未發現惡意軟體。')
|
|
|
|
|
|
|
|
|
|
def pyas_scan_answer_en(self):
|
|
|
|
@@ -1145,12 +1126,10 @@ class MainWindow_Controller(QtWidgets.QMainWindow):#,FileSystemEventHandler):
|
|
|
|
|
if self.pyas_sign_start(file):#簽名檢查
|
|
|
|
|
if self.pyas_scan_start(file,rfp):#MD5較驗
|
|
|
|
|
self.pyas_scan_write_en(file)#寫入發現病毒
|
|
|
|
|
self.ui.Virus_Scan_text.setText(self.text_Translate("✖當前已發現惡意軟體。"))
|
|
|
|
|
else:
|
|
|
|
|
try:
|
|
|
|
|
if self.pyas_scan_start(file,rfp):#MD5較驗
|
|
|
|
|
self.pyas_scan_write_en(file)#寫入發現病毒
|
|
|
|
|
self.ui.Virus_Scan_text.setText(self.text_Translate("✖當前已發現惡意軟體。"))
|
|
|
|
|
else:#未發現病毒
|
|
|
|
|
fts = False
|
|
|
|
|
pe = PE(file)
|
|
|
|
@@ -1164,7 +1143,6 @@ class MainWindow_Controller(QtWidgets.QMainWindow):#,FileSystemEventHandler):
|
|
|
|
|
self.pyas_scan_write_en(file)#寫入發現病毒
|
|
|
|
|
fts = False
|
|
|
|
|
print('[SCAN] Malware has been detected')
|
|
|
|
|
self.ui.Virus_Scan_text.setText(self.text_Translate("✖當前已發現惡意軟體。"))
|
|
|
|
|
except:
|
|
|
|
|
pass
|
|
|
|
|
self.pyas_scan_answer_en()
|
|
|
|
@@ -1566,29 +1544,9 @@ class MainWindow_Controller(QtWidgets.QMainWindow):#,FileSystemEventHandler):
|
|
|
|
|
|
|
|
|
|
def Customize_CMD_Command(self):
|
|
|
|
|
CMD_Command = self.ui.Customize_CMD_Command_lineEdit.text()
|
|
|
|
|
#try: #Not Cplt
|
|
|
|
|
#if str(cryptocode.decrypt(CMD_Command,pyas_version)) == 'professional':
|
|
|
|
|
#self.ui.Window_title.setText("PYAS V"+pyas_version+' (Professional Edition)')
|
|
|
|
|
#return
|
|
|
|
|
#if str(cryptocode.decrypt(CMD_Command,pyas_version)) == 'business':
|
|
|
|
|
#self.ui.Window_title.setText("PYAS V"+pyas_version+' (Business Edition)')
|
|
|
|
|
#return
|
|
|
|
|
#if str(cryptocode.decrypt(CMD_Command,pyas_version)) == 'professional_ltsc':
|
|
|
|
|
#self.ui.Window_title.setText("PYAS V"+pyas_version+' (Professional Edition LTSC)')
|
|
|
|
|
#return
|
|
|
|
|
#if str(cryptocode.decrypt(CMD_Command,pyas_version)) == 'business_ltsc':
|
|
|
|
|
#self.ui.Window_title.setText("PYAS V"+pyas_version+' (Business Edition LTSC)')
|
|
|
|
|
#return
|
|
|
|
|
#except:
|
|
|
|
|
#pass
|
|
|
|
|
if CMD_Command == "":
|
|
|
|
|
return
|
|
|
|
|
if CMD_Command.lower() == "never gonna give you up" or CMD_Command.lower() == "rickroll" or CMD_Command.lower() == "rick roll":
|
|
|
|
|
import webbrowser
|
|
|
|
|
webbrowser.open("https://www.youtube.com/watch?v=dQw4w9WgXcQ")#rickroll easter egg
|
|
|
|
|
return
|
|
|
|
|
if CMD_Command == "python antivirus software" or CMD_Command == "Python Antivirus Software" \
|
|
|
|
|
or CMD_Command == "PYAS" or CMD_Command == "pyas":
|
|
|
|
|
if CMD_Command == "PYAS" or CMD_Command == "pyas":
|
|
|
|
|
self.ui.Customize_CMD_Command_output.setText(english_list["PYAS"])#about pyas
|
|
|
|
|
return
|
|
|
|
|
try:
|
|
|
|
@@ -1614,26 +1572,6 @@ class MainWindow_Controller(QtWidgets.QMainWindow):#,FileSystemEventHandler):
|
|
|
|
|
except:
|
|
|
|
|
self.ui.Customize_CMD_Command_output.setText("Error: Add Function database failed")
|
|
|
|
|
return
|
|
|
|
|
if CMD_Command.split()[1].lower() == "--rules" or CMD_Command.split()[1].lower() == "-r":
|
|
|
|
|
if CMD_Command.split()[2].lower() == "--reg" or CMD_Command.split()[2].lower() == "-r":
|
|
|
|
|
value = CMD_Command.split()[3]
|
|
|
|
|
if CMD_Command.split()[2].lower() == "--perf" or CMD_Command.split()[2].lower() == "-p":
|
|
|
|
|
value = CMD_Command.split()[3]
|
|
|
|
|
while 1:
|
|
|
|
|
QApplication.processEvents()
|
|
|
|
|
x = int(psutil.cpu_percent(interval=0.1))
|
|
|
|
|
if x > int(value):
|
|
|
|
|
print(str(x))
|
|
|
|
|
if CMD_Command.split()[2].lower() == "--file" or CMD_Command.split()[2].lower() == "-f":
|
|
|
|
|
value = CMD_Command.split()[3]
|
|
|
|
|
if CMD_Command.split()[2].lower() == "--task" or CMD_Command.split()[2].lower() == "-t":
|
|
|
|
|
value = CMD_Command.split()[3]
|
|
|
|
|
while 1:
|
|
|
|
|
QApplication.processEvents()
|
|
|
|
|
time.sleep(0.0001)
|
|
|
|
|
for p in psutil.process_iter():
|
|
|
|
|
if str(value) == str(p.name()):
|
|
|
|
|
return
|
|
|
|
|
except Exception as e:
|
|
|
|
|
pyas_bug_log(e)
|
|
|
|
|
QMessageBox.critical(self,self.text_Translate('錯誤'),self.text_Translate('錯誤: ')+ '\"' + CMD_Command + '\"' + self.text_Translate("不是有效命令"),QMessageBox.Ok,QMessageBox.Ok)
|
|
|
|
@@ -1767,7 +1705,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):#,FileSystemEventHandler):
|
|
|
|
|
def find_files_info_zh(self,ffile):
|
|
|
|
|
try:
|
|
|
|
|
for d in range(26):
|
|
|
|
|
self.findfile_zh(str(chr(65+d))+':/',ffile,start)
|
|
|
|
|
self.findfile_zh(str(chr(65+d))+':/',ffile)
|
|
|
|
|
if os.path.isfile('Library/PYAS/Temp/PYASF.tmp'):
|
|
|
|
|
try:
|
|
|
|
|
ft = open('Library/PYAS/Temp/PYASF.tmp','r',encoding="utf-8")
|
|
|
|
@@ -1790,7 +1728,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):#,FileSystemEventHandler):
|
|
|
|
|
pyas_bug_log(e)
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def findfile_zh(self,path,ffile,start):
|
|
|
|
|
def findfile_zh(self,path,ffile):
|
|
|
|
|
try:
|
|
|
|
|
self.ui.Look_for_File_output.setText(self.text_Translate('正在尋找: ')+str(path))
|
|
|
|
|
for fd in os.listdir(path):
|
|
|
|
@@ -1801,7 +1739,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):#,FileSystemEventHandler):
|
|
|
|
|
pass
|
|
|
|
|
else:
|
|
|
|
|
if os.path.isdir(fullpath):
|
|
|
|
|
self.findfile_zh(fullpath,ffile,start)
|
|
|
|
|
self.findfile_zh(fullpath,ffile)
|
|
|
|
|
else:
|
|
|
|
|
if ffile in str(fd):
|
|
|
|
|
try:
|
|
|
|
@@ -2225,7 +2163,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):#,FileSystemEventHandler):
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
try:
|
|
|
|
|
pyas_version = "2.5.2"
|
|
|
|
|
pyas_version = "2.5.3"
|
|
|
|
|
pyae_version = "2.2.1"
|
|
|
|
|
print('[INFO] PYAS V'+pyas_version+' , PYAE V'+pyae_version)
|
|
|
|
|
protect_autorun = False
|
|
|
|
@@ -2240,7 +2178,7 @@ if __name__ == '__main__':
|
|
|
|
|
window = MainWindow_Controller()
|
|
|
|
|
window.setWindowOpacity(1)
|
|
|
|
|
window.show()
|
|
|
|
|
print('[LOAD] Total: '+str(time.time()-start_m)+' sec')
|
|
|
|
|
print('[LOAD] Process Time: '+str(time.process_time()-start_m)+' sec')
|
|
|
|
|
sys.exit(app.exec_())
|
|
|
|
|
except Exception as e:
|
|
|
|
|
pyas_bug_log(e)
|
|
|
|
|