Compare commits

..
15 Commits
Author SHA1 Message Date
87owo dc498949c7 Add files via upload 2026-06-16 04:27:36 +08:00
87owo f804a5b7f0 Add files via upload 2026-06-16 04:20:08 +08:00
87owo b0a3482f25 Add files via upload 2026-06-13 13:04:04 +08:00
87owo 018b497575 Add files via upload 2026-06-09 16:45:28 +08:00
87owo 130b040de1 Add files via upload 2026-06-09 16:08:44 +08:00
87owo bc0a62224a Add files via upload 2026-06-09 15:59:16 +08:00
87owo 77525fc7c5 Add files via upload 2026-06-09 15:15:53 +08:00
87owo a304a2f02d Add files via upload 2026-06-09 13:49:52 +08:00
87owo 9456659544 Add files via upload 2026-06-09 13:49:23 +08:00
87owo 3ec340e0da Add files via upload 2026-06-09 13:48:47 +08:00
87owo f1f35badcb Update LICENSE.txt 2026-06-09 04:08:32 +08:00
87owo 045160c482 Update LICENSE.txt 2026-06-09 04:06:41 +08:00
87owo 559c493997 Update LICENSE.txt 2026-06-09 04:03:01 +08:00
87owo 936475f5bf Merge pull request #63 from WBT907/main
Fixed a bug where PYAS process protection was not working. (To be verified)
2026-06-08 10:41:36 +08:00
wangbotao e97f8eed54 修复 PYAS 进程保护失效 Bug
修复任务管理器可以成功终止 PYAS 进程的问题。原代码中进程保护完全依赖于 GlobalData.PyasPid ,而该变量只有在用户模式程序成功连接到驱动通信端口后才会被设置。如果连接未建立或断开, PyasPid 为 0,导致 IsTargetProtected() 始终返回 FALSE ,进程保护完全失效。
2026-06-07 20:05:38 +08:00
10 changed files with 543 additions and 189 deletions

No files matched your search

