Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11725afa5a | ||
|
|
3bb94d05be | ||
|
|
7290db72e8 | ||
|
|
4dc92b081e | ||
|
|
68c614d9dd | ||
|
|
efca8d0161 | ||
|
|
6d86b15800 | ||
|
|
f43b2df6fc | ||
|
|
9f3eb593f8 | ||
|
|
9ca7c41fe7 | ||
|
|
f39746c116 | ||
|
|
88f1dc2c01 | ||
|
|
ee3daae665 | ||
|
|
9a47f06c2a |
No files matched your search
@@ -1,21 +1,20 @@
|
||||
import os, gc, sys, time, json, requests
|
||||
import psutil, ctypes, win32con, win32gui
|
||||
import win32file, win32api, subprocess
|
||||
import xml.etree.ElementTree as et
|
||||
import os, gc, sys, time, json, psutil
|
||||
import requests, subprocess, win32con
|
||||
import win32file, win32gui, win32api
|
||||
import xml.etree.ElementTree as xmlet
|
||||
from hashlib import md5, sha1, sha256
|
||||
from pefile import PE, DIRECTORY_ENTRY
|
||||
from PYAS_Scripts import scripts_list
|
||||
from PYAS_Language import translations
|
||||
from PYAS_Function import function_list
|
||||
from PYAS_Extension import slist, alist
|
||||
from PYAS_Language import translate_dict
|
||||
from PYAS_Interface import Ui_MainWindow
|
||||
from PyQt5 import QtWidgets, QtGui, QtCore
|
||||
from PyQt5.QtWidgets import *
|
||||
from PyQt5.QtGui import *
|
||||
from PyQt5.QtCore import *
|
||||
from threading import Thread
|
||||
from PyQt5.QtWidgets import *
|
||||
from PyQt5.QtCore import *
|
||||
from PyQt5.QtGui import *
|
||||
|
||||
class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
class MainWindow_Controller(QMainWindow):
|
||||
def __init__(self):
|
||||
super(MainWindow_Controller, self).__init__()
|
||||
self.setAttribute(Qt.WA_TranslucentBackground)
|
||||
@@ -49,10 +48,9 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
self.scan_file = False
|
||||
self.block_window = True
|
||||
self.pyas_opacity = 0
|
||||
self.pyas_version = "2.8.2"
|
||||
self.ui.Theme_White.setChecked(True)
|
||||
self.pyas_version = "2.8.3"
|
||||
self.pyas = str(sys.argv[0]).replace("\\", "/")
|
||||
self.key = self.pyas_key()
|
||||
self.ui.Theme_White.setChecked(True)
|
||||
self.json = self.init_config_json()
|
||||
self.set_system_safe()
|
||||
self.init_config_lang()
|
||||
@@ -60,18 +58,6 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
self.init_boot_config()
|
||||
self.init_config_ui()
|
||||
|
||||
def pyas_key(self):
|
||||
try:
|
||||
with open(self.pyas, "rb") as f:
|
||||
text = str(md5(f.read()).hexdigest())
|
||||
response = requests.get("http://27.147.30.238:5001/pyas", params={"key": text}, timeout=3)
|
||||
if response.status_code == 200 and response.text == "True":
|
||||
return ""
|
||||
else:
|
||||
return "(安全密鑰錯誤)"
|
||||
except:
|
||||
return "(網路連接錯誤)"
|
||||
|
||||
def init_library(self):
|
||||
try:
|
||||
if not os.path.exists("C:/Windows/SysWOW64/PYAS"):
|
||||
@@ -190,20 +176,20 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
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.''')
|
||||
self.effect_shadow = QtWidgets.QGraphicsDropShadowEffect(self)
|
||||
self.effect_shadow = QGraphicsDropShadowEffect(self)
|
||||
self.effect_shadow.setOffset(0,0)
|
||||
self.effect_shadow.setBlurRadius(10)
|
||||
self.effect_shadow.setColor(QtCore.Qt.gray)
|
||||
self.effect_shadow.setColor(Qt.gray)
|
||||
self.ui.widget_2.setGraphicsEffect(self.effect_shadow)
|
||||
self.effect_shadow2 = QtWidgets.QGraphicsDropShadowEffect(self)
|
||||
self.effect_shadow2 = QGraphicsDropShadowEffect(self)
|
||||
self.effect_shadow2.setOffset(0,0)
|
||||
self.effect_shadow2.setBlurRadius(10)
|
||||
self.effect_shadow2.setColor(QtCore.Qt.gray)
|
||||
self.effect_shadow2.setColor(Qt.gray)
|
||||
self.ui.Navigation_Bar.setGraphicsEffect(self.effect_shadow2)
|
||||
self.effect_shadow3 = QtWidgets.QGraphicsDropShadowEffect(self)
|
||||
self.effect_shadow3 = QGraphicsDropShadowEffect(self)
|
||||
self.effect_shadow3.setOffset(0,0)
|
||||
self.effect_shadow3.setBlurRadius(7)
|
||||
self.effect_shadow3.setColor(QtCore.Qt.gray)
|
||||
self.effect_shadow3.setColor(Qt.gray)
|
||||
self.ui.Window_widget.setGraphicsEffect(self.effect_shadow3)
|
||||
self.ui.Virus_Scan_choose_widget.hide()
|
||||
self.ui.Virus_Scan_widget.hide()
|
||||
@@ -232,7 +218,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
self.bug_event(e)
|
||||
|
||||
def trans(self, text):
|
||||
for k, v in translations.get(self.json["language"], translations).items():
|
||||
for k, v in translate_dict.get(self.json["language"], translate_dict).items():
|
||||
text = text.replace(str(k), str(v))
|
||||
return text
|
||||
|
||||
@@ -277,7 +263,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
self.ui.Window_Block_Button.setText(self.trans("軟體彈窗攔截"))
|
||||
self.ui.Repair_System_Network_Button.setText(self.trans("系統網路修復"))
|
||||
self.ui.About_Back.setText(self.trans("返回"))
|
||||
self.ui.PYAS_Version.setText(self.trans(f"PYAS V{self.pyas_version} {self.key}"))
|
||||
self.ui.PYAS_Version.setText(self.trans(f"PYAS V{self.pyas_version}"))
|
||||
self.ui.GUI_Made_title.setText(self.trans("介面製作:"))
|
||||
self.ui.GUI_Made_Name.setText(self.trans("mtkiao"))
|
||||
self.ui.Core_Made_title.setText(self.trans("核心製作:"))
|
||||
@@ -333,7 +319,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
x = 170
|
||||
y = widget.pos().y()
|
||||
self.anim = QPropertyAnimation(widget, b"geometry")
|
||||
widget.setGeometry(QtCore.QRect(x - 100,y, 671,481))
|
||||
widget.setGeometry(QRect(x - 100,y, 671,481))
|
||||
self.anim.setKeyValueAt(0.2, QRect(x - 60,y,671,481))
|
||||
self.anim.setKeyValueAt(0.4, QRect(x - 10,y,671,481))
|
||||
self.anim.setKeyValueAt(0.7, QRect(x - 3,y,671,481))
|
||||
@@ -361,7 +347,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
self.anim2.start()
|
||||
|
||||
def change_animation_3(self,widget,time):
|
||||
self.opacity = QtWidgets.QGraphicsOpacityEffect()
|
||||
self.opacity = QGraphicsOpacityEffect()
|
||||
self.opacity.setOpacity(0)
|
||||
widget.setGraphicsEffect(self.opacity)
|
||||
widget.setAutoFillBackground(True)
|
||||
@@ -378,7 +364,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
|
||||
def change_animation_5(self,widget,x,y,nx,ny):
|
||||
self.anim = QPropertyAnimation(widget, b"geometry")
|
||||
widget.setGeometry(QtCore.QRect(x,y - 45, nx,ny))
|
||||
widget.setGeometry(QRect(x,y - 45, nx,ny))
|
||||
self.anim.setKeyValueAt(0.2, QRect(x,y - 30,nx,ny))
|
||||
self.anim.setKeyValueAt(0.4, QRect(x,y - 10,nx,ny))
|
||||
self.anim.setKeyValueAt(0.7, QRect(x,y - 3,nx,ny))
|
||||
@@ -576,7 +562,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
Main_About = QAction(self.trans("關於"),self)
|
||||
self.WindowMenu.addAction(Main_Settings)
|
||||
self.WindowMenu.addAction(Main_About)
|
||||
Qusetion = self.WindowMenu.exec_(self.ui.Menu_Button.mapToGlobal(QtCore.QPoint(0, 30)))
|
||||
Qusetion = self.WindowMenu.exec_(self.ui.Menu_Button.mapToGlobal(QPoint(0, 30)))
|
||||
if Qusetion == Main_About:
|
||||
if self.ui.About_widget.isHidden():
|
||||
self.ui.About_widget.show()
|
||||
@@ -636,7 +622,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
def set_system_safe(self):
|
||||
try:
|
||||
self.safe = True
|
||||
self.ui.State_icon.setPixmap(QtGui.QPixmap(":/icon/Check.png"))
|
||||
self.ui.State_icon.setPixmap(QPixmap(":/icon/Check.png"))
|
||||
self.ui.State_title.setText(self.trans("此裝置已受到防護"))
|
||||
except:
|
||||
pass
|
||||
@@ -644,7 +630,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
def set_system_unsafe(self):
|
||||
try:
|
||||
self.safe = False
|
||||
self.ui.State_icon.setPixmap(QtGui.QPixmap(":/icon/Close.png"))
|
||||
self.ui.State_icon.setPixmap(QPixmap(":/icon/Close.png"))
|
||||
self.ui.State_title.setText(self.trans("此裝置當前不安全"))
|
||||
except:
|
||||
pass
|
||||
@@ -702,6 +688,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
|
||||
def virus_solve(self):
|
||||
try:
|
||||
self.ui.Virus_Scan_Solve_Button.hide()
|
||||
for file in self.Virus_List:
|
||||
try:
|
||||
self.ui.Virus_Scan_text.setText(self.trans("正在刪除: ")+file)
|
||||
@@ -712,7 +699,6 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
self.set_system_safe()
|
||||
self.Virus_List = []
|
||||
self.Virus_List_Ui = []
|
||||
self.ui.Virus_Scan_Solve_Button.hide()
|
||||
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.trans("成功: 刪除成功"))
|
||||
@@ -721,7 +707,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
|
||||
def file_scan(self):
|
||||
try:
|
||||
file, ftype = QFileDialog.getOpenFileName(self,self.trans("病毒掃描"),"C:/")
|
||||
file = str(QFileDialog.getOpenFileName(self,self.trans("病毒掃描"),"C:/")[0])
|
||||
if file:
|
||||
self.init_scan()
|
||||
self.start_scan(file)
|
||||
@@ -733,7 +719,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
|
||||
def path_scan(self):
|
||||
try:
|
||||
path = QFileDialog.getExistingDirectory(self,self.trans("病毒掃描"),"C:/")
|
||||
path = str(QFileDialog.getExistingDirectory(self,self.trans("病毒掃描"),"C:/"))
|
||||
if path:
|
||||
self.init_scan()
|
||||
self.traverse_path(path)
|
||||
@@ -761,17 +747,17 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
if self.high_sensitivity == 1:
|
||||
if self.api_scan(file):
|
||||
self.write_scan(self.trans("惡意"),file)
|
||||
elif self.scr_scan(file):
|
||||
self.write_scan(self.trans("可疑"),file)
|
||||
elif self.pe_scan(file):
|
||||
self.write_scan(self.trans("可疑"),file)
|
||||
elif self.scr_scan(file):
|
||||
self.write_scan(self.trans("可疑"),file)
|
||||
elif file_type in slist and self.sign_scan(file):
|
||||
if self.api_scan(file):
|
||||
self.write_scan(self.trans("惡意"),file)
|
||||
elif self.scr_scan(file):
|
||||
self.write_scan(self.trans("可疑"),file)
|
||||
elif self.pe_scan(file):
|
||||
self.write_scan(self.trans("可疑"),file)
|
||||
elif self.scr_scan(file):
|
||||
self.write_scan(self.trans("可疑"),file)
|
||||
except:
|
||||
pass
|
||||
|
||||
@@ -800,7 +786,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
text = str(md5(f.read()).hexdigest())
|
||||
strBody = f'-------------------------------7d83e2d7a141e\r\nContent-Disposition: form-data; name="md5s"\r\n\r\n{text}\r\n-------------------------------7d83e2d7a141e\r\nContent-Disposition: form-data; name="format"\r\n\r\nXML\r\n-------------------------------7d83e2d7a141e\r\nContent-Disposition: form-data; name="product"\r\n\r\n360zip\r\n-------------------------------7d83e2d7a141e\r\nContent-Disposition: form-data; name="combo"\r\n\r\n360zip_main\r\n-------------------------------7d83e2d7a141e\r\nContent-Disposition: form-data; name="v"\r\n\r\n2\r\n-------------------------------7d83e2d7a141e\r\nContent-Disposition: form-data; name="osver"\r\n\r\n5.1\r\n-------------------------------7d83e2d7a141e\r\nContent-Disposition: form-data; name="vk"\r\n\r\na03bc211\r\n-------------------------------7d83e2d7a141e\r\nContent-Disposition: form-data; name="mid"\r\n\r\n8a40d9eff408a78fe9ec10a0e7e60f62\r\n-------------------------------7d83e2d7a141e--'
|
||||
response = requests.post('http://qup.f.360.cn/file_health_info.php', data=strBody, timeout=3)
|
||||
return response.status_code == 200 and float(et.fromstring(response.text).find('.//e_level').text) > 50
|
||||
return response.status_code == 200 and float(xmlet.fromstring(response.text).find('.//e_level').text) > 50
|
||||
except:
|
||||
return False
|
||||
|
||||
@@ -943,7 +929,10 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
|
||||
def repair_system_wallpaper(self):
|
||||
try:
|
||||
ctypes.windll.user32.SystemParametersInfoW(0x0014, 0, 'C:/Windows/web/wallpaper/windows/img0.jpg', 0x01 | 0x02)
|
||||
key = win32api.RegOpenKeyEx(win32con.HKEY_CURRENT_USER, "Control Panel\\Desktop", 0, win32con.KEY_SET_VALUE)
|
||||
win32api.RegSetValueEx(key, "Wallpaper", 0, win32con.REG_SZ, 'C:/Windows/web/wallpaper/windows/img0.jpg')
|
||||
win32api.RegCloseKey(key)
|
||||
win32gui.SystemParametersInfo(win32con.SPI_SETDESKWALLPAPER, 'C:/Windows/web/wallpaper/windows/img0.jpg', win32con.SPIF_SENDCHANGE)
|
||||
except:
|
||||
pass
|
||||
|
||||
@@ -987,24 +976,24 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
|
||||
def add_white_list(self):
|
||||
try:
|
||||
file, filetype= QFileDialog.getOpenFileName(self,self.trans("增加到白名單"),"C:/","All File *.*")
|
||||
if file not in ["", "PYAS"]:
|
||||
if str(file.replace("\\", "/")) not in self.whitelist:
|
||||
file = str(QFileDialog.getOpenFileName(self,self.trans("增加到白名單"),"C:/")[0]).replace("\\", "/")
|
||||
if file and file != self.pyas:
|
||||
if file not in self.whitelist:
|
||||
if QMessageBox.warning(self,self.trans("警告"),self.trans("您確定要增加到白名單嗎?"),QMessageBox.Yes|QMessageBox.No) == 16384:
|
||||
try:
|
||||
self.whitelist.append(str(file.replace("\\", "/")))
|
||||
self.whitelist.append(file.replace("\\", "/"))
|
||||
with open("C:/Windows/SysWOW64/PYAS/Whitelist.txt", "a+", encoding="utf-8") as f:
|
||||
f.write(str(file.replace("\\", "/"))+'\n')
|
||||
QMessageBox.information(self,self.trans("成功"),self.trans(f"成功增加到白名單: ")+str(file.replace("\\", "/")),QMessageBox.Ok)
|
||||
f.write(file.replace("\\", "/")+'\n')
|
||||
QMessageBox.information(self,self.trans("成功"),self.trans(f"成功增加到白名單: ")+file,QMessageBox.Ok)
|
||||
except:
|
||||
self.bug_event('增加到白名單失敗')
|
||||
elif QMessageBox.warning(self,self.trans("警告"),self.trans(f"您確定要取消增加到白名單嗎?"),QMessageBox.Yes|QMessageBox.No) == 16384:
|
||||
elif QMessageBox.warning(self,self.trans("警告"),self.trans("您確定要取消增加到白名單嗎?"),QMessageBox.Yes|QMessageBox.No) == 16384:
|
||||
try:
|
||||
self.whitelist.remove(str(file.replace("\\", "/")))
|
||||
self.whitelist.remove(file.replace("\\", "/"))
|
||||
with open("C:/Windows/SysWOW64/PYAS/Whitelist.txt", "w", encoding="utf-8") as f:
|
||||
for file in self.whitelist:
|
||||
f.write(f'{file}\n')
|
||||
QMessageBox.information(self,self.trans("成功"),self.trans(f"成功取消增加到白名單: ")+str(file.replace("\\", "/")),QMessageBox.Ok)
|
||||
for white_file in self.whitelist:
|
||||
f.write(f'{white_file}\n')
|
||||
QMessageBox.information(self,self.trans("成功"),self.trans(f"成功取消增加到白名單: ")+file,QMessageBox.Ok)
|
||||
except:
|
||||
self.bug_event('取消增加到白名單失敗')
|
||||
except Exception as e:
|
||||
@@ -1014,10 +1003,10 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
try:
|
||||
self.block_window = False
|
||||
if QMessageBox.warning(self,self.trans("警告"),self.trans("請選擇要攔截的軟體彈窗"),QMessageBox.Yes|QMessageBox.No) == 16384:
|
||||
while self.block_window == False:
|
||||
while not self.block_window:
|
||||
window_name = str(win32gui.GetWindowText(win32gui.GetForegroundWindow()))
|
||||
QApplication.processEvents()
|
||||
if window_name not in ["", "PYAS"]:
|
||||
if window_name not in ["","PYAS",self.trans("警告")]:
|
||||
if window_name not in self.blocklist:
|
||||
if QMessageBox.warning(self,self.trans("警告"),self.trans(f"您確定要攔截 {window_name} 嗎?"),QMessageBox.Yes|QMessageBox.No) == 16384:
|
||||
try:
|
||||
@@ -1031,8 +1020,8 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
try:
|
||||
self.blocklist.remove(window_name)
|
||||
with open("C:/Windows/SysWOW64/PYAS/Blocklist.txt", "w", encoding="utf-8") as f:
|
||||
for window_name in self.blocklist:
|
||||
f.write(f'{window_name}\n')
|
||||
for block_name in self.blocklist:
|
||||
f.write(f'{block_name}\n')
|
||||
QMessageBox.information(self,self.trans("成功"),self.trans(f"成功取消彈窗攔截: ")+window_name,QMessageBox.Ok)
|
||||
except:
|
||||
self.bug_event('取消到彈窗攔截失敗')
|
||||
@@ -1047,12 +1036,12 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
|
||||
def block_software_window(self):
|
||||
while self.block_window:
|
||||
time.sleep(0.2)
|
||||
for window_name in self.blocklist:
|
||||
try:
|
||||
try:
|
||||
time.sleep(0.2)
|
||||
for window_name in self.blocklist:
|
||||
win32gui.PostMessage(win32gui.FindWindow(None, window_name), win32con.WM_SYSCOMMAND, win32con.SC_CLOSE, 0)
|
||||
except:
|
||||
pass
|
||||
except:
|
||||
pass
|
||||
|
||||
def repair_network(self):
|
||||
try:
|
||||
@@ -1130,7 +1119,7 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
self.ui.Protection_switch_Button_2.setStyleSheet("""
|
||||
QPushButton{border:none;background-color:rgba(20,200,20,100);border-radius: 15px;}
|
||||
QPushButton:hover{background-color:rgba(20,200,20,120);}""")
|
||||
Thread(target=self.protect_file_thread, args=("C:/Users/",), daemon=True).start()
|
||||
Thread(target=self.protect_file_thread, daemon=True).start()
|
||||
|
||||
def protect_boot_init(self):
|
||||
if self.ui.Protection_switch_Button_3.text() == self.trans("已開啟"):
|
||||
@@ -1187,24 +1176,27 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
for p in psutil.process_iter():
|
||||
if p.pid not in existing_processes:
|
||||
existing_processes.add(p.pid)
|
||||
name, file, cmd = p.name(), p.exe().replace("\\", "/"), p.cmdline()
|
||||
name, file, cmd = p.name(), p.exe(), p.cmdline()
|
||||
if file == self.pyas or file in self.whitelist:
|
||||
continue
|
||||
elif ":/Windows" in file and self.enh_protect:
|
||||
if "cmd.exe" in name and self.api_scan(" ".join(cmd[2:])):
|
||||
elif ":\\Windows" in file and self.enh_protect:
|
||||
if "powershell" in name and self.api_scan(cmd[-1].split("'")[-2]):
|
||||
p.kill()
|
||||
self.send_notify(self.trans("惡意腳本攔截: ")+name)
|
||||
elif "powershell.exe" in name and self.api_scan(cmd[-1].split("'")[-2]):
|
||||
elif "cmd" in name and self.api_scan(" ".join(cmd[2:])):
|
||||
p.kill()
|
||||
self.send_notify(self.trans("惡意腳本攔截: ")+name)
|
||||
elif ":/Program" in file and self.enh_protect:
|
||||
elif "msiexec" in name and self.api_scan(cmd[-1]):
|
||||
p.kill()
|
||||
self.send_notify(self.trans("惡意軟體攔截: ")+name)
|
||||
elif ":\\Program" in file and self.enh_protect:
|
||||
if self.sign_scan(file) and self.api_scan(file):
|
||||
p.kill()
|
||||
self.send_notify(self.trans("惡意軟體攔截: ")+name)
|
||||
elif self.api_scan(file) or self.pe_scan(file):
|
||||
p.kill()
|
||||
self.send_notify(self.trans("惡意軟體攔截: ")+name)
|
||||
else:
|
||||
elif self.sign_scan(file):
|
||||
self.p_name = name
|
||||
gc.collect()
|
||||
except:
|
||||
@@ -1220,21 +1212,24 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
except:
|
||||
return False
|
||||
|
||||
def protect_file_thread(self,path):
|
||||
hDir = win32file.CreateFile(path,win32con.GENERIC_READ,win32con.FILE_SHARE_READ|win32con.FILE_SHARE_WRITE|win32con.FILE_SHARE_DELETE,None,win32con.OPEN_EXISTING,win32con.FILE_FLAG_BACKUP_SEMANTICS,None)
|
||||
def protect_file_thread(self):
|
||||
hDir = win32file.CreateFile(f"C:/Users/",win32con.GENERIC_READ,win32con.FILE_SHARE_READ|win32con.FILE_SHARE_WRITE|win32con.FILE_SHARE_DELETE,None,win32con.OPEN_EXISTING,win32con.FILE_FLAG_BACKUP_SEMANTICS,None)
|
||||
while self.file_protect:
|
||||
try:
|
||||
for action, file in win32file.ReadDirectoryChangesW(hDir,1024,True,win32con.FILE_NOTIFY_CHANGE_FILE_NAME|win32con.FILE_NOTIFY_CHANGE_DIR_NAME|win32con.FILE_NOTIFY_CHANGE_ATTRIBUTES|win32con.FILE_NOTIFY_CHANGE_SIZE|win32con.FILE_NOTIFY_CHANGE_LAST_WRITE|win32con.FILE_NOTIFY_CHANGE_SECURITY,None,None):
|
||||
file = str(f"{path}{file}").replace("\\", "/")
|
||||
file_end = str(f".{file.split('.')[-1]}").lower()
|
||||
file_mid = str(f".{file.split('.')[-2]}").lower()
|
||||
if action == 1 or action == 3:
|
||||
if file_mid in alist and self.protect_proc_kill(self.p_name):
|
||||
self.send_notify(self.trans("勒索軟體攔截: ")+self.p_name)
|
||||
elif file_end in slist and self.api_scan(file):
|
||||
os.remove(file)
|
||||
self.send_notify(self.trans("惡意檔案刪除: ")+file)
|
||||
gc.collect()
|
||||
action, file = win32file.ReadDirectoryChangesW(hDir,1024,True,win32con.FILE_NOTIFY_CHANGE_FILE_NAME|win32con.FILE_NOTIFY_CHANGE_DIR_NAME|win32con.FILE_NOTIFY_CHANGE_ATTRIBUTES|win32con.FILE_NOTIFY_CHANGE_SIZE|win32con.FILE_NOTIFY_CHANGE_LAST_WRITE|win32con.FILE_NOTIFY_CHANGE_SECURITY,None,None)[0]
|
||||
file = str(f"C:/Users/{file}").replace("\\", "/")
|
||||
file_end = str(f".{file.split('.')[-1]}").lower()
|
||||
file_mid = str(f".{file.split('.')[-2]}").lower()
|
||||
if action == 3 and file_end in slist and self.api_scan(file):
|
||||
os.remove(file)
|
||||
self.send_notify(self.trans("惡意檔案刪除: ")+file)
|
||||
elif action == 1 and file_mid in alist and self.protect_proc_kill(self.p_name):
|
||||
self.send_notify(self.trans("勒索軟體攔截: ")+self.p_name)
|
||||
elif action == 2 and file_end in alist and self.protect_proc_kill(self.p_name):
|
||||
self.send_notify(self.trans("勒索軟體攔截: ")+self.p_name)
|
||||
elif action == 4 and file_end in alist and self.protect_proc_kill(self.p_name):
|
||||
self.send_notify(self.trans("勒索軟體攔截: ")+self.p_name)
|
||||
gc.collect()
|
||||
except:
|
||||
pass
|
||||
|
||||
@@ -1243,11 +1238,15 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
try:
|
||||
time.sleep(0.2)
|
||||
with open(r"\\.\PhysicalDrive0", "r+b") as f:
|
||||
if f.read(512) != self.mbr_value:
|
||||
f.seek(0)
|
||||
f.write(self.mbr_value)
|
||||
if self.protect_proc_kill(self.p_name):
|
||||
self.send_notify(self.trans("惡意行為攔截: ")+self.p_name)
|
||||
if self.mbr_value[510:512] == b'\x55\xAA':
|
||||
if f.read(512) != self.mbr_value:
|
||||
f.seek(0)
|
||||
f.write(self.mbr_value)
|
||||
if self.protect_proc_kill(self.p_name):
|
||||
self.send_notify(self.trans("惡意行為攔截: ")+self.p_name)
|
||||
elif self.protect_proc_kill(self.p_name):
|
||||
self.send_notify(self.trans("惡意行為攔截: ")+self.p_name)
|
||||
self.init_boot_config()
|
||||
except:
|
||||
pass
|
||||
|
||||
@@ -1263,8 +1262,8 @@ class MainWindow_Controller(QtWidgets.QMainWindow):
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
QtCore.QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
|
||||
QtGui.QGuiApplication.setAttribute(Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
|
||||
QGuiApplication.setAttribute(Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)
|
||||
app = QApplication(sys.argv)
|
||||
MainWindow_Controller()
|
||||
sys.exit(app.exec_())
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
slist = [".exe",".dll",".com",".msi",".scr",
|
||||
".bat",".cmd",".ps1",".vbs",".js"]
|
||||
|
||||
alist = [".exe",".dll",".ppt",".pptx",".wps",
|
||||
alist = [".ppt",".pptx",".wps",".txt",".rtf",
|
||||
".pdf",".xls",".xlsx",".doc",".docx",
|
||||
".jpg",".jpeg",".png",".webp",".gif",
|
||||
".mp3",".wav",".aac",".ogg",".flac",
|
||||
".mp4",".avi",".mov",".wmv",".mkv",
|
||||
".zip",".gz",".7z",".rar",".tar"]
|
||||
".zip",".7z",".rar",".exe",".dll"]
|
||||
+52
-52
@@ -1,52 +1,52 @@
|
||||
translations = {"zh_TW": {"已开启":"已開啟","已关闭":"已關閉","On":"已開啟","Off":"已關閉"},
|
||||
"zh_CN": {"已開啟":"已开启","已關閉":"已关闭","On":"已开启","Off":"已关闭",
|
||||
"軟體":"软件","檔案":"文件","確定":"确认","設定":"设置","關於":"关于",
|
||||
"錯誤":"错误","實時":"实时","發現":"发现","關閉":"关闭","裝置":"设备",
|
||||
"總數":"总数","註冊":"注册","圖標":"图标","路徑":"路径","網路":"网络",
|
||||
"位元":"字节","彈窗":"弹窗","靈敏":"敏感","誤報":"误报","簽":"签",
|
||||
"項":"项","掃":"扫","試":"试","黃":"黄","嗎":"吗","防":"保","鑰":"钥",
|
||||
"當":"当","後":"后","護":"护","導":"导","區":"区","復":"复","攔":"拦",
|
||||
"請":"请","統":"统","刪":"删","進":"进","個":"个","選":"选","啟":"启",
|
||||
"監":"监","並":"并","徑":"径","盤":"盘","隱":"隐","動":"动","狀":"状",
|
||||
"誌":"志","這":"这","會":"会","題":"题","擇":"择","語":"语","無":"无",
|
||||
"顯":"显","變":"变","戶":"户","碼":"码","雲":"云","訂":"订","稱":"称",
|
||||
"類":"类","輸":"输","執":"执","數":"数","尋":"寻","網":"网","詢":"询",
|
||||
"製":"制","員":"员","許":"许","條":"条","藍":"蓝","紅":"红","綠":"绿",
|
||||
"態":"态","務":"务","連":"连","檢":"检","測":"测","關":"关","強":"强",
|
||||
"驅":"驱","為":"为","腳":"脚","增":"增","單":"单","開":"开"},
|
||||
"en_US": {"已開啟":"On","已關閉":"Off","已开启":"On","已关闭":"Off",",":", ",
|
||||
"立即刪除":"Delete Now","安全模式":"Safe Mode","官方網站":"Website",
|
||||
"惡意檔案":"Virus ","惡意軟體":"Malware ","勒索軟體":"Ransom ",
|
||||
"惡意腳本":"Script ","惡意行為":"Behavior ","可疑軟體":"Suspicious ",
|
||||
"許可條款":"License Terms","惡意":"Malicious","可疑":"Suspicious",
|
||||
"啟用":"Enable ","禁用":"Disable ","正在初始化中":"Initializing ",
|
||||
"正在掃描":"Scanning ","正在刪除":"Deleting ","最小化到":"Minimize To ",
|
||||
"確定要":"Sure Want To ","靈敏度":"Sensitivity ","更新":"Update",
|
||||
"白色主題":"White","黑色主題":"Black","黃色主題":"Yellow","紅色主題":"Red",
|
||||
"藍色主題":"Blue","綠色主題":"Green","語言":"Language ","製作":"Make",
|
||||
"測試人員":"Testers","版本資訊":"Information","無效簽名":"Unsign ",
|
||||
"註冊表":"Registry ","退出":"Quit ","檔案":"File ","當前":"Currently ",
|
||||
"狀態":"State ","掃描":"Scan ","工具":"Tools ","防護":"Protect ",
|
||||
"失敗":"Failed ","請":"Please ","路徑":"Path ","方式":"Method ",
|
||||
"需要":"Need ","病毒":"Virus ","選擇":"Select ","返回":"Back",
|
||||
"受到":"Been ","錯誤":"Error","完成":"Complete ","引擎":"Engine ",
|
||||
"托盤":"Tray ","圖標":"Icon ","不安全":"Unsafe","增強":"Enhanced ",
|
||||
"系統":"System ","雲端":"Cloud ","重啟":"Reboot ","修復":"Repair ",
|
||||
"裝置":"Device ","發現":"Found ","成功":"Success ","清理":"Cleanup ",
|
||||
"確定":"OK","執行":"Execute ","警告":"Warning ","使用":"Use ",
|
||||
"網路":"Network ","變更":"Change ","總數":"Total","結束":"End ",
|
||||
"選項":"Options ","監控":"Monitor ","連接":"Connect ","可以":"To ",
|
||||
"進程":"Process ","攔截":"Block ","引導":"Boot ","刪除":"Delete ",
|
||||
"分區":"Partition ","設定":"Settings","關於":"About","模式":"Mode ",
|
||||
"提高":"Improve ","安全":"Security ","顯色":"Color ","主題":"Themes ",
|
||||
"風險":"Risk ","介面":"GUI ","核心":"Core ","服務":"Services ",
|
||||
"管理":"Manage","所有":"All ","全盤":"Full ","取消":"Cancel ",
|
||||
"垃圾":"Junk ","位元":"byte ","本機":"Computer ","停止":"Stop ",
|
||||
"增加到":"Add File To ","白名單":"White List ","軟體":"Software ",
|
||||
"增加":"Add","移除":"Delete","項目":"Items ","生成":"Create ",
|
||||
"開啟":"Open ","您":"You ","此":"This ","並":"And ","未":"Not ",
|
||||
"高":"High ","新":"New ","和":"And ","可能會":"Possible ","會":"Can ",
|
||||
"日誌":"Log","已":"Has ","彈窗":"Window ","要":"To ","驅動":"Drive ",
|
||||
"的":"","顯示":"","個":"","嗎":"","中":"","了":"","行":"","稱":"",
|
||||
"密鑰":"Key ","檢測":"Detect ","誤報":"False Positive ","立即":"",
|
||||
" ":" "}}
|
||||
translate_dict = {"zh_TW": {"已开启":"已開啟","已关闭":"已關閉","On":"已開啟","Off":"已關閉"},
|
||||
"zh_CN": {"已開啟":"已开启","已關閉":"已关闭","On":"已开启","Off":"已关闭",
|
||||
"軟體":"软件","檔案":"文件","確定":"确认","設定":"设置","關於":"关于",
|
||||
"錯誤":"错误","實時":"实时","發現":"发现","關閉":"关闭","裝置":"设备",
|
||||
"總數":"总数","註冊":"注册","圖標":"图标","路徑":"路径","網路":"网络",
|
||||
"位元":"字节","彈窗":"弹窗","靈敏":"敏感","誤報":"误报","簽":"签",
|
||||
"項":"项","掃":"扫","試":"试","黃":"黄","嗎":"吗","防":"保","鑰":"钥",
|
||||
"當":"当","後":"后","護":"护","導":"导","區":"区","復":"复","攔":"拦",
|
||||
"請":"请","統":"统","刪":"删","進":"进","個":"个","選":"选","啟":"启",
|
||||
"監":"监","並":"并","徑":"径","盤":"盘","隱":"隐","動":"动","狀":"状",
|
||||
"誌":"志","這":"这","會":"会","題":"题","擇":"择","語":"语","無":"无",
|
||||
"顯":"显","變":"变","戶":"户","碼":"码","雲":"云","訂":"订","稱":"称",
|
||||
"類":"类","輸":"输","執":"执","數":"数","尋":"寻","網":"网","詢":"询",
|
||||
"製":"制","員":"员","許":"许","條":"条","藍":"蓝","紅":"红","綠":"绿",
|
||||
"態":"态","務":"务","連":"连","檢":"检","測":"测","關":"关","強":"强",
|
||||
"驅":"驱","為":"为","腳":"脚","增":"增","單":"单","開":"开"},
|
||||
"en_US": {"已開啟":"On","已關閉":"Off","已开启":"On","已关闭":"Off",",":", ",
|
||||
"立即刪除":"Delete Now","安全模式":"Safe Mode","官方網站":"Website",
|
||||
"惡意檔案":"Virus ","惡意軟體":"Malware ","勒索軟體":"Ransom ",
|
||||
"惡意腳本":"Script ","惡意行為":"Behavior ","可疑軟體":"Suspicious ",
|
||||
"許可條款":"License Terms","惡意":"Malicious","可疑":"Suspicious",
|
||||
"啟用":"Enable ","禁用":"Disable ","正在初始化中":"Initializing ",
|
||||
"正在掃描":"Scanning ","正在刪除":"Deleting ","最小化到":"Minimize To ",
|
||||
"確定要":"Sure Want To ","靈敏度":"Sensitivity ","更新":"Update",
|
||||
"白色主題":"White","黑色主題":"Black","黃色主題":"Yellow","紅色主題":"Red",
|
||||
"藍色主題":"Blue","綠色主題":"Green","語言":"Language ","製作":"Make",
|
||||
"測試人員":"Testers","版本資訊":"Information","無效簽名":"Unsign ",
|
||||
"註冊表":"Registry ","退出":"Quit ","檔案":"File ","當前":"Currently ",
|
||||
"狀態":"State ","掃描":"Scan ","工具":"Tools ","防護":"Protect ",
|
||||
"失敗":"Failed ","請":"Please ","路徑":"Path ","方式":"Method ",
|
||||
"需要":"Need ","病毒":"Virus ","選擇":"Select ","返回":"Back",
|
||||
"受到":"Been ","錯誤":"Error","完成":"Complete ","引擎":"Engine ",
|
||||
"托盤":"Tray ","圖標":"Icon ","不安全":"Unsafe","增強":"Enhanced ",
|
||||
"系統":"System ","雲端":"Cloud ","重啟":"Reboot ","修復":"Repair ",
|
||||
"裝置":"Device ","發現":"Found ","成功":"Success ","清理":"Cleanup ",
|
||||
"確定":"OK","執行":"Execute ","警告":"Warning ","使用":"Use ",
|
||||
"網路":"Network ","變更":"Change ","總數":"Total","結束":"End ",
|
||||
"選項":"Options ","監控":"Monitor ","連接":"Connect ","可以":"To ",
|
||||
"進程":"Process ","攔截":"Block ","引導":"Boot ","刪除":"Delete ",
|
||||
"分區":"Partition ","設定":"Settings","關於":"About","模式":"Mode ",
|
||||
"提高":"Improve ","安全":"Security ","顯色":"Color ","主題":"Themes ",
|
||||
"風險":"Risk ","介面":"GUI ","核心":"Core ","服務":"Services ",
|
||||
"管理":"Manage","所有":"All ","全盤":"Full ","取消":"Cancel ",
|
||||
"垃圾":"Junk ","位元":"byte ","本機":"Computer ","停止":"Stop ",
|
||||
"增加到":"Add File To ","白名單":"White List ","軟體":"Software ",
|
||||
"增加":"Add","移除":"Delete","項目":"Items ","生成":"Create ",
|
||||
"開啟":"Open ","您":"You ","此":"This ","並":"And ","未":"Not ",
|
||||
"高":"High ","新":"New ","和":"And ","可能會":"Possible ","會":"Can ",
|
||||
"日誌":"Log","已":"Has ","彈窗":"Window ","要":"To ","驅動":"Drive ",
|
||||
"的":"","顯示":"","個":"","嗎":"","中":"","了":"","行":"","稱":"",
|
||||
"密鑰":"Key ","檢測":"Detect ","誤報":"False Positive ","立即":"",
|
||||
" ":" "}}
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import pyinstaller_versionfile
|
||||
pyinstaller_versionfile.create_versionfile(
|
||||
output_file="versionfile.txt",
|
||||
version='2.8.2',
|
||||
version='2.8.3',
|
||||
company_name="PYAS Security",
|
||||
file_description="Python Antivirus Software",
|
||||
internal_name="PYAS",
|
||||
|
||||
Reference in new issue
Block a user