Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb541a0104 | ||
|
|
2063186994 | ||
|
|
860d571039 | ||
|
|
c6d79adf9a | ||
|
|
5453900ba1 | ||
|
|
5029ff1e37 | ||
|
|
47fb691339 | ||
|
|
dff9dd17bf | ||
|
|
5bc4a16b90 | ||
|
|
b1918953b0 | ||
|
|
6e89ed7007 | ||
|
|
744e8bc941 | ||
|
|
0b98ce7ffd | ||
|
|
ca8b293b06 | ||
|
|
e28d99a257 | ||
|
|
488feb6108 | ||
|
|
6cdb106f07 | ||
|
|
a7c5ccd27a | ||
|
|
136f9dbf0a | ||
|
|
16b45c3450 | ||
|
|
68330fad52 | ||
|
|
dca167518d | ||
|
|
bcc44422ef | ||
|
|
e080e03466 | ||
|
|
b6e75490de | ||
|
|
196c014576 | ||
|
|
236110df5e | ||
|
|
b2ae192056 | ||
|
|
f080969a62 | ||
|
|
69d969898d | ||
|
|
a21a766926 | ||
|
|
f11fdb6b96 | ||
|
|
c7445df4c6 | ||
|
|
2c45c9bc5b | ||
|
|
ae5ed27cb6 | ||
|
|
11f9fe3c8b | ||
|
|
e93ad3bd33 | ||
|
|
20c26ea0a8 | ||
|
|
5925a80d3b | ||
|
|
56cb95e523 | ||
|
|
a6e101cc5d | ||
|
|
e8292b6f81 | ||
|
|
37a4392c94 | ||
|
|
a897f75ecf | ||
|
|
79055d3779 |
No files matched your search
@@ -3,7 +3,6 @@ import hashlib, pefile, socket, msvcrt
|
||||
import xml.etree.ElementTree as xmlet
|
||||
import requests, pyperclip, win32file
|
||||
import win32gui, win32api, win32con
|
||||
from PYAS_Function import model_dict
|
||||
from PYAS_Extension import slist, alist
|
||||
from PYAS_Compress import ListCompressor
|
||||
from PYAS_Language import translate_dict
|
||||
@@ -18,15 +17,17 @@ class MainWindow_Controller(QMainWindow):
|
||||
super(MainWindow_Controller, self).__init__()
|
||||
self.setAttribute(Qt.WA_TranslucentBackground)
|
||||
self.setWindowFlags(Qt.FramelessWindowHint)
|
||||
self.pyas = str(sys.argv[0]).replace("\\", "/")
|
||||
self.pyae_version = "2024-01-19"
|
||||
self.pyas_version = "3.0.0"
|
||||
self.pyas = sys.argv[0].replace("\\", "/")
|
||||
self.dir = os.path.dirname(self.pyas)
|
||||
self.pyae_version = "0000-00-00"
|
||||
self.pyas_version = "3.0.2"
|
||||
self.ui = Ui_MainWindow()
|
||||
self.ui.setupUi(self)
|
||||
self.init_show_pyas()
|
||||
self.init_data_base()
|
||||
self.init_read_json()
|
||||
self.init_tray_icon()
|
||||
self.init_config_boot()
|
||||
self.init_config_json()
|
||||
self.init_config_list()
|
||||
self.init_config_qtui()
|
||||
@@ -35,10 +36,6 @@ class MainWindow_Controller(QMainWindow):
|
||||
self.init_control()
|
||||
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()
|
||||
@@ -53,6 +50,25 @@ class MainWindow_Controller(QMainWindow):
|
||||
self.tray_icon.activated.connect(self.init_show_pyas)
|
||||
self.tray_icon.show()
|
||||
|
||||
def init_data_base(self):
|
||||
try:
|
||||
file_path = os.path.join(self.dir, "PYAS_Function.vdb")
|
||||
if os.path.exists(file_path):
|
||||
self.pe = ListCompressor()
|
||||
self.pe.load_model(file_path)
|
||||
self.pyae_version = self.pe.get_label()
|
||||
except Exception as e:
|
||||
self.bug_event(e)
|
||||
|
||||
def init_config_boot(self):
|
||||
try:
|
||||
with open(r"\\.\PhysicalDrive0", "r+b") as f:
|
||||
self.mbr_value = f.read(512)
|
||||
if self.mbr_value[510:512] != b'\x55\xAA':
|
||||
self.mbr_value = False
|
||||
except:
|
||||
self.mbr_value = False
|
||||
|
||||
def write_config(self, config):
|
||||
try:
|
||||
with open("C:/ProgramData/PYAS/PYAS.json", "w") as f:
|
||||
@@ -328,6 +344,7 @@ class MainWindow_Controller(QMainWindow):
|
||||
self.ui.State_icon.setPixmap(QPixmap(file))
|
||||
except:
|
||||
self.ui.Theme_White.setChecked(True)
|
||||
self.ui.State_icon.setPixmap(QPixmap(":/icon/Check.png"))
|
||||
self.ui.Window_widget.setStyleSheet("QWidget#Window_widget {background-color:rgb(240,240,240);}")
|
||||
self.ui.Navigation_Bar.setStyleSheet("QWidget#Navigation_Bar {background-color:rgb(230,230,230);}")
|
||||
|
||||
@@ -397,7 +414,7 @@ class MainWindow_Controller(QMainWindow):
|
||||
|
||||
def timeout(self):
|
||||
if self.opacity.i <= 1:
|
||||
self.opacity.i += 0.03
|
||||
self.opacity.i += 0.05
|
||||
self.opacity.setOpacity(self.opacity.i)
|
||||
else:
|
||||
self.timer.stop()
|
||||
@@ -544,7 +561,7 @@ class MainWindow_Controller(QMainWindow):
|
||||
def init_show_pyas(self):
|
||||
def update_opacity():
|
||||
if self.pyas_opacity <= 100:
|
||||
self.pyas_opacity += 1
|
||||
self.pyas_opacity += 2
|
||||
self.setWindowOpacity(self.pyas_opacity/100)
|
||||
else:
|
||||
self.timer.stop()
|
||||
@@ -557,7 +574,7 @@ class MainWindow_Controller(QMainWindow):
|
||||
def init_hide_pyas(self):
|
||||
def update_opacity():
|
||||
if self.pyas_opacity >= 0:
|
||||
self.pyas_opacity -= 1
|
||||
self.pyas_opacity -= 2
|
||||
self.setWindowOpacity(self.pyas_opacity/100)
|
||||
else:
|
||||
self.timer.stop()
|
||||
@@ -572,7 +589,7 @@ class MainWindow_Controller(QMainWindow):
|
||||
self.send_notify(self.trans("PYAS 已最小化到系統托盤圖標"))
|
||||
|
||||
def closeEvent(self, event):
|
||||
if QMessageBox.warning(self,self.trans("警告"),self.trans("您確定要退出 PYAS 和所有防護嗎?"),QMessageBox.Yes|QMessageBox.No) == 16384:
|
||||
if self.question_event("您確定要退出 PYAS 和所有防護嗎?"):
|
||||
self.virus_scan_break()
|
||||
event.accept()
|
||||
else:
|
||||
@@ -580,24 +597,57 @@ class MainWindow_Controller(QMainWindow):
|
||||
|
||||
def bug_event(self, text):
|
||||
try:
|
||||
print(f"[Error] {text}")
|
||||
QMessageBox.critical(self,self.trans("錯誤"), text, QMessageBox.Ok)
|
||||
print(f"[Error] > {text}")
|
||||
QMessageBox.critical(self, "Error", str(text), QMessageBox.Ok)
|
||||
except:
|
||||
pass
|
||||
|
||||
def info_event(self, text):
|
||||
try:
|
||||
print(f"[Info] > {text}")
|
||||
QMessageBox.information(self, "Info", self.trans(str(text)), QMessageBox.Ok)
|
||||
except:
|
||||
pass
|
||||
|
||||
def question_event(self, text):
|
||||
try:
|
||||
print(f"[Quest] > {text}")
|
||||
return QMessageBox.question(self, "Quest", self.trans(str(text)),QMessageBox.Yes|QMessageBox.No) == 16384
|
||||
except:
|
||||
return False
|
||||
|
||||
def send_notify(self, text):
|
||||
try:
|
||||
now_time = time.strftime('%Y/%m/%d %H:%M:%S')
|
||||
now_time = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
print(f"[Notify] > [{now_time}] {text}")
|
||||
self.tray_icon.showMessage(now_time, text, 5000)
|
||||
QMetaObject.invokeMethod(self.ui.State_output, "append", Qt.QueuedConnection, Q_ARG(str, f"[{now_time}] {text}"))
|
||||
except:
|
||||
pass
|
||||
|
||||
def update_database(self):
|
||||
try:
|
||||
if self.question_event("您確定要更新數據庫嗎?"):
|
||||
file_path = os.path.join(self.dir, "PYAS_Function.vdb")
|
||||
response = requests.get('http://27.147.30.238:5001/database', params={"version": self.pyae_version}, timeout=5)
|
||||
if response.status_code == 200:
|
||||
with open(file_path, 'wb') as f:
|
||||
f.write(response.content)
|
||||
self.init_data_base()
|
||||
self.init_lang_text()
|
||||
self.info_event(f"數據庫更新成功: {self.pyae_version}")
|
||||
elif response.status_code == 204:
|
||||
self.info_event(f"數據庫已經是最新: {self.pyae_version}")
|
||||
except Exception as e:
|
||||
self.bug_event(e)
|
||||
|
||||
def show_menu(self):
|
||||
self.WindowMenu = QMenu()
|
||||
Main_Settings = QAction(self.trans("設定"),self)
|
||||
Main_Update = QAction(self.trans("更新"),self)
|
||||
Main_About = QAction(self.trans("關於"),self)
|
||||
self.WindowMenu.addAction(Main_Settings)
|
||||
self.WindowMenu.addAction(Main_Update)
|
||||
self.WindowMenu.addAction(Main_About)
|
||||
Qusetion = self.WindowMenu.exec_(self.ui.Menu_Button.mapToGlobal(QPoint(0, 30)))
|
||||
if Qusetion == Main_About and self.ui.About_widget.isHidden():
|
||||
@@ -615,6 +665,8 @@ class MainWindow_Controller(QMainWindow):
|
||||
self.ui.Window_widget.raise_()
|
||||
self.change_animation_3(self.ui.Setting_widget,0.5)
|
||||
self.change_animation_5(self.ui.Setting_widget,10,50,831,481)
|
||||
if Qusetion == Main_Update:
|
||||
self.update_database()
|
||||
|
||||
def change_sensitive(self):
|
||||
sw_state = self.ui.high_sensitivity_switch_Button.text()
|
||||
@@ -624,7 +676,7 @@ class MainWindow_Controller(QMainWindow):
|
||||
self.ui.high_sensitivity_switch_Button.setStyleSheet("""
|
||||
QPushButton{border:none;background-color:rgb(230,230,230);border-radius: 10px;}
|
||||
QPushButton:hover{background-color:rgb(220,220,220);}""")
|
||||
elif QMessageBox.warning(self,self.trans("警告"),self.trans("此選項可能會誤報檔案,您確定要開啟嗎?"),QMessageBox.Yes|QMessageBox.No) == 16384:
|
||||
elif self.question_event("此選項可能會誤報檔案,您確定要開啟嗎?"):
|
||||
self.json["high_sensitive"] = 1
|
||||
self.ui.high_sensitivity_switch_Button.setText(self.trans("已開啟"))
|
||||
self.ui.high_sensitivity_switch_Button.setStyleSheet("""
|
||||
@@ -831,9 +883,8 @@ class MainWindow_Controller(QMainWindow):
|
||||
if self.json["cloud_services"] == 1:
|
||||
with open(file, "rb") as f:
|
||||
text = str(hashlib.md5(f.read()).hexdigest())
|
||||
QApplication.processEvents()
|
||||
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)
|
||||
response = requests.post('http://qup.f.360.cn/file_health_info.php', data=strBody, timeout=5)
|
||||
return response.status_code == 200 and float(xmlet.fromstring(response.text).find('.//e_level').text) > 50
|
||||
return False
|
||||
except:
|
||||
@@ -877,13 +928,13 @@ class MainWindow_Controller(QMainWindow):
|
||||
|
||||
def repair_system(self):
|
||||
try:
|
||||
if QMessageBox.warning(self,self.trans("警告"),self.trans("您確定要修復系統檔案嗎?"),QMessageBox.Yes|QMessageBox.No) == 16384:
|
||||
if self.question_event("您確定要修復系統檔案嗎?"):
|
||||
self.repair_system_wallpaper()
|
||||
self.repair_system_restrict()
|
||||
self.repair_system_file_type()
|
||||
self.repair_system_file_icon()
|
||||
self.repair_system_image()
|
||||
QMessageBox.information(self,self.trans("成功"),self.trans("修復系統檔案成功"),QMessageBox.Ok)
|
||||
self.info_event("修復系統檔案成功")
|
||||
except Exception as e:
|
||||
self.bug_event(e)
|
||||
|
||||
@@ -996,12 +1047,12 @@ class MainWindow_Controller(QMainWindow):
|
||||
|
||||
def clean_system(self):
|
||||
try:
|
||||
if QMessageBox.warning(self,self.trans("警告"),self.trans("您確定要清理系統垃圾嗎?"),QMessageBox.Yes|QMessageBox.No) == 16384:
|
||||
if self.question_event("您確定要清理系統垃圾嗎?"):
|
||||
self.total_deleted_size = 0
|
||||
self.traverse_temp(f"C:/Users/{os.getlogin()}/AppData/Local/Temp/")
|
||||
self.traverse_temp(f"C:/Windows/Temp/")
|
||||
self.traverse_temp(f"C:/$Recycle.Bin/")
|
||||
QMessageBox.information(self,self.trans("成功"),self.trans(f"成功清理了 {self.total_deleted_size} 位元的系統垃圾"),QMessageBox.Ok)
|
||||
self.info_event(f"成功清理了 {self.total_deleted_size} 位元的系統垃圾")
|
||||
except Exception as e:
|
||||
self.bug_event(e)
|
||||
|
||||
@@ -1023,40 +1074,40 @@ class MainWindow_Controller(QMainWindow):
|
||||
try:
|
||||
file = str(QFileDialog.getOpenFileName(self,self.trans("增加到白名單"),"C:/")[0]).replace("\\", "/")
|
||||
if file and file not in self.whitelist:
|
||||
if QMessageBox.warning(self,self.trans("警告"),self.trans("您確定要增加到白名單嗎?"),QMessageBox.Yes|QMessageBox.No) == 16384:
|
||||
if self.question_event("您確定要增加到白名單嗎?"):
|
||||
self.whitelist.append(file)
|
||||
with open("C:/ProgramData/PYAS/Whitelist.ini", "a+") as f:
|
||||
f.write(f"{file}\n")
|
||||
QMessageBox.information(self,self.trans("成功"),self.trans(f"成功增加到白名單: ")+file,QMessageBox.Ok)
|
||||
elif file and QMessageBox.warning(self,self.trans("警告"),self.trans("您確定要取消增加到白名單嗎?"),QMessageBox.Yes|QMessageBox.No) == 16384:
|
||||
self.info_event(f"成功增加到白名單: "+file)
|
||||
elif file and self.question_event("您確定要取消增加到白名單嗎?"):
|
||||
self.whitelist.remove(file)
|
||||
with open("C:/ProgramData/PYAS/Whitelist.ini", "w") as f:
|
||||
for white_file in self.whitelist:
|
||||
f.write(f'{white_file}\n')
|
||||
QMessageBox.information(self,self.trans("成功"),self.trans(f"成功取消增加到白名單: ")+file,QMessageBox.Ok)
|
||||
self.info_event(f"成功取消增加到白名單: "+file)
|
||||
except Exception as e:
|
||||
self.bug_event(e)
|
||||
|
||||
def get_software_window(self):
|
||||
try:
|
||||
self.block_window = False
|
||||
if QMessageBox.warning(self,self.trans("警告"),self.trans("請選擇要攔截的軟體彈窗"),QMessageBox.Yes|QMessageBox.No) == 16384:
|
||||
if self.question_event("請選擇要攔截的軟體彈窗"):
|
||||
while not self.block_window:
|
||||
window_name = str(win32gui.GetWindowText(win32gui.GetForegroundWindow()))
|
||||
QApplication.processEvents()
|
||||
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:
|
||||
if self.question_event(f"您確定要攔截 {window_name} 嗎?"):
|
||||
self.blocklist.append(window_name)
|
||||
with open("C:/ProgramData/PYAS/Blocklist.ini", "a+") as f:
|
||||
f.write(f'{window_name}\n')
|
||||
QMessageBox.information(self,self.trans("成功"),self.trans(f"成功增加到彈窗攔截: ")+window_name,QMessageBox.Ok)
|
||||
elif QMessageBox.warning(self,self.trans("警告"),self.trans(f"您確定要取消攔截 {window_name} 嗎?"),QMessageBox.Yes|QMessageBox.No) == 16384:
|
||||
self.info_event(f"成功增加到彈窗攔截: "+window_name)
|
||||
elif self.question_event(f"您確定要取消攔截 {window_name} 嗎?"):
|
||||
self.blocklist.remove(window_name)
|
||||
with open("C:/ProgramData/PYAS/Blocklist.ini", "w") as f:
|
||||
for block_name in self.blocklist:
|
||||
f.write(f'{block_name}\n')
|
||||
QMessageBox.information(self,self.trans("成功"),self.trans(f"成功取消彈窗攔截: ")+window_name,QMessageBox.Ok)
|
||||
self.info_event(f"成功取消彈窗攔截: "+window_name)
|
||||
self.block_window = True
|
||||
self.block_window_init()
|
||||
except Exception as e:
|
||||
@@ -1077,9 +1128,9 @@ class MainWindow_Controller(QMainWindow):
|
||||
|
||||
def repair_network(self):
|
||||
try:
|
||||
if QMessageBox.warning(self,self.trans("警告"),self.trans("您確定要修復系統網路嗎?"),QMessageBox.Yes|QMessageBox.No) == 16384:
|
||||
if self.question_event("您確定要修復系統網路嗎?"):
|
||||
os.system("netsh winsock reset")
|
||||
if QMessageBox.warning(self,self.trans("警告"),self.trans("使用此選項需要重啟,您確定要重啟嗎?"),QMessageBox.Yes|QMessageBox.No) == 16384:
|
||||
if self.question_event("使用此選項需要重啟,您確定要重啟嗎?"):
|
||||
os.system("shutdown -r -t 0")
|
||||
except Exception as e:
|
||||
self.bug_event(e)
|
||||
@@ -1203,29 +1254,28 @@ class MainWindow_Controller(QMainWindow):
|
||||
if p.pid not in existing_processes:
|
||||
existing_processes.add(p.pid)
|
||||
while self.proc_protect:
|
||||
time.sleep(0.05)
|
||||
time.sleep(0.01)
|
||||
for p in psutil.process_iter():
|
||||
try:
|
||||
if p.pid not in existing_processes:
|
||||
existing_processes.add(p.pid)
|
||||
name, file, cmd = p.name(), p.exe(), p.cmdline()
|
||||
name, file, cmd = p.name(), p.exe().replace("\\", "/"), p.cmdline()
|
||||
if file != self.pyas and file not in self.whitelist:
|
||||
psutil.Process(p.pid).suspend()
|
||||
if "powershell" in name and self.api_scan(cmd[-1].split("'")[-2]):
|
||||
p.kill()
|
||||
file = str(cmd[-1].split("'")[-2]).replace("\\", "/")
|
||||
file = cmd[-1].split("'")[-2].replace("\\", "/")
|
||||
self.send_notify(self.trans("惡意腳本攔截: ")+file)
|
||||
elif "cmd.exe" in name and self.api_scan(" ".join(cmd[2:])):
|
||||
p.kill()
|
||||
file = str(" ".join(cmd[2:])).replace("\\", "/")
|
||||
file = " ".join(cmd[2:]).replace("\\", "/")
|
||||
self.send_notify(self.trans("惡意腳本攔截: ")+file)
|
||||
elif ":/Windows" in file and self.api_scan(cmd[-1]):
|
||||
p.kill()
|
||||
file = str(cmd[-1]).replace("\\", "/")
|
||||
file = cmd[-1].replace("\\", "/")
|
||||
self.send_notify(self.trans("惡意軟體攔截: ")+file)
|
||||
elif self.proc_scan(p.pid):
|
||||
elif ":/Windows" not in file and self.proc_scan(p.pid):
|
||||
p.kill()
|
||||
file = str(file).replace("\\", "/")
|
||||
self.send_notify(self.trans("惡意軟體攔截: ")+file)
|
||||
elif ":/Windows" not in file and self.sign_scan(file):
|
||||
self.proc = p
|
||||
@@ -1240,7 +1290,7 @@ class MainWindow_Controller(QMainWindow):
|
||||
for action, file in win32file.ReadDirectoryChangesW(hDir,10485760,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):
|
||||
try:
|
||||
fpath = str(f"C:/Users/{file}").replace("\\", "/")
|
||||
ftype = str(f".{full_path.split('.')[-1]}").lower()
|
||||
ftype = str(f".{fpath.split('.')[-1]}").lower()
|
||||
if action == 3 and ftype in slist and os.path.getsize(fpath) <= 20971520:
|
||||
if self.api_scan(fpath) or self.pe_scan(fpath):
|
||||
os.remove(fpath)
|
||||
@@ -1249,22 +1299,19 @@ class MainWindow_Controller(QMainWindow):
|
||||
pass
|
||||
|
||||
def protect_boot_thread(self):
|
||||
with open(r"\\.\PhysicalDrive0", "r+b") as f:
|
||||
self.mbr_value = f.read(512)
|
||||
if self.mbr_value[510:512] != b'\x55\xAA':
|
||||
self.mbr_value = False
|
||||
while self.mbr_protect and self.mbr_value:
|
||||
try:
|
||||
time.sleep(0.5)
|
||||
file = self.proc.exe().replace("\\", "/")
|
||||
with open(r"\\.\PhysicalDrive0", "r+b") as f:
|
||||
if self.mbr_value[510:512] != b'\x55\xAA':
|
||||
self.proc.kill()
|
||||
file = self.proc.exe().replace("\\", "/")
|
||||
self.send_notify(self.trans("惡意行為攔截: ")+file)
|
||||
elif f.read(512) != self.mbr_value:
|
||||
f.seek(0)
|
||||
f.write(self.mbr_value)
|
||||
self.proc.kill()
|
||||
file = self.proc.exe().replace("\\", "/")
|
||||
self.send_notify(self.trans("惡意行為攔截: ")+file)
|
||||
except:
|
||||
pass
|
||||
|
||||
+10
-10
@@ -1,4 +1,4 @@
|
||||
import json
|
||||
import json, hashlib
|
||||
|
||||
class ListCompressor:
|
||||
def __init__(self):
|
||||
@@ -13,19 +13,19 @@ class ListCompressor:
|
||||
if isinstance(model_data, str):
|
||||
with open(model_data, 'r') as f:
|
||||
model_data = json.load(f)
|
||||
self.model['word'] = model_data['word']
|
||||
self.model.update(model_data)
|
||||
self.model = model_data
|
||||
|
||||
def train_model(self, label, data):
|
||||
if label not in self.model:
|
||||
self.model[label] = []
|
||||
unique_words = set([item for sublist in data for item in sublist])
|
||||
self.model['word'] = {word: idx for idx, word in enumerate(unique_words)}
|
||||
self.model[label].extend([[self.model['word'][item] for item in lst] for lst in data])
|
||||
for lst in data:
|
||||
self.model[label].append(hashlib.md5(''.join(map(str, lst)).encode()).hexdigest()[:8])
|
||||
|
||||
def predict(self, new_list):
|
||||
new_list = [self.model['word'].get(item, 1) for item in new_list if item in self.model['word']]
|
||||
for label, items in self.model.items():
|
||||
if label != 'word' and new_list in items:
|
||||
return label
|
||||
return None
|
||||
if label != 'word' and hashlib.md5(''.join(map(str, new_list)).encode()).hexdigest()[:8] in items:
|
||||
return True
|
||||
return False
|
||||
|
||||
def get_label(self):
|
||||
return list(self.model.keys())[0]
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"2024-01-30 18:57:47": ["f8eaca69", "f0f5732f", "1b02d2da", "9b83055e", "fa39258e", "ebad499a", "7e7275ce", "f9f96fde", "dc2bd521", "2e3086b1", "4cbbe367", "62a39640", "628691a4", "7feb71ad", "c8756155", "724103b9", "21bb3aef", "8b136daa", "d2668208", "5e47ce27", "55e78944", "ec90753b", "cb9e21ee", "55634643", "d1ad686f", "319e2db4", "632f4531", "ecf51f02", "57b1794e", "cf04dfb7", "68b4c29f", "776c99fe", "bafe8409", "07483ddf", "e4753bc3", "86f8c21f", "c069d7d5", "0513868a", "55433105", "a51343e5", "5dd1e0c9", "8b6a35fc", "b2c4204c", "736a55d1", "0e2d378e", "221b87e3", "62a348cf", "1f53d69f", "ac0b27eb", "bee130c7", "00b0d86d", "f1dc8325", "d1e142b8", "87074aa5", "2bd013a0", "d2528b9e", "d90657b4", "b16889df", "c21af82e", "e81da5d7", "0ae06db8", "a072f779", "6c48e028", "acf0fbaa", "846a7177", "97be1e02", "94c2d42c", "e1240e10", "ee0a9c21", "0facf2a6", "2beae172", "39ae5ad7", "6a0c7324", "f074f5b4", "e952305f", "c969fd9d", "9af5a01e", "14688765", "596a470f", "94691d9a", "f30de2e7", "191f1163", "bdcb5a86", "18b3bf16", "30739d24", "e91746a4", "36888e71", "e26dfd80", "d8261ac3", "1a5cb45a", "23191f29", "20cb7eec", "94497ba5", "ce095672", "acf3bb61", "94bff605", "aea0475c", "b6a46047", "f1ae2ce5", "f25e7c70", "4c626e62", "d4da4030", "35eeb9fc", "010bd7e6", "088b5c3d", "4e552f39", "234f232b", "be39b5c7", "4d57d439", "3efc231b", "e3e0254f", "cf88078b", "957e7561", "0157ab1a", "6d75bcaa", "fdf069cb", "a1895d33", "aebc3614", "43d61eab", "967929f9", "11b631fb", "fbe63639", "0593e9a2", "c838e850", "a33c2ab4", "fa8ceeae", "71fa160a", "05178537", "f1bde64f", "30547b8f", "7fe931dd", "5dea0cda", "af0d6ebb", "f242ebc1", "ef2ac9f8", "09082309", "85a4b8a4", "65284f49", "cf215013", "6be2182a", "39d583d4", "e65f4785", "3cbb09cf", "73b78451", "61099a43", "1fe35f2e", "690b5995", "19d85999", "fcaa2063", "522ec9f6", "dfea1c9a", "1e54fc8c", "3d19c3b6", "13102764", "f0949aca", "7782a5e0", "a141f55e", "16eb1d17", "f14e284b", "3c36ae8e", "44349994", "0077b966", "8d8e66bb", "26dbaaa7", "69134125", "6be14646", "d4afaff6", "10c1954f", "07687215", "18b6668e", "295e94f1", "4beef072", "15bbc35a", "833b1998", "b81c15eb", "d0c36eb5", "30ff5635", "23edb694", "b5f2dd11", "9542f014", "2ba7934b", "8ac3e370", "be5348af", "2f7ca0b7", "c11f9756", "72646e9e", "ebaa875f", "d8efdadd", "cea3f4a5", "8f74e253", "c8ee6a44", "29a60790", "b6ed92dc", "022ab8d8", "f45011dd", "5606be13", "9fe86003", "c90d1128", "7bf6f523", "5dc456d1", "d41f3fb7", "839f31ff", "72e25499", "d0008616", "d6d13cfd", "018b8805", "3bd56a87", "7bf71a77", "302c6754", "639a51eb", "3025c6b7", "b233ddd9", "9297a1cb", "c10f2cf6", "a0a8dfd1", "6399f135", "8d394492", "d786ef37", "f516133b", "b71b7a0d", "a51484ee", "b6ec2abf", "184ccf63", "6cc57095", "897e3a5f", "5064bd10", "0abbe6f4", "57d2bb57", "3e3a904e", "cb25c53f", "35ebf1ea", "ec883603", "6c3d2e9a", "cd48542a", "e0b6a475", "1ed5d4af", "5cfe1ec3", "2f3f077c", "817d5bcb", "e7e4805a", "a8ac4be7", "3ae3b681", "781b603d", "99e3aca7", "d3cb5549", "e4e549d2", "eda8c8fd", "5a34fc94", "35385307", "b47d2a97", "8c0d1b23", "5529b024", "068c506c", "41858343", "861a909a", "96471e95", "a2b9d78f", "97255487", "506d0366", "7c5e3180", "e1aee43f", "99ad8db1", "1f4f4ab1", "cc431464", "cffd3e92", "ece85b50", "de6d3489", "9425f525", "c9dfa23f", "a97155f3", "002e23f2", "d440e8ed", "08798831", "96474097", "34962f83", "979532a1", "31f03b48", "5b692416", "c56d5e02", "5c2a1c1e", "6d642743", "fb15345a", "1bf7af93", "bb94e602", "4492b29b", "355885b6", "1e62932b", "f1bede8b", "6104f9a3", "86a6529d", "971f7f79", "8ace816a", "86a8a864", "4f85c567", "333b7df1", "cebe043f", "aa818d5e", "5458e526", "5354fc59", "14238173", "4794d596", "bd2797bd", "7e5013a9", "4211942c", "8c919cb4", "39bae570", "c8476924", "59d0bcc8", "29a47420", "62145122", "0b95337c", "55cd1300", "6fec3fac", "7abd0227", "ec842bbb", "f60b523e", "8ec73106", "e29225d6", "54224ade", "d722b746", "9342c1e3", "ce494c91", "4c1e1a2e", "20879280", "1c623712", "0ab6b9b5", "3cbe70c8", "090a5016", "1176c81f", "c4ca6358", "0ac1e588", "327018cc", "1aa3b54f", "9d8ed7e1", "98ecee4c", "1250f47d", "b48f6dcc", "2fd8a8a8", "df5292b9", "43ca2196", "eabebfd0", "5ef75e18", "6043426b", "5668ab16", "5694217b", "8da2c149", "8e108bc2", "4c44a17c", "ccdbc95c", "d578162e", "a828b92d", "226217c3", "5008e44f", "6ff4ce20", "10f2a2b1", "ee6b50e6", "1bc9bab0", "a69a2aba", "9dbfcd08", "539bc501", "640f2927", "e7e38d5e", "43adb03a", "7033ad33", "a98e1d1d", "19c928b8", "20fcecfd", "2038f57b", "1938493f", "47a32506", "6aa98b23", "051020bf", "4f5a3b25", "34d7276a", "79f68a23", "5b28a176", "15826bb9", "6a2eaaab", "23269a41", "79d85fa6", "51fe1954", "8f737801", "44dde6a5", "f8b69084", "136c1369", "086c7679", "0016c379", "2fe5822d", "1b146d77", "ff778b87", "6357bd68", "95840477", "c605b02a", "d9e4a2da", "1488771c", "1d067fed", "6c1c79f2", "4ce7e503", "c0d7b8fb", "ef0a1059", "f8984bae", "c9f98890", "f4eb7828", "5e570d46", "9ea12215", "de09d16e", "a470767a", "8c43a7fe", "65f145c0", "e425c385", "51453f5f", "fbca4af8", "5f213b95", "a6e2669f", "0d8e3Line truncated
|
||||
+5
-5
@@ -15,7 +15,7 @@ translate_dict = {
|
||||
"詢":"询","製":"制","員":"员","許":"许","條":"条","藍":"蓝","紅":"红",
|
||||
"綠":"绿","態":"态","務":"务","連":"连","檢":"检","測":"测","關":"关",
|
||||
"強":"强","驅":"驱","為":"为","腳":"脚","增":"增","單":"单","開":"开",
|
||||
"惡":"恶"},
|
||||
"惡":"恶","據":"据","庫":"库","經":"经","敗":"败"},
|
||||
"en_US": {"已開啟":"On","已關閉":"Off","已开启":"On","已关闭":"Off",",":", ",
|
||||
"立即刪除":"Delete Now","安全模式":"Safe Mode","官方網站":"Website",
|
||||
"惡意檔案":"Virus ","惡意軟體":"Malware ","勒索軟體":"Ransom ",
|
||||
@@ -23,9 +23,9 @@ translate_dict = {
|
||||
"許可條款":"License Terms","惡意":"Malicious","可疑":"Suspicious",
|
||||
"啟用":"Enable ","禁用":"Disable ","正在初始化中":"Initializing ",
|
||||
"正在掃描":"Scanning ","正在刪除":"Deleting ","最小化到":"Minimize To ",
|
||||
"確定要":"Sure Want To ","靈敏度":"Sensitivity ","更新":"Update",
|
||||
"確定要":"Sure Want To ","靈敏度":"Sensitivity ","更新":"Update ",
|
||||
"白色主題":"White","黃色主題":"Yellow","紅色主題":"Red","語言":"Language ",
|
||||
"藍色主題":"Blue","綠色主題":"Green","自定主題":"Custom",
|
||||
"藍色主題":"Blue","綠色主題":"Green","自定主題":"Custom","最新":"Latest ",
|
||||
"測試人員":"Testers","版本資訊":"Information","通訊":"Communication ",
|
||||
"註冊表":"Registry ","退出":"Quit ","檔案":"File ","當前":"Currently ",
|
||||
"狀態":"State ","掃描":"Scan ","工具":"Tools ","防護":"Protect ",
|
||||
@@ -47,8 +47,8 @@ translate_dict = {
|
||||
"增加到":"Add File To ","白名單":"White List ","軟體":"Software ",
|
||||
"增加":"Add","移除":"Delete","項目":"Items ","生成":"Create ","稱":"",
|
||||
"複製":"Copy ","開啟":"Open ","此":"This ","並":"And ","全盤":"Full ",
|
||||
"已經是":"Already ","數據庫":"Database ","誤報":"False Positive ",
|
||||
"高":"High ","新":"New ","和":"And ","可能會":"Possible ","會":"Can ",
|
||||
"日誌":"Log","已":"Has ","彈窗":"Window ","要":"To ","驅動":"Drive ",
|
||||
"的":"","顯示":"","個":"","嗎":"","中":"","了":"","行":"","立即":"",
|
||||
"密鑰":"Key ","檢測":"Detect ","誤報":"False Positive ","製作":"Make",
|
||||
" ":" "}}
|
||||
"密鑰":"Key ","檢測":"Detect ","製作":"Make"," ":" "}}
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import pyinstaller_versionfile
|
||||
pyinstaller_versionfile.create_versionfile(
|
||||
output_file="versionfile.txt",
|
||||
version='3.0.0',
|
||||
version='3.0.2',
|
||||
company_name="PYAS Security",
|
||||
file_description="Python Antivirus Software",
|
||||
internal_name="PYAS",
|
||||
|
||||
@@ -2,13 +2,15 @@
|
||||
|
||||

|
||||
|
||||
## File Function
|
||||
## File Information
|
||||
|
||||
PYAS.py -> Main PYAS Program (including animation, scanning, protection functions, etc.)
|
||||
|
||||
PYAS_Compress.py -> Conversion Database (used to convert database dict and list to and from each other)
|
||||
|
||||
PYAS_Extension.py -> File Extension (including scanned file extensions and common file extensions)
|
||||
|
||||
PYAS_Function*.7z -> Compress Database (need to use 7zip to decompress and put it in the same directory)
|
||||
PYAS_Function.* -> Virus Database (the virus database must be placed in the same directory)
|
||||
|
||||
PYAS_Interface.py -> PyQt5 Interface (designed by QT designer, must be matched with the main program)
|
||||
|
||||
@@ -20,6 +22,8 @@ PYAS_Version.py -> Pyinstaller Info (file information, version information, orig
|
||||
|
||||
## Requirements
|
||||
|
||||
Use pip install requirements to install import module
|
||||
|
||||
```
|
||||
psutil==5.9.5
|
||||
pefile==2023.2.7
|
||||
@@ -29,6 +33,121 @@ pywin32==306
|
||||
PyQt5==5.15.9
|
||||
```
|
||||
|
||||
## Hash Scanning
|
||||
|
||||
Use Qihoo 360 cloud service to scan known malicious files
|
||||
|
||||
```
|
||||
import hashlib, requests
|
||||
import xml.etree.ElementTree as xmlet
|
||||
|
||||
def hash_scan(file):
|
||||
try:
|
||||
with open(file, "rb") as f:
|
||||
text = str(hashlib.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)
|
||||
if response.status_code == 200:
|
||||
level = float(xmlet.fromstring(response.text).find('.//e_level').text)
|
||||
if level > 50:
|
||||
return "Virus"
|
||||
elif level <= 10:
|
||||
return "Safe"
|
||||
return "Unknown"
|
||||
return f"Error: {response.status_code}"
|
||||
except Exception as e:
|
||||
return f"Error: {e}"
|
||||
|
||||
info = hash_scan("path to file")
|
||||
print(info)
|
||||
```
|
||||
|
||||
## Pefile Scanning
|
||||
|
||||
Get the pefile file function import table for scanning
|
||||
|
||||
```
|
||||
import pefile
|
||||
|
||||
def pe_scan(file):
|
||||
try:
|
||||
fn = []
|
||||
with pefile.PE(file) as pe:
|
||||
for entry in pe.DIRECTORY_ENTRY_IMPORT:
|
||||
for func in entry.imports:
|
||||
try:
|
||||
fn.append(str(func.name, "utf-8"))
|
||||
except:
|
||||
pass
|
||||
if fn in known_malicious_list:
|
||||
return "Virus"
|
||||
return "Safe"
|
||||
return "Unknown"
|
||||
except Exception as e:
|
||||
return f"Error: {e}"
|
||||
|
||||
info = pe_scan("path to file")
|
||||
print(info)
|
||||
```
|
||||
|
||||
## Process Detect
|
||||
|
||||
Show the new process name, file path, cmd line, pid
|
||||
|
||||
```
|
||||
import psutil, time
|
||||
|
||||
def proc_detect():
|
||||
existing_processes = set()
|
||||
for p in psutil.process_iter():
|
||||
if p.pid not in existing_processes:
|
||||
existing_processes.add(p.pid)
|
||||
while True:
|
||||
time.sleep(0.1)
|
||||
for p in psutil.process_iter():
|
||||
try:
|
||||
if p.pid not in existing_processes:
|
||||
existing_processes.add(p.pid)
|
||||
name, file, cmd = p.name(), p.exe(), p.cmdline()
|
||||
print(f"Name: {name}")
|
||||
print(f"File: {file}")
|
||||
print(f"Pid: {p.pid}")
|
||||
print(f"Cmd: {cmd}")
|
||||
except:
|
||||
pass
|
||||
|
||||
proc_detect()
|
||||
```
|
||||
|
||||
## File Detect
|
||||
|
||||
Monitor file changes under the specified path
|
||||
|
||||
```
|
||||
import os, win32file, win32con
|
||||
|
||||
def file_detect(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)
|
||||
while True:
|
||||
for action, file in win32file.ReadDirectoryChangesW(hDir,10485760,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):
|
||||
try:
|
||||
fpath = os.path.join(path, file)
|
||||
if action == 1:
|
||||
print(f"File Create: {fpath}")
|
||||
elif action == 2:
|
||||
print(f"File Delete: {fpath}")
|
||||
elif action == 3:
|
||||
print(f"File Modify: {fpath}")
|
||||
elif action == 4:
|
||||
print(f"File Rename: {fpath}")
|
||||
elif action == 5:
|
||||
print(f"File Rename: {fpath}")
|
||||
except:
|
||||
pass
|
||||
|
||||
file_detect("path")
|
||||
```
|
||||
|
||||
## Official Website
|
||||
|
||||
https://pyantivirus.wixsite.com/pyas
|
||||
@@ -43,7 +162,9 @@ https://github.com/87owo/PYAS/blob/main/LICENSE.md
|
||||
|
||||
Windows 8.1, 10, 11 (64-bit), Ram 1GB, Rom 1GB or higher
|
||||
|
||||
Other systems may experience software malfunctions or crash
|
||||
|
||||
## Special Thanks
|
||||
360, Wix, VirusShare, mtkiao129, LenStevens, AV-T Team of LisectGroup
|
||||
360, Wix, VirusShare, mtkiao129, AV-T Team of LisectGroup
|
||||
|
||||
Copyright© 2020~2024 PYAS Security By 87owo
|
||||
Reference in new issue
Block a user