+1 -1
View File
@@ -211,7 +211,7 @@ def train_process(X, y, feature_names):
params,
train_data,
valid_sets=[valid_data],
num_boost_round=500,
num_boost_round=300,
callbacks=[
lgb.log_evaluation(period=50),
lgb.reset_parameter(learning_rate=_calculate_dynamic_lr)
+55 -11
View File
@@ -179,7 +179,11 @@ window.AppI18n = {
"Network Block": "網路攔截",
"Driver Block": "驅動攔截",
"System Restart": "系統重啟",
"Clean Junk": "清理垃圾"
"Clean Junk": "清理垃圾",
"protect_suspend": "進程暫停",
"protect_suspend_desc": "此選項可以暫停進程等待掃描",
"opt_autostart": "開機啟動",
"opt_autostart_desc": "此選項可以設定開機自動執行",
},
"simplified_switch": {
"app_name": "PYAS Security",
@@ -360,7 +364,11 @@ window.AppI18n = {
"Network Block": "网络拦截",
"Driver Block": "驱动拦截",
"System Restart": "系统重启",
"Clean Junk": "清理垃圾"
"Clean Junk": "清理垃圾",
"protect_suspend": "进程暂停",
"protect_suspend_desc": "此选项可以暂停进程等待扫描",
"opt_autostart": "开机启动",
"opt_autostart_desc": "此选项可以设定开机自动运行",
},
"english_switch": {
"app_name": "PYAS Security",
@@ -541,7 +549,11 @@ window.AppI18n = {
"Network Block": "Network Block",
"Driver Block": "Driver Block",
"System Restart": "System Restart",
"Clean Junk": "Clean Junk"
"Clean Junk": "Clean Junk",
"protect_suspend": "Process Suspend",
"protect_suspend_desc": "Suspend processes while waiting for scanning",
"opt_autostart": "Auto Start",
"opt_autostart_desc": "Run automatically at system startup",
},
"japanese_switch": {
"app_name": "PYAS Security",
@@ -722,7 +734,11 @@ window.AppI18n = {
"Network Block": "ネットワークブロック",
"Driver Block": "ドライバーブロック",
"System Restart": "システムの再起動",
"Clean Junk": "ジャンククリーンアップ"
"Clean Junk": "ジャンククリーンアップ",
"protect_suspend": "プロセスの一時停止",
"protect_suspend_desc": "スキャン待ちの間プロセスを一時停止します",
"opt_autostart": "自動起動",
"opt_autostart_desc": "システム起動時に自動的に実行します",
},
"korean_switch": {
"app_name": "PYAS Security",
@@ -903,7 +919,11 @@ window.AppI18n = {
"Network Block": "네트워크 차단",
"Driver Block": "드라이버 차단",
"System Restart": "시스템 재시작",
"Clean Junk": "정크 정리"
"Clean Junk": "정크 정리",
"protect_suspend": "프로세스 일시 중지",
"protect_suspend_desc": "스캔을 기다리는 동안 프로세스를 일시 중지합니다",
"opt_autostart": "자동 시작",
"opt_autostart_desc": "시스템 시작 시 자동으로 실행합니다",
},
"french_switch": {
"app_name": "PYAS Security",
@@ -1084,7 +1104,11 @@ window.AppI18n = {
"Network Block": "Réseau bloqué",
"Driver Block": "Pilote bloqué",
"System Restart": "Redémarrage système",
"Clean Junk": "Nettoyage"
"Clean Junk": "Nettoyage",
"protect_suspend": "Suspendre processus",
"protect_suspend_desc": "Suspend les processus en attente d'analyse",
"opt_autostart": "Démarrage auto",
"opt_autostart_desc": "Exécuter automatiquement au démarrage",
},
"spanish_switch": {
"app_name": "PYAS Security",
@@ -1265,7 +1289,11 @@ window.AppI18n = {
"Network Block": "Red bloqueada",
"Driver Block": "Controlador bloqueado",
"System Restart": "Reinicio del sistema",
"Clean Junk": "Limpieza de basura"
"Clean Junk": "Limpieza de basura",
"protect_suspend": "Suspender procesos",
"protect_suspend_desc": "Suspender procesos mientras espera el escaneo",
"opt_autostart": "Inicio automático",
"opt_autostart_desc": "Ejecutar automáticamente al inicio",
},
"hindi_switch": {
"app_name": "PYAS Security",
@@ -1446,7 +1474,11 @@ window.AppI18n = {
"Network Block": "नेटवर्क अवरुद्ध",
"Driver Block": "ड्राइवर अवरुद्ध",
"System Restart": "सिस्टम पुनरारंभ",
"Clean Junk": "कचरा साफ़ करें"
"Clean Junk": "कचरा साफ़ करें",
"protect_suspend": "प्रक्रिया रोकें",
"protect_suspend_desc": "स्कैन की प्रतीक्षा करते समय प्रक्रियाओं को रोकें",
"opt_autostart": "स्वतः प्रारंभ",
"opt_autostart_desc": "सिस्टम स्टार्टअप पर स्वचालित रूप से चलाएं",
},
"arabic_switch": {
"app_name": "PYAS Security",
@@ -1627,7 +1659,11 @@ window.AppI18n = {
"Network Block": "حظر شبكة",
"Driver Block": "حظر محرك",
"System Restart": "إعادة تشغيل النظام",
"Clean Junk": "تنظيف المخلفات"
"Clean Junk": "تنظيف المخلفات",
"protect_suspend": "تعليق العمليات",
"protect_suspend_desc": "تعليق العمليات أثناء انتظار الفحص",
"opt_autostart": "بدء تلقائي",
"opt_autostart_desc": "التشغيل تلقائيًا عند بدء التشغيل",
},
"russian_switch": {
"app_name": "PYAS Security",
@@ -1808,7 +1844,11 @@ window.AppI18n = {
"Network Block": "Блокировка сети",
"Driver Block": "Блокировка драйвера",
"System Restart": "Перезапуск системы",
"Clean Junk": "Очистка мусора"
"Clean Junk": "Очистка мусора",
"protect_suspend": "Приостановка процессов",
"protect_suspend_desc": "Приостановка процессов в ожидании сканирования",
"opt_autostart": "Автозапуск",
"opt_autostart_desc": "Автоматический запуск при старте системы",
},
"slovenian_switch": {
"app_name": "PYAS Security",
@@ -1989,7 +2029,11 @@ window.AppI18n = {
"Network Block": "Omrežje blokirano",
"Driver Block": "Gonilnik blokiran",
"System Restart": "Ponovni zagon sistema",
"Clean Junk": "Čiščenje nesnage"
"Clean Junk": "Čiščenje nesnage",
"protect_suspend": "Začasna ustavitev",
"protect_suspend_desc": "Zaustavite procese med čakanjem na skeniranje",
"opt_autostart": "Samodejni zagon",
"opt_autostart_desc": "Samodejni zagon ob zagonu sistema",
}
},
langMap: {
+37 -26
View File
@@ -85,6 +85,7 @@ document.addEventListener('DOMContentLoaded', () => {
startup: [{key: 'type', label: 'col_type', flex: 0.5, isI18n: true}, {key: 'name', label: 'col_name', flex: 1.5}, {key: 'status', label: 'col_status', flex: 0.5, isI18n: true}, {key: 'path', label: 'col_path', flex: 3}],
virus: [{key: 'label', label: 'col_type', flex: 1, isI18n: true}, {key: 'path', label: 'col_path', flex: 3}],
pathOnly: [{key: 'path', label: 'col_path', flex: 1}],
fileList: [{key: 'time_str', label: 'col_date', flex: 1.5}, {key: 'path', label: 'col_path', flex: 5}],
junk: [{key: 'path', label: 'col_path', flex: 3}, {key: 'sizeStr', label: 'col_size', flex: 1}],
popup: [{key: 'exe', label: 'col_prog', flex: 1}, {key: 'class', label: 'col_class', flex: 1}, {key: 'title', label: 'col_title', flex: 2}],
repair: [{key: 'display', label: 'col_repair', flex: 1, isI18n: true}, {key: 'path', label: 'col_path', flex: 3}],
@@ -446,23 +447,23 @@ document.addEventListener('DOMContentLoaded', () => {
};
const checkVirusListEmpty = () => {
updateCustomSelectUI('scan_method_select', 'none');
if (appState.virusResults.length === 0) {
appState.virusMap.clear();
changeScanSelectMode('scan');
const title = document.querySelector('#scan_window .section-title');
const text = document.getElementById('progress_text');
if (title) {
title.setAttribute('data-i18n', 'scan_virus');
title.textContent = getMsg('scan_virus');
updateCustomSelectUI('scan_method_select', 'none');
if (appState.virusResults.length === 0) {
appState.virusMap.clear();
changeScanSelectMode('scan');
const title = document.querySelector('#scan_window .section-title');
const text = document.getElementById('progress_text');
if (title) {
title.setAttribute('data-i18n', 'scan_virus');
title.textContent = getMsg('scan_virus');
}
if (text) {
text.setAttribute('data-i18n', 'scan_virus_desc');
text.removeAttribute('data-dynamic-msg');
text.textContent = getMsg('scan_virus_desc');
}
}
if (text) {
text.setAttribute('data-i18n', 'scan_virus_desc');
text.removeAttribute('data-dynamic-msg');
text.textContent = getMsg('scan_virus_desc');
}
}
};
};
const triggerScan = (method) => {
if (!window.pywebview) return;
@@ -594,9 +595,19 @@ document.addEventListener('DOMContentLoaded', () => {
const refreshConfigLists = () => {
if (!window.pywebview) return;
window.pywebview.api.get_config().then(cfg => {
renderDataGrid('#whitelist_window', (cfg.white_list || []).map(i => ({path: i.file || i})), cols.pathOnly, 'path');
renderDataGrid('#quarantine_window', (cfg.quarantine || []).map(i => ({path: i.file || i})), cols.pathOnly, 'path');
renderDataGrid('#custom_protect_window', (cfg.custom_rule || []).map(i => ({path: i.file || i})), cols.pathOnly, 'path');
const formatTime = (ts) => {
if (!ts) return '-';
const d = new Date(ts * 1000);
const pad = n => n.toString().padStart(2, '0');
return `[${d.getFullYear()}-${pad(d.getMonth()+1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}]`;
};
const mapList = (arr) => (arr || []).map(i => ({
path: i.file || (typeof i === 'string' ? i : ''),
time_str: formatTime(i.time)
}));
renderDataGrid('#whitelist_window', mapList(cfg.white_list), cols.fileList, 'path');
renderDataGrid('#quarantine_window', mapList(cfg.quarantine), cols.fileList, 'path');
renderDataGrid('#custom_protect_window', mapList(cfg.custom_rule), cols.fileList, 'path');
const popupRules = (cfg.block_list || []).map(item => ({ exe: item.exe || '*', class: item.class || '*', title: item.title || '*', value: item.exe || item.title }));
renderDataGrid('#popup_window', popupRules, cols.popup, 'value');
});
@@ -770,7 +781,7 @@ document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('.toggle-switch input').forEach((toggle, index) => {
toggle.addEventListener('change', async (e) => {
const switchMap = ["process_switch", "document_switch", "system_switch", "driver_switch", "network_switch", "sensitive_switch", "extension_switch", "cloud_switch", "context_switch"];
const switchMap = ["process_switch", "suspend_switch", "document_switch", "system_switch", "driver_switch", "network_switch", "sensitive_switch", "extension_switch", "cloud_switch", "autostart_switch", "context_switch"];
const key = switchMap[index];
if (window.pywebview && key) {
toggle.disabled = true;
@@ -1054,9 +1065,9 @@ document.addEventListener('DOMContentLoaded', () => {
renderDataGrid('#startup_window', [], cols.startup, 'id', false);
renderDataGrid('#junk_window', [], cols.junk, 'path', true);
renderDataGrid('#repair_window', [], cols.repair, 'id', true);
renderDataGrid('#whitelist_window', [], cols.pathOnly, 'path', false);
renderDataGrid('#quarantine_window', [], cols.pathOnly, 'path', false);
renderDataGrid('#custom_protect_window', [], cols.pathOnly, 'path', false);
renderDataGrid('#whitelist_window', [], cols.fileList, 'path', false);
renderDataGrid('#quarantine_window', [], cols.fileList, 'path', false);
renderDataGrid('#custom_protect_window', [], cols.fileList, 'path', false);
renderDataGrid('#popup_window', [], cols.popup, 'value', false);
renderDataGrid('#log_export_window', [], cols.log, 'id', true);
renderDataGrid('#netmon_window', [], cols.netmon, 'pid', false);
@@ -1071,7 +1082,7 @@ document.addEventListener('DOMContentLoaded', () => {
updateCustomSelectUI('theme_select', theme);
updateCustomSelectUI('lang_select', lang);
const switchMap = ["process_switch", "document_switch", "system_switch", "driver_switch", "network_switch", "sensitive_switch", "extension_switch", "cloud_switch", "context_switch"];
const switchMap = ["process_switch", "suspend_switch", "document_switch", "system_switch", "driver_switch", "network_switch", "sensitive_switch", "extension_switch", "cloud_switch", "autostart_switch", "context_switch"];
document.querySelectorAll('.toggle-switch input').forEach((toggle, index) => {
if (appState.firstLaunch) {
toggle.checked = false;
@@ -1091,8 +1102,8 @@ document.addEventListener('DOMContentLoaded', () => {
window.onEngineReady = async () => {
if (!appState.firstLaunch) return;
await window.pywebview.api.update_config("first_launch", false);
const switchMap = ["process_switch", "document_switch", "system_switch", "driver_switch", "network_switch", "sensitive_switch", "extension_switch", "cloud_switch", "context_switch"];
const seq = ["cloud_switch", "process_switch", "document_switch", "system_switch", "network_switch", "driver_switch"];
const switchMap = ["process_switch", "suspend_switch", "document_switch", "system_switch", "driver_switch", "network_switch", "sensitive_switch", "extension_switch", "cloud_switch", "autostart_switch", "context_switch"];
const seq = ["cloud_switch", "autostart_switch", "process_switch", "suspend_switch", "document_switch", "system_switch", "network_switch", "driver_switch"];
for (const key of seq) {
const index = switchMap.indexOf(key);
+65 -23
View File
@@ -109,6 +109,12 @@
</div>
<label class="toggle-switch"><input type="checkbox" checked><span class="slider"></span></label>
</div>
<div class="list-item">
<div class="item-info">
<h2 data-i18n>進程暫停</h2><p data-i18n>此選項可以暫停進程等待掃描</p>
</div>
<label class="toggle-switch"><input type="checkbox" checked><span class="slider"></span></label>
</div>
<div class="list-item">
<div class="item-info">
<h2 data-i18n>檔案防護</h2><p data-i18n>此選項可以隔離惡意檔案建立</p>
@@ -215,6 +221,12 @@
</div>
<label class="toggle-switch"><input type="checkbox" checked><span class="slider"></span></label>
</div>
<div class="list-item">
<div class="item-info">
<h2 data-i18n>開機啟動</h2><p data-i18n>此選項可以設定開機自動執行</p>
</div>
<label class="toggle-switch"><input type="checkbox" checked><span class="slider"></span></label>
</div>
<div class="list-item">
<div class="item-info">
<h2 data-i18n>選單掃描</h2><p data-i18n>此選項可以啟用右鍵掃描功能</p>
@@ -284,34 +296,64 @@
</div>
<div class="license-widget">
<textarea class="license-text" readonly>87owo Publicly Available Source Code License Agreement
Last updated: 2025-12-19
1. License and Ownership
- This software and its source code are source available for public view.
- Access or execution of certain features may require an activation key.
- 87owo reserves all legal rights, no intellectual property is transferred.
- All project archives, source code, and binaries remain fully proprietary.
Last Updated: 2026-06-09
IMPORTANT NOTICE: THIS LICENSE IS "SOURCE AVAILABLE" AND IS NOT AN OPEN SOURCE LICENSE APPROVED BY THE OPEN SOURCE INITIATIVE (OSI). BY DOWNLOADING, ACCESSING, OR USING THE SOFTWARE, YOU AGREE TO BE BOUND BY THESE TERMS.
2. Use and Prohibitions
- You may view, download, and modify the code for local and personal use.
- Redistribution of any original or modified code requires prior consent.
- Commercial hosting or SaaS deployment is prohibited without permission.
- Reverse engineering, license removal, or illegal use is strictly barred.
1. Definitions and Interpretation
3. Data and Privacy
- This project may collect operational data for optimization and analysis.
- All collected data is strictly anonymized to ensure the user's privacy.
- Transmission of information is encrypted to prevent unauthorized access.
- 1.1. Author: Refers to 87owo (PYAS Security).
- 1.2. Software: Refers to the source code, binaries, project archives, assets, and documentation associated with this repository or distribution.
- 1.3. Personal Local Use: Means viewing, downloading, executing, and modifying the Software strictly on local hardware owned or directly controlled by an individual for private, non-commercial, non-production, and non-distribution purposes.
- 1.4. Enterprise Use: Includes enterprise internal deployment, multi-user institutional use, or utilization within any corporate environment, which is strictly excluded from Personal Local Use.
4. Updates and Terms
- New releases may include critical patches, enhancements, or UI changes.
- Continued use of these services constitutes acceptance of updated terms.
- The author reserves the right to modify these license terms at any time.
2. Intellectual Property and Ownership
5. Warranty and Liability
- All services and assets are provided "as is" without any form of warranty.
- 87owo is not liable for any direct or indirect damages from software use.
- Users assume all risks regarding performance, data, and system integrity.
- 2.1. Retention of Rights: The Author reserves all legal rights, titles, and interests in and to the Software, including but not limited to all copyrights, trademarks, patents, and trade secrets.
- 2.2. No Transfer: No intellectual property rights or ownership stakes are transferred under this Agreement. All project components remain fully proprietary.
- 2.3. Activation Keys: Access to or execution of certain premium features, modules, or binary distributions within the Software may require a valid, authorized activation key issued solely by the Author.
3. Grant of License and Permitted Use
Subject to your strict compliance with all terms of this Agreement, the Author hereby grants you a limited, non-exclusive, world-wide, royalty-free, revocable, and non-transferable license to:
- 3.1. Code Inspection: View and download the source code from official authorized repositories.
- 3.2. Local Modification: Modify the source code strictly for the purposes of Personal Local Use.
- 3.3. Local Execution: Execute the Software locally for personal evaluation and private deployment.
4. Prohibitions and Restrictions
Except as explicitly granted in Section 3, you shall not, and shall not permit any third party to:
- 4.1. Unauthorized Redistribution: Copy, redistribute, sublicense, republish, mirror, or publicly disclose any original or modified versions of the source code, binaries, or assets.
- 4.2. Commercial and SaaS Deployment: Host, deploy, embed, or utilize the Software for commercial purposes, including but not limited to Software-as-a-Service (SaaS), commercial web hosting, paid remote execution, cloud infrastructure integration, or enterprise internal utility.
- 4.3. Reverse Engineering: Reverse engineer, decompile, decrypt, or disassemble any binary components of the Software, except and only to the extent that such restriction is explicitly prohibited by applicable mandatory laws.
- 4.4. Notice Preservation: Remove, obscure, deface, or alter any copyright notices, trademarks, hyperlinked terms, or license files included within the Software distribution.
5. Prior Authorization and Application Channels
- 5.1. Authorization Requirement: Any activity exceeding the scope of Personal Local Use (including but not limited to public redistribution, independent forks not targeting upstream contributions, commercial deployment, or enterprise use) requires prior explicit written consent from the Author.
- 5.2. Official Application Channels: Users seeking such authorization must submit a formal request through one of the following official channels:
- Channel A (GitHub Fork): Initiating a standard Fork on the official GitHub repository for collaborative and upstream contributions.
- Channel B (GitHub Issues): Submitting a public issue utilizing the designated authorization request template.
- Channel C (Official Email): Sending a detailed inquiry to the official organizational email address associated with the PYAS Security project.
- 5.3. Request Content: Any application must explicitly state the specific use case, intended target audience, scope of deployment, and whether any commercial monetization is involved.
6. Updates, Amendments, and Scope of Terms
- 6.1. New Releases: The Author may deliver updates, critical security patches, feature enhancements, or user interface modifications. Continued use of the Software constitutes acceptance of the latest distributed version.
- 6.2. Non-Retroactivity: The Author reserves the right to amend this License Agreement at any time. Amendments apply strictly to subsequent versions or new downloads. Copies lawfully acquired prior to such modification remain governed by the exact version of the License under which they were originally obtained.
7. Telemetry, Data, and Privacy
- 7.1. Operational Data Collection: The Software may collect anonymized technical, operational, and usage data strictly for security analysis, performance optimization, and bug reporting.
- 7.2. Cloud Sample Submission: To enhance threat detection and malware analysis, the Software may automatically or manually transmit suspicious executable files and software samples to the Author's cloud infrastructure for deep analysis.
- 7.3. Scope of Collected Extensions: Sample collection targets potential executable and system binary formats, which explicitly include, but are not limited to, files with the following extensions: `.exe`, `.dll`, `.sys`, `.ocx`, `.scr`, `.efi`, `.acm`, `.ax`, `.cpl`, `.drv`, `.com`, `.mui`, `.pyd`, `.wfx`, `.api`, `.awx`, `.rll`, and `.winmd`.
- 7.4. Public Disclosure of Threat Intelligence: You explicitly acknowledge and agree that the metadata, behavioral reports, and threat intelligence data generated from the cloud analysis of submitted samples may be publicly disclosed, published, or shared with the cybersecurity community for collaborative defense purposes.
- 7.5. Opt-Out Mechanism: Cloud-based telemetry and sample submission are fully optional. Users who do not wish to participate in sample collection or cloud-assisted analysis may disable the corresponding cloud services at any time via the toggle switches provided within the Software’s settings interface.
8. Warranty Disclaimer and Limitation of Liability
- 8.1. Disclaimer of Warranty: TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE SOFTWARE AND ALL RELATED ASSETS ARE PROVIDED ON AN "AS IS" AND "AS AVAILABLE" BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED.
- 8.2. Limitation of Liability: TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL THE AUTHOR, COPYRIGHT HOLDERS, OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE. USERS ASSUME ALL RISKS REGARDING PERFORMANCE, DATA INTEGRITY, AND SYSTEM STABILITY.
© 2020-2026 87owo (PYAS Security). All rights reserved.</textarea>
</div>
+53 -23
View File
@@ -1,31 +1,61 @@
87owo Publicly Available Source Code License Agreement
Last updated: 2025-12-19
1. License and Ownership
- This software and its source code are source available for public view.
- Access or execution of certain features may require an activation key.
- 87owo reserves all legal rights, no intellectual property is transferred.
- All project archives, source code, and binaries remain fully proprietary.
Last Updated: 2026-06-09
IMPORTANT NOTICE: THIS LICENSE IS "SOURCE AVAILABLE" AND IS NOT AN OPEN SOURCE LICENSE APPROVED BY THE OPEN SOURCE INITIATIVE (OSI). BY DOWNLOADING, ACCESSING, OR USING THE SOFTWARE, YOU AGREE TO BE BOUND BY THESE TERMS.
2. Use and Prohibitions
- You may view, download, and modify the code for local and personal use.
- Redistribution of any original or modified code requires prior consent.
- Commercial hosting or SaaS deployment is prohibited without permission.
- Reverse engineering, license removal, or illegal use is strictly barred.
1. Definitions and Interpretation
3. Data and Privacy
- This project may collect operational data for optimization and analysis.
- All collected data is strictly anonymized to ensure the user's privacy.
- Transmission of information is encrypted to prevent unauthorized access.
- 1.1. Author: Refers to 87owo (PYAS Security).
- 1.2. Software: Refers to the source code, binaries, project archives, assets, and documentation associated with this repository or distribution.
- 1.3. Personal Local Use: Means viewing, downloading, executing, and modifying the Software strictly on local hardware owned or directly controlled by an individual for private, non-commercial, non-production, and non-distribution purposes.
- 1.4. Enterprise Use: Includes enterprise internal deployment, multi-user institutional use, or utilization within any corporate environment, which is strictly excluded from Personal Local Use.
4. Updates and Terms
- New releases may include critical patches, enhancements, or UI changes.
- Continued use of these services constitutes acceptance of updated terms.
- The author reserves the right to modify these license terms at any time.
2. Intellectual Property and Ownership
5. Warranty and Liability
- All services and assets are provided "as is" without any form of warranty.
- 87owo is not liable for any direct or indirect damages from software use.
- Users assume all risks regarding performance, data, and system integrity.
- 2.1. Retention of Rights: The Author reserves all legal rights, titles, and interests in and to the Software, including but not limited to all copyrights, trademarks, patents, and trade secrets.
- 2.2. No Transfer: No intellectual property rights or ownership stakes are transferred under this Agreement. All project components remain fully proprietary.
- 2.3. Activation Keys: Access to or execution of certain premium features, modules, or binary distributions within the Software may require a valid, authorized activation key issued solely by the Author.
3. Grant of License and Permitted Use
Subject to your strict compliance with all terms of this Agreement, the Author hereby grants you a limited, non-exclusive, world-wide, royalty-free, revocable, and non-transferable license to:
- 3.1. Code Inspection: View and download the source code from official authorized repositories.
- 3.2. Local Modification: Modify the source code strictly for the purposes of Personal Local Use.
- 3.3. Local Execution: Execute the Software locally for personal evaluation and private deployment.
4. Prohibitions and Restrictions
Except as explicitly granted in Section 3, you shall not, and shall not permit any third party to:
- 4.1. Unauthorized Redistribution: Copy, redistribute, sublicense, republish, mirror, or publicly disclose any original or modified versions of the source code, binaries, or assets.
- 4.2. Commercial and SaaS Deployment: Host, deploy, embed, or utilize the Software for commercial purposes, including but not limited to Software-as-a-Service (SaaS), commercial web hosting, paid remote execution, cloud infrastructure integration, or enterprise internal utility.
- 4.3. Reverse Engineering: Reverse engineer, decompile, decrypt, or disassemble any binary components of the Software, except and only to the extent that such restriction is explicitly prohibited by applicable mandatory laws.
- 4.4. Notice Preservation: Remove, obscure, deface, or alter any copyright notices, trademarks, hyperlinked terms, or license files included within the Software distribution.
5. Prior Authorization and Application Channels
- 5.1. Authorization Requirement: Any activity exceeding the scope of Personal Local Use (including but not limited to public redistribution, independent forks not targeting upstream contributions, commercial deployment, or enterprise use) requires prior explicit written consent from the Author.
- 5.2. Official Application Channels: Users seeking such authorization must submit a formal request through one of the following official channels:
- Channel A (GitHub Fork): Initiating a standard Fork on the official GitHub repository for collaborative and upstream contributions.
- Channel B (GitHub Issues): Submitting a public issue utilizing the designated authorization request template.
- Channel C (Official Email): Sending a detailed inquiry to the official organizational email address associated with the PYAS Security project.
- 5.3. Request Content: Any application must explicitly state the specific use case, intended target audience, scope of deployment, and whether any commercial monetization is involved.
6. Updates, Amendments, and Scope of Terms
- 6.1. New Releases: The Author may deliver updates, critical security patches, feature enhancements, or user interface modifications. Continued use of the Software constitutes acceptance of the latest distributed version.
- 6.2. Non-Retroactivity: The Author reserves the right to amend this License Agreement at any time. Amendments apply strictly to subsequent versions or new downloads. Copies lawfully acquired prior to such modification remain governed by the exact version of the License under which they were originally obtained.
7. Telemetry, Data, and Privacy
- 7.1. Operational Data Collection: The Software may collect anonymized technical, operational, and usage data strictly for security analysis, performance optimization, and bug reporting.
- 7.2. Cloud Sample Submission: To enhance threat detection and malware analysis, the Software may automatically or manually transmit suspicious executable files and software samples to the Author's cloud infrastructure for deep analysis.
- 7.3. Scope of Collected Extensions: Sample collection targets potential executable and system binary formats, which explicitly include, but are not limited to, files with the following extensions: `.exe`, `.dll`, `.sys`, `.ocx`, `.scr`, `.efi`, `.acm`, `.ax`, `.cpl`, `.drv`, `.com`, `.mui`, `.pyd`, `.wfx`, `.api`, `.awx`, `.rll`, and `.winmd`.
- 7.4. Public Disclosure of Threat Intelligence: You explicitly acknowledge and agree that the metadata, behavioral reports, and threat intelligence data generated from the cloud analysis of submitted samples may be publicly disclosed, published, or shared with the cybersecurity community for collaborative defense purposes.
- 7.5. Opt-Out Mechanism: Cloud-based telemetry and sample submission are fully optional. Users who do not wish to participate in sample collection or cloud-assisted analysis may disable the corresponding cloud services at any time via the toggle switches provided within the Software’s settings interface.
8. Warranty Disclaimer and Limitation of Liability
- 8.1. Disclaimer of Warranty: TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE SOFTWARE AND ALL RELATED ASSETS ARE PROVIDED ON AN "AS IS" AND "AS AVAILABLE" BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED.
- 8.2. Limitation of Liability: TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL THE AUTHOR, COPYRIGHT HOLDERS, OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE. USERS ASSUME ALL RISKS REGARDING PERFORMANCE, DATA INTEGRITY, AND SYSTEM STABILITY.
© 2020-2026 87owo (PYAS Security). All rights reserved.
+254 -77
View File
@@ -1,8 +1,8 @@
import os, re, gc, io, csv, sys, time, json, uuid, stat, queue, msvcrt, winreg
import shutil, hashlib, platform, threading, subprocess, pefile, pystray
import socket, requests, webview, webbrowser, ctypes, ctypes.wintypes
import os, re, gc, io, csv, sys, time, json, uuid, stat, queue, msvcrt
import shutil, hashlib, platform, threading, subprocess, pefile, winreg
import pystray, requests, webview, webbrowser, ctypes, ctypes.wintypes
from PIL import Image, ImageDraw
from PIL import Image
from concurrent.futures import ThreadPoolExecutor
from http.server import SimpleHTTPRequestHandler
from socketserver import TCPServer
@@ -36,12 +36,6 @@ class MIB_TCPROW_OWNER_PID(ctypes.Structure):
("dwOwningPid", ctypes.wintypes.DWORD)
]
class MIB_TCPTABLE_OWNER_PID(ctypes.Structure):
_fields_ = [
("dwNumEntries", ctypes.wintypes.DWORD),
("table", MIB_TCPROW_OWNER_PID * 1)
]
class FILE_NOTIFY_INFORMATION(ctypes.Structure):
_fields_ = [
("NextEntryOffset", ctypes.wintypes.DWORD),
@@ -50,17 +44,6 @@ class FILE_NOTIFY_INFORMATION(ctypes.Structure):
("FileName", ctypes.wintypes.WCHAR * 1024)
]
class SERVICE_STATUS(ctypes.Structure):
_fields_ = [
("dwServiceType", ctypes.wintypes.DWORD),
("dwCurrentState", ctypes.wintypes.DWORD),
("dwControlsAccepted", ctypes.wintypes.DWORD),
("dwWin32ExitCode", ctypes.wintypes.DWORD),
("dwServiceSpecificExitCode", ctypes.wintypes.DWORD),
("dwCheckPoint", ctypes.wintypes.DWORD),
("dwWaitHint", ctypes.wintypes.DWORD)
]
class PROCESS_BASIC_INFORMATION(ctypes.Structure):
_fields_ = [
("Reserved1", ctypes.wintypes.LPVOID),
@@ -232,13 +215,12 @@ class WindowAPI:
self.file_config = os.path.join(self.path_config, "PYAS", "Config.json")
self.file_log = os.path.join(self.path_config, "PYAS", "Report.json")
self.path_properties = os.path.join(self.path_pyas, "Engine", "Properties")
self.path_pattern = os.path.join(self.path_pyas, "Engine", "Pattern")
self.path_heuristic = os.path.join(self.path_pyas, "Engine", "Heuristic")
self.path_protect = os.path.join(self.path_pyas, "Plugins", "Filter")
self.path_drivers = os.path.join(self.path_protect, "PYAS_Driver.sys")
def init_windll(self):
for name in ["ntdll", "Psapi", "user32", "kernel32", "advapi32", "iphlpapi", "shell32", "fltlib"]:
for name in ["ntdll", "Psapi", "user32", "kernel32", "iphlpapi", "shell32", "fltlib"]:
try:
setattr(self, name.lower(), ctypes.WinDLL(name, use_last_error=True))
except Exception as e:
@@ -251,21 +233,6 @@ class WindowAPI:
self.user32.SendMessageTimeoutW.argtypes = [ctypes.wintypes.HWND, ctypes.wintypes.UINT, ctypes.wintypes.WPARAM, ctypes.c_void_p, ctypes.wintypes.UINT, ctypes.wintypes.UINT, ctypes.c_void_p]
self.user32.SendMessageTimeoutW.restype = ctypes.wintypes.LPARAM
self.advapi32.OpenSCManagerW.argtypes = [ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.wintypes.DWORD]
self.advapi32.OpenSCManagerW.restype = ctypes.wintypes.HANDLE
self.advapi32.CreateServiceW.argtypes = [ctypes.wintypes.HANDLE, ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.wintypes.DWORD, ctypes.wintypes.DWORD, ctypes.wintypes.DWORD, ctypes.wintypes.DWORD, ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.POINTER(ctypes.wintypes.DWORD), ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_wchar_p]
self.advapi32.CreateServiceW.restype = ctypes.wintypes.HANDLE
self.advapi32.OpenServiceW.argtypes = [ctypes.wintypes.HANDLE, ctypes.c_wchar_p, ctypes.wintypes.DWORD]
self.advapi32.OpenServiceW.restype = ctypes.wintypes.HANDLE
self.advapi32.StartServiceW.argtypes = [ctypes.wintypes.HANDLE, ctypes.wintypes.DWORD, ctypes.POINTER(ctypes.c_wchar_p)]
self.advapi32.StartServiceW.restype = ctypes.wintypes.BOOL
self.advapi32.ControlService.argtypes = [ctypes.wintypes.HANDLE, ctypes.wintypes.DWORD, ctypes.POINTER(SERVICE_STATUS)]
self.advapi32.ControlService.restype = ctypes.wintypes.BOOL
self.advapi32.DeleteService.argtypes = [ctypes.wintypes.HANDLE]
self.advapi32.DeleteService.restype = ctypes.wintypes.BOOL
self.advapi32.CloseServiceHandle.argtypes = [ctypes.wintypes.HANDLE]
self.advapi32.CloseServiceHandle.restype = ctypes.wintypes.BOOL
self.ntdll.NtQueryInformationProcess.argtypes = [ctypes.wintypes.HANDLE, ctypes.wintypes.ULONG, ctypes.c_void_p, ctypes.wintypes.ULONG, ctypes.POINTER(ctypes.wintypes.ULONG)]
self.ntdll.NtQueryInformationProcess.restype = ctypes.wintypes.ULONG
self.ntdll.NtSuspendProcess.argtypes = [ctypes.wintypes.HANDLE]
@@ -311,11 +278,9 @@ class WindowAPI:
self.kernel32.GetProcessIoCounters.restype = ctypes.wintypes.BOOL
self.kernel32.VirtualQueryEx.argtypes = [ctypes.wintypes.HANDLE, ctypes.c_void_p, ctypes.POINTER(MEMORY_BASIC_INFORMATION), ctypes.c_size_t]
self.kernel32.VirtualQueryEx.restype = ctypes.c_size_t
self.kernel32.SetProcessWorkingSetSize.argtypes = [ctypes.wintypes.HANDLE, ctypes.c_size_t, ctypes.c_size_t]
self.kernel32.SetProcessWorkingSetSize.restype = ctypes.wintypes.BOOL
self.psapi.EnumProcessModulesEx.argtypes = [ctypes.wintypes.HANDLE, ctypes.POINTER(ctypes.wintypes.HMODULE), ctypes.wintypes.DWORD, ctypes.POINTER(ctypes.wintypes.DWORD), ctypes.wintypes.DWORD]
self.psapi.EnumProcessModulesEx.restype = ctypes.wintypes.BOOL
self.psapi.GetModuleFileNameExW.argtypes = [ctypes.wintypes.HANDLE, ctypes.wintypes.HMODULE, ctypes.c_wchar_p, ctypes.wintypes.DWORD]
self.psapi.GetModuleFileNameExW.restype = ctypes.wintypes.DWORD
self.psapi.GetMappedFileNameW.argtypes = [ctypes.wintypes.HANDLE, ctypes.c_void_p, ctypes.wintypes.LPWSTR, ctypes.wintypes.DWORD]
self.psapi.GetMappedFileNameW.restype = ctypes.wintypes.DWORD
@@ -346,6 +311,7 @@ class WindowAPI:
self.cloud_pending = set()
self.last_io_counters = {}
self.last_io_time = time.time()
self.suspended_procs = set()
self.lock_driver = threading.RLock()
self.lock_update = threading.RLock()
@@ -355,7 +321,7 @@ class WindowAPI:
self.lock_io = threading.RLock()
self.pyas_default = {
"version": "3.5.9",
"version": "3.6.0",
"api_host": "https://pyas-security.com/",
"api_key": "fBRZxYS1UxykM-qzNOlKOEl63WILzlvgNMn6QfsG6FXCAAIktCrOPTAfY5_hEyuZ",
"suffix": [".exe", ".dll", ".sys", ".ocx", ".scr", ".efi", ".acm", ".ax", ".cpl", ".drv", ".com", ".mui", ".pyd", ".wfx", ".api", ".awx", ".rll", ".winmd", ".ax"],
@@ -365,6 +331,7 @@ class WindowAPI:
"theme": "system_switch",
"first_launch": True,
"process_switch": False,
"suspend_switch": True,
"document_switch": False,
"system_switch": False,
"driver_switch": False,
@@ -372,6 +339,7 @@ class WindowAPI:
"extension_switch": False,
"sensitive_switch": False,
"cloud_switch": False,
"autostart_switch": True,
"context_switch": False,
"custom_rule": [],
"white_list": [],
@@ -491,7 +459,6 @@ class WindowAPI:
def update_config(self, key, value):
with self.lock_update:
with self.lock_config:
old_value = self.pyas_config.get(key)
if old_value == value:
return value
@@ -518,9 +485,10 @@ class WindowAPI:
self.start_daemon_thread(self.pipe_server_thread)
else:
success = False
elif key == "context_switch":
self.register_context_menu(True)
elif key == "autostart_switch":
self.manage_autostart(True)
except Exception as e:
self.write_log("WARN", "Feature Start", detail=str(e), success=False)
@@ -530,6 +498,25 @@ class WindowAPI:
success = self.stop_system_driver()
elif key == "context_switch":
self.register_context_menu(False)
elif key == "document_switch":
with self.lock_file_ops:
if getattr(self, 'h_dir_file', None):
try:
self.kernel32.CloseHandle(self.h_dir_file)
except Exception:
pass
self.h_dir_file = None
elif key == "autostart_switch":
self.manage_autostart(False)
elif key == "suspend_switch":
with self.lock_proc:
if hasattr(self, 'suspended_procs'):
for h in list(self.suspended_procs):
try:
self.ntdll.NtResumeProcess(h)
except Exception:
pass
self.suspended_procs.clear()
if success:
with self.lock_config:
@@ -660,6 +647,20 @@ class WindowAPI:
pass
return False
def manage_autostart(self, enable):
try:
task_name = "PYAS_Security_ATS"
if enable:
cmd = f"$Action = New-ScheduledTaskAction -Execute '{self.file_pyas}' -Argument '-hide'; $Trigger = New-ScheduledTaskTrigger -AtLogOn; $Settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries; Register-ScheduledTask -TaskName '{task_name}' -Action $Action -Trigger $Trigger -Settings $Settings -RunLevel Highest -Force"
subprocess.run(["powershell", "-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-WindowStyle", "Hidden", "-Command", cmd], creationflags=0x08000000)
else:
subprocess.run(["schtasks", "/Delete", "/TN", task_name, "/F"], creationflags=0x08000000)
return True
except Exception as e:
self.write_log("WARN", "manage_autostart", detail=str(e), success=False)
return False
def manage_named_list(self, list_key, files, action="add", lock_func=None):
if list_key == "quarantine" and lock_func is None:
lock_func = self.lock_file
@@ -680,25 +681,24 @@ class WindowAPI:
acted_items = []
with self.lock_config:
target_list = self.pyas_config.setdefault(list_key, [])
if action == "add":
for path in norm_paths:
path_case = os.path.normcase(path)
exists = False
for item in target_list:
if isinstance(item, dict):
val = item.get("file", "")
np = self.norm_path(val, must_exist=False)
if np and os.path.normcase(np) == path_case:
exists = True
break
val = item.get("file", "") if isinstance(item, dict) else item
np = self.norm_path(val, must_exist=False)
if np and os.path.normcase(np) == path_case:
exists = True
break
if not exists:
if lock_func:
lock_func(path, True)
target_list.append({"file": path})
target_list.append({"file": path, "time": time.time()})
acted_items.append(path)
if list_key == "white_list":
self.sync_driver_whitelist(path, True)
@@ -706,7 +706,6 @@ class WindowAPI:
elif action == "remove":
norm_paths_case = {os.path.normcase(p) for p in norm_paths}
new_list = []
for item in target_list:
val = item.get("file", "") if isinstance(item, dict) else item
if val:
@@ -855,6 +854,12 @@ class WindowAPI:
"spanish_switch": "Abrir PYAS", "hindi_switch": "PYAS खोलें", "arabic_switch": "فتح PYAS",
"russian_switch": "Открыть PYAS", "slovenian_switch": "Odpri PYAS"
},
"optimize_mem": {
"traditional_switch": "一鍵加速", "simplified_switch": "一键加速", "english_switch": "Memory Boost",
"japanese_switch": "メモリ最適化", "korean_switch": "메모리 최적화", "french_switch": "Optimiser",
"spanish_switch": "Optimizar", "hindi_switch": "मेमोरी बूस्ट", "arabic_switch": "تسريع",
"russian_switch": "Ускорение", "slovenian_switch": "Optimizacija"
},
"check_update": {
"traditional_switch": "檢查更新", "simplified_switch": "检查更新", "english_switch": "Check Update",
"japanese_switch": "更新を確認", "korean_switch": "업데이트 확인", "french_switch": "Vérifier la mise à jour",
@@ -876,6 +881,7 @@ class WindowAPI:
menu = pystray.Menu(
pystray.MenuItem(lambda item: self.get_tray_text("open_ui"), self.restore_from_tray, default=True),
pystray.MenuItem(lambda item: self.get_tray_text("optimize_mem"), self.optimize_memory),
pystray.MenuItem(lambda item: self.get_tray_text("check_update"), self.tray_check_update),
pystray.MenuItem(lambda item: self.get_tray_text("exit_app"), self.close)
)
@@ -962,6 +968,36 @@ class WindowAPI:
self.stop_system_driver()
with self.lock_file_ops:
if getattr(self, 'h_dir_file', None):
try:
self.kernel32.CloseHandle(self.h_dir_file)
except Exception:
pass
self.h_dir_file = None
if hasattr(self, 'virus_lock'):
for file_path, (fd, lock_size) in list(self.virus_lock.items()):
try:
msvcrt.locking(fd, msvcrt.LK_UNLCK, lock_size)
except Exception:
pass
try:
os.close(fd)
except Exception:
pass
self.virus_lock.clear()
with self.lock_proc:
if hasattr(self, 'suspended_procs'):
for h in list(self.suspended_procs):
try:
self.ntdll.NtResumeProcess(h)
self.kernel32.CloseHandle(h)
except Exception:
pass
self.suspended_procs.clear()
if hasattr(self, 'h_mutex') and self.h_mutex:
try:
self.kernel32.CloseHandle(self.h_mutex)
@@ -970,6 +1006,19 @@ class WindowAPI:
if self._window:
self._window.destroy()
with self.lock_logs:
if getattr(self, 'logs_dirty', False):
try:
os.makedirs(os.path.dirname(self.file_log), exist_ok=True)
with open(self.file_log, "w", encoding="utf-8") as f:
json.dump(self.logs_data, f, indent=4, ensure_ascii=False)
except Exception:
pass
with self.lock_config:
pass
os._exit(0)
def init_ui_ready(self):
@@ -1094,18 +1143,43 @@ class WindowAPI:
return []
def open_file_location(self, file_path):
if file_path:
expanded_path = os.path.expandvars(file_path).strip('"').strip("'")
if not file_path:
return False
if os.path.exists(expanded_path):
try:
clean_path = os.path.normpath(expanded_path)
subprocess.Popen(f'explorer /select,"{clean_path}"')
expanded_path = os.path.expandvars(file_path).strip('"').strip("'")
reg_prefixes = ("HKLM", "HKCU", "HKCR", "HKU", "HKCC", "HKEY_")
return True
except Exception:
pass
if expanded_path.upper().startswith(reg_prefixes):
try:
full_path = expanded_path
if full_path.startswith("HKLM"):
full_path = full_path.replace("HKLM", "HKEY_LOCAL_MACHINE", 1)
elif full_path.startswith("HKCU"):
full_path = full_path.replace("HKCU", "HKEY_CURRENT_USER", 1)
elif full_path.startswith("HKCR"):
full_path = full_path.replace("HKCR", "HKEY_CLASSES_ROOT", 1)
elif full_path.startswith("HKU"):
full_path = full_path.replace("HKU", "HKEY_USERS", 1)
elif full_path.startswith("HKCC"):
full_path = full_path.replace("HKCC", "HKEY_CURRENT_CONFIG", 1)
subprocess.run(["taskkill", "/F", "/IM", "regedit.exe"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, creationflags=0x08000000)
self._reg_write(winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Applets\Regedit", "LastKey", winreg.REG_SZ, full_path)
subprocess.Popen("regedit.exe")
return True
except Exception:
pass
return False
if os.path.exists(expanded_path):
try:
clean_path = os.path.normpath(expanded_path)
subprocess.Popen(f'explorer /select,"{clean_path}"')
return True
except Exception:
pass
return False
def open_website(self):
@@ -1576,6 +1650,68 @@ class WindowAPI:
self.write_log("WARN", "clean_system_junk", detail=str(e), operate=True, success=False)
return 0
def optimize_memory(self, icon=None, item=None):
def _optimize():
try:
hwnd = self.user32.GetForegroundWindow()
fg_pid = ctypes.wintypes.DWORD(0)
if hwnd:
self.user32.GetWindowThreadProcessId(hwnd, ctypes.byref(fg_pid))
pids = self.get_process_list_pids()
optimized_count = 0
skip_set = {
"dwm.exe", "explorer.exe", "csrss.exe", "smss.exe", "winlogon.exe",
"lsass.exe", "services.exe", "svchost.exe", "wininit.exe", "audiodg.exe",
"spoolsv.exe", "sihost.exe", "fontdrvhost.exe", "taskmgr.exe"
}
for pid in pids:
if pid <= 4 or pid == self.pid_pyas or pid == fg_pid.value:
continue
name, _ = self.get_exe_info(pid)
if name and name.lower() in skip_set:
continue
h = self.kernel32.OpenProcess(0x0100, False, pid)
if h:
try:
if self.kernel32.SetProcessWorkingSetSize(h, ctypes.c_size_t(-1), ctypes.c_size_t(-1)):
optimized_count += 1
finally:
self.kernel32.CloseHandle(h)
title = self._loc({
"traditional_switch": "一鍵加速", "simplified_switch": "一键加速", "english_switch": "Memory Boost",
"japanese_switch": "メモリ最適化", "korean_switch": "메모리 최적화", "french_switch": "Optimiser",
"spanish_switch": "Optimizar", "hindi_switch": "मेमोरी बूस्ट", "arabic_switch": "تسريع",
"russian_switch": "Ускорение", "slovenian_switch": "Optimizacija"
})
msg = self._loc({
"traditional_switch": f"已釋放 {optimized_count} 個背景進程的記憶體",
"simplified_switch": f"已释放 {optimized_count} 个后台进程的内存",
"english_switch": f"Freed memory for {optimized_count} background processes",
"japanese_switch": f"{optimized_count} 個のバックグラウンドプロセスのメモリを解放しました",
"korean_switch": f"{optimized_count}개 백그라운드 프로세스 메모리 확보",
"french_switch": f"Mémoire libérée pour {optimized_count} processus",
"spanish_switch": f"Memoria liberada para {optimized_count} procesos",
"hindi_switch": f"{optimized_count} पृष्ठभूमि प्रक्रियाओं के लिए मेमोरी मुक्त की गई",
"arabic_switch": f"تم تحرير الذاكرة لـ {optimized_count} من العمليات في الخلفية",
"russian_switch": f"Освобождена память {optimized_count} фоновых процессов",
"slovenian_switch": f"Sproščen pomnilnik za {optimized_count} procesov v ozadju"
})
self.show_notification(title, msg)
self.write_log("INFO", "Memory Boost", detail=f"Optimized {optimized_count} processes", operate=True)
except Exception as e:
self.write_log("WARN", "optimize_memory", detail=str(e), success=False)
threading.Thread(target=_optimize, daemon=True).start()
def get_startup_list(self):
items = []
@@ -2581,24 +2717,42 @@ class WindowAPI:
for pid in new_pids:
h = self.kernel32.OpenProcess(0x1F0FFF, False, pid)
if h:
self.ntdll.NtSuspendProcess(h)
with self.lock_config:
should_suspend = self.pyas_config.get("suspend_switch", True)
if should_suspend:
self.ntdll.NtSuspendProcess(h)
with self.lock_proc:
self.suspended_procs.add(h)
try:
self.proc_pool.submit(self.handle_new_process, pid, h)
self.proc_pool.submit(self.handle_new_process, pid, h, should_suspend)
except Exception:
self.ntdll.NtResumeProcess(h)
self.kernel32.CloseHandle(h)
if should_suspend:
self.ntdll.NtResumeProcess(h)
with self.lock_proc:
self.suspended_procs.discard(h)
self.kernel32.CloseHandle(h)
except Exception as e:
self.write_log("WARN", "protect_proc_thread", detail=str(e), success=False)
def handle_new_process(self, pid, h=None):
def handle_new_process(self, pid, h=None, suspended=None):
if suspended is None:
with self.lock_config:
suspended = self.pyas_config.get("suspend_switch", True)
if not h:
h = self.kernel32.OpenProcess(0x1F0FFF, False, pid)
if not h:
return
self.ntdll.NtSuspendProcess(h)
if suspended:
self.ntdll.NtSuspendProcess(h)
with self.lock_proc:
if not hasattr(self, 'suspended_procs'):
self.suspended_procs = set()
self.suspended_procs.add(h)
try:
cmdline = self.get_process_cmdline(h)
process_file = self.get_process_file(h)
@@ -2648,8 +2802,17 @@ class WindowAPI:
self.write_log("BLOCK", "Process DLL Block", pid=pid, source=hidden_virus_path, file_hash=self.calc_file_hash(hidden_virus_path))
finally:
self.ntdll.NtResumeProcess(h)
self.kernel32.CloseHandle(h)
if suspended:
try:
self.ntdll.NtResumeProcess(h)
except Exception:
pass
with self.lock_proc:
self.suspended_procs.discard(h)
try:
self.kernel32.CloseHandle(h)
except Exception:
pass
def scan_process_memory(self, pid, h_process):
scanned_paths = set()
@@ -2697,10 +2860,17 @@ class WindowAPI:
return None
def protect_file_thread(self):
with self.lock_file_ops:
if getattr(self, 'h_dir_file', None):
return
hDir = self.kernel32.CreateFileW(self.path_user, 0x0001, 0x00000007, None, 3, 0x02000000, None)
if not hDir or hDir == -1:
return
with self.lock_file_ops:
self.h_dir_file = hDir
try:
buffer = ctypes.create_string_buffer(262144)
temp_prefix = os.path.normcase(self.path_temp)
@@ -2709,12 +2879,13 @@ class WindowAPI:
while True:
with self.lock_config:
if not self.pyas_config.get("document_switch", False): break
if not self.pyas_config.get("document_switch", False):
break
try:
bytes_returned = ctypes.wintypes.DWORD()
res = self.kernel32.ReadDirectoryChangesW(hDir, buffer, ctypes.sizeof(buffer), True, 0x0000001F, ctypes.byref(bytes_returned), None, None)
res = self.kernel32.ReadDirectoryChangesW(self.h_dir_file, buffer, ctypes.sizeof(buffer), True, 0x0000001F, ctypes.byref(bytes_returned), None, None)
if not res or bytes_returned.value == 0:
continue
break
offset = 0
while True:
@@ -2739,10 +2910,16 @@ class WindowAPI:
offset += notify.NextEntryOffset
except Exception as e:
self.write_log("WARN", "protect_file_thread", detail=str(e), success=False)
except Exception:
break
finally:
self.kernel32.CloseHandle(hDir)
with self.lock_file_ops:
if getattr(self, 'h_dir_file', None):
try:
self.kernel32.CloseHandle(self.h_dir_file)
except Exception:
pass
self.h_dir_file = None
def handle_new_file(self, file_path):
try:
+44 -24
View File
@@ -1,5 +1,5 @@
import os, re, yara, time, math, json, zlib, numpy, base64, requests, datetime
import ctypes, ctypes.wintypes, hashlib, pefile, threading, onnxruntime
import os, re, yara, time, math, json, zlib, mmap, numpy, datetime, requests
import ctypes, ctypes.wintypes, pefile, threading, onnxruntime
####################################################################################################
@@ -240,8 +240,8 @@ class pe_scanner:
f = float(val)
if math.isinf(f) or math.isnan(f):
return 0.0
return f
return f
except Exception:
return 0.0
@@ -260,23 +260,31 @@ class pe_scanner:
res = {"StringCount": 0.0, "StringMeanLength": 0.0, "StringEntropy": 0.0}
res.update(dict.fromkeys(self._STRING_KEYS, 0.0))
matches = self._STRING_PATTERN.findall(file_bytes)
if not matches:
return res
total_len = 0
count = 0
global_counts = numpy.zeros(256, dtype=numpy.int64)
mv = memoryview(file_bytes)
combined_data = b''.join(matches)
count = len(matches)
total_len = len(combined_data)
for m in self._STRING_PATTERN.finditer(file_bytes):
count += 1
start, end = m.span()
total_len += (end - start)
arr = numpy.frombuffer(mv[start:end], dtype=numpy.uint8)
global_counts += numpy.bincount(arr, minlength=256)
if count == 0 or total_len == 0:
return res
res["StringCount"] = float(count)
res["StringMeanLength"] = float(total_len) / count
res["StringEntropy"] = self._calc_entropy(combined_data)
arr = numpy.frombuffer(combined_data, dtype=numpy.uint8)
counts = numpy.bincount(arr, minlength=127)
char_counts = counts[0x20:0x7F]
counts_nonzero = global_counts[global_counts > 0]
if len(counts_nonzero) > 0:
res["StringEntropy"] = float(numpy.log2(total_len) - numpy.sum(counts_nonzero * numpy.log2(counts_nonzero)) / total_len)
valid_chars = global_counts[0x20:0x7F]
res.update(dict(zip(self._STRING_KEYS, valid_chars.astype(numpy.float64) / total_len)))
res.update(dict(zip(self._STRING_KEYS, char_counts.astype(numpy.float64) / total_len)))
return res
def _extract_histograms(self, file_bytes):
@@ -305,6 +313,7 @@ class pe_scanner:
byte_bins = w_counts.reshape(16, 16).sum(axis=1)
idx_start = ent_bin * 16
ent_hist[idx_start : idx_start+16] += byte_bins
else:
num_windows = (sz - window) // step + 1
batch_windows = 10000
@@ -445,6 +454,7 @@ class pe_scanner:
if getattr(struct, 'GuardCFFunctionTable', 0) != 0:
cfg["HasCFG"] = 1.0
if getattr(struct, 'SEHandlerTable', 0) != 0:
cfg["HasSEHTable"] = 1.0
@@ -479,7 +489,6 @@ class pe_scanner:
dw_length = int.from_bytes(file_bytes[curr:curr+4], 'little')
if dw_length < 8:
break
count += 1
curr += (dw_length + 7) & ~7
@@ -488,18 +497,21 @@ class pe_scanner:
def extract_features(self, file_path):
pe = None
mm = None
f = None
try:
fsize = os.path.getsize(file_path)
if fsize == 0 or fsize > 536870912:
return None
with open(file_path, "rb") as f:
file_bytes = f.read()
f = open(file_path, "rb")
mm = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
base = {}
dlls = set()
apis = set()
pe = pefile.PE(data=file_bytes, fast_load=True)
pe = pefile.PE(data=mm, fast_load=True)
try:
pe.parse_rich_header()
@@ -515,7 +527,7 @@ class pe_scanner:
pass
base['TrustSigned'] = 1.0 if self.signer.sign_verify(file_path) else 0.0
base['FileEntropy'] = self._calc_entropy(file_bytes)
base['FileEntropy'] = self._calc_entropy(mm)
base['FileSize'] = float(fsize)
fh = pe.FILE_HEADER
@@ -580,6 +592,7 @@ class pe_scanner:
try:
s_data = section.get_data()
s_entropy = self._calc_entropy(s_data)
except Exception:
s_entropy = 0.0
@@ -631,9 +644,9 @@ class pe_scanner:
if hasattr(pe, 'FileInfo'):
for fileinfo_list in pe.FileInfo:
for fileinfo in fileinfo_list:
if getattr(fileinfo, 'name', '') in ('StringFileInfo', b'StringFileInfo'):
for st in getattr(fileinfo, 'StringTable', []):
for key, val in st.entries.items():
try:
k = key.decode('utf-8', 'ignore') if isinstance(key, bytes) else str(key)
@@ -690,6 +703,7 @@ class pe_scanner:
for entry in pe.DIRECTORY_ENTRY_RESOURCE.entries:
if getattr(entry, 'id', None) == 3 and hasattr(entry, 'directory'):
icon_count += len(getattr(entry.directory, 'entries', []))
base['IconCount'] = float(icon_count)
else:
base['IconCount'] = 0.0
@@ -699,14 +713,14 @@ class pe_scanner:
else:
base['DebugCount'] = 0.0
base.update(self._extract_strings(file_bytes))
base.update(self._extract_histograms(file_bytes))
base.update(self._extract_strings(mm))
base.update(self._extract_histograms(mm))
base.update(self._extract_overlay_features(pe, fsize))
base.update(self._extract_rich_header(pe))
base.update(self._extract_ep_anomalies(pe))
base.update(self._extract_advanced_resources(pe))
base.update(self._extract_load_config(pe))
base.update(self._extract_security_directory(pe, file_bytes, fsize))
base.update(self._extract_security_directory(pe, mm, fsize))
for k in base:
base[k] = self._safe_float(base[k])
@@ -718,10 +732,15 @@ class pe_scanner:
finally:
if pe:
pe.close()
if mm:
mm.close()
if f:
f.close()
def pe_scan(self, file_path, enhanced_mode=False):
if not self.model or not self.feature_order:
return False, False
try:
raw_data = self.extract_features(file_path)
if not raw_data:
@@ -758,6 +777,8 @@ class pe_scanner:
vec[0, feat_map[new_fn]] += 1.0
outputs = self.model.run(None, {self.input_name: vec})
del raw_data, vec
result = outputs[1]
prob = 0.0
@@ -771,7 +792,6 @@ class pe_scanner:
prob = float(result[0][1])
score = int(prob * 100)
if score >= 80:
return f"General:WinPE/Malware.{score}!ml", score
elif enhanced_mode and score >= 50:
+1 -1
View File
@@ -1,6 +1,6 @@
#define AppId "{{a7d7bac3-93b8-4630-8308-c7a56bf7fdf4}"
#define AppName "PYAS"
#define AppVersion "3.5.9.0"
#define AppVersion "3.6.0.0"
#define AppPublisher "PYAS Security"
#define AppURL "https://github.com/87owo/PYAS"
#define AppExeName "PYAS.exe"
+1 -1
View File
@@ -2,7 +2,7 @@ import pyinstaller_versionfile
pyinstaller_versionfile.create_versionfile(
output_file="versionfile.txt",
version='3.5.9.0',
version='3.6.0.0',
company_name="PYAS Security",
file_description="PYAS Security Antivirus",
internal_name="PYAS",
+32 -2
View File
@@ -1,4 +1,4 @@
#include "DriverCommon.h"
#include "DriverCommon.h"
constexpr auto MAX_TRACKERS = 64;
constexpr auto RANSOM_TIME_WINDOW_MS = 3000;
@@ -597,8 +597,38 @@ update_cache:
}
BOOLEAN IsTargetProtected(HANDLE ProcessId) {
// 检查是否为已连接的 PYAS 进程
if ((ULONG)(ULONG_PTR)ProcessId == GlobalData.PyasPid) return TRUE;
return FALSE;
// 额外检查:通过进程路径匹配保护规则(后备保护机制)
if (KeGetCurrentIrql() != PASSIVE_LEVEL) return FALSE;
PUNICODE_STRING imageFileName = NULL;
NTSTATUS status = GetProcessImageName(ProcessId, &imageFileName);
if (!NT_SUCCESS(status) || !imageFileName || !imageFileName->Buffer) {
return FALSE;
}
BOOLEAN isProtected = FALSE;
KeEnterCriticalRegion();
ExAcquireResourceSharedLite(&RuleLock, TRUE);
// 检查进程路径是否匹配保护路径规则
PRULE_NODE Node = g_FileProtectedPaths;
while (Node) {
if (WildcardMatch(Node->Pattern.Buffer, imageFileName->Buffer, imageFileName->Length)) {
isProtected = TRUE;
break;
}
Node = Node->Next;
}
ExReleaseResourceLite(&RuleLock);
KeLeaveCriticalRegion();
if (imageFileName) ExFreePool(imageFileName);
return isProtected;
}
BOOLEAN CheckRegistryRule(PCUNICODE_STRING KeyName) {