Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5faee6a05f | ||
|
|
9213f9f54f | ||
|
|
c5e8351d76 | ||
|
|
e8e245ac0b | ||
|
|
2d8d6851d1 | ||
|
|
54f3e2ceda | ||
|
|
81d98917c3 | ||
|
|
8651f1e5d6 | ||
|
|
db1a26424d | ||
|
|
16405810dd | ||
|
|
f4f7fc1b0c | ||
|
|
e1145a743a | ||
|
|
6e5b54bbfe | ||
|
|
a948219e1a | ||
|
|
5675e926d5 | ||
|
|
cb7f8bbaab | ||
|
|
61e7fd8f40 | ||
|
|
76fab2671a | ||
|
|
dbc2bd2d62 | ||
|
|
73e62935ff | ||
|
|
c9e28b5482 | ||
|
|
6bf58eae4a | ||
|
|
3e09574b3c | ||
|
|
a7a00b9ca6 | ||
|
|
7a62e2df27 | ||
|
|
317f1ccae7 | ||
|
|
884631409a | ||
|
|
14dca5e2cb | ||
|
|
3a0b856d47 | ||
|
|
e66f8af022 | ||
|
|
13e4560d86 | ||
|
|
5ea789df7f | ||
|
|
debda9ec11 | ||
|
|
b3f126181b | ||
|
|
6bd110cae7 | ||
|
|
635f4ccde3 | ||
|
|
01da2685a5 | ||
|
|
b040aad8d1 | ||
|
|
84a0f08618 | ||
|
|
1f64c0d672 | ||
|
|
5bfff87e21 | ||
|
|
47db0e1c46 | ||
|
|
9a9fdc418f | ||
|
|
c30c89ed40 | ||
|
|
d7bb89968f | ||
|
|
f9b431d158 | ||
|
|
a1364896af | ||
|
|
2870a999a2 | ||
|
|
98646a6bd9 | ||
|
|
8ec894f576 | ||
|
|
254a67b9a8 | ||
|
|
eebfb79c27 | ||
|
|
1a1d7ec783 | ||
|
|
4482144b4d | ||
|
|
827279c9a8 | ||
|
|
b1d3488842 | ||
|
|
90112ae1ae | ||
|
|
1f4b9390b9 | ||
|
|
cc142aca40 | ||
|
|
89513b2c0d | ||
|
|
bfcd00acec | ||
|
|
9833b28a50 |
No files matched your search
@@ -3,9 +3,8 @@ import hashlib, pefile, socket, msvcrt
|
||||
import requests, pyperclip, win32file
|
||||
import win32gui, win32api, win32con
|
||||
import xml.etree.ElementTree as xmlet
|
||||
from PYAS_Scripts import scripts_list
|
||||
from PYAS_Rules import pyasrule_dict
|
||||
from PYAS_Function import function_list
|
||||
from PYAS_Function_Safe import function_list_safe
|
||||
from PYAS_Extension import slist, alist
|
||||
from PYAS_Language import translate_dict
|
||||
from PYAS_Interface import Ui_MainWindow
|
||||
@@ -20,16 +19,17 @@ class MainWindow_Controller(QMainWindow):
|
||||
self.setAttribute(Qt.WA_TranslucentBackground)
|
||||
self.setWindowFlags(Qt.FramelessWindowHint)
|
||||
self.pyas = str(sys.argv[0]).replace("\\", "/")
|
||||
self.pyas_version = "2.8.9"
|
||||
self.pyas_version = "2.9.2"
|
||||
self.ui = Ui_MainWindow()
|
||||
self.ui.setupUi(self)
|
||||
self.init_tray_icon()
|
||||
self.init_virus_list()
|
||||
self.init_state_safe()
|
||||
self.init_config_path()
|
||||
self.init_config_read()
|
||||
self.init_config_json()
|
||||
self.init_config_list()
|
||||
self.init_config_boot()
|
||||
self.init_config_json()
|
||||
self.init_config_qtui()
|
||||
self.init_change_lang()
|
||||
self.init_control()
|
||||
@@ -94,11 +94,18 @@ class MainWindow_Controller(QMainWindow):
|
||||
except:
|
||||
self.mbr_value = False
|
||||
|
||||
def init_config_json(self):
|
||||
if not os.path.exists("C:/ProgramData/PYAS/PYAS.json"):
|
||||
def init_config_read(self):
|
||||
try:
|
||||
if not os.path.exists("C:/ProgramData/PYAS/PYAS.json"):
|
||||
self.write_config({"language":"en_US","high_sensitivity":0,"cloud_services":1})
|
||||
with open("C:/ProgramData/PYAS/PYAS.json", "r", encoding="utf-8") as f:
|
||||
self.json = json.load(f)
|
||||
except:
|
||||
self.write_config({"language":"en_US","high_sensitivity":0,"cloud_services":1})
|
||||
with open("C:/ProgramData/PYAS/PYAS.json", "r", encoding="utf-8") as f:
|
||||
self.json = json.load(f)
|
||||
with open("C:/ProgramData/PYAS/PYAS.json", "r", encoding="utf-8") as f:
|
||||
self.json = json.load(f)
|
||||
|
||||
def init_config_json(self):
|
||||
self.high_sensitivity = self.json.get("high_sensitivity", 0)
|
||||
if self.high_sensitivity == 1:
|
||||
self.ui.high_sensitivity_switch_Button.setText(self.trans("已開啟"))
|
||||
@@ -530,14 +537,15 @@ class MainWindow_Controller(QMainWindow):
|
||||
|
||||
def closeEvent(self, event):
|
||||
if QMessageBox.warning(self,self.trans("警告"),self.trans("您確定要退出 PYAS 和所有防護嗎?"),QMessageBox.Yes|QMessageBox.No) == 16384:
|
||||
self.virus_scan_break()
|
||||
event.accept()
|
||||
else:
|
||||
event.ignore()
|
||||
|
||||
def bug_event(self, error):
|
||||
def bug_event(self, text):
|
||||
try:
|
||||
print(f"[Error] {error}")
|
||||
QMessageBox.critical(self,self.trans("錯誤"),error,QMessageBox.Ok)
|
||||
print(f"[Error] {text}")
|
||||
QMessageBox.critical(self,self.trans("錯誤"), text, QMessageBox.Ok)
|
||||
except:
|
||||
pass
|
||||
|
||||
@@ -772,15 +780,11 @@ class MainWindow_Controller(QMainWindow):
|
||||
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.pe_scan(file):
|
||||
self.write_scan(self.trans("可疑"),file)
|
||||
elif self.scr_scan(file):
|
||||
self.write_scan(self.trans("可疑"),file)
|
||||
except:
|
||||
pass
|
||||
|
||||
@@ -788,15 +792,15 @@ class MainWindow_Controller(QMainWindow):
|
||||
for fd in os.listdir(path):
|
||||
try:
|
||||
file = str(os.path.join(path,fd)).replace("\\", "/")
|
||||
self.ui.Virus_Scan_text.setText(self.trans(f"正在掃描: ")+file)
|
||||
QApplication.processEvents()
|
||||
if self.scan_file == False:
|
||||
return
|
||||
break
|
||||
elif ":/Windows" in file:
|
||||
continue
|
||||
elif os.path.isdir(file):
|
||||
self.traverse_path(file)
|
||||
elif file not in self.whitelist:
|
||||
self.ui.Virus_Scan_text.setText(self.trans(f"正在掃描: ")+file)
|
||||
QApplication.processEvents()
|
||||
self.start_scan(file)
|
||||
gc.collect()
|
||||
except:
|
||||
@@ -821,29 +825,25 @@ class MainWindow_Controller(QMainWindow):
|
||||
except:
|
||||
return True
|
||||
|
||||
def scr_scan(self, text):
|
||||
try:
|
||||
if os.path.isfile(text):
|
||||
with open(text, "r", encoding="utf-8") as f:
|
||||
text = f.read()
|
||||
return any(sn.lower() in str(text).lower() for sn in scripts_list)
|
||||
except:
|
||||
return False
|
||||
|
||||
def pe_scan(self, file):
|
||||
try:
|
||||
fn = set()
|
||||
fn = []
|
||||
with pefile.PE(file) as pe:
|
||||
for entry in pe.DIRECTORY_ENTRY_IMPORT:
|
||||
for func in entry.imports:
|
||||
try:
|
||||
fn.add(str(func.name, "utf-8"))
|
||||
fn.append(str(func.name, "utf-8"))
|
||||
except:
|
||||
pass
|
||||
max_vfl = max(len(set(fn) & set(vfl)) / len(set(fn) | set(vfl)) for vfl in function_list)
|
||||
max_sfl = max(len(set(fn) & set(sfl)) / len(set(fn) | set(sfl)) for sfl in function_list_safe)
|
||||
#print(f'Virus:{int(max_vfl * 100)}%, Safe:{int(max_sfl * 100)}%')
|
||||
return int(max_vfl * 100) > int(max_sfl * 100)
|
||||
max_vfl = []
|
||||
for vfl in function_list:
|
||||
QApplication.processEvents()
|
||||
max_vfl.append(len(set(fn)&set(vfl))/len(set(fn)|set(vfl)))
|
||||
if self.high_sensitivity and max(max_vfl) == 1.0:
|
||||
return True
|
||||
elif "_CorExeMain" not in fn and max(max_vfl) == 1.0:
|
||||
return True
|
||||
return False
|
||||
except:
|
||||
return False
|
||||
|
||||
@@ -1179,27 +1179,32 @@ class MainWindow_Controller(QMainWindow):
|
||||
existing_processes.add(p.pid)
|
||||
psutil.Process(p.pid).suspend()
|
||||
name, file, cmd = p.name(), p.exe().replace("\\", "/"), p.cmdline()
|
||||
if ":/Windows" in file or ":/Program" in file:
|
||||
if "powershell" in name and self.api_scan(cmd[-1].split("'")[-2]):
|
||||
p.kill()
|
||||
self.send_notify(self.trans("惡意腳本攔截: ")+name)
|
||||
elif "cmd.exe" in name and self.api_scan(" ".join(cmd[2:])):
|
||||
p.kill()
|
||||
self.send_notify(self.trans("惡意腳本攔截: ")+name)
|
||||
elif self.scr_scan(file) or self.api_scan(cmd[-1]):
|
||||
p.kill()
|
||||
self.send_notify(self.trans("惡意軟體攔截: ")+name)
|
||||
elif file != self.pyas and file not in self.whitelist:
|
||||
if self.sign_scan(file):
|
||||
self.proc = p
|
||||
if self.api_scan(file) or self.pe_scan(file):
|
||||
p.kill()
|
||||
self.send_notify(self.trans("惡意軟體攔截: ")+name)
|
||||
if self.protect_proc_scan(name, file, cmd):
|
||||
p.kill()
|
||||
self.send_notify(self.trans("惡意軟體攔截: ")+file)
|
||||
elif ":/Windows" not in file and self.sign_scan(file):
|
||||
self.proc = p
|
||||
psutil.Process(p.pid).resume()
|
||||
gc.collect()
|
||||
except:
|
||||
pass
|
||||
|
||||
def protect_proc_scan(self, name, file, cmd):
|
||||
try:
|
||||
if file != self.pyas and file not in self.whitelist:
|
||||
if "powershell" in name:
|
||||
file = str(cmd[-1].split("'")[-2])
|
||||
elif "cmd.exe" in name:
|
||||
file = str(" ".join(cmd[2:]))
|
||||
elif ":/Windows" in file:
|
||||
file = str(cmd[-1])
|
||||
elif ":/Program" in file:
|
||||
file = str(cmd[-1])
|
||||
return self.api_scan(file) or self.pe_scan(file)
|
||||
return False
|
||||
except:
|
||||
pass
|
||||
|
||||
def protect_file_thread(self):
|
||||
hDir = win32file.CreateFile("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)
|
||||
self.ransom_block = False
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
||||
scripts_list = ["%0|%0","ExclusionPath","cmdkey","eiculwo"]
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
import pyinstaller_versionfile
|
||||
pyinstaller_versionfile.create_versionfile(
|
||||
output_file="versionfile.txt",
|
||||
version='2.8.9',
|
||||
version='2.9.2',
|
||||
company_name="PYAS Security",
|
||||
file_description="Python Antivirus Software",
|
||||
internal_name="PYAS",
|
||||
legal_copyright="© PYAS Security",
|
||||
legal_copyright="PYAS Security",
|
||||
original_filename="PYAS.exe",
|
||||
product_name="PYAS")
|
||||
Reference in new issue
Block a user