Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7927f12e84 | ||
|
|
7774ff77b2 | ||
|
|
aaa2ed7eef | ||
|
|
b83674e9b7 | ||
|
|
017356780c | ||
|
|
45916004d2 | ||
|
|
388c8b615e | ||
|
|
4219473632 | ||
|
|
f2283cdb7f | ||
|
|
72ce9cfd6b | ||
|
|
b26375d25a | ||
|
|
a2a823f358 | ||
|
|
62164cf628 | ||
|
|
0b5fc22181 | ||
|
|
0df905f777 | ||
|
|
a539a948f6 | ||
|
|
6bd8364b5f | ||
|
|
70b70bc3e7 | ||
|
|
ac50f8917e | ||
|
|
f935b2c0b6 | ||
|
|
245c9d1119 | ||
|
|
9476313725 | ||
|
|
2d27a74278 | ||
|
|
823a5115eb | ||
|
|
33ab1e1f5e | ||
|
|
8db984d1fd | ||
|
|
a00415657a | ||
|
|
527837cc56 | ||
|
|
ac9ddff8b1 | ||
|
|
4ebae2a167 | ||
|
|
11f1685f42 | ||
|
|
8199101891 | ||
|
|
4f3ce323ae | ||
|
|
76befc7c70 | ||
|
|
8b0ad06676 | ||
|
|
d7f091a3a9 | ||
|
|
679b00229c | ||
|
|
0cfc636fb6 | ||
|
|
bd3c31e150 | ||
|
|
8e9547b75a | ||
|
|
d38ecc0f96 | ||
|
|
85834497e0 | ||
|
|
0d8997db02 | ||
|
|
cb53450ca5 | ||
|
|
f38ae36eb6 | ||
|
|
8218b0c8a6 | ||
|
|
ea036d2d53 | ||
|
|
b163eb2cdb | ||
|
|
ba3568f312 | ||
|
|
80c9976832 | ||
|
|
b6326c25b9 | ||
|
|
35f591cf49 | ||
|
|
67e437bbd7 | ||
|
|
194dae8ce1 | ||
|
|
a89442ceb0 | ||
|
|
24debf6062 | ||
|
|
ff98846c99 | ||
|
|
e3f5a0bca1 | ||
|
|
7278e4f051 | ||
|
|
709a511c1d | ||
|
|
452027f085 | ||
|
|
8574802428 | ||
|
|
79fb044921 | ||
|
|
13ac634fea | ||
|
|
04a68bc262 | ||
|
|
47de15ab68 | ||
|
|
512af24a05 | ||
|
|
e5ff46d3bb | ||
|
|
c7a0979140 | ||
|
|
7fd7245df2 | ||
|
|
026301b011 | ||
|
|
5cc77f90ae | ||
|
|
0d4568ac8a | ||
|
|
a6ed491a39 | ||
|
|
90dfc3f1ae | ||
|
|
36388fb0d7 | ||
|
|
043166d0c8 | ||
|
|
b92d488851 | ||
|
|
d841a04a89 | ||
|
|
d8553baa78 | ||
|
|
8521d5aee3 | ||
|
|
ebe21d9c7f | ||
|
|
3b83abdbd3 | ||
|
|
aead2463c9 | ||
|
|
5cc5676672 | ||
|
|
ecc32ca18d | ||
|
|
661640de79 | ||
|
|
96dfdab7ed | ||
|
|
56bed5fd3b | ||
|
|
3fd3b18406 | ||
|
|
45bac97a16 | ||
|
|
2c6eca4a92 | ||
|
|
8109d59655 | ||
|
|
8a15571cd2 | ||
|
|
a15c8f2e60 | ||
|
|
cec3d6c04d | ||
|
|
d872604855 | ||
|
|
2b6fb933a4 | ||
|
|
1da892e863 | ||
|
|
19bfedd1a3 | ||
|
|
cb87392d9d | ||
|
|
7cd5bc9ec3 | ||
|
|
edcc1a30ab | ||
|
|
6f93f6ab06 | ||
|
|
9de1f44288 | ||
|
|
3d360b0881 | ||
|
|
cf1c415846 | ||
|
|
90133e2444 | ||
|
|
81246046b8 | ||
|
|
20e037ab9e | ||
|
|
bc27036ba7 | ||
|
|
1cd470b90b | ||
|
|
64471e34bc | ||
|
|
f4c5d3de09 | ||
|
|
0dc59405e3 | ||
|
|
7c775bdc9b | ||
|
|
61400ff4d4 | ||
|
|
e119e34ebe | ||
|
|
6f059747bf | ||
|
|
24d72641fa | ||
|
|
b91fca3aa6 | ||
|
|
a6f1947837 | ||
|
|
6919131cef | ||
|
|
9186d801fc | ||
|
|
76e2f200bd | ||
|
|
1400bbd9ce | ||
|
|
fd37628ac2 | ||
|
|
4396d5afc4 | ||
|
|
f5faf80883 | ||
|
|
ba32da97c8 | ||
|
|
ec2de73d3a | ||
|
|
f4d032e5c7 | ||
|
|
4114aac6c3 | ||
|
|
0c43c6bb5f | ||
|
|
7b3c965b88 | ||
|
|
d1035268f6 | ||
|
|
8968f30bf9 | ||
|
|
84c2c29600 | ||
|
|
b2a59f261c | ||
|
|
363a330f8e | ||
|
|
1d2aa059ee | ||
|
|
f2bfa908a1 | ||
|
|
02a8de4696 | ||
|
|
22fa3eff71 | ||
|
|
69361209c3 | ||
|
|
ff0aeaa4ef | ||
|
|
3c461dfd4b | ||
|
|
c6beda383e | ||
|
|
3d59f3befd | ||
|
|
e54f0db239 | ||
|
|
0f877f2749 | ||
|
|
b69ba165d9 | ||
|
|
965076fe52 | ||
|
|
f4d6cb0430 | ||
|
|
19d412188c |
No files matched your search
@@ -0,0 +1,34 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
:: Check for permissions
|
||||
>nul 2>&1 "%SYSTEMROOT%\system32\icacls.exe" "%SYSTEMROOT%\system32\config\system"
|
||||
|
||||
if %errorlevel% NEQ 0 goto NoAdmin
|
||||
goto gotAdmin
|
||||
|
||||
:NoAdmin
|
||||
echo You do not have administrator rights, please run this script as administrator.
|
||||
pause
|
||||
exit /B
|
||||
|
||||
:gotAdmin
|
||||
if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs"
|
||||
|
||||
set "script_dir=%~dp0"
|
||||
set "script_dir=%script_dir:~0,-1%"
|
||||
|
||||
bcdedit -debug on
|
||||
bcdedit /set testsigning on
|
||||
bcdedit /deletevalue {current} safeboot
|
||||
|
||||
powershell.exe -ExecutionPolicy Bypass -Command ^
|
||||
"$endDate = (Get-Date).AddYears(100); ^
|
||||
$cert = New-SelfSignedCertificate -DnsName PYAS -CertStoreLocation cert:\LocalMachine\My -Type CodeSigning -NotAfter $endDate; ^
|
||||
$pwd = ConvertTo-SecureString -String 'PYAS' -Force -AsPlainText; ^
|
||||
Export-PfxCertificate -Cert $cert -FilePath '%script_dir%\PYAS.pfx' -Password $pwd;"
|
||||
"%script_dir%\signtool.exe" sign /f "%script_dir%\PYAS.pfx" /p PYAS "%script_dir%\PYAS_Driver.sys"
|
||||
sc create PYAS_Driver type= kernel start= demand binPath= "%script_dir%\PYAS_Driver.sys"
|
||||
|
||||
shutdown -r -t 0
|
||||
endlocal
|
||||
Whitespace-only changes.
Binary file not shown.
@@ -0,0 +1,25 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
:: Check for permissions
|
||||
>nul 2>&1 "%SYSTEMROOT%\system32\icacls.exe" "%SYSTEMROOT%\system32\config\system"
|
||||
|
||||
if %errorlevel% NEQ 0 goto NoAdmin
|
||||
goto gotAdmin
|
||||
|
||||
:NoAdmin
|
||||
echo You do not have administrator rights, please run this script as administrator.
|
||||
pause
|
||||
exit /B
|
||||
|
||||
:gotAdmin
|
||||
if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs"
|
||||
|
||||
sc stop PYAS_Driver
|
||||
sc delete PYAS_Driver
|
||||
|
||||
bcdedit /set testsigning off
|
||||
bcdedit -debug off
|
||||
|
||||
shutdown -r -t 0
|
||||
endlocal
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"Unknown": [38413146381396798812836662586219087594480760119241756145287379993031670453973, 96759775057307603829199050115151442660431386536877578909394799687553144825391], "White": [92860071170291586757870565976957954052649178883790647665503983139114277816413, 50625869624179221836524636484722091669820057030729734765256925026245308185143, 79303266820014134748061006437377483029320717142203104125806969476209010566146, 50391760446499089493384482654016917630509060287507523223191455177998253781572, 34733894651460458125941968926483828168477919119649839915356573816494375383659, 16447578251589668808184123721615810667991570306415913809506896532563163557975, 18668853151306203943053249777678854424409647574074706653144503993068509738028, 16447129799599854768187525514242197965987640167415805965954293039200573272151, 42965648781535883376480003940402366467478625051031283341289116138472520399484, 45637511530246203537935382208327538642024163565740899790237852717178844340385, 100662025713257198141308144602569453810226448934776598411982222249289646045820, 2813878798545665948450767843887867208740292941021073849284371582085785669685, 54695748401254225125045716155327877471149349614359435230254611073117412307518, 27428665293760567560050957450577436769403462770366418052177943137905489504373, 32018095881556959863902669246154132691484124511748151111295836576906027842532, 82735669648112373508385530969898006750362429118827185652448450648454052106395, 27853809242729492000984914092533936796891917926358854729439436487683423285261, 20030429995379197455160031864140436552884002299333955332088108013764717533796, 82338140557728967648601024370995428985866052631101882076231147335348455671038, 71339449324799277130427957011381342555145697382104653874846579353871764366968, 2432232479351500614611699169184443988440809841079862157291791071419485606436, 9463527399566410848087352636323112952591923803840644609432039785310381355253, 17287926889345790925003722717807755244540044472850272987265624141065166747251, 31507509644511868166890345905396462199402122513677304280568315890707028374136, 92802443753971611323223428952970105040389824130209263287070763891097867755624, 60491018752293550079699763462944244393253888103551546202593483014975813742967, 45133408084728538869955951560598604064861024543940290379768365214821771604584, 6759146298068049614085390992799666053918974602489525613718797088468975708017, 43161770374046173333870752071317153674965637163816017117315179871715332666383, 55200886519442939000007636174371797768786544863806926514781108850256791225983, 102124766481586899841647737641698083212305154684644839980199278690335383712492, 52992286898317605666180786036367620316269750824654214415314225077986227890804, 96307454545313440124283308270263825589093792315386382296096934270155352236733, 36073459579994433898643313577597321150634749356791285363958792075031385371364, 5354562433688861244299028006341553420425390015040147574513776499404802540118, 2671602537216404752611755689384448521170725107261295121211275163689399347529, 31174448189678483951801405655647041557287598300853213718404097030076935043252, 817984956081990458969224676381868506770627801582748844000835755782736667191, 6997953573828232905847825866256444005094471443450029313008738013465446666864, 41288968033780608769032189481784193916730262129846893330891418484950645535282, 56724589038911745751056508177185337741291265472470897077742981563488398484126, 3353938097938067320481103667469354721822387389147415219233498938990215839034, 21195721951654457114265478558602466514207347021822959737607658828495062116920, 2916561284514958799877078174216081002558870786437593202464334407456915288119, 93137488384582768487662730765406914258099784103320160609442537879778117334700, 21195721951654457114265478558602377311225888285332501136798116331518898022972, 85036278951571446667616241901438186945472743486751871120301019617002115253240, 14623491695050192413097067629676318500123044497134202517578785087180871258165, 2022308710750553104057453378681448926020203033444470910346149752954363011822, 16435447118324352510213480738895714506136417806014749563314727656196027207884, 20110908101408861236178371339075650317185505287106087252378028881915405550816, 97262306467112548995108413358594977802790545321935863056096364390382492643957, 96614497885586867524036482497010189662872359368622249290846422070379022959337, 1895288773648887609359329471072769468085207279473521707976899919066265183340, 2651591106060448314208209841614702280337184080195391257416359882876000875095, 114619913163036058498985801603082782363327281628924544162718017899237779173997, 2481883953883130814217575190747389944608730963897863224598923997640828351014, 45000300637061336566799421885334051647634671537987073940268834014403441552901, 79047998258892679051555952202178856054614923426747250310189496005785954516966, 92887093185298651693450115442544102614083847612212241647641096093293220418098, 7140769773119319253009453104401896171570019200295580355390762162793695491644, 17012496707Line truncated
|
||||
@@ -1,16 +1,16 @@
|
||||
import os, gc, sys, time, json, psutil
|
||||
import hashlib, pefile, socket, msvcrt
|
||||
import xml.etree.ElementTree as xmlet
|
||||
import os, gc, sys, time, json, yara
|
||||
import pefile, socket, msvcrt, psutil
|
||||
import requests, pyperclip, win32file
|
||||
import win32gui, win32api, win32con
|
||||
from PYAS_Engine import ListSimHash
|
||||
from PYAS_Extension import slist, alist
|
||||
from PYAS_Compress import ListCompressor
|
||||
from PYAS_Language import translate_dict
|
||||
from PYAS_Interface import Ui_MainWindow
|
||||
from threading import Thread
|
||||
from PyQt5.QtWidgets import *
|
||||
from PyQt5.QtCore import *
|
||||
from PyQt5.QtGui import *
|
||||
from subprocess import *
|
||||
|
||||
class MainWindow_Controller(QMainWindow):
|
||||
def __init__(self):
|
||||
@@ -19,11 +19,13 @@ class MainWindow_Controller(QMainWindow):
|
||||
self.setWindowFlags(Qt.FramelessWindowHint)
|
||||
self.pyas = sys.argv[0].replace("\\", "/")
|
||||
self.dir = os.path.dirname(self.pyas)
|
||||
self.pyae_version = "0000-00-00 00:00:00"
|
||||
self.pyas_version = "3.0.3"
|
||||
self.pyae_version = "Fusion Engine"
|
||||
self.pyas_version = "3.1.2"
|
||||
self.ui = Ui_MainWindow()
|
||||
self.ui.setupUi(self)
|
||||
self.init_show_pyas()
|
||||
self.init_startup()
|
||||
self.init_sys_drive()
|
||||
self.init_rule_dict()
|
||||
self.init_data_base()
|
||||
self.init_read_json()
|
||||
self.init_tray_icon()
|
||||
@@ -50,13 +52,53 @@ class MainWindow_Controller(QMainWindow):
|
||||
self.tray_icon.activated.connect(self.init_show_pyas)
|
||||
self.tray_icon.show()
|
||||
|
||||
def init_startup(self):
|
||||
try:
|
||||
if len(sys.argv) > 1:
|
||||
param = sys.argv[1]
|
||||
if "h" in param or "hid" in param:
|
||||
pass
|
||||
else:
|
||||
self.init_show_pyas()
|
||||
elif len(sys.argv) <= 1:
|
||||
self.init_show_pyas()
|
||||
except Exception as e:
|
||||
self.bug_event(e)
|
||||
|
||||
def init_sys_drive(self):
|
||||
try:
|
||||
file_path = os.path.join(self.dir, "Driver")
|
||||
if os.path.exists(file_path):
|
||||
Popen("sc start PYAS_Driver", shell=True, stdout=PIPE, stderr=PIPE).wait()
|
||||
except Exception as e:
|
||||
self.bug_event(e)
|
||||
|
||||
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()
|
||||
file_path = os.path.join(self.dir, "Model")
|
||||
for root, dirs, files in os.walk(file_path):
|
||||
for file in files:
|
||||
model_path = os.path.join(root, file)
|
||||
ftype = str(f".{file.split('.')[-1]}").lower()
|
||||
if ftype in [".json", ".txt"]:
|
||||
self.pe = ListSimHash()
|
||||
self.pe.load_model(model_path)
|
||||
except Exception as e:
|
||||
self.bug_event(e)
|
||||
|
||||
def init_rule_dict(self):
|
||||
try:
|
||||
self.compiled_rules = {}
|
||||
file_path = os.path.join(self.dir, "Rules")
|
||||
for root, dirs, files in os.walk(file_path):
|
||||
for file in files:
|
||||
yara_path = os.path.join(root, file)
|
||||
ftype = str(f".{file.split('.')[-1]}").lower()
|
||||
if ftype in [".yara", ".yar"]:
|
||||
rules = yara.compile(yara_path)
|
||||
elif ftype in [".yc", ".yrc"]:
|
||||
rules = yara.load(yara_path)
|
||||
self.compiled_rules[yara_path] = rules
|
||||
except Exception as e:
|
||||
self.bug_event(e)
|
||||
|
||||
@@ -94,19 +136,19 @@ class MainWindow_Controller(QMainWindow):
|
||||
if not os.path.exists("C:/ProgramData/PYAS"):
|
||||
os.makedirs("C:/ProgramData/PYAS")
|
||||
if not os.path.exists("C:/ProgramData/PYAS/PYAS.json"):
|
||||
self.write_config({"high_sensitive":0,"cloud_services":1,
|
||||
self.write_config({"high_sensitive":0,"cloud_services":"http://127.0.0.1/",
|
||||
"language":"en_US","theme_color":"White","theme_custom":""})
|
||||
with open("C:/ProgramData/PYAS/PYAS.json", "r") as f:
|
||||
self.json = json.load(f)
|
||||
except:
|
||||
self.write_config({"high_sensitive":0,"cloud_services":1,
|
||||
self.write_config({"high_sensitive":0,"cloud_services":"http://127.0.0.1/",
|
||||
"language":"en_US","theme_color":"White","theme_custom":""})
|
||||
with open("C:/ProgramData/PYAS/PYAS.json", "r") as f:
|
||||
self.json = json.load(f)
|
||||
|
||||
def init_config_json(self):
|
||||
self.json["high_sensitive"] = self.json.get("high_sensitive", 0)
|
||||
self.json["cloud_services"] = self.json.get("cloud_services", 1)
|
||||
self.json["cloud_services"] = self.json.get("cloud_services", "http://127.0.0.1/")
|
||||
self.json["language"] = self.json.get("language", "en_US")
|
||||
self.json["theme_color"] = self.json.get("theme_color", "White")
|
||||
self.json["theme_custom"] = self.json.get("theme_custom", "")
|
||||
@@ -115,11 +157,6 @@ class MainWindow_Controller(QMainWindow):
|
||||
self.ui.high_sensitivity_switch_Button.setStyleSheet("""
|
||||
QPushButton{border:none;background-color:rgb(200, 250, 200);border-radius: 10px;}
|
||||
QPushButton:hover{background-color:rgb(210, 250, 210);}""")
|
||||
if self.json["cloud_services"] == 1:
|
||||
self.ui.cloud_services_switch_Button.setText(self.trans("已開啟"))
|
||||
self.ui.cloud_services_switch_Button.setStyleSheet("""
|
||||
QPushButton{border:none;background-color:rgb(200, 250, 200);border-radius: 10px;}
|
||||
QPushButton:hover{background-color:rgb(210, 250, 210);}""")
|
||||
if self.json["language"] == "zh_TW":
|
||||
self.ui.Language_Traditional_Chinese.setChecked(True)
|
||||
elif self.json["language"] == "zh_CN":
|
||||
@@ -171,7 +208,7 @@ class MainWindow_Controller(QMainWindow):
|
||||
self.ui.Protection_switch_Button_4.clicked.connect(self.protect_reg_init)
|
||||
self.ui.Protection_switch_Button_5.clicked.connect(self.protect_net_init)
|
||||
self.ui.high_sensitivity_switch_Button.clicked.connect(self.change_sensitive)
|
||||
self.ui.cloud_services_switch_Button.clicked.connect(self.change_cloud_service)
|
||||
self.ui.cloud_services_switch_Button.clicked.connect(self.cloud_service)
|
||||
self.ui.Add_White_list_Button.clicked.connect(self.add_white_list)
|
||||
self.ui.Language_Traditional_Chinese.clicked.connect(self.init_change_lang)
|
||||
self.ui.Language_Simplified_Chinese.clicked.connect(self.init_change_lang)
|
||||
@@ -286,16 +323,16 @@ class MainWindow_Controller(QMainWindow):
|
||||
self.ui.GUI_Made_Name.setText(self.trans("mtkiao"))
|
||||
self.ui.Core_Made_title.setText(self.trans("核心製作:"))
|
||||
self.ui.Core_Made_Name.setText(self.trans("87owo"))
|
||||
self.ui.Testers_title.setText(self.trans("測試人員:"))
|
||||
self.ui.Testers_Name.setText(self.trans("87owo"))
|
||||
self.ui.Testers_title.setText(self.trans("特別感謝:"))
|
||||
self.ui.Testers_Name.setText(self.trans("0sha0"))
|
||||
self.ui.PYAS_URL_title.setText(self.trans("官方網站:"))
|
||||
self.ui.PYAS_URL.setText(self.trans("<html><head/><body><p><a href=\"https://github.com/87owo/PYAS\"><span style=\" text-decoration: underline; color:#000000;\">https://github.com/87owo/PYAS</span></a></p></body></html>"))
|
||||
self.ui.high_sensitivity_title.setText(self.trans("高靈敏度模式"))
|
||||
self.ui.high_sensitivity_illustrate.setText(self.trans("啟用此選項可以提高引擎的靈敏度"))
|
||||
self.ui.high_sensitivity_switch_Button.setText(self.trans(self.ui.high_sensitivity_switch_Button.text()))
|
||||
self.ui.cloud_services_title.setText(self.trans("雲端掃描服務"))
|
||||
self.ui.cloud_services_illustrate.setText(self.trans("啟用此選項可以連接雲端掃描服務"))
|
||||
self.ui.cloud_services_switch_Button.setText(self.trans(self.ui.cloud_services_switch_Button.text()))
|
||||
self.ui.cloud_services_title.setText(self.trans("上報雲端分析"))
|
||||
self.ui.cloud_services_illustrate.setText(self.trans("此選項可以選擇檔案並上報雲端分析"))
|
||||
self.ui.cloud_services_switch_Button.setText(self.trans("選擇"))
|
||||
self.ui.Add_White_list_title.setText(self.trans("增加到白名單"))
|
||||
self.ui.Add_White_list_illustrate.setText(self.trans("此選項可以選擇檔案並增加到白名單"))
|
||||
self.ui.Add_White_list_Button.setText(self.trans(self.ui.Add_White_list_Button.text()))
|
||||
@@ -565,8 +602,8 @@ class MainWindow_Controller(QMainWindow):
|
||||
self.setWindowOpacity(self.pyas_opacity/100)
|
||||
else:
|
||||
self.timer.stop()
|
||||
self.show()
|
||||
self.pyas_opacity = 0
|
||||
self.show()
|
||||
self.timer = QTimer()
|
||||
self.timer.timeout.connect(update_opacity)
|
||||
self.timer.start(2)
|
||||
@@ -590,6 +627,13 @@ class MainWindow_Controller(QMainWindow):
|
||||
|
||||
def closeEvent(self, event):
|
||||
if self.question_event("您確定要退出 PYAS 和所有防護嗎?"):
|
||||
Popen("sc stop PYAS_Driver", shell=True, stdout=PIPE, stderr=PIPE).wait()
|
||||
self.block_window = False
|
||||
self.proc_protect = False
|
||||
self.file_protect = False
|
||||
self.mbr_protect = False
|
||||
self.reg_protect = False
|
||||
self.net_protect = False
|
||||
self.virus_scan_break()
|
||||
event.accept()
|
||||
else:
|
||||
@@ -625,29 +669,13 @@ class MainWindow_Controller(QMainWindow):
|
||||
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_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_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():
|
||||
@@ -665,8 +693,15 @@ 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()
|
||||
#if Qusetion == Main_Update:
|
||||
#self.update_database()
|
||||
|
||||
def update_database(self):
|
||||
try:
|
||||
if self.question_event("您確定要更新數據庫嗎?"):
|
||||
pass
|
||||
except Exception as e:
|
||||
self.bug_event(e)
|
||||
|
||||
def change_sensitive(self):
|
||||
sw_state = self.ui.high_sensitivity_switch_Button.text()
|
||||
@@ -684,21 +719,17 @@ class MainWindow_Controller(QMainWindow):
|
||||
QPushButton:hover{background-color:rgb(210,250,210);}""")
|
||||
self.write_config(self.json)
|
||||
|
||||
def change_cloud_service(self):
|
||||
sw_state = self.ui.cloud_services_switch_Button.text()
|
||||
if sw_state == self.trans("已關閉"):
|
||||
self.json["cloud_services"] = 1
|
||||
self.ui.cloud_services_switch_Button.setText(self.trans("已開啟"))
|
||||
self.ui.cloud_services_switch_Button.setStyleSheet("""
|
||||
QPushButton{border:none;background-color:rgb(200,250,200);border-radius: 10px;}
|
||||
QPushButton:hover{background-color:rgb(210,250,210);}""")
|
||||
elif sw_state == self.trans("已開啟"):
|
||||
self.json["cloud_services"] = 0
|
||||
self.ui.cloud_services_switch_Button.setText(self.trans("已關閉"))
|
||||
self.ui.cloud_services_switch_Button.setStyleSheet("""
|
||||
QPushButton{border:none;background-color:rgb(230,230,230);border-radius: 10px;}
|
||||
QPushButton:hover{background-color:rgb(220,220,220);}""")
|
||||
self.write_config(self.json)
|
||||
def cloud_service(self):
|
||||
try:
|
||||
file = str(QFileDialog.getOpenFileName(self,self.trans("上報雲端分析"),"C:/")[0]).replace("\\", "/")
|
||||
if file and self.question_event("您確定要上報雲端分析嗎?"):
|
||||
response = requests.post(self.json["cloud_services"], files={'file': open(file, 'rb')})
|
||||
if response.status_code == 200:
|
||||
self.info_event(f"成功上報雲端分析: "+file)
|
||||
else:
|
||||
self.bug_event(response.status_code)
|
||||
except Exception as e:
|
||||
self.bug_event(e)
|
||||
|
||||
def init_scan(self):
|
||||
try:
|
||||
@@ -706,7 +737,7 @@ class MainWindow_Controller(QMainWindow):
|
||||
QApplication.processEvents()
|
||||
try:
|
||||
for file in self.virus_list:
|
||||
self.unlock_file(file)
|
||||
self.lock_file(file, False)
|
||||
except:
|
||||
pass
|
||||
self.scan_file = True
|
||||
@@ -733,17 +764,14 @@ class MainWindow_Controller(QMainWindow):
|
||||
copyPath.triggered.connect(lambda: copyPathFunc())
|
||||
menu.exec_(self.ui.Virus_Scan_output.mapToGlobal(point))
|
||||
|
||||
def lock_file(self, file):
|
||||
def lock_file(self, file, lock):
|
||||
try:
|
||||
self.virus_lock[file] = os.open(file, os.O_RDWR)
|
||||
msvcrt.locking(self.virus_lock[file], msvcrt.LK_NBLCK, 0)
|
||||
except:
|
||||
pass
|
||||
|
||||
def unlock_file(self, file):
|
||||
try:
|
||||
msvcrt.locking(self.virus_lock[file], msvcrt.LK_UNLCK, 0)
|
||||
os.close(self.virus_lock[file])
|
||||
if lock:
|
||||
self.virus_lock[file] = os.open(file, os.O_RDWR)
|
||||
msvcrt.locking(self.virus_lock[file], msvcrt.LK_NBLCK, os.path.getsize(file))
|
||||
else:
|
||||
msvcrt.locking(self.virus_lock[file], msvcrt.LK_UNLCK, os.path.getsize(file))
|
||||
os.close(self.virus_lock[file])
|
||||
except:
|
||||
pass
|
||||
|
||||
@@ -753,37 +781,41 @@ class MainWindow_Controller(QMainWindow):
|
||||
for file in self.virus_list:
|
||||
try:
|
||||
if self.ui.Virus_Scan_output.findItems(file, Qt.MatchContains)[0].checkState() == Qt.Checked:
|
||||
self.ui.Virus_Scan_text.setText(self.trans("正在刪除: ")+file)
|
||||
self.ui.Virus_Scan_title.setText(self.trans("正在刪除"))
|
||||
self.ui.Virus_Scan_text.setText(file)
|
||||
QApplication.processEvents()
|
||||
self.unlock_file(file)
|
||||
self.lock_file(file, False)
|
||||
os.remove(file)
|
||||
else:
|
||||
self.unlock_file(file)
|
||||
self.lock_file(file, False)
|
||||
except:
|
||||
continue
|
||||
self.virus_lock = {}
|
||||
self.virus_list = []
|
||||
self.virus_list_ui = []
|
||||
self.ui.Virus_Scan_output.clear()
|
||||
self.ui.Virus_Scan_text.setText(self.trans("成功: 刪除成功"))
|
||||
self.ui.Virus_Scan_title.setText(self.trans("病毒掃描"))
|
||||
self.ui.Virus_Scan_text.setText(self.trans("刪除成功"))
|
||||
except Exception as e:
|
||||
self.bug_event(e)
|
||||
|
||||
def write_scan(self, state, file):
|
||||
try:
|
||||
self.lock_file(file)
|
||||
self.virus_list.append(file)
|
||||
self.virus_list_ui.append(f"[{state}] {file}")
|
||||
item = QListWidgetItem()
|
||||
item.setText(f"[{state}] {file}")
|
||||
item.setFlags(item.flags() | Qt.ItemIsUserCheckable)
|
||||
item.setCheckState(Qt.Checked)
|
||||
self.ui.Virus_Scan_output.addItem(item)
|
||||
if state and file:
|
||||
self.lock_file(file, True)
|
||||
self.virus_list.append(file)
|
||||
self.virus_list_ui.append(f"[{state}] {file}")
|
||||
item = QListWidgetItem()
|
||||
item.setText(f"[{state}] {file}")
|
||||
item.setFlags(item.flags() | Qt.ItemIsUserCheckable)
|
||||
item.setCheckState(Qt.Checked)
|
||||
self.ui.Virus_Scan_output.addItem(item)
|
||||
except:
|
||||
pass
|
||||
|
||||
def answer_scan(self):
|
||||
try:
|
||||
self.ui.Virus_Scan_title.setText(self.trans("病毒掃描"))
|
||||
if self.virus_list:
|
||||
self.ui.Virus_Scan_Solve_Button.show()
|
||||
self.ui.Virus_Scan_Break_Button.hide()
|
||||
@@ -803,6 +835,7 @@ class MainWindow_Controller(QMainWindow):
|
||||
self.ui.Virus_Scan_Break_Button.hide()
|
||||
self.ui.Virus_Scan_choose_Button.show()
|
||||
self.ui.Virus_Scan_text.setText(self.trans("請選擇掃描方式"))
|
||||
self.ui.Virus_Scan_title.setText(self.trans("病毒掃描"))
|
||||
|
||||
def virus_scan_menu(self):
|
||||
if self.ui.Virus_Scan_choose_widget.isHidden():
|
||||
@@ -814,9 +847,9 @@ class MainWindow_Controller(QMainWindow):
|
||||
def file_scan(self):
|
||||
try:
|
||||
file = str(QFileDialog.getOpenFileName(self,self.trans("病毒掃描"),"C:/")[0])
|
||||
if file and file not in self.whitelist:
|
||||
if file and file not in self.whitelist and file != self.pyas:
|
||||
self.init_scan()
|
||||
self.start_scan(file)
|
||||
self.write_scan(self.start_scan(file),file)
|
||||
self.answer_scan()
|
||||
except Exception as e:
|
||||
self.bug_event(e)
|
||||
@@ -844,59 +877,42 @@ class MainWindow_Controller(QMainWindow):
|
||||
self.bug_event(e)
|
||||
self.virus_scan_break()
|
||||
|
||||
def start_scan(self, file):
|
||||
try:
|
||||
file_type = str(f".{file.split('.')[-1]}").lower()
|
||||
if self.json["high_sensitive"] and file != self.pyas:
|
||||
if self.api_scan(file):
|
||||
self.write_scan(self.trans("惡意"),file)
|
||||
elif self.pe_scan(file):
|
||||
self.write_scan(self.trans("可疑"),file)
|
||||
elif file_type in slist and file != self.pyas:
|
||||
if self.api_scan(file):
|
||||
self.write_scan(self.trans("惡意"),file)
|
||||
elif self.pe_scan(file):
|
||||
self.write_scan(self.trans("可疑"),file)
|
||||
except:
|
||||
pass
|
||||
|
||||
def traverse_path(self,path):
|
||||
for fd in os.listdir(path):
|
||||
try:
|
||||
file = str(os.path.join(path,fd)).replace("\\", "/")
|
||||
if self.scan_file == False:
|
||||
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)
|
||||
elif file not in self.whitelist and file != self.pyas:
|
||||
self.ui.Virus_Scan_title.setText(self.trans("正在掃描"))
|
||||
self.ui.Virus_Scan_text.setText(file)
|
||||
QApplication.processEvents()
|
||||
self.start_scan(file)
|
||||
self.write_scan(self.start_scan(file),file)
|
||||
gc.collect()
|
||||
except:
|
||||
pass
|
||||
|
||||
def api_scan(self, file):
|
||||
def start_scan(self, file):
|
||||
try:
|
||||
if self.json["cloud_services"] == 1:
|
||||
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=5)
|
||||
return response.status_code == 200 and float(xmlet.fromstring(response.text).find('.//e_level').text) > 50
|
||||
ftype = str(f".{file.split('.')[-1]}").lower()
|
||||
label, level = self.pe_scan(file)
|
||||
if label and "Unknown" in label:
|
||||
if self.rule_scan(file):
|
||||
return "Rules"
|
||||
elif label and "White" not in label:
|
||||
if self.json["high_sensitive"]:
|
||||
return label
|
||||
elif level and level >= 0.9:
|
||||
return label
|
||||
elif self.json["high_sensitive"]:
|
||||
if self.rule_scan(file):
|
||||
return "Rules"
|
||||
return False
|
||||
except:
|
||||
return False
|
||||
|
||||
def sign_scan(self, file):
|
||||
try:
|
||||
with pefile.PE(file, fast_load=True) as pe:
|
||||
return pe.OPTIONAL_HEADER.DATA_DIRECTORY[pefile.DIRECTORY_ENTRY["IMAGE_DIRECTORY_ENTRY_SECURITY"]].VirtualAddress == 0
|
||||
except:
|
||||
return True
|
||||
|
||||
def pe_scan(self, file):
|
||||
try:
|
||||
fn = []
|
||||
@@ -907,20 +923,36 @@ class MainWindow_Controller(QMainWindow):
|
||||
fn.append(str(func.name, "utf-8"))
|
||||
except:
|
||||
pass
|
||||
if self.json["high_sensitive"]:
|
||||
return self.pe.predict(fn)
|
||||
elif "_CorExeMain" not in fn:
|
||||
return self.pe.predict(fn)
|
||||
QApplication.processEvents()
|
||||
return self.pe.predict(fn)
|
||||
except:
|
||||
return False, False
|
||||
|
||||
def sign_scan(self, file):
|
||||
try:
|
||||
with pefile.PE(file, fast_load=True) as pe:
|
||||
return pe.OPTIONAL_HEADER.DATA_DIRECTORY[pefile.DIRECTORY_ENTRY["IMAGE_DIRECTORY_ENTRY_SECURITY"]].VirtualAddress == 0
|
||||
except:
|
||||
return True
|
||||
|
||||
def rule_scan(self, file):
|
||||
try:
|
||||
with open(file, "rb") as f:
|
||||
data = f.read()
|
||||
for name, rules in self.compiled_rules.items():
|
||||
QApplication.processEvents()
|
||||
if rules.match(data=data):
|
||||
return True
|
||||
return False
|
||||
except:
|
||||
return False
|
||||
|
||||
def proc_scan(self, p):
|
||||
try:
|
||||
for entry in psutil.Process(p.pid).memory_maps():
|
||||
for entry in p.memory_maps():
|
||||
file = entry.path.replace("\\", "/")
|
||||
if ":/Windows" not in file and ":/Program" not in file:
|
||||
if self.api_scan(file) or self.pe_scan(file):
|
||||
if self.start_scan(file):
|
||||
return True
|
||||
return False
|
||||
except:
|
||||
@@ -1027,9 +1059,7 @@ class MainWindow_Controller(QMainWindow):
|
||||
for i in Permission:
|
||||
try:
|
||||
win32api.RegDeleteValue(key,i)
|
||||
self.proc.kill()
|
||||
file = self.proc.exe().replace("\\", "/")
|
||||
self.send_notify(self.trans("惡意行為攔截: ")+file)
|
||||
self.kill_process(self.proc, "惡意行為攔截")
|
||||
except:
|
||||
pass
|
||||
win32api.RegCloseKey(key)
|
||||
@@ -1253,59 +1283,89 @@ class MainWindow_Controller(QMainWindow):
|
||||
Thread(target=self.protect_net_thread, daemon=True).start()
|
||||
|
||||
def protect_proc_thread(self):
|
||||
existing_processes = set()
|
||||
self.proc = None
|
||||
existing_process = set()
|
||||
for p in psutil.process_iter():
|
||||
existing_processes.add(p.pid)
|
||||
existing_process.add(p.pid)
|
||||
while self.proc_protect:
|
||||
time.sleep(0.01)
|
||||
new_process = set()
|
||||
for p in psutil.process_iter():
|
||||
new_process.add(p.pid)
|
||||
for pid in new_process - existing_process:
|
||||
try:
|
||||
if p.pid not in existing_processes:
|
||||
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 = 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 = " ".join(cmd[2:]).replace("\\", "/")
|
||||
self.send_notify(self.trans("惡意腳本攔截: ")+file)
|
||||
elif ":/Windows" in file and self.api_scan(cmd[-1]):
|
||||
p.kill()
|
||||
file = cmd[-1].replace("\\", "/")
|
||||
self.send_notify(self.trans("惡意軟體攔截: ")+file)
|
||||
elif ":/Windows" not in file and self.proc_scan(p):
|
||||
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()
|
||||
existing_processes.add(p.pid)
|
||||
elif not psutil.pid_exists(p.pid):
|
||||
existing_processes.remove(p.pid)
|
||||
p = psutil.Process(pid)
|
||||
self.handle_new_process(p)
|
||||
except:
|
||||
pass
|
||||
existing_process = new_process
|
||||
|
||||
def handle_new_process(self, p):
|
||||
try:
|
||||
name, file, cmd = p.name(), p.exe().replace("\\", "/"), p.cmdline()
|
||||
if file != self.pyas and file not in self.whitelist:
|
||||
self.lock_process(p, True)
|
||||
if "powershell" in name and self.start_scan(cmd[-1].split("'")[-2]):
|
||||
self.kill_process(p, "惡意腳本攔截")
|
||||
elif "cmd.exe" in name and self.start_scan(" ".join(cmd[2:])):
|
||||
self.kill_process(p, "惡意腳本攔截")
|
||||
elif ":/Windows" in file and self.start_scan(cmd[-1]):
|
||||
self.kill_process(p, "惡意軟體攔截")
|
||||
elif ":/Windows" not in file and self.proc_scan(p):
|
||||
self.kill_process(p, "惡意軟體攔截")
|
||||
elif ":/Windows" not in file and self.sign_scan(file):
|
||||
self.proc = p
|
||||
self.lock_process(p, False)
|
||||
gc.collect()
|
||||
except:
|
||||
self.lock_process(p, False)
|
||||
|
||||
def lock_process(self, p, lock):
|
||||
try:
|
||||
if lock:
|
||||
p.suspend()
|
||||
else:
|
||||
p.resume()
|
||||
except:
|
||||
pass
|
||||
|
||||
def kill_process(self, p, info):
|
||||
try:
|
||||
if p.is_running():
|
||||
file = p.exe().replace("\\", "/")
|
||||
self.send_notify(self.trans(f"{info}: ")+file)
|
||||
for child in p.children(recursive=True):
|
||||
child.kill()
|
||||
p.kill()
|
||||
self.proc = None
|
||||
except:
|
||||
pass
|
||||
|
||||
def protect_file_thread(self):
|
||||
hDir = win32file.CreateFile("C:/",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_counts = 0
|
||||
while self.file_protect:
|
||||
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:/{file}").replace("\\", "/")
|
||||
ftype = str(f".{fpath.split('.')[-1]}").lower()
|
||||
if action == 2 and ":/Users" in fpath and "/AppData/" not in fpath:
|
||||
if ftype in alist:
|
||||
self.proc.kill()
|
||||
file = self.proc.exe().replace("\\", "/")
|
||||
self.send_notify(self.trans("勒索行為攔截: ")+file)
|
||||
elif action == 3 and os.path.getsize(fpath) <= 20971520 and ftype in slist:
|
||||
if ":/Users" in fpath or ":/Windows" not in fpath:
|
||||
if self.api_scan(fpath) or self.pe_scan(fpath):
|
||||
if self.ransom_counts >= 3 and self.proc:
|
||||
self.ransom_counts = 0
|
||||
self.kill_process(self.proc, "勒索行為攔截")
|
||||
elif ":/Windows" in fpath and "/Temp/" not in fpath:
|
||||
if action == 2 and ftype in alist:
|
||||
self.ransom_counts += 1
|
||||
elif action == 4 and ftype in alist:
|
||||
self.ransom_counts += 1
|
||||
elif ":/Users" in fpath and "/AppData/" not in fpath:
|
||||
if action == 2 and ftype in alist:
|
||||
self.ransom_counts += 1
|
||||
elif action == 4 and ftype in alist:
|
||||
self.ransom_counts += 1
|
||||
elif action == 3 and ftype in slist and os.path.getsize(fpath) <= 52428800:
|
||||
if self.sign_scan(file) and self.start_scan(fpath):
|
||||
os.remove(fpath)
|
||||
self.send_notify(self.trans("惡意軟體刪除: ")+fpath)
|
||||
gc.collect()
|
||||
except:
|
||||
pass
|
||||
|
||||
@@ -1315,17 +1375,13 @@ class MainWindow_Controller(QMainWindow):
|
||||
time.sleep(0.2)
|
||||
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)
|
||||
self.kill_process(self.proc, "惡意行為攔截")
|
||||
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)
|
||||
self.kill_process(self.proc, "惡意行為攔截")
|
||||
except:
|
||||
pass
|
||||
self.kill_process(self.proc, "惡意行為攔截")
|
||||
|
||||
def protect_reg_thread(self):
|
||||
while self.reg_protect:
|
||||
@@ -1344,11 +1400,9 @@ class MainWindow_Controller(QMainWindow):
|
||||
time.sleep(0.2)
|
||||
local = socket.gethostbyname(socket.gethostname())
|
||||
for conn in self.proc.connections():
|
||||
file = self.proc.exe().replace("\\", "/")
|
||||
if ":/Windows" not in file and ":/Program" not in file:
|
||||
if conn.laddr.ip == local:
|
||||
self.proc.kill()
|
||||
self.send_notify(self.trans("網路通訊攔截: ")+file)
|
||||
self.kill_process(self.proc, "網路通訊攔截")
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
import json, hashlib
|
||||
|
||||
class ListCompressor:
|
||||
def __init__(self):
|
||||
self.model = {}
|
||||
|
||||
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, label, data):
|
||||
if label not in self.model:
|
||||
self.model[label] = []
|
||||
for lst in data:
|
||||
self.model[label].append(hashlib.md5(''.join(map(str, lst)).encode()).hexdigest()[:8])
|
||||
|
||||
def predict(self, new_list):
|
||||
for label, items in self.model.items():
|
||||
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]
|
||||
@@ -0,0 +1,84 @@
|
||||
import time, json, hashlib, numpy
|
||||
from collections import Counter
|
||||
|
||||
class ListSimHash:
|
||||
def __init__(self):
|
||||
self.model = {}
|
||||
|
||||
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 get_model(self, label):
|
||||
return self.model[label]
|
||||
|
||||
def train_model(self, label, data):
|
||||
start = time.time()
|
||||
print(f"Convert {label}")
|
||||
if label not in self.model:
|
||||
self.model[label] = []
|
||||
for i, x in enumerate(data, 1):
|
||||
self.model[label].append(self.build_text(x))
|
||||
used = "{0:.2f}".format(time.time()-start)
|
||||
prefix, suffix = f'{i}/{len(data)}:', f'{used}s'
|
||||
self.progress_bar(i, len(data), prefix, suffix)
|
||||
|
||||
def build_text(self, content):
|
||||
sums, batch, count = [], [], 0
|
||||
features = dict(Counter(sorted(content)))
|
||||
for f, w in features.items():
|
||||
count += w
|
||||
batch.append(hashlib.sha256(json.dumps(f).encode('utf-8')).digest() * w)
|
||||
if len(batch) >= 10000:
|
||||
sums.append(self.sum_hashes(batch))
|
||||
batch = []
|
||||
if batch:
|
||||
sums.append(self.sum_hashes(batch))
|
||||
combined_sums = numpy.sum(sums, 0)
|
||||
v = numpy.packbits(combined_sums > count / 2).tobytes()
|
||||
return int.from_bytes(v, 'big')
|
||||
|
||||
def sum_hashes(self, digests):
|
||||
bitarray = numpy.unpackbits(numpy.frombuffer(b''.join(digests), dtype='>B'))
|
||||
return numpy.sum(numpy.reshape(bitarray, (-1, 256)), 0)
|
||||
|
||||
def progress_bar(self, items, total, prefix='', suffix='', length=50, fill='█'):
|
||||
percent = min(100.0, max(0.0, 100 * (items / float(total))))
|
||||
end_char = '\n' if percent >= 100 else '\r'
|
||||
percent_string = "{0:.2f}".format(percent)
|
||||
filled_length = int(length * items // total)
|
||||
bar = fill * filled_length + ' ' * (length - filled_length)
|
||||
print(f'\r{prefix: <15} |{bar}| {percent_string}% {suffix}', end=end_char)
|
||||
|
||||
def predict_all(self, query):
|
||||
label_similarities = {}
|
||||
query_hash = self.build_text(query)
|
||||
for label in self.model:
|
||||
max_similarity = 0
|
||||
for data_point in self.model[label]:
|
||||
similarity = self.similar(data_point, query_hash)
|
||||
if similarity > max_similarity:
|
||||
max_similarity = similarity
|
||||
label_similarities[label] = max_similarity
|
||||
return label_similarities
|
||||
|
||||
def predict(self, query):
|
||||
max_similarity, max_label = 0, None
|
||||
query_hash = self.build_text(query)
|
||||
for label in self.model:
|
||||
for data_point in self.model[label]:
|
||||
similarity = self.similar(data_point, query_hash)
|
||||
if similarity > max_similarity:
|
||||
max_similarity, max_label = similarity, label
|
||||
return max_label, max_similarity
|
||||
|
||||
def similar(self, x, y):
|
||||
hamming_distance = bin(x ^ y).count('1')
|
||||
return 1 - hamming_distance / 256
|
||||
@@ -1 +0,0 @@
|
||||
{"2024-02-11 11:48:42": ["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
|
||||
+8
-7
@@ -4,7 +4,7 @@ translate_dict = {
|
||||
"軟體":"软件","檔案":"文件","確定":"确认","設定":"设置","關於":"关于",
|
||||
"錯誤":"错误","實時":"实时","發現":"发现","關閉":"关闭","裝置":"设备",
|
||||
"總數":"总数","註冊":"注册","圖標":"图标","路徑":"路径","網路":"网络",
|
||||
"位元":"字节","彈窗":"弹窗","靈敏":"敏感","誤報":"误报","複製":"复制",
|
||||
"位元":"字节","彈窗":"弹窗","靈敏":"敏感","複製":"复制","誤":"误","報":"报",
|
||||
"訊":"讯","項":"项","掃":"扫","試":"试","黃":"黄","嗎":"吗","防":"保",
|
||||
"鑰":"钥","當":"当","後":"后","護":"护","導":"导","區":"区","復":"复",
|
||||
"攔":"拦","請":"请","統":"统","刪":"删","進":"进","個":"个","選":"选",
|
||||
@@ -15,18 +15,18 @@ translate_dict = {
|
||||
"詢":"询","製":"制","員":"员","許":"许","條":"条","藍":"蓝","紅":"红",
|
||||
"綠":"绿","態":"态","務":"务","連":"连","檢":"检","測":"测","關":"关",
|
||||
"強":"强","驅":"驱","為":"为","腳":"脚","增":"增","單":"单","開":"开",
|
||||
"惡":"恶","據":"据","庫":"库","經":"经","敗":"败"},
|
||||
"惡":"恶","據":"据","庫":"库","經":"经","敗":"败","謝":"谢","別":"别"},
|
||||
"en_US": {"已開啟":"On","已關閉":"Off","已开启":"On","已关闭":"Off",",":", ",
|
||||
"立即刪除":"Delete Now","安全模式":"Safe Mode","官方網站":"Website",
|
||||
"立即刪除":"Delete Now","安全模式":"Safe Mode","官方網站":"Website ",
|
||||
"惡意檔案":"Virus ","惡意軟體":"Malware ","勒索行為":"Ransom ",
|
||||
"惡意腳本":"Script ","惡意行為":"Behavior ","可疑軟體":"Suspicious ",
|
||||
"許可條款":"License Terms","惡意":"Malicious","可疑":"Suspicious",
|
||||
"許可條款":"License Terms ","惡意":"Malicious","可疑":"Suspicious",
|
||||
"啟用":"Enable ","禁用":"Disable ","正在初始化中":"Initializing ",
|
||||
"正在掃描":"Scanning ","正在刪除":"Deleting ","最小化到":"Minimize To ",
|
||||
"確定要":"Sure Want To ","靈敏度":"Sensitivity ","更新":"Update ",
|
||||
"白色主題":"White","黃色主題":"Yellow","紅色主題":"Red","語言":"Language ",
|
||||
"藍色主題":"Blue","綠色主題":"Green","自定主題":"Custom","最新":"Latest ",
|
||||
"測試人員":"Testers","版本資訊":"Information","通訊":"Communication ",
|
||||
"特別感謝":"Contributors ","版本資訊":"Information","通訊":"Communication ",
|
||||
"註冊表":"Registry ","退出":"Quit ","檔案":"File ","當前":"Currently ",
|
||||
"狀態":"State ","掃描":"Scan ","工具":"Tools ","防護":"Protect ",
|
||||
"失敗":"Failed ","請":"Please ","路徑":"Path ","方式":"Method ",
|
||||
@@ -47,8 +47,9 @@ translate_dict = {
|
||||
"增加到":"Add File To ","白名單":"White List ","軟體":"Software ",
|
||||
"增加":"Add","移除":"Delete","項目":"Items ","生成":"Create ","稱":"",
|
||||
"複製":"Copy ","開啟":"Open ","此":"This ","並":"And ","全盤":"Full ",
|
||||
"已經是":"Already ","數據庫":"Database ","誤報":"False Positive ",
|
||||
"已經在":"Already ","數據庫":"Database ","誤報":"False Positive ",
|
||||
"高":"High ","新":"New ","和":"And ","可能會":"Possible ","會":"Can ",
|
||||
"日誌":"Log","已":"Has ","彈窗":"Window ","要":"To ","驅動":"Drive ",
|
||||
"的":"","顯示":"","個":"","嗎":"","中":"","了":"","行":"","立即":"",
|
||||
"密鑰":"Key ","檢測":"Detect ","製作":"Make"," ":" "}}
|
||||
"密鑰":"Key ","檢測":"Detect ","製作":"Maker ","運行":"Running",
|
||||
"自動":"Auto ","上報":"Report ","分析":"Analysis "," ":" "}}
|
||||
+2
-1
@@ -1,7 +1,8 @@
|
||||
import pyinstaller_versionfile
|
||||
|
||||
pyinstaller_versionfile.create_versionfile(
|
||||
output_file="versionfile.txt",
|
||||
version='3.0.3',
|
||||
version='3.1.2',
|
||||
company_name="PYAS Security",
|
||||
file_description="Python Antivirus Software",
|
||||
internal_name="PYAS",
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
# PYAS (Python Antivirus Software)
|
||||
|
||||

|
||||

|
||||
|
||||
## Readme Language
|
||||
|
||||
[繁體中文](https://github.com/87owo/PYAS/blob/main/README_zh_TW.md) ,
|
||||
[简体中文](https://github.com/87owo/PYAS/blob/main/README_zh_CN.md)
|
||||
|
||||
## 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_Engine.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.* -> Virus Database (the virus database must be placed in the same directory)
|
||||
PYAS_Model.* -> 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 +25,29 @@ PYAS_Language.py -> Translate Dict (Traditional Chinese, Simplified Chinese, Eng
|
||||
|
||||
PYAS_Version.py -> Pyinstaller Info (file information, version information, original name, etc.)
|
||||
|
||||
## Dir Information
|
||||
|
||||
```
|
||||
PYAS/
|
||||
├── Driver/
|
||||
│ ├── PYAS_Driver.sys
|
||||
│ └── ...
|
||||
│
|
||||
├── Model/
|
||||
│ ├── PYAS_Model.json
|
||||
│ ├── PYAS_Model.txt
|
||||
│ └── ...
|
||||
│
|
||||
├── Rules/
|
||||
│ ├── Yara_Rules.yar
|
||||
│ ├── Compile_Rules.yrc
|
||||
│ └── ...
|
||||
│
|
||||
├── PYAS.py
|
||||
├── PYAS_Engine.py
|
||||
└── ...
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
Use pip install requirements to install import module
|
||||
@@ -33,35 +61,6 @@ 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
|
||||
@@ -98,23 +97,25 @@ Show the new process name, file path, cmd line, pid
|
||||
import psutil, time
|
||||
|
||||
def proc_detect():
|
||||
existing_processes = set()
|
||||
existing_process = set()
|
||||
for p in psutil.process_iter():
|
||||
if p.pid not in existing_processes:
|
||||
existing_processes.add(p.pid)
|
||||
existing_process.add(p.pid)
|
||||
while True:
|
||||
time.sleep(0.1)
|
||||
new_process = set()
|
||||
for p in psutil.process_iter():
|
||||
new_process.add(p.pid)
|
||||
for pid in new_process - existing_process:
|
||||
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
|
||||
p = psutil.Process(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 Exception as e:
|
||||
print(f"Error: {e}")
|
||||
existing_process = new_process
|
||||
|
||||
proc_detect()
|
||||
```
|
||||
@@ -154,17 +155,22 @@ https://pyantivirus.wixsite.com/pyas
|
||||
|
||||
https://github.com/87owo/PYAS
|
||||
|
||||
## PYAS Driver
|
||||
|
||||
https://github.com/0sha0/PYAS_Protection
|
||||
|
||||
## MIT license
|
||||
|
||||
https://github.com/87owo/PYAS/blob/main/LICENSE.md
|
||||
|
||||
## Support System
|
||||
|
||||
Windows 8.1, 10, 11 (64-bit), Ram 1GB, Rom 1GB or higher
|
||||
Windows 8.1, 10, 11 (64-bit), Ram 500MB, Rom 200MB or higher
|
||||
|
||||
Other systems may experience software malfunctions or crash
|
||||
|
||||
## Special Thanks
|
||||
360, Wix, VirusShare, mtkiao129, AV-T Team of LisectGroup
|
||||
|
||||
Wix, 0sha0, mtkiao129, AV-T Team of LisectGroup
|
||||
|
||||
Copyright© 2020~2024 PYAS Security By 87owo
|
||||
+171
@@ -0,0 +1,171 @@
|
||||
# PYAS (Python 杀毒软件)
|
||||
|
||||

|
||||
|
||||
## 文件信息
|
||||
|
||||
PYAS.py -> PYAS主程式(包括动画、扫描、保护功能等)
|
||||
|
||||
PYAS_Engine.py -> 转换资料库(用于相互转换资料库字典和清单)
|
||||
|
||||
PYAS_Extension.py -> 副文件名(包括扫描文件副文件名和常用副文件名)
|
||||
|
||||
PYAS_Model.* -> 病毒库(病毒库必须放在同一目录下)
|
||||
|
||||
PYAS_Interface.py -> PyQt5界面(由QT设计师设计,必须与主程式相符)
|
||||
|
||||
PYAS_Resource.py -> PyQt5资源(状态图片、图示包、按钮图示等)
|
||||
|
||||
PYAS_Language.py -> 翻译字典(繁体中文、简体中文、英文)
|
||||
|
||||
PYAS_Version.py -> Pyinstaller资讯(文件资讯、版本资讯、原名等)
|
||||
|
||||
## 目录信息
|
||||
|
||||
```
|
||||
PYAS/
|
||||
├── Driver/
|
||||
│ ├── PYAS_Driver.sys
|
||||
│ └── ...
|
||||
│
|
||||
├── Model/
|
||||
│ ├── PYAS_Model.json
|
||||
│ ├── PYAS_Model.txt
|
||||
│ └── ...
|
||||
│
|
||||
├── Rules/
|
||||
│ ├── Yara_Rules.yar
|
||||
│ ├── Compile_Rules.yrc
|
||||
│ └── ...
|
||||
│
|
||||
├── PYAS.py
|
||||
├── PYAS_Engine.py
|
||||
└── ...
|
||||
```
|
||||
|
||||
## 安装要求
|
||||
|
||||
使用 pip install requirements 来安装需要的模组
|
||||
|
||||
```
|
||||
psutil==5.9.5
|
||||
pefile==2023.2.7
|
||||
requests==2.31.0
|
||||
pyperclip==1.8.2
|
||||
pywin32==306
|
||||
PyQt5==5.15.9
|
||||
```
|
||||
|
||||
## 文件扫描
|
||||
|
||||
取得pefile文件函数导入表进行扫描
|
||||
|
||||
```
|
||||
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)
|
||||
```
|
||||
|
||||
## 进程监控
|
||||
|
||||
显示新进程名称、文件路径、cmd 行、pid
|
||||
|
||||
```
|
||||
import psutil, time
|
||||
|
||||
def proc_detect():
|
||||
existing_process = set()
|
||||
for p in psutil.process_iter():
|
||||
existing_process.add(p.pid)
|
||||
while True:
|
||||
time.sleep(0.1)
|
||||
new_process = set()
|
||||
for p in psutil.process_iter():
|
||||
new_process.add(p.pid)
|
||||
for pid in new_process - existing_process:
|
||||
try:
|
||||
p = psutil.Process(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 Exception as e:
|
||||
print(f"Error: {e}")
|
||||
existing_process = new_process
|
||||
|
||||
proc_detect()
|
||||
```
|
||||
|
||||
## 文件监控
|
||||
|
||||
监控指定路径下的文件变化
|
||||
|
||||
```
|
||||
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")
|
||||
```
|
||||
|
||||
## 官方网页
|
||||
|
||||
https://pyantivirus.wixsite.com/pyas
|
||||
|
||||
https://github.com/87owo/PYAS
|
||||
|
||||
## 开源协议
|
||||
|
||||
https://github.com/87owo/PYAS/blob/main/LICENSE.md
|
||||
|
||||
## 驱动程序
|
||||
|
||||
https://github.com/0sha0/PYAS_Protection
|
||||
|
||||
## 支援系统
|
||||
|
||||
Windows 8.1, 10, 11 (64-bit), 内存 500MB, 存储 200MB 或更高
|
||||
|
||||
其他系统或版本可能会遇到软体功能故障或程序崩溃
|
||||
|
||||
## 特别感谢
|
||||
|
||||
360, Wix, VirusShare, mtkiao129, AV-T Team of LisectGroup
|
||||
|
||||
Copyright© 2020~2024 PYAS Security By 87owo
|
||||
+169
@@ -0,0 +1,169 @@
|
||||
# PYAS (Python 防毒軟體)
|
||||
|
||||

|
||||
|
||||
## 檔案資訊
|
||||
|
||||
PYAS.py -> PYAS主程式(包括動畫、掃描、保護功能等)
|
||||
|
||||
PYAS_Engine.py -> 轉換資料庫(用於相互轉換資料庫字典和清單)
|
||||
|
||||
PYAS_Extension.py -> 檔案副檔名(包括掃描檔案副檔名和常用檔案副檔名)
|
||||
|
||||
PYAS_Model.* -> 病毒庫(病毒庫必須放在同一目錄下)
|
||||
|
||||
PYAS_Interface.py -> PyQt5 Interface(由QT設計師設計,必須與主程式相符)
|
||||
|
||||
PYAS_Resource.py -> PyQt5資源(狀態圖片、圖示包、按鈕圖示等)
|
||||
|
||||
PYAS_Language.py -> 翻譯字典(繁體中文、簡體中文、英文)
|
||||
|
||||
PYAS_Version.py -> Pyinstaller Info(檔案資訊、版本資訊、原名等)
|
||||
|
||||
## 目錄資訊
|
||||
|
||||
```
|
||||
PYAS/
|
||||
├── Driver/
|
||||
│ ├── PYAS_Driver.sys
|
||||
│ └── ...
|
||||
│
|
||||
├── Model/
|
||||
│ ├── PYAS_Model.json
|
||||
│ ├── PYAS_Model.txt
|
||||
│ └── ...
|
||||
│
|
||||
├── Rules/
|
||||
│ ├── Yara_Rules.yar
|
||||
│ ├── Compile_Rules.yrc
|
||||
│ └── ...
|
||||
│
|
||||
├── PYAS.py
|
||||
├── PYAS_Engine.py
|
||||
└── ...
|
||||
```
|
||||
|
||||
## 安裝要求
|
||||
|
||||
使用 pip install requirements 來安裝需要的模組
|
||||
|
||||
```
|
||||
psutil==5.9.5
|
||||
pefile==2023.2.7
|
||||
requests==2.31.0
|
||||
pyperclip==1.8.2
|
||||
pywin32==306
|
||||
PyQt5==5.15.9
|
||||
```
|
||||
|
||||
## 檔案掃描
|
||||
|
||||
取得pefile檔案函數導入表進行掃描
|
||||
|
||||
```
|
||||
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)
|
||||
```
|
||||
|
||||
## 進程監控
|
||||
|
||||
顯示新進程名稱、檔案路徑、cmd 行、pid
|
||||
```
|
||||
import psutil, time
|
||||
|
||||
def proc_detect():
|
||||
existing_process = set()
|
||||
for p in psutil.process_iter():
|
||||
existing_process.add(p.pid)
|
||||
while True:
|
||||
time.sleep(0.1)
|
||||
new_process = set()
|
||||
for p in psutil.process_iter():
|
||||
new_process.add(p.pid)
|
||||
for pid in new_process - existing_process:
|
||||
try:
|
||||
p = psutil.Process(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 Exception as e:
|
||||
print(f"Error: {e}")
|
||||
existing_process = new_process
|
||||
|
||||
proc_detect()
|
||||
```
|
||||
|
||||
## 檔案監控
|
||||
|
||||
監控指定路徑下的檔案變化
|
||||
```
|
||||
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")
|
||||
```
|
||||
|
||||
## 官方網頁
|
||||
|
||||
https://pyantivirus.wixsite.com/pyas
|
||||
|
||||
https://github.com/87owo/PYAS
|
||||
|
||||
## 開源協議
|
||||
|
||||
https://github.com/87owo/PYAS/blob/main/LICENSE.md
|
||||
|
||||
## 驅動程式
|
||||
|
||||
https://github.com/0sha0/PYAS_Protection
|
||||
|
||||
## 支援系統
|
||||
|
||||
Windows 8.1, 10, 11 (64-bit),記憶體 500MB, 磁碟容量 200MB 或更高
|
||||
|
||||
其他系統或版本可能會遇到軟體功能故障或程序崩潰
|
||||
|
||||
## 特別感謝
|
||||
|
||||
Wix, 0sha0, mtkiao129, AV-T Team of LisectGroup
|
||||
|
||||
Copyright© 2020~2024 PYAS Security By 87owo
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user