Compare commits

...
17 Commits
Author SHA1 Message Date
PYDT 960b1d53f7 Add files via upload 2025-08-09 19:32:57 +08:00
PYDT f09dee6a52 Add files via upload 2025-08-09 19:32:08 +08:00
PYDT 301e1e56d1 Delete Plugins/Filter/PYAS_Driver.sys 2025-08-09 19:31:04 +08:00
PYDT 6b2dbd382d Add files via upload 2025-08-08 23:15:27 +08:00
PYDT e6f526c766 Update README_zh_CN.md 2025-08-06 01:09:35 +08:00
PYDT 06cca669a0 Update README_zh_CN.md 2025-08-06 01:09:18 +08:00
PYDT f89ccea208 Update README_zh_TW.md 2025-08-06 01:07:35 +08:00
PYDT 0728f2d995 Update README.md 2025-08-06 01:06:20 +08:00
PYDT c7a7a61c9a Delete PYAS_Suffixes.py 2025-08-06 00:43:52 +08:00
PYDT aca11e66a8 Delete PYAS_Language.py 2025-08-06 00:43:36 +08:00
PYDT 46c7a001c2 Delete Extens directory 2025-08-06 00:43:07 +08:00
PYDT d6aa3c50a3 Add files via upload 2025-08-06 00:42:43 +08:00
PYDT caaadc5cf3 Add files via upload 2025-08-06 00:41:52 +08:00
PYDT 14d703903c Delete Driver directory 2025-08-06 00:41:07 +08:00
PYDT 76fa14ab01 Add files via upload 2025-08-06 00:40:11 +08:00
PYDT d1afe255e5 Add files via upload 2025-05-06 17:28:11 +08:00
PYDT 8f27739331 Add files via upload 2025-04-25 17:09:33 +08:00
21 changed files with 17679 additions and 14163 deletions

No files matched your search

