Compare commits

...
20 Commits
Author SHA1 Message Date
PYDT 417b17da98 Add files via upload 2025-08-13 16:35:12 +08:00
PYDT 4ca19a4eb0 Update README_zh_CN.md 2025-08-13 16:00:20 +08:00
PYDT e834dfb7ee Update README_zh_TW.md 2025-08-13 16:00:05 +08:00
PYDT 5e1ff74fb3 Update README.md 2025-08-13 15:59:50 +08:00
PYDT 7a1d0f2ca7 Delete Engine/Model/PYAS_Model_A1.onnx 2025-08-13 15:53:33 +08:00
PYDT b305522106 Delete Engine/Model/PYAS_Model.json 2025-08-13 15:53:15 +08:00
PYDT ff3495645a Add files via upload 2025-08-13 15:52:58 +08:00
PYDT ddc000321f Add files via upload 2025-08-13 15:41:32 +08:00
PYDT fe4e6af3b9 Add files via upload 2025-08-13 15:40:43 +08:00
PYDT a1a83cc32c Add files via upload 2025-08-13 15:39:56 +08:00
PYDT e37665218b Update README_zh_CN.md 2025-08-12 17:25:31 +08:00
PYDT 2a876f4136 Update README_zh_TW.md 2025-08-12 17:20:27 +08:00
PYDT 290d8e8a64 Update README_zh_TW.md 2025-08-12 17:19:09 +08:00
PYDT 121bce529f Update README_zh_TW.md 2025-08-12 17:17:17 +08:00
PYDT 1232d98573 Update README.md 2025-08-12 17:16:46 +08:00
PYDT 208d9150b0 Update README.md 2025-08-12 17:10:23 +08:00
PYDT 351bf7725e Update README.md 2025-08-12 17:07:56 +08:00
PYDT a547776766 Add files via upload 2025-08-12 17:06:02 +08:00
PYDT 86a8d20757 Add files via upload 2025-08-11 11:26:26 +08:00
PYDT 760c420f95 Delete Plugins/Filter directory 2025-08-11 11:26:15 +08:00
10 changed files with 292 additions and 85 deletions

No files matched your search

