Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e091a3e7c | ||
|
|
8840da91d7 | ||
|
|
1f4ff04ed3 | ||
|
|
60974e8f72 | ||
|
|
86f68994c2 | ||
|
|
21c4918486 | ||
|
|
c6a426ec25 | ||
|
|
db75a22c1c | ||
|
|
7e85d22ecd | ||
|
|
67adadc0a4 | ||
|
|
6b78562454 | ||
|
|
4f13afc867 | ||
|
|
c34e8f193f | ||
|
|
4bcb507eae | ||
|
|
a50d457d75 | ||
|
|
9f119265a9 | ||
|
|
0b121a624b | ||
|
|
0f47f5ec8f | ||
|
|
f89896d041 | ||
|
|
5e335fd5e8 | ||
|
|
fd245dec14 | ||
|
|
774cdc5de3 | ||
|
|
633cfad1a8 |
No files matched your search
@@ -4,10 +4,10 @@ import xml.etree.ElementTree as xmlet
|
||||
import requests, pyperclip, win32file
|
||||
import win32gui, win32api, win32con
|
||||
from PYAS_Extension import slist, alist
|
||||
from PYAS_Function_Safe import func_safe
|
||||
from PYAS_Function_Virus import func_virus
|
||||
from PYAS_Compress import ListCompressor
|
||||
from PYAS_Language import translate_dict
|
||||
from PYAS_Interface import Ui_MainWindow
|
||||
from PYAS_Function import model_dict
|
||||
from threading import Thread
|
||||
from PyQt5.QtWidgets import *
|
||||
from PyQt5.QtCore import *
|
||||
@@ -19,9 +19,10 @@ class MainWindow_Controller(QMainWindow):
|
||||
self.setAttribute(Qt.WA_TranslucentBackground)
|
||||
self.setWindowFlags(Qt.FramelessWindowHint)
|
||||
self.pyas = str(sys.argv[0]).replace("\\", "/")
|
||||
self.pyas_version = "2.9.8"
|
||||
self.pyas_version = "2.9.9"
|
||||
self.ui = Ui_MainWindow()
|
||||
self.ui.setupUi(self)
|
||||
self.init_data_base()
|
||||
self.init_tray_icon()
|
||||
self.init_virus_list()
|
||||
self.init_state_safe()
|
||||
@@ -36,6 +37,10 @@ class MainWindow_Controller(QMainWindow):
|
||||
self.show_pyas_ui()
|
||||
self.init_threads()
|
||||
|
||||
def init_data_base(self):
|
||||
self.pe = ListCompressor()
|
||||
self.pe.load_model(model_dict)
|
||||
|
||||
def init_threads(self):
|
||||
self.protect_proc_init()
|
||||
self.protect_file_init()
|
||||
@@ -837,17 +842,11 @@ class MainWindow_Controller(QMainWindow):
|
||||
fn.append(str(func.name, "utf-8"))
|
||||
except:
|
||||
pass
|
||||
max_vfl = []
|
||||
for vfl in func_virus:
|
||||
QApplication.processEvents()
|
||||
max_vfl.append(len(set(fn)&set(vfl))/len(set(fn)|set(vfl)))
|
||||
max_sfl = []
|
||||
for sfl in func_safe:
|
||||
QApplication.processEvents()
|
||||
max_sfl.append(len(set(fn)&set(sfl))/len(set(fn)|set(sfl)))
|
||||
if self.high_sensitivity:
|
||||
return max(max_vfl) >= max(max_sfl)
|
||||
return max(max_vfl) - max(max_sfl) >= 0.1
|
||||
return self.pe.predict(fn, similarity=0.5)
|
||||
elif "_CorExeMain" not in fn:
|
||||
return self.pe.predict(fn, similarity=0.6)
|
||||
return False
|
||||
except:
|
||||
return False
|
||||
|
||||
@@ -1209,7 +1208,7 @@ class MainWindow_Controller(QMainWindow):
|
||||
elif self.proc_scan(p.pid):
|
||||
p.kill()
|
||||
self.send_notify(self.trans("惡意軟體攔截: ")+file)
|
||||
elif self.sign_scan(file):
|
||||
elif ":/Windows" not in file and self.sign_scan(file):
|
||||
self.proc = p
|
||||
psutil.Process(p.pid).resume()
|
||||
gc.collect()
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import json
|
||||
|
||||
class ListCompressor:
|
||||
def __init__(self):
|
||||
self.model = {'ones': [], 'zero': [], 'word': {}}
|
||||
|
||||
def save_model(self, file_name):
|
||||
with open(file_name, 'w') as f:
|
||||
json.dump(self.model, f)
|
||||
print(f"\nModel Is Saved In {file_name}")
|
||||
|
||||
def load_model(self, model_data):
|
||||
if isinstance(model_data, str):
|
||||
with open(model_data, 'r') as f:
|
||||
model_data = json.load(f)
|
||||
self.model = model_data
|
||||
|
||||
def train_model(self, ones, zero, min_count=1, max_ratio=1.0):
|
||||
unique_words = set([item for sublist in ones + zero for item in sublist])
|
||||
self.model['word'] = {word: idx for idx, word in enumerate(unique_words)}
|
||||
ones = [[self.model['word'][item] for item in lst] for lst in ones if len(lst) >= min_count and len(lst) / len(unique_words) <= max_ratio]
|
||||
zero = [[self.model['word'][item] for item in lst] for lst in zero if len(lst) >= min_count and len(lst) / len(unique_words) <= max_ratio]
|
||||
self.model['ones'].extend(ones)
|
||||
self.model['zero'].extend(zero)
|
||||
|
||||
def simplify_lists(self, lists):
|
||||
return [list(set(lst)) for lst in lists]
|
||||
|
||||
def predict(self, new_list, similarity=0.5):
|
||||
new_list = [self.model['word'].get(item, -1) for item in new_list if item in self.model['word']]
|
||||
if len(new_list) < 1:
|
||||
return False
|
||||
max_vfl = [len(set(new_list) & set(ones)) / len(set(new_list) | set(ones)) for ones in self.model['ones']]
|
||||
max_sfl = [len(set(new_list) & set(zero)) / len(set(new_list) | set(zero)) for zero in self.model['zero']]
|
||||
return max(max_vfl) >= max(max_sfl) and max(max_vfl) >= similarity
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
-1
@@ -1,7 +1,7 @@
|
||||
import pyinstaller_versionfile
|
||||
pyinstaller_versionfile.create_versionfile(
|
||||
output_file="versionfile.txt",
|
||||
version='2.9.8',
|
||||
version='2.9.9',
|
||||
company_name="PYAS Security",
|
||||
file_description="Python Antivirus Software",
|
||||
internal_name="PYAS",
|
||||
|
||||
Reference in new issue
Block a user