-34
View File
@@ -1,34 +0,0 @@
@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
View File
Whitespace-only changes.
Binary file not shown.
-25
View File
@@ -1,25 +0,0 @@
@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.
Binary file not shown.
Binary file not shown.
-117
View File
@@ -1,117 +0,0 @@
Windows Registry Editor Version 5.00
; Repair system restrictions
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\MMC]
; NoControlPanel
"NoControlPanel"=dword:00000000
; NoDrives
"NoDrives"=dword:00000000
; NoFileMenu
"NoFileMenu"=dword:00000000
; NoFind
"NoFind"=dword:00000000
; NoRealMode
"NoRealMode"=dword:00000000
; NoRecentDocsMenu
"NoRecentDocsMenu"=dword:00000000
; NoSetFolders
"NoSetFolders"=dword:00000000
; NoSetFolderOptions
"NoSetFolderOptions"=dword:00000000
; NoViewOnDrive
"NoViewOnDrive"=dword:00000000
; NoClose
"NoClose"=dword:00000000
; NoRun
"NoRun"=dword:00000000
; NoDesktop
"NoDesktop"=dword:00000000
; NoLogOff
"NoLogOff"=dword:00000000
; NoFolderOptions
"NoFolderOptions"=dword:00000000
; RestrictRun
"RestrictRun"=dword:00000000
; NoViewContextMenu
"NoViewContexMenu"=dword:00000000
; HideClock
"HideClock"=dword:00000000
; NoStartMenuMorePrograms
"NoStartMenuMorePrograms"=dword:00000000
; NoStartMenuMyGames
"NoStartMenuMyGames"=dword:00000000
; NoStartMenuMyMusic
"NoStartMenuMyMusic"=dword:00000000
; DisableCMD
"DisableCMD"=dword:00000000
; NoWinKeys
"NoWinKeys"=dword:00000000
; StartMenuLogOff
"StartMenuLogOff"=dword:00000000
; NoSimpleNetlDList
"NoSimpleNetlDList"=dword:00000000
; NoLowDiskSpaceChecks
"NoLowDiskSpaceChecks"=dword:00000000
; DisableLockWorkstation
"DisableLockWorkstation"=dword:00000000
; Restrict_Run
"Restrict_Run"=dword:00000000
; DisableTaskMgr
"DisableTaskMgr"=dword:00000000
; DisableRegistryTools
"DisableRegistryTools"=dword:00000000
; DisableChangePassword
"DisableChangePassword"=dword:00000000
; Wallpaper
"Wallpaper"=dword:00000000
; NoComponents
"NoComponents"=dword:00000000
; NoAddingComponents
"NoAddingComponents"=dword:00000000
; NoStartMenuPinnedList
"NoStartMenuPinnedList"=dword:00000000
; NoActiveDesktop
"NoActiveDesktop"=dword:00000000
; NoSetActiveDesktop
"NoSetActiveDesktop"=dword:00000000
; NoActiveDesktopChanges
"NoActiveDesktopChanges"=dword:00000000
; NoChangeStartMenu
"NoChangeStartMenu"=dword:00000000
; NoFavoritesMenu
"NoFavoritesMenu"=dword:00000000
; NoRecentDocsHistory
"NoRecentDocsHistory"=dword:00000000
; NoSetTaskbar
"NoSetTaskbar"=dword:00000000
; NoSMHelp
"NoSMHelp"=dword:00000000
; NoTrayContextMenu
"NoTrayContextMenu"=dword:00000000
; NoViewContextMenu
"NoViewContextMenu"=dword:00000000
; NoManageMyComputerVerb
"NoManageMyComputerVerb"=dword:00000000
; NoWindowsUpdate
"NoWindowsUpdate"=dword:00000000
; ClearRecentDocsOnExit
"ClearRecentDocsOnExit"=dword:00000000
; NoStartMenuNetworkPlaces
"NoStartMenuNetworkPlaces"=dword:00000000
; Repair Image File Execution Options
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options]
; (Delete all subkeys here if necessary)
; Repair executable file icon
[HKEY_CLASSES_ROOT\exefile\DefaultIcon]
@="%1"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\exefile\DefaultIcon]
@="%1"
; Repair executable file type
[HKEY_CLASSES_ROOT\.exe]
@="exefile"
[HKEY_CLASSES_ROOT\exefile\shell\open\command]
@="\"%1\" %*"
-1
View File
@@ -1 +0,0 @@
sfc /scannow
-1
View File
@@ -1 +0,0 @@
None
+1434 -1611
View File
File diff suppressed because it is too large. Load diff
+74 -17
View File
@@ -1,10 +1,10 @@
translate_dict = {
"zh_TW": {"已开启":"已開啟","已关闭":"已關閉","On":"已開啟","Off":"已關閉"},
"zh_CN": {"已開啟":"已开启","已關閉":"已关闭","On":"已开启","Off":"已关闭",
"traditional_switch": {"开启":"開啟","关闭":"關閉","On":"開啟","Off":"關閉"},
"simplified_switch": {"開啟":"开启","關閉":"关闭","On":"开启","Off":"关闭",
"錯誤":"错误","發現":"发现","關閉":"关闭","裝置":"设备","記憶體":"内存",
"軟體":"软件","檔案":"文件","確定":"确认","設定":"设置","關於":"关于",
"總數":"总数","註冊":"注册","圖標":"图标","路徑":"路径","網路":"网络",
"位元":"字节","靈敏":"敏感","複製":"复制","開啟":"开启","資源回收桶":"资源回收桶",
"位元":"字节","靈敏":"敏感","複製":"复制","開啟":"开启", "離":"离",
"訊":"讯","項":"项","掃":"扫","試":"试","黃":"黄","嗎":"吗","防":"保",
"鑰":"钥","當":"当","後":"后","護":"护","導":"导","區":"区","復":"复",
"攔":"拦","請":"请","統":"统","刪":"删","進":"进","個":"个","選":"选",
@@ -17,20 +17,21 @@ translate_dict = {
"強":"强","驅":"驱","為":"为","腳":"脚","單":"单","開":"开","擴":"扩",
"惡":"恶","據":"据","庫":"库","經":"经","敗":"败","謝":"谢","別":"别",
"載":"载","誤":"误","報":"报","鏈":"链","竄":"窜","蹤":"踪","與":"与",
"異":"异","實":"实","時":"时","彈":"弹","窗":"窗","暫":"暂","訂":"订",},
"en_US": {"已開啟":"On","已關閉":"Off","已开启":"On","已关闭":"Off",",":", ",
"立即刪除":"Delete Now","安全模式":"Safe Mode","官方網站":"Website ",
"異":"异","實":"实","時":"时","彈":"弹","窗":"窗","暫":"暂","訂":"订",
"資":"资","產":"产","金":"密",},
"english_switch": {"開啟":"On","關閉":"Off","开启":"On","关闭":"Off",",":", ",
"立即刪除":"Delete Now","安全模式":"Safe Mode","官方網站":"Official Website ",
"腳本":"Script ","鏈式":"Chain ","記憶體":"Memory ","加載":"Load ",
"行為":"Behavior ","可疑":"Suspicious ","勒索":"Ransom ",
"許可條款":"License Terms ","惡意":"Malicious","可疑":"Suspicious",
"行為":"Behavior ","可疑":"Suspicious ","勒索":"Ransom ","主要":"Main ",
"許可條款":"License Terms ","惡意":"Malicious", "開發":"Developers ",
"啟用":"Enable ","禁用":"Disable ","正在初始化中":"Initializing ",
"正在掃描":"Scanning ","正在刪除":"Deleting ","正在追蹤":"Tracking ",
"最小化到":"Minimize To ","靈敏度":"Sensitivity ","正在檢查":"Checking ",
"確定要":"Sure Want To ","引擎靈敏度":"Sensitivity ","更新":"Update ",
"白色主題":"White","黃色主題":"Yellow","紅色主題":"Red","語言":"Language ",
"藍色主題":"Blue","綠色主題":"Green","自訂主題":"Custom","最新":"Latest ",
"藍色主題":"Blue","綠色主題":"Green","自訂主題":"Custom","黑色主題":"Black",
"特別感謝":"Contributors ","版本資訊":"Information","通訊":"Connect ",
"註冊表":"Registry ","退出":"Quit ","檔案":"File ","當前":"Currently ",
"註冊":"Registry ","退出":"Quit ","檔案":"File ","當前":"Currently ",
"狀態":"State ","掃描":"Scan ","工具":"Tools ","防護":"Protect ",
"失敗":"Failed ","請":"Please ","路徑":"Path ","方式":"Method ",
"需要":"Need ","病毒":"Virus ","選擇":"Select ","返回":"Back",
@@ -40,20 +41,21 @@ translate_dict = {
"裝置":"Device ","發現":"Found ","成功":"Success ","清理":"Cleanup ",
"確定":"OK","執行":"Execute ","警告":"Warning ","使用":"Use ",
"網路":"Network ","變更":"Change ","總數":"Total","結束":"End ",
"選項":"Options ","監控":"Monitor ","連接":"Connect ","可以":"To ",
"選項":"Options ","監控":"Monitor ","連接":"Connect ","可以":"Can ",
"進程":"Process ","攔截":"Block ","引導":"Boot ","刪除":"Delete ",
"分區":"Partition ","設定":"Setting ","關於":"About","模式":"Mode ",
"提高":"Improve ","安全":"Security ","顯色":"Color ","主題":"Themes ",
"風險":"Risk ","介面":"GUI ","核心":"Core ","服務":"Services ",
"提高":"Improve ","安全":"Security ","顯色":"Color ","顏色":"Color ",
"主題":"Theme ", "回收":"Collect ", "無用":"Useless ","導入":"Import ",
"風險":"Risk ","介面":"UI ","核心":"Core ","服務":"Services ",
"管理":"Manage","所有":"All ","您":"You ","取消":"Cancel ","未":"Not ",
"垃圾":"Junk ","位元":"byte ","本機":"Computer ","停止":"Stop ",
"到":"To ","白名單":"White List ","軟體":"Software ","正在":"",
"增加":"Add ","移除":"Delete ","項目":"Items ","生成":"Create ","稱":"",
"複製":"Copy ","開啟":"Open ","此":"This ","並":"And ","全盤":"Full ",
"已經在":"Already ","數據庫":"Database ","誤報":"False Positive ",
"複製":"Copy ","此":"This ","並":"And ","全盤":"Full ","最新":"Latest ",
"已存在":"Already ","數據庫":"Database ","誤報":"False Positive ",
"高":"High ","新":"New ","和":"And ","可能會":"Possible ","會":"Can ",
"日誌":"Log","已":"Has ","彈窗":"Window ","要":"To ","驅動":"Driver ",
"的":"","顯示":"","個":"","嗎":"","中":"","了":"","行":"","立即":"",
"的":"","顯示":"","個":"","嗎":"","了":"","行":"","立即":"",
"密鑰":"Key ","檢測":"Detect ","製作":"Maker ","運行":"Running",
"擴展":"Extension ","套件":"Kit ","自動":"Auto ","上報":"Report ",
"分析":"Analysis ","自身":"Self ","其他":"Other ","配置":"Config ",
@@ -63,4 +65,59 @@ translate_dict = {
"與":"With ","當":"When ","功能":"Function ","異常":"Abnormal ",
"重置":"Reset ","窗口":"Window ","暫存":"Temp ","自訂":"Custom ",
"不支持":"Not Support ","共":"Total ","秒":"Seconds ","耗時":"Takes ",
"時":""," ":" "}}
"沙箱":"Sandbox ", "虛擬":"Virtual ", "隔離":"Quarantine ", "時":"",
"建立":"Create ","環境":"Environment ","沙箱":"Sandbox ","化":"", "表":"",
"達":"Reached ", "上限":"Limit ", "區":"", "金鑰":"Key ", "產品":"Product ",
"前往":"Go ","檢查":"Check ","可用":"Available "," ":" "},
"white_switch": {
"_white": "_black",},
"red_switch": {
"235, 235, 235": "255, 235, 235",
"245, 245, 245": "255, 225, 225",
"255, 255, 255": "255, 245, 245",
"240, 240, 240": "255, 220, 220",
"250, 250, 250": "255, 210, 210",
"220, 255, 220": "255, 220, 220",
"210, 255, 210": "255, 210, 210",
"_white": "_black"
},
"yellow_switch": {
"235, 235, 235": "255, 255, 235",
"245, 245, 245": "255, 255, 225",
"255, 255, 255": "255, 255, 245",
"240, 240, 240": "255, 255, 220",
"250, 250, 250": "255, 255, 210",
"220, 255, 220": "255, 255, 220",
"210, 255, 210": "255, 255, 210",
"_white": "_black"
},
"green_switch": {
"235, 235, 235": "235, 255, 235",
"245, 245, 245": "225, 255, 225",
"255, 255, 255": "245, 255, 245",
"240, 240, 240": "220, 255, 220",
"250, 250, 250": "210, 255, 210",
"_white": "_black"
},
"blue_switch": {
"235, 235, 235": "235, 235, 255",
"245, 245, 245": "225, 225, 255",
"255, 255, 255": "245, 245, 255",
"240, 240, 240": "220, 220, 255",
"250, 250, 250": "210, 210, 255",
"220, 255, 220": "220, 220, 255",
"210, 255, 210": "210, 210, 255",
"_white": "_black"
},
"black_switch": {
"255, 255, 255": "55, 55, 55",
"245, 245, 245": "75, 75, 75",
"235, 235, 235": "65, 65, 65",
"240, 240, 240": "80, 80, 80",
"250, 250, 250": "90, 90, 90",
"220, 255, 220": "80, 80, 80",
"210, 255, 210": "90, 90, 90",
"0, 0, 0": "255, 255, 255",
"_black": "_white"
}
}
+118 -122
View File
@@ -1,154 +1,150 @@
import os, sys, time, json, yara, numpy
import chardet, pefile, onnxruntime
import os, yara, numpy, locale, pefile, onnxruntime
from PIL import Image
class YRScan:
class rule_scanner:
def __init__(self):
self.rules = {}
self.network = []
def load_rules(self, file_path):
def load_path(self, path):
for root, _, files in os.walk(path):
for file in files:
self.load_file(os.path.join(root, file))
def load_file(self, file):
ext = os.path.splitext(file)[1].lower()
try:
ftype = os.path.splitext(file_path)[-1].lower()
if ftype in [".yara", ".yar"]:
self.rules[file_path] = yara.compile(file_path)
elif ftype in [".yc", ".yrc"]:
self.rules[file_path] = yara.load(file_path)
elif ftype in [".ip", ".ips"]:
with open(file_path, "r") as f:
self.network += [l.strip() for l in f.readlines()]
if ext in ('.yara', '.yar'):
self.rules[file] = yara.compile(file)
elif ext in ('.yc', '.yrc'):
self.rules[file] = yara.load(file)
elif ext in ('.ip', '.txt'):
with open(file, "r") as f:
self.network.extend(line.strip() for line in f if line.strip())
except Exception as e:
print(e)
def yr_scan(self, file_path):
def yara_scan(self, file_path):
try:
if isinstance(file_path, str):
with open(file_path, "rb") as f:
file_path = f.read()
for name, rules in self.rules.items():
matchs_rules = rules.match(data=file_path)
if matchs_rules:
label = str(matchs_rules[0]).split("_")[0]
level = str(matchs_rules[0]).split("_")[-1]
data = open(file_path, "rb").read() if isinstance(file_path, str) else file_path
for rules in self.rules.values():
matches = rules.match(data=data)
if matches:
rule_name = str(matches[0])
label = rule_name.split("_")[0]
level = rule_name.split("_")[-1]
return f"Rules/{label}", level
return False, False
except Exception as e:
except Exception:
return False, False
class DLScan:
class model_scanner:
SHELLS = {
"0","1","2","3","4","5","6","7","8","9","cry","tvm","dec","enc","vmp","upx","aes","lzma","press","pack",
"enigma","protect","secur","asmstub","base","bss","clr_uef","cursors","transit","trs_age","engine","fio",
"fothk","h~;","icapsec","malloc_h","miniex","mssmixer","ndr64","nsys_wr","obr","wow","wow64svc","wpp_sf",
"pad","pgae","poolmi","proxy","qihoo","retpol","uedbg","tracesup","rwexec","rygs","s:@","sanontcp","segm",
"test","res","wisevec","viahwaes","orpc","nep","ace","extjmp","no_bbt","data","page","hexpthk"}
def __init__(self):
self.models = {}
self.valid_interpolations = {
"box": Image.Resampling.BOX,
"none": Image.Resampling.NEAREST,
"bilinear": Image.Resampling.BILINEAR,
"hamming": Image.Resampling.HAMMING,
"bicubic": Image.Resampling.BICUBIC,
"lanczos": Image.Resampling.LANCZOS,
"nearest": Image.Resampling.NEAREST}
self.suffix = {".com", ".exe", ".dll", ".sys", ".scr", ".bat", ".cmd", ".ps1", ".vbs", ".wsf"}
self.labels = ["Pefile/White", "Script/White", "Pefile/General", "Script/General"]
self.detect = {"Pefile/General", "Script/General"}
self.resize = (224, 224)
shell_section = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
"cry", "tvm", "dec", "enc", "vmp", "upx", "aes", "lzma", "press",
"pack", "enigma", "protect", "secur"]
unknown_section = ["asmstub", "base", "bss", "clr_uef", "cursors",
"engine", "fio", "fothk", "h~;", "icapsec", "malloc_h", "miniex",
"mssmixer", "ndr64", "nsys_wr", "obr", "wow", "wow64svc", "wpp_sf",
"pad", "pgae", "poolmi", "proxy", "qihoo", "res", "retpol", "uedbg",
"rwexec", "rygs", "s:@", "sanontcp", "segm", "test", "tracesup",
"transit", "trs_age", "wisevec"]
unimportant_section = ["viahwaes", "orpc", "nep", "ace", "extjmp",
"no_bbt", "data", "page", "hexpthk"]
self.shells = shell_section + unimportant_section + unknown_section
def load_path(self, path):
for root, _, files in os.walk(path):
for file in files:
self.load_file(os.path.join(root, file))
def load_model(self, file_path):
def load_file(self, file):
if file.lower().endswith('.onnx'):
try:
self.models[file] = onnxruntime.InferenceSession(file)
except Exception as e:
print(e)
def is_valid_suffix(self, file_path):
return os.path.splitext(file_path)[-1].lower() in self.suffix
def model_scan(self, file_path):
try:
ftype = os.path.splitext(file_path)[-1].lower()
if ftype in [".json", ".txt"]:
with open(file_path, 'r') as f:
self.class_names = json.load(f)
elif ftype in [".onnx"]:
self.models[file_path] = onnxruntime.InferenceSession(file_path)
self.labels = self.class_names['Labels']
self.detect = self.class_names['Detect']
self.values = self.class_names['Values']
self.resize = self.class_names['Resize']
self.suffix = self.class_names['Suffix']
except Exception as e:
pass
if not self.models or not self.is_valid_suffix(file_path):
return False, False
def dl_scan(self, file_path):
try:
batch_images = []
for section, file_data in self.get_type(file_path).items():
image_data = self.preprocess_image(file_data, tuple(self.resize))
image_array = numpy.asarray(image_data).astype('float32') / 255.0
if len(image_array.shape) == 2:
image_array = numpy.expand_dims(image_array, axis=-1)
batch_images.append(image_array)
batch_results = [{label: [] for label in self.labels} for _ in range(len(batch_images))]
batch_images = numpy.stack(batch_images, axis=0)
for model_name, model in self.models.items():
input_name = model.get_inputs()[0].name
predictions = model.run(None, {input_name: batch_images})[0]
for i, pre_answers in enumerate(predictions):
for k, score in enumerate(pre_answers):
batch_results[i][self.labels[k].strip()].append(score)
final_results = []
for result in batch_results:
label_percentage = {label: (sum(scores) / len(scores)) * 100
for label, scores in result.items()}
best_label, best_confidence = max(label_percentage.items(), key=lambda x: x[1])
final_results.append((best_label, int(best_confidence)))
if best_label in self.detect:
return best_label, int(best_confidence)
model = next(iter(self.models.values()))
shape = model.get_inputs()[0].shape
channels = shape[-1] if shape[-1] in (1, 3) else (shape[1] if shape[1] in (1, 3) else 1)
file_sections = self.get_type(file_path)
if not file_sections:
return False, False
batch_images = [self.preprocess_image(data, self.resize, channels) for data in file_sections.values()]
arr = numpy.stack([numpy.asarray(img).astype('float32') / 255.0 for img in batch_images])
if arr.ndim == 3:
arr = arr[..., None]
if shape[-1] in (1, 3):
model_input = arr
elif shape[1] in (1, 3):
model_input = arr.transpose(0, 3, 1, 2)
else:
return False, False
input_name = model.get_inputs()[0].name
predictions = model.run(None, {input_name: model_input})[0]
label_scores = {label: [] for label in self.labels}
for pre_answers in predictions:
for k, score in enumerate(pre_answers):
label_scores[self.labels[k]].append(score)
label_percentage = {label: (sum(scores)/len(scores))*100 for label, scores in label_scores.items() if scores}
if not label_percentage:
return False, False
best_label, best_conf = max(label_percentage.items(), key=lambda x: x[1])
if best_label in self.detect:
return best_label, int(best_conf)
return False, False
except Exception as e:
except Exception:
return False, False
def preprocess_image(self, file_data, target_size):
width, height, channels, interpolation = target_size
def preprocess_image(self, file_data, size, channels=1):
width, height = size
wah = int(numpy.ceil(numpy.sqrt(len(file_data) / channels)))
array_data = numpy.frombuffer(file_data, dtype=numpy.uint8)
expected_size = wah * wah * channels
image_array = numpy.zeros((expected_size,), dtype=numpy.uint8)
image_array[:len(file_data)] = array_data
arr = numpy.frombuffer(file_data, dtype=numpy.uint8)
img = numpy.zeros(wah*wah*channels, dtype=numpy.uint8)
img[:len(file_data)] = arr
if channels == 1:
reshape = image_array.reshape((wah, wah))
image = Image.fromarray(reshape, 'L')
elif channels == 3:
reshape = image_array.reshape((wah, wah, 3))
image = Image.fromarray(reshape, 'RGB')
if width == 0 and height == 0:
return image
i = self.valid_interpolations.get(interpolation.lower(), Image.BILINEAR)
return image.resize((width, height), i)
image = Image.fromarray(img.reshape((wah, wah)), 'L')
else:
image = Image.fromarray(img.reshape((wah, wah, channels)), 'RGB')
return image.resize((width, height), Image.Resampling.NEAREST)
def is_text_file(self, content, sample_size):
try:
raw_data = content[:sample_size]
encoding = chardet.detect(raw_data)["encoding"]
if encoding in ["ascii", "utf-8", "utf-8-sig"]:
if raw_data.decode(encoding):
return True
return False
except:
def is_text_file(self, content, sample_size=1024):
raw = content[:sample_size]
if not raw:
return False
text_char = set(range(32, 127)) | {9, 10, 13}
nontext = sum(b not in text_char for b in raw)
return nontext / len(raw) < 0.15
def get_type(self, file_path):
match_data = {}
ftype = os.path.splitext(file_path)[-1].lower()
if ftype in self.suffix:
try:
with pefile.PE(file_path, fast_load=True) as pe:
for section in pe.sections:
name = section.Name.rstrip(b'\x00').decode('latin1')
if (section.Characteristics & 0x00000020 and not
any(s in name.lower() for s in self.shells)):
print(name)
match_data[name] = section.get_data()
except:
with open(file_path, 'rb') as f:
file_content = f.read()
if self.is_text_file(file_content, 1024):
match_data[ftype] = file_content
if not self.is_valid_suffix(file_path):
return match_data
try:
with pefile.PE(file_path, fast_load=True) as pe:
sec = pe.OPTIONAL_HEADER.DATA_DIRECTORY[pefile.DIRECTORY_ENTRY['IMAGE_DIRECTORY_ENTRY_SECURITY']]
if bool(sec.VirtualAddress and sec.Size):
return {}
for section in pe.sections:
name = section.Name.rstrip(b'\x00').decode('latin1').lower()
if (section.Characteristics & 0x00000020) and name not in self.SHELLS:
match_data[name] = section.get_data()
except pefile.PEFormatError:
with open(file_path, 'rb') as f:
file_content = f.read()
if self.is_text_file(file_content):
match_data[os.path.splitext(file_path)[-1].lower()] = file_content
return match_data
+1538 -2136
View File
File diff suppressed because it is too large. Load diff
+14454 -10001
View File
File diff suppressed because it is too large. Load diff
-10
View File
@@ -1,10 +0,0 @@
file_types = [
".exe",".dll",".sys",".com",".scr",
".zip",".7z",".rar",".tar",".gz",
".js",".bat",".cmd",".ps1",".vbs",
".ppt",".pptx",".wps",".txt",".rtf",
".pdf",".xls",".xlsx",".doc",".docx",
".jpg",".jpeg",".png",".webp",".gif",
".mp3",".wav",".aac",".ogg",".flac",
".mp4",".avi",".mov",".wmv",".mkv",
".aux",".cur",".mui",".ttf",".efi"]
+1 -1
View File
@@ -2,7 +2,7 @@ import pyinstaller_versionfile
pyinstaller_versionfile.create_versionfile(
output_file="versionfile.txt",
version='3.3.0',
version='3.3.1',
company_name="PYAS Security",
file_description="Python Antivirus Software",
internal_name="PYAS",
Binary file not shown.
+20 -29
View File
@@ -11,38 +11,33 @@
## Requirements
```
pip install chardet==5.2.0
pip install numpy==1.26.3
pip install numpy==1.26.4
pip install onnxruntime==1.18.1
pip install pefile==2023.2.7
pip install pillow==10.4.0
pip install pyperclip==1.8.2
pip install PyQt5==5.15.11
pip install requests==2.32.3
pip install yara-python==4.5.1
pip install Pillow==11.0.0
pip install pyperclip==1.9.0
pip install PySide6==6.9.1
pip install requests==2.32.4
pip install yara-python==4.5.4
```
## File Information
```
PYAS/
├── Driver/ (Protect driver and Microsoft runtime)
│ └── ...
│
├── Engine/ (Deep learn model and Yara database)
│ └── ...
│
├── Exten/ (Exten tools and System repair tools)
│ └── ...
│
├── PYAS.py (Main PYAS program with qtui interaction and protect function)
├── PYAS_Engine.py (Deep learning predict and yara rules file scanner)
├── PYAS_Suffixes.py (including scan file suffixes and common suffixes)
├── PYAS_Interface.py (Qt designer ui, must be matched with the main program)
├── PYAS_Resource.py (status pictures, icon packages, and button icons)
├── PYAS_Language.py (Traditional Chinese, Simplified Chinese and English)
├── PYAS_Version.py (file information, version information, original name)
└── ...
├── PYAS.py # Main application (PySide6 GUI interface)
├── PYAS_Config.py # Configuration handling and global parameters
├── PYAS_Engine.py # Scanning engine (integrates YARA & ONNX AI detection)
├── PYAS_Interface.py # User interface definitions and widget logic
├── PYAS_Resource.py # Static resource management
├── PYAS_Version.py # Packaging and version info
├── Engine/
│ ├── Models/ # Directory for ONNX AI models
│ └── Rules/ # Directory for YARA and network rules
├── Plugins/
│ └── Filter/ # Driver directory
│ └── PYAS_Driver.sys # Windows kernel driver for security protection
└── ... # Other supplementary folders and files
```
## Official Website
@@ -55,17 +50,13 @@ https://github.com/87owo/PYAS
https://github.com/87owo/Microsoft_Runtime/releases
## 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 500MB, Rom 200MB or higher
Windows 10, 11 (64-bit), Ram 500MB, Rom 200MB or higher
Other systems may experience software malfunctions or crash
+20 -29
View File
@@ -5,38 +5,33 @@
## 安装要求
```
pip install chardet==5.2.0
pip install numpy==1.26.3
pip install numpy==1.26.4
pip install onnxruntime==1.18.1
pip install pefile==2023.2.7
pip install pillow==10.4.0
pip install pyperclip==1.8.2
pip install PyQt5==5.15.11
pip install requests==2.32.3
pip install yara-python==4.5.1
pip install Pillow==11.0.0
pip install pyperclip==1.9.0
pip install PySide6==6.9.1
pip install requests==2.32.4
pip install yara-python==4.5.4
```
## 文件信息
```
PYAS/
├── Driver/ (驱动保护和微软运行库)
│ └── ...
│
├── Engine/ (深度学习和规则数据库)
│ └── ...
│
├── Exten/ (扩展功能与系统修复工具)
│ └── ...
│
├── PYAS.py (PYAS主程序含界面交互与保护功能)
├── PYAS_Engine.py (深度学习预测和规则扫描器)
├── PYAS_Suffixes.py (获取扫描或事件文件的后缀)
├── PYAS_Interface.py (搭配主程序的Qt设计介面)
├── PYAS_Resource.py (状态图片和图标和按钮图片)
├── PYAS_Language.py (繁体中文和简体中文和英文翻译)
├── PYAS_Version.py (版本和讯息名称和打包文件名)
└── ...
├── PYAS.py # 主程序,提供 PySide6 视觉化操作介面
├── PYAS_Config.py # 设定档处理与全域参数管理
├── PYAS_Engine.py # 扫描引擎,整合 YARA 规则与 ONNX AI 模型
├── PYAS_Interface.py # UI 介面定义与元件交互
├── PYAS_Resource.py # 资源档与静态资源管理
├── PYAS_Version.py # 程式版本与打包资讯
├── Engine/
│ ├── Models/ # AI 模型(ONNX 格式)存放目录
│ └── Rules/ # YARA 规则与网路规则存放目录
├── Plugins/
│ └── Filter/ # 驱动程式目录
│ └── PYAS_Driver.sys # Windows 驱动程式(系统保护用)
└── ... # 其它辅助资料夹与档案
```
## 官方网页
@@ -49,17 +44,13 @@ https://github.com/87owo/PYAS
https://github.com/87owo/Microsoft_Runtime/releases
## 驱动程序
https://github.com/0sha0/PYAS_Protection
## 开源协议
https://github.com/87owo/PYAS/blob/main/LICENSE.md
## 支援系统
Windows 8.1, 10, 11 (64-bit), 内存 500MB, 存储 200MB 或更高
Windows 10, 11 (64-bit), 内存 500MB, 存储 200MB 或更高
其他系统或版本可能会遇到软体功能故障或程序崩溃
+20 -29
View File
@@ -5,38 +5,33 @@
## 安裝要求
```
pip install chardet==5.2.0
pip install numpy==1.26.3
pip install numpy==1.26.4
pip install onnxruntime==1.18.1
pip install pefile==2023.2.7
pip install pillow==10.4.0
pip install pyperclip==1.8.2
pip install PyQt5==5.15.11
pip install requests==2.32.3
pip install yara-python==4.5.1
pip install Pillow==11.0.0
pip install pyperclip==1.9.0
pip install PySide6==6.9.1
pip install requests==2.32.4
pip install yara-python==4.5.4
```
## 檔案資訊
```
PYAS/
├── Driver/ (驅動防護和微軟運行庫)
│ └── ...
│
├── Engine/ (深度學習和規則數據庫)
│ └── ...
│
├── Exten/ (擴展功能與系統修復工具)
│ └── ...
│
├── PYAS.py (PYAS主程序含介面交互與防護功能)
├── PYAS_Engine.py (深度學習預測和規則掃描器)
├── PYAS_Suffixes.py (獲取掃描或事件檔案的副檔名)
├── PYAS_Interface.py (搭配主程序的Qt設計介面)
├── PYAS_Resource.py (狀態圖片圖標和按鈕圖片)
├── PYAS_Language.py (繁體中文和簡體中文和英文翻譯)
├── PYAS_Version.py (檔案版本和訊息名稱和打包檔名)
└── ...
├── PYAS.py # 主程式,提供 PySide6 視覺化操作介面
├── PYAS_Config.py # 設定檔處理與全域參數管理
├── PYAS_Engine.py # 掃描引擎,整合 YARA 規則與 ONNX AI 模型
├── PYAS_Interface.py # UI 介面定義與元件交互
├── PYAS_Resource.py # 資源檔與靜態資源管理
├── PYAS_Version.py # 程式版本與打包資訊
├── Engine/
│ ├── Models/ # AI 模型(ONNX 格式)存放目錄
│ └── Rules/ # YARA 規則與網路規則存放目錄
├── Plugins/
│ └── Filter/ # 驅動程式目錄
│ └── PYAS_Driver.sys # Windows 驅動程式(系統保護用)
└── ... # 其它輔助資料夾與檔案
```
## 官方網頁
@@ -49,17 +44,13 @@ https://github.com/87owo/PYAS
https://github.com/87owo/Microsoft_Runtime/releases
## 驅動程式
https://github.com/0sha0/PYAS_Protection
## 開源協議
https://github.com/87owo/PYAS/blob/main/LICENSE.md
## 支援系統
Windows 8.1, 10, 11 (64-bit),記憶體 500MB, 磁碟容量 200MB 或更高
Windows 10, 11 (64-bit),記憶體 500MB, 磁碟容量 200MB 或更高
其他系統或版本可能會遇到軟體功能故障或程序崩潰