-11
View File
@@ -1,11 +0,0 @@
{
"Suffix": [".com", ".exe", ".dll", ".sys", ".scr", ".bat", ".cmd", ".ps1", ".vbs", ".wsf"],
"Labels": ["Pefile/White", "Script/White", "Pefile/General", "Script/General"],
"Detect": ["Pefile/General", "Script/General"],
"Resize": [224, 224, 1, "nearest"],
"Values": 95
}
Binary file not shown.
+73
View File
@@ -0,0 +1,73 @@
from PIL import Image
import numpy, pefile, os
def file_to_images(file_data, output_dir, file_name, target_size=(224, 224)):#
wah = int(numpy.ceil(numpy.sqrt(len(file_data))))
file_data = numpy.frombuffer(file_data, dtype=numpy.uint8)
image_array = numpy.zeros((wah * wah,), dtype=numpy.uint8)
image_array[:len(file_data)] = file_data
image = Image.fromarray(image_array.reshape((wah, wah)), 'L')
image = image.resize(target_size, Image.Resampling.NEAREST)
image.save(os.path.join(output_dir, f"{file_name}.png"))
def check_file_type(file_path):
try:
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"]
shells = shell_section + unimportant_section + unknown_section
ftype = str(f".{file_path.split('.')[-1]}").lower()
if ftype in [".bat", ".cmd", ".ps1", ".vbs", ".wsf", ".js", ".html"]:
with open(file_path, 'rb') as f:
return [f.read()]
match_data = []
if ftype in [".com", ".exe", ".dll", ".sys", ".scr"]:
with pefile.PE(file_path, fast_load=True) as pe:
for section in pe.sections:
section_name = section.Name.rstrip(b'\x00').decode('latin1')
#if (section.Characteristics & 0x00000020 and not
#any(shell in section_name.lower() for shell in shells)):
if section.Characteristics & 0x00000020:
match_data.append(section.get_data())
return match_data
return False
except Exception as e:
print(e)
return False
def batch_file_to_images(input_dir, output_dir):
for root, dirs, files in os.walk(input_dir):
for file in files:
try:
file_path = os.path.join(root, file)
file_data = check_file_type(file_path)
if file_data:
for i, data in enumerate(file_data, 1):
print(i, file_path)
relative_path = os.path.relpath(root, input_dir)
output_path_dir = os.path.join(output_dir, relative_path)
if not os.path.exists(output_path_dir):
os.makedirs(output_path_dir)
file_to_images(data, output_path_dir, f"{i}_{file}")
except Exception as e:
print(e)
pass
input_directory = input('Enter the folder path: ')
output_directory = "./Image_File"
batch_file_to_images(input_directory, output_directory)
input('Conversion Complete')
+111
View File
@@ -0,0 +1,111 @@
import tensorflow as tf
import os, tf2onnx, numpy, random
from PIL import Image
from tensorflow.keras import *
Image.MAX_IMAGE_PIXELS = None
tf.keras.mixed_precision.set_global_policy('mixed_float16')
def get_file_list(directory):
file_paths, labels, class_indices = [], [], {}
for i, cls in enumerate(sorted([d for d in os.listdir(directory) if os.path.isdir(os.path.join(directory, d))])):
class_indices[cls] = i
cls_dir = os.path.join(directory, cls)
for root, _, files in os.walk(cls_dir):
for file in files:
if file.lower().endswith(('.jpg', '.jpeg', '.png', '.bmp', '.gif')):
file_paths.append(os.path.join(root, file))
labels.append(i)
return file_paths, labels, class_indices
def load_dataset(train_dir, val_dir, val_split=0.01, batch_size=128, color_mode="grayscale"):
channels = 1 if color_mode == "grayscale" else 3
if train_dir == val_dir:
file_paths, labels, class_indices = get_file_list(train_dir)
combined = list(zip(file_paths, labels))
random.shuffle(combined)
file_paths[:], labels[:] = zip(*combined)
num_val = int(val_split * len(file_paths))
train_files = file_paths[num_val:]
train_labels = labels[num_val:]
val_files = file_paths[:num_val]
val_labels = labels[:num_val]
else:
train_files, train_labels, class_indices = get_file_list(train_dir)
val_files, val_labels, _ = get_file_list(val_dir)
num_classes = len(class_indices)
def parse_fn(filename, label):
img = tf.io.read_file(filename)
img = tf.image.decode_image(img, channels=channels, expand_animations=False)
img = tf.cast(img, tf.float32) / 255.0
label = tf.one_hot(label, depth=num_classes)
return img, label
train_ds = tf.data.Dataset.from_tensor_slices((train_files, train_labels))
train_ds = train_ds.map(parse_fn, num_parallel_calls=tf.data.AUTOTUNE)
train_ds = train_ds.batch(batch_size).prefetch(tf.data.AUTOTUNE)
val_ds = tf.data.Dataset.from_tensor_slices((val_files, val_labels))
val_ds = val_ds.map(parse_fn, num_parallel_calls=tf.data.AUTOTUNE)
val_ds = val_ds.batch(batch_size).prefetch(tf.data.AUTOTUNE)
train_ds.class_indices = class_indices
return train_ds, val_ds
def gated_conv(x, strides):
c = layers.DepthwiseConv2D(3, strides=strides, padding='same', activation='gelu')(x)
g = layers.DepthwiseConv2D(3, strides=strides, padding='same', activation='sigmoid')(x)
return layers.Multiply()([c, g])
def multi_conv(x, strides):
convs = [layers.DepthwiseConv2D(kernel_size=k, strides=strides, padding='same')(x) for k in [1, 3, 5, 7]]
x = layers.Concatenate()(convs)
x = layers.BatchNormalization()(x)
return layers.Activation('gelu')(x)
def se_block(x, reduction):
filters = x.shape[-1]
s = layers.Conv2D(filters // reduction, 1, padding='same', activation='gelu')(x)
s = layers.BatchNormalization()(s)
s = layers.Conv2D(filters, 1, padding='same', activation='sigmoid')(s)
s = layers.BatchNormalization()(s)
return layers.multiply([x, s])
def build_model(input_shape, num_classes):
i = layers.Input(shape=input_shape)
x = multi_conv(i, strides=1)
x = multi_conv(x, strides=2)
x = gated_conv(x, strides=2)
x = multi_conv(x, strides=2)
x = multi_conv(x, strides=2)
x = multi_conv(x, strides=2)
x = se_block(x, reduction=2)
x = layers.GlobalAveragePooling2D()(x)
o = layers.Dense(num_classes, activation='softmax', dtype='float32')(x)
return models.Model(i, o)
def lr_scheduler(epoch, lr):
return 1e-3 * (0.7 ** epoch)
class CustomModelCheckpoint(callbacks.Callback):
def on_epoch_end(self, epoch, logs=False):
models.save_model(self.model, f"PYAS_Model_Epoch_{epoch + 1}.h5")
spec = (tf.TensorSpec((None,) + train_ds.image_shape, tf.float32),)
model_proto, _ = tf2onnx.convert.from_keras(self.model, input_signature=spec, opset=18)
with open(f"PYAS_Model_Epoch_{epoch + 1}.onnx", "wb") as f:
f.write(model_proto.SerializeToString())
train_ds, val_ds = load_dataset(r'./Image_File', r'./Image_File')
for imgs, _ in train_ds.take(1):
train_ds.image_shape = imgs.shape[1:]
break
strategy = tf.distribute.MirroredStrategy(cross_device_ops=tf.distribute.HierarchicalCopyAllReduce())
with strategy.scope():
try:
model = models.load_model('PYAS_Model_Epoch_0.h5')
print("Load model from disk")
except:
print("Creating a new model")
model = build_model(train_ds.image_shape, len(train_ds.class_indices))
model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])
model.fit(train_ds, epochs=30, callbacks=[CustomModelCheckpoint(), callbacks.LearningRateScheduler(lr_scheduler)], validation_data=val_ds)
input("Training complete.")
+15 -7
View File
@@ -112,7 +112,7 @@ class MainWindow_Controller(QMainWindow):
"traditional_switch", "simplified_switch", "english_switch",
]
self.pyas_default = {
"version": "3.3.2",
"version": "3.3.3",
"product": "00000-00000-00000-00000-00000",
"language": "english_switch",
"theme": "white_switch",
@@ -139,6 +139,7 @@ class MainWindow_Controller(QMainWindow):
"SHELLCODE_BLOCK": "殼碼行為攔截",
"THREAD_BLOCK": "線程行為攔截",
"INJECT_BLOCK": "注入行為攔截",
"PROC_BLOCK": "進程行為攔截",
}
####################################################################################################
@@ -147,6 +148,7 @@ class MainWindow_Controller(QMainWindow):
self.file_pyas = self.norm_path(sys.argv[0])
self.args_pyas = sys.argv[1:]
self.path_pyas = os.path.dirname(self.file_pyas)
self.pid_pyas = int(os.getpid())
self.path_appdata = os.environ.get("APPDATA")
self.path_name = os.environ.get("USERNAME")
@@ -334,17 +336,20 @@ class MainWindow_Controller(QMainWindow):
if checked:
self.start_daemon_thread(self.protect_system_thread)
elif name == "driver_switch":
if checked:
self.install_system_driver()
if not checked:
self.stop_system_driver()
elif self.install_system_driver():
self.start_daemon_thread(self.pipe_server_thread)
else:
self.stop_system_driver()
self.pyas_config[name] = False
self.send_message("驅動防護啟用失敗", "warn", True)
elif name == "network_switch":
if checked:
self.start_daemon_thread(self.protect_net_thread)
else:
self.send_message(f"此功能不支持使用", "info", True)
self.save_config(self.file_config, self.pyas_config)
self.apply_settings()
def init_thread(self):
self.start_daemon_thread(self.popup_intercept_thread)
@@ -390,9 +395,12 @@ class MainWindow_Controller(QMainWindow):
widget.setProperty("_connected_toggle", True)
elif hasattr(widget, "setText"):
if not hasattr(widget, "_origin_text"):
widget._origin_text = self.get_widget_text(widget)
widget.setText(self.trans(lang, widget._origin_text))
if name == "log_text":
pass
else:
if not hasattr(widget, "_origin_text"):
widget._origin_text = self.get_widget_text(widget)
widget.setText(self.trans(lang, widget._origin_text))
if hasattr(widget, "setStyleSheet"):
if not hasattr(widget, "_origin_style"):
+1 -1
View File
@@ -2,7 +2,7 @@ import pyinstaller_versionfile
pyinstaller_versionfile.create_versionfile(
output_file="versionfile.txt",
version='3.3.2',
version='3.3.3',
company_name="PYAS Security",
file_description="Python Antivirus Software",
internal_name="PYAS",
Binary file not shown.
+7 -3
View File
@@ -6,6 +6,8 @@ Python antivirus software uses deep learning and behavioral monitoring to block
## Readme Language
English : https://github.com/87owo/PYAS/blob/main/README.md
繁體中文 : https://github.com/87owo/PYAS/blob/main/README_zh_TW.md
简体中文 : https://github.com/87owo/PYAS/blob/main/README_zh_CN.md
@@ -42,7 +44,7 @@ PYAS/
├── PYAS_Config.py # Configuration handling and global parameters
├── PYAS_Engine.py # YARA and ONNX Scanning engine
├── PYAS_Interface.py # User interface definitions and widget logic
├── PYAS_Resource.py # Static resource management
├── PYAS_Resource.py # Static picture resource management
├── PYAS_Version.py # Packaging and version info
└── ... # Other supplementary folders and files
```
@@ -55,13 +57,15 @@ Packaged Releases Download: https://github.com/87owo/PYAS/releases
| Config | Permissions | System version | Available memory | Available storage |
|-----------|---------------|----------------|------------------|-------------------|
| Minimum | Administrator | Windows 8.1 | 200MB | 100MB |
| Minimum | Administrator | Windows 10 | 200MB | 100MB |
| Recommend | Administrator | Windows 10 | 300MB | 200MB |
| Optimal | Administrator | Windows 11 | 500MB | 200MB |
## Official Website
https://github.com/87owo/PYAS
Official Website : https://pyantivirus.wixsite.com/pyas
Open Source Website : https://github.com/87owo/PYAS
## Project License
+43 -32
View File
@@ -1,8 +1,20 @@
# PYAS (Python 杀毒软件)
# PYAS
以 Python 开发的杀毒软件,结合深度学习与行为监控来阻挡威胁!
![PYAS_UI](https://github.com/user-attachments/assets/68765836-7272-482f-b8cd-d8ba728d88ab)
## 安装要求
## 说明语言
English : https://github.com/87owo/PYAS/blob/main/README.md
繁體中文 : https://github.com/87owo/PYAS/blob/main/README_zh_TW.md
简体中文 : https://github.com/87owo/PYAS/blob/main/README_zh_CN.md
## 安装需求
建议使用 Python 3.10。其他版本的 Python 可能需要不同的 pip 指令。
```
pip install numpy==1.26.4
@@ -15,47 +27,46 @@ pip install requests==2.32.4
pip install yara-python==4.5.4
```
## 文件信息
## 文件讯息
以下列出所有相关代码与文件的存放位置。
```
PYAS/
├── 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 规则与网路规则存放目录
│ ├── Models/ # ONNX 深度学习模型目录
│ └── Rules/ # YARA 与网络规则目录
│
├── Plugins/
│ └── Filter/ # 驱动程式目录
│ └── PYAS_Driver.sys # Windows 驱动程式(系统保护用)
└── ... # 其它辅助资料夹与档案
│ └── Filter/ # 用于安全防护的 Windows 核心驱动
│
├── PYAS.py # 主程式与图形界面 (GUI)
├── PYAS_Config.py # 组态处理与全域参数
├── PYAS_Engine.py # YARA 与 ONNX 扫描引擎
├── PYAS_Interface.py # 使用者介面定义与元件逻辑
├── PYAS_Resource.py # 静态图片资源管理
├── PYAS_Version.py # 打包与版本资讯
└── ... # 其他补充文件夹与文件
```
## 官方网页
## 安装版本
https://pyantivirus.wixsite.com/pyas
打包发行版下载:https://github.com/87owo/PYAS/releases
https://github.com/87owo/PYAS
## 系统需求
## 微软运行库
| 配置需求 | 权限需求 | 系统需求 | 可用內存 | 可用储存空间 |
| ---- | ------- | ----------- | ----- | ------ |
| 最低 | 系统管理员 | Windows 10 | 200MB | 100MB |
| 建议 | 系统管理员 | Windows 10 | 300MB | 200MB |
| 最佳 | 系统管理员 | Windows 11 | 500MB | 200MB |
https://github.com/87owo/Microsoft_Runtime/releases
## 官方网站
## 开源协议
官方网站 : https://pyantivirus.wixsite.com/pyas
开源网站 : https://github.com/87owo/PYAS
## 授权条款
https://github.com/87owo/PYAS/blob/main/LICENSE.md
## 支援系统
Windows 10, 11 (64-bit), 内存 500MB, 存储 200MB 或更高
其他系统或版本可能会遇到软体功能故障或程序崩溃
## 特别感谢
Wix, mtkiao129, 0sha0, AV-T Team of LisectGroup
Copyright© 2020~2025 PYAS Security By 87owo
+42 -31
View File
@@ -1,8 +1,20 @@
# PYAS (Python 防毒軟體)
# PYAS
以 Python 開發的防毒軟體,結合深度學習與行為監控來阻擋威脅!
![PYAS_UI](https://github.com/user-attachments/assets/68765836-7272-482f-b8cd-d8ba728d88ab)
## 安裝要求
## 說明語言
English : https://github.com/87owo/PYAS/blob/main/README.md
繁體中文 : https://github.com/87owo/PYAS/blob/main/README_zh_TW.md
简体中文 : https://github.com/87owo/PYAS/blob/main/README_zh_CN.md
## 安裝需求
建議使用 Python 3.10。其他版本的 Python 可能需要不同的 pip 指令。
```
pip install numpy==1.26.4
@@ -17,45 +29,44 @@ pip install yara-python==4.5.4
## 檔案資訊
以下列出所有相關程式碼與文件的存放位置。
```
PYAS/
├── 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 規則與網路規則存放目錄
│ ├── Models/ # ONNX 深度學習模型目錄
│ └── Rules/ # YARA 與網路規則目錄
│
├── Plugins/
│ └── Filter/ # 驅動程式目錄
│ └── PYAS_Driver.sys # Windows 驅動程式(系統保護用)
└── ... # 其它輔助資料夾與檔案
│ └── Filter/ # 用於安全防護的 Windows 核心驅動程式
│
├── PYAS.py # 主程式與圖形介面 (GUI)
├── PYAS_Config.py # 組態處理與全域參數
├── PYAS_Engine.py # YARA 與 ONNX 掃描引擎
├── PYAS_Interface.py # 使用者介面定義與元件邏輯
├── PYAS_Resource.py # 靜態圖片資源管理
├── PYAS_Version.py # 打包與版本資訊
└── ... # 其他補充資料夾與檔案
```
## 官方網頁
## 安裝版本
https://pyantivirus.wixsite.com/pyas
打包發行版下載:https://github.com/87owo/PYAS/releases
https://github.com/87owo/PYAS
## 系統需求
## 微軟運行庫
| 配置需求 | 權限需求 | 系統需求 | 可用記憶體 | 可用儲存空間 |
| ---- | ------- | ----------- | ----- | ------ |
| 最低 | 系統管理員 | Windows 10 | 200MB | 100MB |
| 建議 | 系統管理員 | Windows 10 | 300MB | 200MB |
| 最佳 | 系統管理員 | Windows 11 | 500MB | 200MB |
https://github.com/87owo/Microsoft_Runtime/releases
## 官方網站
## 開源協議
官方網站 : https://pyantivirus.wixsite.com/pyas
開源網站 : https://github.com/87owo/PYAS
## 授權條款
https://github.com/87owo/PYAS/blob/main/LICENSE.md
## 支援系統
Windows 10, 11 (64-bit),記憶體 500MB, 磁碟容量 200MB 或更高
其他系統或版本可能會遇到軟體功能故障或程序崩潰
## 特別感謝
Wix, mtkiao129, 0sha0, AV-T Team of LisectGroup
Copyright© 2020~2025 PYAS Security By 87owo