diff --git a/Block-List.en-US.md b/Block-List.en-US.md new file mode 100644 index 0000000..8b9f72d --- /dev/null +++ b/Block-List.en-US.md @@ -0,0 +1,59 @@ +# Block List +The sub items stand for products that may be affected by this tool. +- 360 + - 360 Safe + - 360 Antivirus + - 360 Browser + - 360 Safe Suite (Safe + Antivirus + Browser) +- 2345 + - 2345 Browser + - 2345 Safeguard +- 6789 + - 6789 Zip +- Baidu + - Baidu Safeguard + - Baidu AntiVirus + - Baidu Browser + - Baidu NetDisk +- Baofeng Video +- Toutiao Video +- Driver Life +- Funshion Video +- Format Factory +- Kuai Zip +- Kingsoft + - Kingsoft Antivirus + - Liebao Browser + - WPS Office +- Kugou +- Kuwo +- LeTV +- PPTV +- iQIYI +- Rising + - Rising Antivirus +- Adware +- Ruanmei +- Sogou + - Sogou Pinyin IME + - Sogou Browser +- Sohu + - Sohu Video +- Taobao/UC + - Ali Wangwang + - UC Browser +- Tencent + - Tencent QQ + - TIM + - Tencent PC Manager + - QQ Browser +- Thunder + - Thunder X + - Thunder 9 + - Thunder Video Player + - Thunder Game Accelerator + - Thunder Game Box +- Youku +- YY + - YY VoIP + - YY Browser \ No newline at end of file diff --git a/Block-List.en.md b/Block-List.en.md deleted file mode 100644 index 60d1921..0000000 --- a/Block-List.en.md +++ /dev/null @@ -1,27 +0,0 @@ -# Block List -- 360 -- 2345 -- Baidu -- Baofeng Video -- Toutiao Video -- Driver Life -- Funshion -- Format Factory -- Kuai Zip -- Kingsoft -- Kugou -- Kuwo -- LeTV -- NetEase -- PPTV -- iQIYI -- Rising -- Adware -- Ruanmei -- Sogou -- Sohu -- Taobao/UC -- Tencent -- Thunder -- Youku -- YY \ No newline at end of file diff --git a/Block-List.zh-CN.md b/Block-List.zh-CN.md index a002299..45a290b 100644 --- a/Block-List.zh-CN.md +++ b/Block-List.zh-CN.md @@ -1,7 +1,20 @@ # 屏蔽列表 +子项目表示可能会受屏蔽影响的产品, 也可能有未在此列表的产品受影响. - 360 + - 360安全卫士 + - 360杀毒 + - 360浏览器 + - 360安全套装(卫士+杀毒+浏览器) - 2345 + - 2345浏览器 + - 2345卫士 +- 6789 + - 6789压缩 - 百度 + - 百度卫士 + - 百度杀毒 + - 百度浏览器 + - 百度网盘 - 暴风影音 - 头条视频 - 驱动人生 @@ -9,19 +22,38 @@ - 格式工厂 - 快压 - 金山 + - 金山毒霸 + - 猎豹浏览器 + - WPS Office - 酷狗 - 酷我 - 乐视 -- 网易 - PPTV - 爱奇艺 - 瑞星 + - 瑞星杀毒 - 广告下载器 - 软媒 - 搜狗 + - 搜狗拼音 + - 搜狗浏览器 - 搜狐 + - 搜狐影音 - 淘宝/UC + - 阿里旺旺 + - UC浏览器 - 腾讯 + - 腾讯QQ + - TIM + - 腾讯电脑管家 + - QQ浏览器 - 迅雷 + - 迅雷X + - 迅雷9 + - 迅雷影音 + - 网游加速器 + - 迅雷游戏盒子 - 优酷 -- YY语音/浏览器 \ No newline at end of file +- YY + - YY语音 + - YY浏览器 \ No newline at end of file diff --git a/README.en-US.md b/README.en-US.md new file mode 100644 index 0000000..4bbdebc --- /dev/null +++ b/README.en-US.md @@ -0,0 +1,44 @@ +# Malware Patch +[中文版](README.md) + +Prevent UAC authorization of Chinese malware, no need to run in background. + +Project inspired by [Windows apps that amaze us](https://amazing-apps.gitbooks.io/windows-apps-that-amaze-us/content/en/blacklist.html). + +## CLI Usage +- No parameter : Open GUI. +- `--silent-update` : Silently check and download update. +- `--disallow-all` : Disallow all UAC authorizations of malwares. +- `--allow-all` : Allow all UAC authorizations of malwares. +- `--remove` : Clean up temp files used for update. +- `--allow` : Select a program (from "Open File" dialog) and allow UAC authorization of it. +> The selected program must be signed because this app uses its digital signature to identify the program, the same below +- `--disallow` : Select a program and disallow UAC authorization of it. +- `--allow=file`: Allow UAC authorization of `file`. +- `--disallow=file`: Disallow UAC authorization of `file`. + +## System Support +- Windows 10 +- Windows 8.1 +- *Windows 7* (**Not tested yet**) + +## Language Support +- English +- 简体中文 + +## Block Lists +- [English](Block-List.en-US.md) +- [简体中文](Block-List.zh-CN.md) + +## Example +### Before + +Before + +### Disallow it and save + +Disallow it and save + +### After + +After diff --git a/README.md b/README.md index 053ea59..059abd8 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,44 @@ -# Malware Patch -[中文版](README.zh-CN.md) +# 软件屏蔽器 +[English version](README.en-US.md) + +阻止指定软件的管理员授权, 无需后台运行. + +项目灵感来源:[Windows apps that amaze us](https://amazing-apps.gitbooks.io/windows-apps-that-amaze-us/zh-CN/blacklist.html). + +## 命令行参数 +- 无参数 : 启动图形界面. +- `--silent-update` : 在后台进行更新. +- `--disallow-all` : 屏蔽所有支持的软件. +- `--allow-all` : 允许所有支持的软件. +- `--remove` : 清理更新的缓存文件. +- `--allow`: (从"打开文件"对话框)选择并允许程序. +> 程序必须拥有数字签名,因为本功能使用其数字签名实现,下同 +- `--disallow`: 选择并屏蔽程序. +- `--allow=file`: 允许传入的`file`. +- `--disallow=file`: 屏蔽传入的`file`. + +## 系统支持 +- Windows 10 +- Windows 8.1 +- *Windows 7* (**尚未测试**) -Prevent UAC authorization of Chinese malwares, **no** need to run in background. +## 语言支持 +- 简体中文 +- English -Project inspired by [Windows apps that amaze us](https://amazing-apps.gitbooks.io/windows-apps-that-amaze-us/content/en/blacklist.html). +## 屏蔽列表 +- [简体中文](Block-List.zh-CN.md) +- [English](Block-List.en-US.md) -*This repository contains only version info and binary.* +## 例子 +### 屏蔽前 -## CLI Usage -- No parameter : Open GUI. -- `--silent-update` : Silently check and download update. -- `--disallow-all` : Disallow all UAC authorizations of malwares. -- `--allow-all` : Allow all UAC authorizations of malwares. -- `--proxy=127.0.0.1:8000` : Set proxy for `--silent-update`. -- `--remove` : Clean up temp files used for update. -- `--allow=file`: Allow UAC authorization of `file`. (The `file` must be signed because app uses its digital signature to identify the program, same for disallow) -- `--disallow=file`: Disallow UAC authorization of `file`. +屏蔽前 -## About Temp Files -Currently this app only store new version file as `__mwp.exe` in the same directory. You can delete it manually after update. +### 屏蔽并保存 -## System Support -- Windows 10 -- Windows 8/8.1 -- *Windows 7* (**Not tested yet**) +屏蔽并保存 -## Language Support -- English -- 简体中文 - -## Block Lists -- [English](Block-List.en.md) -- [简体中文](Block-List.zh-CN.md) +### 屏蔽后 -## Example -### Before -![Before](before.png) -### Disallow it and save -![Disallow it and save](disallow.png) -### After -![After](after.png) +屏蔽后 \ No newline at end of file diff --git a/README.zh-CN.md b/README.zh-CN.md deleted file mode 100644 index 055fc05..0000000 --- a/README.zh-CN.md +++ /dev/null @@ -1,42 +0,0 @@ -# 软件屏蔽器 -[English version](README.md) - -阻止指定软件的管理员授权,**无需**后台运行. - -项目灵感来源:[Windows apps that amaze us](https://amazing-apps.gitbooks.io/windows-apps-that-amaze-us/zh-CN/blacklist.html). - -*此仓库仅包含版本信息和可执行程序.* - -## 命令行参数 -- 无参数 : 启动图形界面. -- `--silent-update` : 在后台进行更新. -- `--disallow-all` : 屏蔽所有支持的软件. -- `--allow-all` : 允许所有支持的软件. -- `--proxy=127.0.0.1:8000` : 为`--silent-update`指定代理. -- `--remove` : 清理更新的缓存文件. -- `--allow=file`: 允许传入的`file`. (`file`必须拥有数字签名,因为本功能使用其数字签名实现,下同) -- `--disallow=file`: 屏蔽传入的`file`. - -## 关于缓存文件 -目前此应用只会在同目录中产生更新文件`__mwp.exe`. 更新完成后你可以用手动删除它. - -## 系统支持 -- Windows 10 -- Windows 8/8.1 -- *Windows 7* (**尚未测试**) - -## 语言支持 -- 简体中文 -- English - -## 屏蔽列表 -- [简体中文](Block-List.zh-CN.md) -- [English](Block-List.en.md) - -## 例子 -### 屏蔽前 -![屏蔽前](before.png) -### 屏蔽并保存 -![屏蔽并保存](disallow.png) -### 屏蔽后 -![屏蔽后](after.png) \ No newline at end of file diff --git a/mwp-ver.txt b/mwp-ver.txt index a2a9ac2..93580fb 100644 --- a/mwp-ver.txt +++ b/mwp-ver.txt @@ -1 +1 @@ -2.6.0.0 \ No newline at end of file +2.9.1.0 \ No newline at end of file diff --git a/mwp.exe b/mwp.exe index 0c42488..d45f813 100644 Binary files a/mwp.exe and b/mwp.exe differ diff --git a/src/MalwarePatch.sln b/src/MalwarePatch.sln new file mode 100644 index 0000000..0c99abe --- /dev/null +++ b/src/MalwarePatch.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.16 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MalwarePatch", "MalwarePatch\MalwarePatch.csproj", "{769D2F79-D71B-4F5F-A61F-B1EF3A4C7414}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {769D2F79-D71B-4F5F-A61F-B1EF3A4C7414}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {769D2F79-D71B-4F5F-A61F-B1EF3A4C7414}.Debug|Any CPU.Build.0 = Debug|Any CPU + {769D2F79-D71B-4F5F-A61F-B1EF3A4C7414}.Release|Any CPU.ActiveCfg = Release|Any CPU + {769D2F79-D71B-4F5F-A61F-B1EF3A4C7414}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/MalwarePatch/Ace.dll b/src/MalwarePatch/Ace.dll new file mode 100644 index 0000000..929bde4 Binary files /dev/null and b/src/MalwarePatch/Ace.dll differ diff --git a/src/MalwarePatch/App.config b/src/MalwarePatch/App.config new file mode 100644 index 0000000..ecdcf8a --- /dev/null +++ b/src/MalwarePatch/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/MalwarePatch/App.xaml b/src/MalwarePatch/App.xaml new file mode 100644 index 0000000..c0918c5 --- /dev/null +++ b/src/MalwarePatch/App.xaml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/MalwarePatch/App.xaml.cs b/src/MalwarePatch/App.xaml.cs new file mode 100644 index 0000000..0635216 --- /dev/null +++ b/src/MalwarePatch/App.xaml.cs @@ -0,0 +1,60 @@ +using MalwarePatch.CliTools; +using MalwarePatch.Languages; +using MalwarePatch.Models; +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Diagnostics; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Shell; + +namespace MalwarePatch +{ + public partial class App : Application + { + protected override void OnStartup(StartupEventArgs e) + { + AppDomain.CurrentDomain.AssemblyResolve += assemblyResolveHandler; + //StartupUri = new Uri("MainWindow.xaml", UriKind.RelativeOrAbsolute); + base.OnStartup(e); + // CultureInfo.CurrentUICulture = new CultureInfo("en-US"); + AppJumpList.CreateJumpList(); +#if DEBUG + File.AppendAllText($"args.txt", string.Join(" ", e.Args)); +#endif + if (SilentUpdater.TryParse(e.Args) || + UserCertificateCli.TryParse(e.Args) || + MalwareChecker.TryParse(e.Args)) + { + Shutdown(); + } + else + { + Updater.InstallUpdateAndRun(this, e.Args); + } + } + static Assembly assemblyResolveHandler(object s, ResolveEventArgs e) + { + var dllName = new AssemblyName(e.Name).Name + ".dll"; + var assembly = Assembly.GetExecutingAssembly(); + var resourceName = assembly.GetManifestResourceNames().FirstOrDefault(name => name.EndsWith(dllName)); + if (resourceName == null) + { + return null; + } + using (var stream = assembly.GetManifestResourceStream(resourceName)) + { + var assemblyData = new byte[stream.Length]; + stream.Read(assemblyData, 0, assemblyData.Length); + return Assembly.Load(assemblyData); + } + } + } +} diff --git a/src/MalwarePatch/AppIcons/01-disallow-small.ico b/src/MalwarePatch/AppIcons/01-disallow-small.ico new file mode 100644 index 0000000..a402d9b Binary files /dev/null and b/src/MalwarePatch/AppIcons/01-disallow-small.ico differ diff --git a/src/MalwarePatch/AppIcons/02-allow-small.ico b/src/MalwarePatch/AppIcons/02-allow-small.ico new file mode 100644 index 0000000..17ed99b Binary files /dev/null and b/src/MalwarePatch/AppIcons/02-allow-small.ico differ diff --git a/src/MalwarePatch/AppJumpList.cs b/src/MalwarePatch/AppJumpList.cs new file mode 100644 index 0000000..a924f76 --- /dev/null +++ b/src/MalwarePatch/AppJumpList.cs @@ -0,0 +1,37 @@ +using MalwarePatch.Languages; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Shell; + +namespace MalwarePatch +{ + static class AppJumpList + { + public static void CreateJumpList() + { + var jumpList = new JumpList(); + var language = new MainLanguage(); + jumpList.JumpItems.Add(new JumpTask + { + Title = language[MainLanguage.Keys.DisallowProgram], + Arguments = "--disallow", + Description = language[MainLanguage.Keys.DisallowProgramDescription], + IconResourceIndex = 1, + }); + jumpList.JumpItems.Add(new JumpTask + { + Title = language[MainLanguage.Keys.AllowProgram], + Arguments = "--allow", + Description = language[MainLanguage.Keys.AllowProgramDescription], + IconResourceIndex = 2, + }); + jumpList.ShowFrequentCategory = false; + jumpList.ShowRecentCategory = false; + JumpList.SetJumpList(Application.Current, jumpList); + } + } +} diff --git a/src/MalwarePatch/Assets/Icons.UserCertificates.xaml b/src/MalwarePatch/Assets/Icons.UserCertificates.xaml new file mode 100644 index 0000000..2bd0e51 --- /dev/null +++ b/src/MalwarePatch/Assets/Icons.UserCertificates.xaml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/MalwarePatch/Assets/Icons.xaml b/src/MalwarePatch/Assets/Icons.xaml new file mode 100644 index 0000000..4b81a1f --- /dev/null +++ b/src/MalwarePatch/Assets/Icons.xaml @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/MalwarePatch/Assets/certificate-map.json b/src/MalwarePatch/Assets/certificate-map.json new file mode 100644 index 0000000..9084f55 --- /dev/null +++ b/src/MalwarePatch/Assets/certificate-map.json @@ -0,0 +1,175 @@ +{ + "360": [ + "360.cer", + "360 256.cer", + "360 sd.cer", + "360 browser 2018.11.cer", + "360 browser 256.2018.11.cer" + ], + "2345": [ + "2345.cer", + "2345 256.cer", + "2345 browser.cer", + "2345 browser 256.cer", + "2345 2019.6.cer", + "2345 256.2019.6.cer" + ], + "6789": [ + "6789.cer", + "6789 256.cer", + "6789 256.2019.4.cer" + ], + "Baidu": [ + "baidu.cer", + "baidusp.cer", + "baidu browser.cer", + "baidu download.cer", + "baidu browser.2018.7.8.cer", + "baidu browser 256.2018.7.8.cer", + "baidu netdisk.cer", + "baidu netdisk 256.cer" + ], + "Baofeng": [ + "baofeng.cer", + "baofeng 256.cer" + ], + "DongfangToutiao": [ + "donfang toutiao.cer", + "donfang toutiao 256.cer", + "donfang toutiao 2020.1.cer", + "donfang toutiao 256.2020.1.cer" + ], + "DriverLife": [ + "driveTheLife.cer", + "driveTheLife 256.cer", + "driveTheLife 2019.6.cer", + "driveTheLife 256.2019.6.cer" + ], + "Funshion": [ + "funshion.cer" + ], + "FormatFactory": [ + "grid verse (format factory).cer", + "grid verse (format factory) 256.cer", + "grid verse (format factory) 2018.12.cer" + ], + "HeiNote": [ + "7654 note.cer", + "7654 note 256.cer", + "7654 note 2019.10.cer", + "7654 note 256.2019.10.cer" + ], + "KuaiZip": [ + "kuaizip.cer", + "kuaizip 256.cer" + ], + "Kingsoft": [ + "kingsoft.cer", + "kingsoft 256.cer", + "kingsoft ws.cer", + "kingsoft browser.cer", + "kingsoft browser 256.cer", + "kingsoft wps.cer", + "kingsoft wps 256.cer", + "kingsoft 2019.6.cer", + "kingsoft 256.2019.6.cer" + ], + "Kugou": [ + "kugou.cer" + ], + "Kuwo": [ + "kuwo.cer" + ], + "LeTV": [ + "leshi.cer", + "leshi 256.cer" + ], + "PPTV": [ + "pptv.cer", + "pptv 256.cer", + "pptv 2019.1.cer", + "pptv 256.2019.1.cer", + "pplive.cer", + "pplive 256.cer" + ], + "iQIYI": [ + "qiyi.cer", + "qiyi 256.cer" + ], + "Rising": [ + "rising.cer", + "rising 256.cer", + "rising 2018.9.cer", + "rising 256.2018.9.cer", + "rising 2019.8.cer", + "rising 256.2019.8.cer" + ], + "Riyue": [ + "riyue (at).cer", + "riyue (at) 256.cer", + "xingcheng (at).cer", + "xingcheng (at) 256.cer" + ], + "Ruanmei": [ + "ruanmei.cer", + "ruanmei 256.cer", + "ruanmei 256.2019.1.cer" + ], + "Sogou": [ + "sogou.cer", + "sogou 256.cer", + "sogou 2019.8.cer", + "sogou 256.2019.8.cer", + "sogou 2019.10.cer", + "sogou 256.2019.10.cer" + ], + "Sohu": [ + "sohu.cer", + "sohu 2018.12.cer" + ], + "Taobao": [ + "taobao.cer", + "taobao 256.cer", + "aliwangwang 2018.8.cer", + "aliwangwang 256.2018.8.cer" + ], + "Tencent": [ + "tencent.cer", + "tencent 256.cer", + "tencent 2018.11.cer", + "tencent 256.2018.11.cer" + ], + "Thunder": [ + "thunder.cer", + "thunder 256.cer", + "thunder 2018.9.cer", + "thunder 256.2018.9.cer", + "thunder player.cer", + "thunder player 256.cer", + "thunder game.cer", + "thunder game 256.cer", + "thunder game.2018.7.8.cer", + "thunder game 256.2018.7.8.cer", + "thunder accel.cer", + "thunder accel 256.cer", + "thunder player 2018.12.cer", + "thunder player 256.2018.12.cer", + "thunder 2020.1.cer", + "thunder 256.2020.1.cer" + ], + "Youku": [ + "youku.cer", + "youku 256.cer", + "youku 2018.8.cer", + "youku 256.2018.8.cer" + ], + "YY": [ + "yy.cer", + "yy 256.cer", + "yy browser.cer", + "yy 2018.12.cer", + "yy 256.2018.12.cer", + "yy 2020.1.cer", + "yy 256.2020.1.cer" + ] +} diff --git a/src/MalwarePatch/Assets/display-names.json b/src/MalwarePatch/Assets/display-names.json new file mode 100644 index 0000000..92f4df9 --- /dev/null +++ b/src/MalwarePatch/Assets/display-names.json @@ -0,0 +1,61 @@ +{ + "en-US": { + "360": "360", + "2345": "2345", + "6789": "6789", + "Baidu": "Baidu", + "Baofeng": "Baofeng Video", + "DongfangToutiao": "Toutiao Video", + "DriverLife": "Driver Life", + "Funshion": "Funshion", + "FormatFactory": "Format Factory", + "HeiNote": "Hei Note", + "KuaiZip": "Kuai Zip", + "Kingsoft": "Kingsoft", + "Kugou": "Kugou", + "Kuwo": "Kuwo", + "LeTV": "LeTV", + "PPTV": "PPTV", + "iQIYI": "iQIYI", + "Rising": "Rising", + "Riyue": "Adware", + "Ruanmei": "Ruanmei", + "Sogou": "Sogou", + "Sohu": "Sohu", + "Taobao": "Taobao/UC", + "Tencent": "Tencent", + "Thunder": "Thunder", + "Youku": "Youku", + "YY": "YY" + }, + "zh-CN": { + "360": "360", + "2345": "2345", + "6789": "6789", + "Baidu": "百度", + "Baofeng": "暴风影音", + "DongfangToutiao": "头条视频", + "DriverLife": "驱动人生", + "Funshion": "风行", + "FormatFactory": "格式工厂", + "HackedFlash": "病毒版Flash", + "HeiNote": "小黑记事本", + "KuaiZip": "快压", + "Kingsoft": "金山", + "Kugou": "酷狗", + "Kuwo": "酷我", + "LeTV": "乐视", + "PPTV": "PPTV", + "iQIYI": "爱奇艺", + "Rising": "瑞星", + "Riyue": "广告下载器", + "Ruanmei": "软媒", + "Sogou": "搜狗", + "Sohu": "搜狐", + "Taobao": "淘宝/UC", + "Tencent": "腾讯", + "Thunder": "迅雷", + "Youku": "优酷", + "YY": "YY" + } +} diff --git a/src/MalwarePatch/Assets/malware-remote-info.json b/src/MalwarePatch/Assets/malware-remote-info.json new file mode 100644 index 0000000..ee81984 --- /dev/null +++ b/src/MalwarePatch/Assets/malware-remote-info.json @@ -0,0 +1,233 @@ +{ + "360": { + "fixed": [ + "https://dl.360safe.com/inst.exe", + "https://dl.360safe.com/se/360se_setup.exe", + "https://dl.360safe.com/inst_safe_se.exe", + "https://dl.360safe.com/360safe_cq.exe", + "http://down.360safe.com/bizhi/360wallpaper_baidu.exe", + "http://cdn-file-ssl-bizhi.ludashi.com/pc/appstore/huanliang/360wallpaper_360se.exe", + "http://down.360safe.com/bizhi/360wallpaper_bird.exe" + ], + "match": [ + { + "url": "http://sd.360.cn/", + "regex": "href=\"(http://down.360safe.com/360sd/.*?.exe)", + "group": 1 + } + ] + }, + "2345": { + "fixed": [], + "match": [ + { + "url": "http://ie.2345.com/chrome/freecall/", + "regex": "'href'\\s*:\\s*'(.*?[^beta]\\.exe)',", + "group": 1 + }, + { + "url": "http://safe.2345.cc/", + "regex": "downl[ao][ao]dUrl\" href=\"(.*?)\"", + "group": 1 + } + ] + }, + "Baidu": { + "fixed": [], + "match": [] + }, + "Baofeng": { + "fixed": [], + "match": [ + { + "url": "http://home.baofeng.com/", + "regex": "立即下载", + "group": 2 + } + ] + }, + "DongfangToutiao": { + "fixed": [ + "http://kan.eastday.com/download/" + ], + "match": [] + }, + "DriverLife": { + "fixed": [], + "match": [ + { + "url": "http://www.160.com/", + "regex": "href=\"(http[s]?://file1.updrv.com/soft/dtl8/.*?\.exe)", + "group": 1 + } + ] + }, + "FormatFactory": { + "fixed": [ + "http://down.pcgeshi.com/FormatFactory_setup.exe" + ], + "match": [] + }, + "HeiNote": { + "fixed": [], + "match": [ + { + "url": "http://heinote.7654.com/", + "regex": "href=\"(http://d\\.heinote\\.com/downloads/.*?)\"", + "group": 1 + } + ] + }, + "KuaiZip": { + "fixed": [], + "match": [ + { + "url": "http://www.kuaizip.com/", + "regex": "href=\"(http://dl\\.kkdownload\\.com/.*.exe)", + "group": 1 + } + ] + }, + "Kingsoft": { + "fixed": [], + "match": [ + { + "url": "http://www.ijinshan.com/", + "regex": "top_down_btn.*href=\"(.*?)\"", + "group": 1 + }, + { + "url": "https://www.liebao.cn/", + "regex": "href=\"(http[s]?://dl.liebao.cn/kb/KSbrowser.*?)\"", + "group": 1 + }, + { + "url": "http://www.wps.cn/", + "regex": "class=\"btn btn-lg\"\\s*href=\"(.*?)\"\\s*onclick.*?WPS Office 2019 PC", + "group": 1 + } + ] + }, + "Kugou": { + "fixed": [ + "http://download.kugou.com/download/kugou_pc" + ], + "match": [] + }, + "Kuwo": { + "fixed": [ + "http://down.kuwo.cn/mbox/kwmusic_web_4.exe" + ], + "match": [] + }, + "PPTV": { + "fixed": [ + "http://app.aplus.pptv.com/minisite/download/" + ], + "match": [] + }, + "iQIYI": { + "fixed": [ + "http://dl.static.iqiyi.com/hz/IQIYIsetup_app.exe" + ], + "match": [] + }, + "Rising": { + "fixed": [], + "match": [ + { + "url": "http://www.rising.com.cn/service/javascript/RsDownProVer.js", + "regex": "var RsPcV17Url=\"(.*)\"", + "group": 1 + } + ] + }, + "Ruanmei": { + "fixed": [], + "match": [ + { + "url": "http://mofang.ruanmei.com/", + "regex": "href=\"(http[s]?://d.ruanmei.com/pcmaster/.*?)\"", + "group": 1 + } + ] + }, + "Sogou": { + "fixed": [], + "match": [ + { + "url": "https://pinyin.sogou.com/", + "regex": "banner0_link2.*href=\"(.*?)\"", + "group": 1 + }, + { + "url": "https://ie.sogou.com/", + "regex": "nav=\"download\".*href=\"(.*?)\"", + "group": 1 + } + ] + }, + "Sohu": { + "fixed": [], + "match": [ + { + "url": "https://tv.sohu.com/app/?x=4", + "regex": "href=\"(.*?)\".*btn-dwn", + "group": 1 + } + ] + }, + "Taobao": { + "fixed": [ + "https://alimarket.taobao.com/markets/qnww/aliww-download?wh_from=win" + ], + "match": [] + }, + "Tencent": { + "fixed": [], + "match": [ + { + "url": "http://im.qq.com/pcqq/", + "regex": "href=\"(.*?)\".*class=\"download\"", + "group": 1 + }, + { + "url": "https://office.qq.com/download.html", + "regex": "href=\"(.*?)\".*tim.downloads.windows", + "group": 1 + }, + { + "url": "https://guanjia.qq.com/", + "regex": "href=\"(.*?)\".*banner_download", + "group": 1 + } + ] + }, + "Thunder": { + "fixed": [ + "http://down.sandai.net/XLNetAcc/XLNetAccSetup.exe" + ], + "match": [ + { + "url": "http://dl.xunlei.com", + "regex": "href=\"(http://down.sandai.net/thunderx/.*?.exe)", + "group": 1 + }, + { + "url": "http://dl.xunlei.com", + "regex": "href=\"(http://xmp.down.sandai.net/.*?.exe)", + "group": 1 + } + ] + }, + "YY": { + "fixed": [], + "match": [ + { + "url": "http://www.yy.com/web/pcyy_download/", + "regex": "window\\.location\\.href=\"(.*?)\"", + "group": 1 + } + ] + } +} diff --git a/src/MalwarePatch/BuildTools/InsertIcons.exe b/src/MalwarePatch/BuildTools/InsertIcons.exe new file mode 100644 index 0000000..4388cf6 Binary files /dev/null and b/src/MalwarePatch/BuildTools/InsertIcons.exe differ diff --git a/src/MalwarePatch/Certificates/2345 2019.6.cer b/src/MalwarePatch/Certificates/2345 2019.6.cer new file mode 100644 index 0000000..258f5be Binary files /dev/null and b/src/MalwarePatch/Certificates/2345 2019.6.cer differ diff --git a/src/MalwarePatch/Certificates/2345 256.2019.6.cer b/src/MalwarePatch/Certificates/2345 256.2019.6.cer new file mode 100644 index 0000000..62ac030 Binary files /dev/null and b/src/MalwarePatch/Certificates/2345 256.2019.6.cer differ diff --git a/src/MalwarePatch/Certificates/2345 256.cer b/src/MalwarePatch/Certificates/2345 256.cer new file mode 100644 index 0000000..6c7ac0c Binary files /dev/null and b/src/MalwarePatch/Certificates/2345 256.cer differ diff --git a/src/MalwarePatch/Certificates/2345 browser 256.cer b/src/MalwarePatch/Certificates/2345 browser 256.cer new file mode 100644 index 0000000..712692d Binary files /dev/null and b/src/MalwarePatch/Certificates/2345 browser 256.cer differ diff --git a/src/MalwarePatch/Certificates/2345 browser.cer b/src/MalwarePatch/Certificates/2345 browser.cer new file mode 100644 index 0000000..199fe15 Binary files /dev/null and b/src/MalwarePatch/Certificates/2345 browser.cer differ diff --git a/src/MalwarePatch/Certificates/2345.cer b/src/MalwarePatch/Certificates/2345.cer new file mode 100644 index 0000000..9acc9a3 Binary files /dev/null and b/src/MalwarePatch/Certificates/2345.cer differ diff --git a/src/MalwarePatch/Certificates/360 256.cer b/src/MalwarePatch/Certificates/360 256.cer new file mode 100644 index 0000000..2aeaa8a Binary files /dev/null and b/src/MalwarePatch/Certificates/360 256.cer differ diff --git a/src/MalwarePatch/Certificates/360 browser 2018.11.cer b/src/MalwarePatch/Certificates/360 browser 2018.11.cer new file mode 100644 index 0000000..8b62f16 Binary files /dev/null and b/src/MalwarePatch/Certificates/360 browser 2018.11.cer differ diff --git a/src/MalwarePatch/Certificates/360 browser 256.2018.11.cer b/src/MalwarePatch/Certificates/360 browser 256.2018.11.cer new file mode 100644 index 0000000..377c094 Binary files /dev/null and b/src/MalwarePatch/Certificates/360 browser 256.2018.11.cer differ diff --git a/src/MalwarePatch/Certificates/360 sd.cer b/src/MalwarePatch/Certificates/360 sd.cer new file mode 100644 index 0000000..d7aed1e Binary files /dev/null and b/src/MalwarePatch/Certificates/360 sd.cer differ diff --git a/src/MalwarePatch/Certificates/360.cer b/src/MalwarePatch/Certificates/360.cer new file mode 100644 index 0000000..6014bc2 Binary files /dev/null and b/src/MalwarePatch/Certificates/360.cer differ diff --git a/src/MalwarePatch/Certificates/6789 256.2019.4.cer b/src/MalwarePatch/Certificates/6789 256.2019.4.cer new file mode 100644 index 0000000..44e8c3d Binary files /dev/null and b/src/MalwarePatch/Certificates/6789 256.2019.4.cer differ diff --git a/src/MalwarePatch/Certificates/6789 256.cer b/src/MalwarePatch/Certificates/6789 256.cer new file mode 100644 index 0000000..b9cbf11 Binary files /dev/null and b/src/MalwarePatch/Certificates/6789 256.cer differ diff --git a/src/MalwarePatch/Certificates/6789.cer b/src/MalwarePatch/Certificates/6789.cer new file mode 100644 index 0000000..b9cbf11 Binary files /dev/null and b/src/MalwarePatch/Certificates/6789.cer differ diff --git a/src/MalwarePatch/Certificates/7654 note 2019.10.cer b/src/MalwarePatch/Certificates/7654 note 2019.10.cer new file mode 100644 index 0000000..1b306bc Binary files /dev/null and b/src/MalwarePatch/Certificates/7654 note 2019.10.cer differ diff --git a/src/MalwarePatch/Certificates/7654 note 256.2019.10.cer b/src/MalwarePatch/Certificates/7654 note 256.2019.10.cer new file mode 100644 index 0000000..e6c6bcb Binary files /dev/null and b/src/MalwarePatch/Certificates/7654 note 256.2019.10.cer differ diff --git a/src/MalwarePatch/Certificates/7654 note 256.cer b/src/MalwarePatch/Certificates/7654 note 256.cer new file mode 100644 index 0000000..8c18aa4 Binary files /dev/null and b/src/MalwarePatch/Certificates/7654 note 256.cer differ diff --git a/src/MalwarePatch/Certificates/7654 note.cer b/src/MalwarePatch/Certificates/7654 note.cer new file mode 100644 index 0000000..b06b645 Binary files /dev/null and b/src/MalwarePatch/Certificates/7654 note.cer differ diff --git a/src/MalwarePatch/Certificates/@Target.txt b/src/MalwarePatch/Certificates/@Target.txt new file mode 100644 index 0000000..286d506 --- /dev/null +++ b/src/MalwarePatch/Certificates/@Target.txt @@ -0,0 +1,34 @@ +360... +2345explorer/pcsafe +6789zip +aliwangwang +BaiduSd/BaiduAn/browser/netdisk +Baofeng +leTV +Donfang Video +driveTheLife +FormatFactory +Funshion +HeiNote +iQiYi +KuaiZip +Kingsoft Antivirus/Browser +Kugou +Kuwo +NetEase +PCMaster +PPTV +QQ/QQPCMgr/TIM +RisingSD +SogouPinyin/Explorer +SohuVA +Thunder player/game +YoukuClient +YouDao +YY + +Updated 08/13/2018 + +// Manual +Youku +Riyue diff --git a/src/MalwarePatch/Certificates/aliwangwang 2018.8.cer b/src/MalwarePatch/Certificates/aliwangwang 2018.8.cer new file mode 100644 index 0000000..ed82e27 Binary files /dev/null and b/src/MalwarePatch/Certificates/aliwangwang 2018.8.cer differ diff --git a/src/MalwarePatch/Certificates/aliwangwang 256.2018.8.cer b/src/MalwarePatch/Certificates/aliwangwang 256.2018.8.cer new file mode 100644 index 0000000..6fcb921 Binary files /dev/null and b/src/MalwarePatch/Certificates/aliwangwang 256.2018.8.cer differ diff --git a/src/MalwarePatch/Certificates/baidu browser 256.2018.7.8.cer b/src/MalwarePatch/Certificates/baidu browser 256.2018.7.8.cer new file mode 100644 index 0000000..0b95df9 Binary files /dev/null and b/src/MalwarePatch/Certificates/baidu browser 256.2018.7.8.cer differ diff --git a/src/MalwarePatch/Certificates/baidu browser.2018.7.8.cer b/src/MalwarePatch/Certificates/baidu browser.2018.7.8.cer new file mode 100644 index 0000000..c74f2aa Binary files /dev/null and b/src/MalwarePatch/Certificates/baidu browser.2018.7.8.cer differ diff --git a/src/MalwarePatch/Certificates/baidu browser.cer b/src/MalwarePatch/Certificates/baidu browser.cer new file mode 100644 index 0000000..4b768cc Binary files /dev/null and b/src/MalwarePatch/Certificates/baidu browser.cer differ diff --git a/src/MalwarePatch/Certificates/baidu download.cer b/src/MalwarePatch/Certificates/baidu download.cer new file mode 100644 index 0000000..688ebfe Binary files /dev/null and b/src/MalwarePatch/Certificates/baidu download.cer differ diff --git a/src/MalwarePatch/Certificates/baidu netdisk 256.cer b/src/MalwarePatch/Certificates/baidu netdisk 256.cer new file mode 100644 index 0000000..688ebfe Binary files /dev/null and b/src/MalwarePatch/Certificates/baidu netdisk 256.cer differ diff --git a/src/MalwarePatch/Certificates/baidu netdisk.cer b/src/MalwarePatch/Certificates/baidu netdisk.cer new file mode 100644 index 0000000..6896fbf Binary files /dev/null and b/src/MalwarePatch/Certificates/baidu netdisk.cer differ diff --git a/src/MalwarePatch/Certificates/baidu.cer b/src/MalwarePatch/Certificates/baidu.cer new file mode 100644 index 0000000..a3bbea3 Binary files /dev/null and b/src/MalwarePatch/Certificates/baidu.cer differ diff --git a/src/MalwarePatch/Certificates/baidusp.cer b/src/MalwarePatch/Certificates/baidusp.cer new file mode 100644 index 0000000..4b768cc Binary files /dev/null and b/src/MalwarePatch/Certificates/baidusp.cer differ diff --git a/src/MalwarePatch/Certificates/baofeng 256.cer b/src/MalwarePatch/Certificates/baofeng 256.cer new file mode 100644 index 0000000..2d2daed Binary files /dev/null and b/src/MalwarePatch/Certificates/baofeng 256.cer differ diff --git a/src/MalwarePatch/Certificates/baofeng.cer b/src/MalwarePatch/Certificates/baofeng.cer new file mode 100644 index 0000000..7a25f8d Binary files /dev/null and b/src/MalwarePatch/Certificates/baofeng.cer differ diff --git a/src/MalwarePatch/Certificates/donfang toutiao 2020.1.cer b/src/MalwarePatch/Certificates/donfang toutiao 2020.1.cer new file mode 100644 index 0000000..43211ef Binary files /dev/null and b/src/MalwarePatch/Certificates/donfang toutiao 2020.1.cer differ diff --git a/src/MalwarePatch/Certificates/donfang toutiao 256.2020.1.cer b/src/MalwarePatch/Certificates/donfang toutiao 256.2020.1.cer new file mode 100644 index 0000000..4a3fd64 Binary files /dev/null and b/src/MalwarePatch/Certificates/donfang toutiao 256.2020.1.cer differ diff --git a/src/MalwarePatch/Certificates/donfang toutiao 256.cer b/src/MalwarePatch/Certificates/donfang toutiao 256.cer new file mode 100644 index 0000000..26fbc25 Binary files /dev/null and b/src/MalwarePatch/Certificates/donfang toutiao 256.cer differ diff --git a/src/MalwarePatch/Certificates/donfang toutiao.cer b/src/MalwarePatch/Certificates/donfang toutiao.cer new file mode 100644 index 0000000..3f99045 Binary files /dev/null and b/src/MalwarePatch/Certificates/donfang toutiao.cer differ diff --git a/src/MalwarePatch/Certificates/driveTheLife 2019.6.cer b/src/MalwarePatch/Certificates/driveTheLife 2019.6.cer new file mode 100644 index 0000000..01343ea Binary files /dev/null and b/src/MalwarePatch/Certificates/driveTheLife 2019.6.cer differ diff --git a/src/MalwarePatch/Certificates/driveTheLife 256.2019.6.cer b/src/MalwarePatch/Certificates/driveTheLife 256.2019.6.cer new file mode 100644 index 0000000..01343ea Binary files /dev/null and b/src/MalwarePatch/Certificates/driveTheLife 256.2019.6.cer differ diff --git a/src/MalwarePatch/Certificates/driveTheLife 256.cer b/src/MalwarePatch/Certificates/driveTheLife 256.cer new file mode 100644 index 0000000..0c7181d Binary files /dev/null and b/src/MalwarePatch/Certificates/driveTheLife 256.cer differ diff --git a/src/MalwarePatch/Certificates/driveTheLife.cer b/src/MalwarePatch/Certificates/driveTheLife.cer new file mode 100644 index 0000000..b05e3b9 Binary files /dev/null and b/src/MalwarePatch/Certificates/driveTheLife.cer differ diff --git a/src/MalwarePatch/Certificates/funshion.cer b/src/MalwarePatch/Certificates/funshion.cer new file mode 100644 index 0000000..404da98 Binary files /dev/null and b/src/MalwarePatch/Certificates/funshion.cer differ diff --git a/src/MalwarePatch/Certificates/grid verse (format factory) 2018.12.cer b/src/MalwarePatch/Certificates/grid verse (format factory) 2018.12.cer new file mode 100644 index 0000000..b97ea96 Binary files /dev/null and b/src/MalwarePatch/Certificates/grid verse (format factory) 2018.12.cer differ diff --git a/src/MalwarePatch/Certificates/grid verse (format factory) 256.cer b/src/MalwarePatch/Certificates/grid verse (format factory) 256.cer new file mode 100644 index 0000000..0035708 Binary files /dev/null and b/src/MalwarePatch/Certificates/grid verse (format factory) 256.cer differ diff --git a/src/MalwarePatch/Certificates/grid verse (format factory).cer b/src/MalwarePatch/Certificates/grid verse (format factory).cer new file mode 100644 index 0000000..964709d Binary files /dev/null and b/src/MalwarePatch/Certificates/grid verse (format factory).cer differ diff --git a/src/MalwarePatch/Certificates/kingsoft 2019.6.cer b/src/MalwarePatch/Certificates/kingsoft 2019.6.cer new file mode 100644 index 0000000..e33a1f3 Binary files /dev/null and b/src/MalwarePatch/Certificates/kingsoft 2019.6.cer differ diff --git a/src/MalwarePatch/Certificates/kingsoft 256.2019.6.cer b/src/MalwarePatch/Certificates/kingsoft 256.2019.6.cer new file mode 100644 index 0000000..a9a1123 Binary files /dev/null and b/src/MalwarePatch/Certificates/kingsoft 256.2019.6.cer differ diff --git a/src/MalwarePatch/Certificates/kingsoft 256.cer b/src/MalwarePatch/Certificates/kingsoft 256.cer new file mode 100644 index 0000000..a9a1123 Binary files /dev/null and b/src/MalwarePatch/Certificates/kingsoft 256.cer differ diff --git a/src/MalwarePatch/Certificates/kingsoft browser 256.cer b/src/MalwarePatch/Certificates/kingsoft browser 256.cer new file mode 100644 index 0000000..ebe7e00 Binary files /dev/null and b/src/MalwarePatch/Certificates/kingsoft browser 256.cer differ diff --git a/src/MalwarePatch/Certificates/kingsoft browser.cer b/src/MalwarePatch/Certificates/kingsoft browser.cer new file mode 100644 index 0000000..6def2b9 Binary files /dev/null and b/src/MalwarePatch/Certificates/kingsoft browser.cer differ diff --git a/src/MalwarePatch/Certificates/kingsoft wps 256.cer b/src/MalwarePatch/Certificates/kingsoft wps 256.cer new file mode 100644 index 0000000..35a66de Binary files /dev/null and b/src/MalwarePatch/Certificates/kingsoft wps 256.cer differ diff --git a/src/MalwarePatch/Certificates/kingsoft wps.cer b/src/MalwarePatch/Certificates/kingsoft wps.cer new file mode 100644 index 0000000..4f9b3de Binary files /dev/null and b/src/MalwarePatch/Certificates/kingsoft wps.cer differ diff --git a/src/MalwarePatch/Certificates/kingsoft ws.cer b/src/MalwarePatch/Certificates/kingsoft ws.cer new file mode 100644 index 0000000..ebe7e00 Binary files /dev/null and b/src/MalwarePatch/Certificates/kingsoft ws.cer differ diff --git a/src/MalwarePatch/Certificates/kingsoft.cer b/src/MalwarePatch/Certificates/kingsoft.cer new file mode 100644 index 0000000..11264db Binary files /dev/null and b/src/MalwarePatch/Certificates/kingsoft.cer differ diff --git a/src/MalwarePatch/Certificates/kuaizip 256.cer b/src/MalwarePatch/Certificates/kuaizip 256.cer new file mode 100644 index 0000000..f6a29d7 Binary files /dev/null and b/src/MalwarePatch/Certificates/kuaizip 256.cer differ diff --git a/src/MalwarePatch/Certificates/kuaizip.cer b/src/MalwarePatch/Certificates/kuaizip.cer new file mode 100644 index 0000000..daee517 Binary files /dev/null and b/src/MalwarePatch/Certificates/kuaizip.cer differ diff --git a/src/MalwarePatch/Certificates/kugou.cer b/src/MalwarePatch/Certificates/kugou.cer new file mode 100644 index 0000000..b9175f6 Binary files /dev/null and b/src/MalwarePatch/Certificates/kugou.cer differ diff --git a/src/MalwarePatch/Certificates/kuwo.cer b/src/MalwarePatch/Certificates/kuwo.cer new file mode 100644 index 0000000..2e88543 Binary files /dev/null and b/src/MalwarePatch/Certificates/kuwo.cer differ diff --git a/src/MalwarePatch/Certificates/leshi 256.cer b/src/MalwarePatch/Certificates/leshi 256.cer new file mode 100644 index 0000000..0415393 Binary files /dev/null and b/src/MalwarePatch/Certificates/leshi 256.cer differ diff --git a/src/MalwarePatch/Certificates/leshi.cer b/src/MalwarePatch/Certificates/leshi.cer new file mode 100644 index 0000000..0415393 Binary files /dev/null and b/src/MalwarePatch/Certificates/leshi.cer differ diff --git a/src/MalwarePatch/Certificates/netease 256.cer b/src/MalwarePatch/Certificates/netease 256.cer new file mode 100644 index 0000000..34bb876 Binary files /dev/null and b/src/MalwarePatch/Certificates/netease 256.cer differ diff --git a/src/MalwarePatch/Certificates/netease youdao.cer b/src/MalwarePatch/Certificates/netease youdao.cer new file mode 100644 index 0000000..542a81c Binary files /dev/null and b/src/MalwarePatch/Certificates/netease youdao.cer differ diff --git a/src/MalwarePatch/Certificates/netease.cer b/src/MalwarePatch/Certificates/netease.cer new file mode 100644 index 0000000..34bb876 Binary files /dev/null and b/src/MalwarePatch/Certificates/netease.cer differ diff --git a/src/MalwarePatch/Certificates/pplive 256.cer b/src/MalwarePatch/Certificates/pplive 256.cer new file mode 100644 index 0000000..efa58c7 Binary files /dev/null and b/src/MalwarePatch/Certificates/pplive 256.cer differ diff --git a/src/MalwarePatch/Certificates/pplive.cer b/src/MalwarePatch/Certificates/pplive.cer new file mode 100644 index 0000000..ad0178a Binary files /dev/null and b/src/MalwarePatch/Certificates/pplive.cer differ diff --git a/src/MalwarePatch/Certificates/pptv 2019.1.cer b/src/MalwarePatch/Certificates/pptv 2019.1.cer new file mode 100644 index 0000000..bede640 Binary files /dev/null and b/src/MalwarePatch/Certificates/pptv 2019.1.cer differ diff --git a/src/MalwarePatch/Certificates/pptv 256.2019.1.cer b/src/MalwarePatch/Certificates/pptv 256.2019.1.cer new file mode 100644 index 0000000..be20f60 Binary files /dev/null and b/src/MalwarePatch/Certificates/pptv 256.2019.1.cer differ diff --git a/src/MalwarePatch/Certificates/pptv 256.cer b/src/MalwarePatch/Certificates/pptv 256.cer new file mode 100644 index 0000000..2fe4a55 Binary files /dev/null and b/src/MalwarePatch/Certificates/pptv 256.cer differ diff --git a/src/MalwarePatch/Certificates/pptv.cer b/src/MalwarePatch/Certificates/pptv.cer new file mode 100644 index 0000000..379da62 Binary files /dev/null and b/src/MalwarePatch/Certificates/pptv.cer differ diff --git a/src/MalwarePatch/Certificates/qiyi 256.cer b/src/MalwarePatch/Certificates/qiyi 256.cer new file mode 100644 index 0000000..50d2c95 Binary files /dev/null and b/src/MalwarePatch/Certificates/qiyi 256.cer differ diff --git a/src/MalwarePatch/Certificates/qiyi.cer b/src/MalwarePatch/Certificates/qiyi.cer new file mode 100644 index 0000000..dcad515 Binary files /dev/null and b/src/MalwarePatch/Certificates/qiyi.cer differ diff --git a/src/MalwarePatch/Certificates/rising 2018.9.cer b/src/MalwarePatch/Certificates/rising 2018.9.cer new file mode 100644 index 0000000..4d55db4 Binary files /dev/null and b/src/MalwarePatch/Certificates/rising 2018.9.cer differ diff --git a/src/MalwarePatch/Certificates/rising 2019.8.cer b/src/MalwarePatch/Certificates/rising 2019.8.cer new file mode 100644 index 0000000..79cd497 Binary files /dev/null and b/src/MalwarePatch/Certificates/rising 2019.8.cer differ diff --git a/src/MalwarePatch/Certificates/rising 256.2018.9.cer b/src/MalwarePatch/Certificates/rising 256.2018.9.cer new file mode 100644 index 0000000..6b799cd Binary files /dev/null and b/src/MalwarePatch/Certificates/rising 256.2018.9.cer differ diff --git a/src/MalwarePatch/Certificates/rising 256.2019.8.cer b/src/MalwarePatch/Certificates/rising 256.2019.8.cer new file mode 100644 index 0000000..46f09fc Binary files /dev/null and b/src/MalwarePatch/Certificates/rising 256.2019.8.cer differ diff --git a/src/MalwarePatch/Certificates/rising 256.cer b/src/MalwarePatch/Certificates/rising 256.cer new file mode 100644 index 0000000..977e11b Binary files /dev/null and b/src/MalwarePatch/Certificates/rising 256.cer differ diff --git a/src/MalwarePatch/Certificates/rising.cer b/src/MalwarePatch/Certificates/rising.cer new file mode 100644 index 0000000..18f2ec4 Binary files /dev/null and b/src/MalwarePatch/Certificates/rising.cer differ diff --git a/src/MalwarePatch/Certificates/riyue (at) 256.cer b/src/MalwarePatch/Certificates/riyue (at) 256.cer new file mode 100644 index 0000000..f74801a Binary files /dev/null and b/src/MalwarePatch/Certificates/riyue (at) 256.cer differ diff --git a/src/MalwarePatch/Certificates/riyue (at).cer b/src/MalwarePatch/Certificates/riyue (at).cer new file mode 100644 index 0000000..c51fc90 Binary files /dev/null and b/src/MalwarePatch/Certificates/riyue (at).cer differ diff --git a/src/MalwarePatch/Certificates/ruanmei 256.2019.1.cer b/src/MalwarePatch/Certificates/ruanmei 256.2019.1.cer new file mode 100644 index 0000000..480eb64 Binary files /dev/null and b/src/MalwarePatch/Certificates/ruanmei 256.2019.1.cer differ diff --git a/src/MalwarePatch/Certificates/ruanmei 256.cer b/src/MalwarePatch/Certificates/ruanmei 256.cer new file mode 100644 index 0000000..81f35cb Binary files /dev/null and b/src/MalwarePatch/Certificates/ruanmei 256.cer differ diff --git a/src/MalwarePatch/Certificates/ruanmei.cer b/src/MalwarePatch/Certificates/ruanmei.cer new file mode 100644 index 0000000..1cf3b0c Binary files /dev/null and b/src/MalwarePatch/Certificates/ruanmei.cer differ diff --git a/src/MalwarePatch/Certificates/sogou 2019.10.cer b/src/MalwarePatch/Certificates/sogou 2019.10.cer new file mode 100644 index 0000000..89ca877 Binary files /dev/null and b/src/MalwarePatch/Certificates/sogou 2019.10.cer differ diff --git a/src/MalwarePatch/Certificates/sogou 2019.8.cer b/src/MalwarePatch/Certificates/sogou 2019.8.cer new file mode 100644 index 0000000..c8a2227 Binary files /dev/null and b/src/MalwarePatch/Certificates/sogou 2019.8.cer differ diff --git a/src/MalwarePatch/Certificates/sogou 256.2019.10.cer b/src/MalwarePatch/Certificates/sogou 256.2019.10.cer new file mode 100644 index 0000000..132dc53 Binary files /dev/null and b/src/MalwarePatch/Certificates/sogou 256.2019.10.cer differ diff --git a/src/MalwarePatch/Certificates/sogou 256.2019.8.cer b/src/MalwarePatch/Certificates/sogou 256.2019.8.cer new file mode 100644 index 0000000..132dc53 Binary files /dev/null and b/src/MalwarePatch/Certificates/sogou 256.2019.8.cer differ diff --git a/src/MalwarePatch/Certificates/sogou 256.cer b/src/MalwarePatch/Certificates/sogou 256.cer new file mode 100644 index 0000000..12f672a Binary files /dev/null and b/src/MalwarePatch/Certificates/sogou 256.cer differ diff --git a/src/MalwarePatch/Certificates/sogou.cer b/src/MalwarePatch/Certificates/sogou.cer new file mode 100644 index 0000000..9560b0f Binary files /dev/null and b/src/MalwarePatch/Certificates/sogou.cer differ diff --git a/src/MalwarePatch/Certificates/sohu 2018.12.cer b/src/MalwarePatch/Certificates/sohu 2018.12.cer new file mode 100644 index 0000000..293b17c Binary files /dev/null and b/src/MalwarePatch/Certificates/sohu 2018.12.cer differ diff --git a/src/MalwarePatch/Certificates/sohu.cer b/src/MalwarePatch/Certificates/sohu.cer new file mode 100644 index 0000000..0015e1c Binary files /dev/null and b/src/MalwarePatch/Certificates/sohu.cer differ diff --git a/src/MalwarePatch/Certificates/taobao 256.cer b/src/MalwarePatch/Certificates/taobao 256.cer new file mode 100644 index 0000000..a5b658a Binary files /dev/null and b/src/MalwarePatch/Certificates/taobao 256.cer differ diff --git a/src/MalwarePatch/Certificates/taobao.cer b/src/MalwarePatch/Certificates/taobao.cer new file mode 100644 index 0000000..2e16c27 Binary files /dev/null and b/src/MalwarePatch/Certificates/taobao.cer differ diff --git a/src/MalwarePatch/Certificates/tencent 2018.11.cer b/src/MalwarePatch/Certificates/tencent 2018.11.cer new file mode 100644 index 0000000..e943e56 Binary files /dev/null and b/src/MalwarePatch/Certificates/tencent 2018.11.cer differ diff --git a/src/MalwarePatch/Certificates/tencent 256.2018.11.cer b/src/MalwarePatch/Certificates/tencent 256.2018.11.cer new file mode 100644 index 0000000..f8d1fb0 Binary files /dev/null and b/src/MalwarePatch/Certificates/tencent 256.2018.11.cer differ diff --git a/src/MalwarePatch/Certificates/tencent 256.cer b/src/MalwarePatch/Certificates/tencent 256.cer new file mode 100644 index 0000000..dc191fb Binary files /dev/null and b/src/MalwarePatch/Certificates/tencent 256.cer differ diff --git a/src/MalwarePatch/Certificates/tencent.cer b/src/MalwarePatch/Certificates/tencent.cer new file mode 100644 index 0000000..d8e020c Binary files /dev/null and b/src/MalwarePatch/Certificates/tencent.cer differ diff --git a/src/MalwarePatch/Certificates/thunder 2018.9.cer b/src/MalwarePatch/Certificates/thunder 2018.9.cer new file mode 100644 index 0000000..6e89acf Binary files /dev/null and b/src/MalwarePatch/Certificates/thunder 2018.9.cer differ diff --git a/src/MalwarePatch/Certificates/thunder 2020.1.cer b/src/MalwarePatch/Certificates/thunder 2020.1.cer new file mode 100644 index 0000000..734157f Binary files /dev/null and b/src/MalwarePatch/Certificates/thunder 2020.1.cer differ diff --git a/src/MalwarePatch/Certificates/thunder 256.2018.9.cer b/src/MalwarePatch/Certificates/thunder 256.2018.9.cer new file mode 100644 index 0000000..6e89acf Binary files /dev/null and b/src/MalwarePatch/Certificates/thunder 256.2018.9.cer differ diff --git a/src/MalwarePatch/Certificates/thunder 256.2020.1.cer b/src/MalwarePatch/Certificates/thunder 256.2020.1.cer new file mode 100644 index 0000000..734157f Binary files /dev/null and b/src/MalwarePatch/Certificates/thunder 256.2020.1.cer differ diff --git a/src/MalwarePatch/Certificates/thunder 256.cer b/src/MalwarePatch/Certificates/thunder 256.cer new file mode 100644 index 0000000..f5f54f6 Binary files /dev/null and b/src/MalwarePatch/Certificates/thunder 256.cer differ diff --git a/src/MalwarePatch/Certificates/thunder accel 256.cer b/src/MalwarePatch/Certificates/thunder accel 256.cer new file mode 100644 index 0000000..db03557 Binary files /dev/null and b/src/MalwarePatch/Certificates/thunder accel 256.cer differ diff --git a/src/MalwarePatch/Certificates/thunder accel.cer b/src/MalwarePatch/Certificates/thunder accel.cer new file mode 100644 index 0000000..db03557 Binary files /dev/null and b/src/MalwarePatch/Certificates/thunder accel.cer differ diff --git a/src/MalwarePatch/Certificates/thunder game 256.2018.7.8.cer b/src/MalwarePatch/Certificates/thunder game 256.2018.7.8.cer new file mode 100644 index 0000000..8d4e16e Binary files /dev/null and b/src/MalwarePatch/Certificates/thunder game 256.2018.7.8.cer differ diff --git a/src/MalwarePatch/Certificates/thunder game 256.cer b/src/MalwarePatch/Certificates/thunder game 256.cer new file mode 100644 index 0000000..96e1937 Binary files /dev/null and b/src/MalwarePatch/Certificates/thunder game 256.cer differ diff --git a/src/MalwarePatch/Certificates/thunder game.2018.7.8.cer b/src/MalwarePatch/Certificates/thunder game.2018.7.8.cer new file mode 100644 index 0000000..8d4e16e Binary files /dev/null and b/src/MalwarePatch/Certificates/thunder game.2018.7.8.cer differ diff --git a/src/MalwarePatch/Certificates/thunder game.cer b/src/MalwarePatch/Certificates/thunder game.cer new file mode 100644 index 0000000..96e1937 Binary files /dev/null and b/src/MalwarePatch/Certificates/thunder game.cer differ diff --git a/src/MalwarePatch/Certificates/thunder player 2018.12.cer b/src/MalwarePatch/Certificates/thunder player 2018.12.cer new file mode 100644 index 0000000..bb45850 Binary files /dev/null and b/src/MalwarePatch/Certificates/thunder player 2018.12.cer differ diff --git a/src/MalwarePatch/Certificates/thunder player 256.2018.12.cer b/src/MalwarePatch/Certificates/thunder player 256.2018.12.cer new file mode 100644 index 0000000..bb45850 Binary files /dev/null and b/src/MalwarePatch/Certificates/thunder player 256.2018.12.cer differ diff --git a/src/MalwarePatch/Certificates/thunder player 256.cer b/src/MalwarePatch/Certificates/thunder player 256.cer new file mode 100644 index 0000000..57e5120 Binary files /dev/null and b/src/MalwarePatch/Certificates/thunder player 256.cer differ diff --git a/src/MalwarePatch/Certificates/thunder player.cer b/src/MalwarePatch/Certificates/thunder player.cer new file mode 100644 index 0000000..57e5120 Binary files /dev/null and b/src/MalwarePatch/Certificates/thunder player.cer differ diff --git a/src/MalwarePatch/Certificates/thunder.cer b/src/MalwarePatch/Certificates/thunder.cer new file mode 100644 index 0000000..38ad98c Binary files /dev/null and b/src/MalwarePatch/Certificates/thunder.cer differ diff --git a/src/MalwarePatch/Certificates/xingcheng (at) 256.cer b/src/MalwarePatch/Certificates/xingcheng (at) 256.cer new file mode 100644 index 0000000..81a8895 Binary files /dev/null and b/src/MalwarePatch/Certificates/xingcheng (at) 256.cer differ diff --git a/src/MalwarePatch/Certificates/xingcheng (at).cer b/src/MalwarePatch/Certificates/xingcheng (at).cer new file mode 100644 index 0000000..796de1d Binary files /dev/null and b/src/MalwarePatch/Certificates/xingcheng (at).cer differ diff --git a/src/MalwarePatch/Certificates/youku 2018.8.cer b/src/MalwarePatch/Certificates/youku 2018.8.cer new file mode 100644 index 0000000..ed82e27 Binary files /dev/null and b/src/MalwarePatch/Certificates/youku 2018.8.cer differ diff --git a/src/MalwarePatch/Certificates/youku 256.2018.8.cer b/src/MalwarePatch/Certificates/youku 256.2018.8.cer new file mode 100644 index 0000000..6fcb921 Binary files /dev/null and b/src/MalwarePatch/Certificates/youku 256.2018.8.cer differ diff --git a/src/MalwarePatch/Certificates/youku 256.cer b/src/MalwarePatch/Certificates/youku 256.cer new file mode 100644 index 0000000..22fad9e Binary files /dev/null and b/src/MalwarePatch/Certificates/youku 256.cer differ diff --git a/src/MalwarePatch/Certificates/youku.cer b/src/MalwarePatch/Certificates/youku.cer new file mode 100644 index 0000000..113a8c4 Binary files /dev/null and b/src/MalwarePatch/Certificates/youku.cer differ diff --git a/src/MalwarePatch/Certificates/yy 2018.12.cer b/src/MalwarePatch/Certificates/yy 2018.12.cer new file mode 100644 index 0000000..01d763d Binary files /dev/null and b/src/MalwarePatch/Certificates/yy 2018.12.cer differ diff --git a/src/MalwarePatch/Certificates/yy 2020.1.cer b/src/MalwarePatch/Certificates/yy 2020.1.cer new file mode 100644 index 0000000..e0b21e1 Binary files /dev/null and b/src/MalwarePatch/Certificates/yy 2020.1.cer differ diff --git a/src/MalwarePatch/Certificates/yy 256.2018.12.cer b/src/MalwarePatch/Certificates/yy 256.2018.12.cer new file mode 100644 index 0000000..01d763d Binary files /dev/null and b/src/MalwarePatch/Certificates/yy 256.2018.12.cer differ diff --git a/src/MalwarePatch/Certificates/yy 256.2020.1.cer b/src/MalwarePatch/Certificates/yy 256.2020.1.cer new file mode 100644 index 0000000..e0b21e1 Binary files /dev/null and b/src/MalwarePatch/Certificates/yy 256.2020.1.cer differ diff --git a/src/MalwarePatch/Certificates/yy 256.cer b/src/MalwarePatch/Certificates/yy 256.cer new file mode 100644 index 0000000..dc2dd68 Binary files /dev/null and b/src/MalwarePatch/Certificates/yy 256.cer differ diff --git a/src/MalwarePatch/Certificates/yy browser.cer b/src/MalwarePatch/Certificates/yy browser.cer new file mode 100644 index 0000000..e3959cd Binary files /dev/null and b/src/MalwarePatch/Certificates/yy browser.cer differ diff --git a/src/MalwarePatch/Certificates/yy.cer b/src/MalwarePatch/Certificates/yy.cer new file mode 100644 index 0000000..51938d5 Binary files /dev/null and b/src/MalwarePatch/Certificates/yy.cer differ diff --git a/src/MalwarePatch/CliTools/MalwareChecker.cs b/src/MalwarePatch/CliTools/MalwareChecker.cs new file mode 100644 index 0000000..c1f0540 --- /dev/null +++ b/src/MalwarePatch/CliTools/MalwareChecker.cs @@ -0,0 +1,276 @@ +using Ace; +using Ace.Files; +using Ace.Files.Json; +using Ace.Wpf.Mvvm; +using MalwarePatch.Windows.Check; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Net.Mime; +using System.Security.Cryptography; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Shell; + +namespace MalwarePatch.CliTools +{ + class MalwareCheckException : Exception + { + public MalwareCheckException(string message) : base(message) { } + public MalwareCheckException() : base() { } + } + class MalwareChecker + { + private const string InfoPath = @"assets/malware-remote-info.json"; + private const string UserAgent = @"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36"; + private readonly JsonObject infoObject; + private readonly StringBuilder stringBuilder = new StringBuilder(); + private readonly bool clean = false; + private const string LogFileName = "mwp-check.log"; + private double downloadedCount = 0; + + public MalwareChecker(bool clean = false) + { + this.clean = clean; + infoObject = JsonObject.Parse(AppResource.GetResourceData(InfoPath).ToString(true)); + } + public static bool TryParse(string[] args) + { + if (args.Length == 0) + { + return false; + } + if (args[0].EqualsIgnoreCase("--malware-check")) + { + new CheckWindow(args.Length > 1 && args[1] == "--clean").ShowDialog(); + return true; + } + else + { + return false; + } + } + public MalwareCheckerModel Model { get; } = new MalwareCheckerModel(); + public bool Debug { get; set; } = false; + public Task Start() + { + stringBuilder.Clear(); + downloadedCount = 0; + Model.ProgressState = TaskbarItemProgressState.Normal; + log("Malware checker started"); + return Task.Run(() => + { + Parallel.ForEach(infoObject, property => downloadCategory(property)); + // infoObject.ForEach(property => downloadCategory(property)); + Stop(); + }); + } + public void Stop() + { + log("Malware checker completed"); + Model.ProgressState = TaskbarItemProgressState.None; + lock (stringBuilder) + { + File.WriteAllText(LogFileName, stringBuilder.ToString()); + } + } + private void log(string message) + { + lock (stringBuilder) + { + stringBuilder + .Append($"[{DateTime.Now.ToString()}] ") + .Append(message) + .Append(Environment.NewLine); + System.Diagnostics.Debug.WriteLine(message); + } + } + private void error(string message) + { + lock (stringBuilder) + { + stringBuilder + .Append(Environment.NewLine) + .Append($"[{DateTime.Now.ToString()}] ") + .Append(message) + .Append(Environment.NewLine) + .Append(Environment.NewLine); + System.Diagnostics.Debug.WriteLine(message); + } + } + private void downloadCategory(JsonProperty category) + { + try + { + Model.Message = $"Downloading: {category.Name}"; + downloadFixedUrl(category.ObjectValue["fixed"].ArrayValue); + // log($"Downloaded fixed urls of {category.Name}"); + downloadRegexUrl(category.ObjectValue["match"].ArrayValue); + // log($"Downloaded regex urls of {category.Name}"); + downloadedCount++; + Model.ProgressValue = downloadedCount / infoObject.Count; + } + catch (Exception ex) + when (ex is MalwareCheckException || ex is WebException /*|| ex is CryptographicException*/) + { + error($"Error downloading {category.Name}: {ex.Message}"); + } + } + private void downloadUrl(string url) + { + if (!Debug) + { + using (var webClient = new WebClient()) + { + if (url.StartsWith("//")) + { + url = "http:" + url; + } + webClient.Headers["user-agent"] = UserAgent; + var filename = url.GetHashCode().ToString() + ".exe"; + if (!File.Exists(filename)) + { + var data = webClient.DownloadData(url); + File.WriteAllBytes(filename, data); + log($"Downloaded: {url}"); + } + else + { + log($"Already downloaded: {url}"); + } + verifyCertificate(filename); + } + } + else + { + // Thread.Sleep(3000); + log($"Debug download: {url}"); + } + } + private void verifyCertificate(string path) + { + var disallowed = false; + try + { + var certificate = new CertificateFile(new X509Certificate2(path)); + disallowed = certificate.IsDisallowed; + certificate.Dispose(); + } + catch (CryptographicException ex) + { + error($"Certificate error: {ex.Message}, path={path}"); + } + + if (disallowed) + { + if (clean) + { + try + { + File.Delete(path); + log($"Verified {path}: Disallowed and deleted."); + } + catch (Exception ex) + { + error($"Error deleting file {path}: {ex.Message}"); + } + } + else + { + log($"Verified {path}: Disallowed."); + } + } + else + { + log($"Verified {path}: NOT disallowed."); + } + } + private void downloadFixedUrl(JsonArray array) + { + array.ToStringList().ForEach(url => downloadUrl(url)); + } + private void downloadRegexUrl(JsonArray array) + { + foreach (var matchInfo in array.ToObjectList()) + { + var url = matchInfo["url"].StringValue; + var html = ""; + try + { + using (var webClient = new WebClient()) + { + webClient.Headers["user-agent"] = UserAgent; + webClient.Encoding = Encoding.UTF8; + html = webClient.DownloadString(url); + } + var regex = matchInfo["regex"].StringValue; + var match = html.Match(regex); + var group = decimal.ToInt32(matchInfo["group"].NumberValue.Value); + if (match.Success) + { + if (match.Groups.Count > group - 1) + { + var matchedUrl = match.Groups[group].Value; + downloadUrl(matchedUrl); + } + else + { + throw new MalwareCheckException($"Regex group not found for {url}, group = {group}"); + } + } + else + { + throw new MalwareCheckException($"Regex match for {url} failed, regex = {regex}"); + } + } + catch (Exception ex) + when (ex is MalwareCheckException || ex is WebException/* || ex is CryptographicException*/) + { + error($"Error fetching {url}: {ex.Message}"); + File.WriteAllText($"{url.GetHashCode()}.html", html); + } + } + + } + } + class MalwareCheckerModel : NotificationObject + { + + private string message = ""; + public string Message + { + get => message; + set + { + message = value; + OnPropertyChanged(nameof(Message)); + } + } + + private double progressValue = 0.0; + public double ProgressValue + { + get => progressValue; + set + { + progressValue = value; + OnPropertyChanged(nameof(ProgressValue)); + } + } + + private TaskbarItemProgressState progressState = TaskbarItemProgressState.None; + public TaskbarItemProgressState ProgressState + { + get => progressState; + set + { + progressState = value; + OnPropertyChanged(nameof(ProgressState)); + } + } + } +} diff --git a/src/MalwarePatch/CliTools/SilentUpdater.cs b/src/MalwarePatch/CliTools/SilentUpdater.cs new file mode 100644 index 0000000..f06ff71 --- /dev/null +++ b/src/MalwarePatch/CliTools/SilentUpdater.cs @@ -0,0 +1,122 @@ +using Ace; +using MalwarePatch.Models; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MalwarePatch.CliTools +{ + internal class SilentUpdater + { + public const string + SilentUpdateParameter = "--silent-update", + DisallowAllParameter = "--disallow-all", + AllowAllParameter = "--allow-all", + ProxyParameter = "--proxy"; + + public static bool TryParse(string[] args) + { + var dictionary = string.Join(" ", args).SplitToDictionary(" ", "=", true); + var proxy = null as string; + //if (dictionary.ContainsKey(ProxyParameter)) + //{ + // proxy = dictionary[ProxyParameter]; + //} + + try + { + if (dictionary.ContainsKey(SilentUpdateParameter)) + { + Update(dictionary, proxy)?.Wait(); + } + else if (dictionary.ContainsKey(DisallowAllParameter)) + { + DisallowAll().Wait(); + } + else if (dictionary.ContainsKey(AllowAllParameter)) + { + AllowAll().Wait(); + } + else + { + return false; + } + } + catch + { + return false; + } + + return true; + } + public static Task Update(Dictionary dictionary, string proxy = null) + { + var checker = new VersionChecker + { + Proxy = proxy + }; + if (checker.HasNewVersion) + { + return Task.Run(() => + { + var arguments = new Dictionary + { + { Updater.RestartParameter, null } + }; + arguments.AddRange(dictionary); + arguments.Remove(SilentUpdateParameter); + + var finalArguments = string.Join(" ", arguments.Select(item => + { + if (item.Value is null) + { + return item.Key; + } + else + { + return $"{item.Key}={item.Value}"; + } + })); + var updater = new Updater + { + Proxy = proxy, + RestartParameters = finalArguments == Updater.RestartParameter ? "" : finalArguments + }; + updater.DownloadUpdate().Wait(); + if (File.Exists(Updater.UpdateFileName)) + { + var startInfo = new ProcessStartInfo(Updater.UpdateFileName) + { + Arguments = $"{Updater.UpdateParameter}={(Process.GetCurrentProcess().MainModule.FileName.GetFileName()).Quotes()} {updater.RestartParameters}", + WorkingDirectory = Environment.CurrentDirectory, + UseShellExecute = false, + }; + Process.Start(startInfo); + } + }); + } + else + { + return null; + } + } + public static Task DisallowAll() + { + return Task.Run(() => + { + BuiltInCertificates.All.ForEach(c => c.Disallow()); + }); + } + public static Task AllowAll() + { + return Task.Run(() => + { + BuiltInCertificates.All.ForEach(c => c.Allow()); + }); + } + } +} diff --git a/src/MalwarePatch/CliTools/UserCertificateCli.cs b/src/MalwarePatch/CliTools/UserCertificateCli.cs new file mode 100644 index 0000000..29d72a2 --- /dev/null +++ b/src/MalwarePatch/CliTools/UserCertificateCli.cs @@ -0,0 +1,56 @@ +using Ace; +using Ace.Files; +using MalwarePatch.Commands; +using MalwarePatch.Models; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Security.Cryptography; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading.Tasks; +using System.Windows; + +namespace MalwarePatch.CliTools +{ + static class UserCertificateCli + { + private const string disallowKey = "--disallow", allowKey = "--allow"; + public static bool TryParse(string[] args) + { + if (args.Length == 0) + { + return false; + } + var dict = string.Join(",", args).ToLowerInvariant().SplitToDictionary(",", "=", true); + if (dict.ContainsKey(disallowKey)) + { + var filename = dict[disallowKey]?.NoQuotes(); + if (filename is null) + { + new UserCertificateCommand(allow: false, null).Execute(); + } + else + { + new UserCertificate(filename).Disallow(); + } + return true; + } + if (dict.ContainsKey(allowKey)) + { + var filename = dict[allowKey]?.NoQuotes(); + if (filename is null) + { + new UserCertificateCommand(allow: true, null).Execute(); + } + else + { + new UserCertificate(filename).Allow(); + } + return true; + } + return false; + } + } +} diff --git a/src/MalwarePatch/Commands/BatchCheckCommand.cs b/src/MalwarePatch/Commands/BatchCheckCommand.cs new file mode 100644 index 0000000..aebf4ec --- /dev/null +++ b/src/MalwarePatch/Commands/BatchCheckCommand.cs @@ -0,0 +1,35 @@ +using MalwarePatch.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; + +namespace MalwarePatch.Commands +{ + sealed class BatchCheckCommand : ICommand + { + private readonly bool checkValue; + private readonly IEnumerable certificates; + public BatchCheckCommand(bool checkValue, IEnumerable certificates) + { + this.checkValue = checkValue; + this.certificates = certificates; + } + + public event EventHandler CanExecuteChanged; + private void invokeCanExecuteChanged() => CanExecuteChanged?.Invoke(this, EventArgs.Empty); + + public bool CanExecute(object parameter) => certificates.Count() != 0; + public void Execute(object parameter) + { + foreach (var certificate in certificates) + { + certificate.IsAllowed = checkValue; + } + } + } +} diff --git a/src/MalwarePatch/Commands/DirectCommand.cs b/src/MalwarePatch/Commands/DirectCommand.cs new file mode 100644 index 0000000..fe25fbf --- /dev/null +++ b/src/MalwarePatch/Commands/DirectCommand.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Input; + +namespace MalwarePatch.Commands +{ + class DirectCommand : ICommand + { + public event EventHandler CanExecuteChanged; + private void onCanExecuteChanged() => CanExecuteChanged?.Invoke(this, EventArgs.Empty); + public Func CanExecuteFunc { get; set; } + public bool CanExecute(object parameter) => CanExecuteFunc?.Invoke(parameter) ?? true; + public Action ExcuteAction { get; set; } + public void Execute(object parameter) => ExcuteAction?.Invoke(parameter); + } +} diff --git a/src/MalwarePatch/Commands/SaveChangesCommand.cs b/src/MalwarePatch/Commands/SaveChangesCommand.cs new file mode 100644 index 0000000..63342f9 --- /dev/null +++ b/src/MalwarePatch/Commands/SaveChangesCommand.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using Ace; +using MalwarePatch.Models; + +namespace MalwarePatch.Commands +{ + sealed class SaveChangesCommand : ICommand + { + public event EventHandler CanExecuteChanged; + private void invokeCanExecuteChanged() => CanExecuteChanged?.Invoke(this, EventArgs.Empty); + private readonly IEnumerable certificates; + + public Action BeforeExecute { get; set; } + public Action AfterExecute { get; set; } + public SaveChangesCommand(IEnumerable certificates) + { + this.certificates = certificates; + } + public bool CanExecute(object parameter) + { + return Utils.IsAdministratorProcess; + } + public async void Execute(object parameter) + { + BeforeExecute?.Invoke(); + await Task.Run(() => + { + foreach (var certificate in certificates) + { + if (certificate.IsAllowed) + { + certificate.Allow(); + } + else + { + certificate.Disallow(); + } + } + }); + AfterExecute?.Invoke(); + } + } +} diff --git a/src/MalwarePatch/Commands/UserCertificateCommand.cs b/src/MalwarePatch/Commands/UserCertificateCommand.cs new file mode 100644 index 0000000..f20b0e3 --- /dev/null +++ b/src/MalwarePatch/Commands/UserCertificateCommand.cs @@ -0,0 +1,48 @@ +using Ace; +using Ace.Wpf.Mvvm; +using MalwarePatch.Models; +using Microsoft.Win32; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Input; + +namespace MalwarePatch.Commands +{ + class UserCertificateCommand : Ace.Wpf.Mvvm.Command + { + private readonly bool allow = true; + private readonly IEnumerable certificates; + public UserCertificateCommand(bool allow, IEnumerable certificates) + { + this.allow = allow; + this.certificates = certificates; + } + + protected override void ExecuteCommand(object parameter) + { + var dialog = new OpenFileDialog + { + AddExtension = true, + DefaultExt = ".exe", + Multiselect = false, + }; + if (dialog.ShowDialog() ?? false) + { + var filename = dialog.FileName; + var certificate = new UserCertificate(filename); + if (allow) + { + certificate.Allow(); + } + else + { + certificate.Disallow(); + } + certificates?.ForEach(c => c.UpdateState()); + } + } + } +} diff --git a/src/MalwarePatch/Languages/MainLanguage.cs b/src/MalwarePatch/Languages/MainLanguage.cs new file mode 100644 index 0000000..5b6beb5 --- /dev/null +++ b/src/MalwarePatch/Languages/MainLanguage.cs @@ -0,0 +1,98 @@ +using Ace; +using Ace.Files.Json; +using Ace.Wpf.Mvvm; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace MalwarePatch.Languages +{ + sealed class MainLanguage : Language + { + public enum Keys + { + Title, + TextAvailablePatches, + ButtonSave, + ToggleUncheckedHelp, + ToggleCheckedHelp, + ButtonAdd, + ButtonRemove, + ButtonCheckAll, + ButtonUncheckAll, + ButtonUpdate, + TextSaved, + TextNewVersion, + DisallowProgram, + AllowProgram, + DisallowProgramDescription, + AllowProgramDescription, + } + internal static DateTime LastModifiedTime => File.GetLastWriteTime(Process.GetCurrentProcess().MainModule.FileName); + internal const int UpdateMonth = 1; + internal static string UpdateTime + { + get + { + var now = new DateTime(); + return new DateTime(now.Year, UpdateMonth, now.Day).ToString("MMMM"); + } + } + public MainLanguage() + { + translations.Add(new Translation + { + Culture = new System.Globalization.CultureInfo("en-US"), + Texts = new List + { + $"{UpdateTime} Update - v{Assembly.GetExecutingAssembly().GetName().Version}", + "Malware Patch", + "Save", + "Uncheck to disallow", + "Check to allow", + "Add", + "Remove", + "Allow All", + "Disallow All", + "Update", + "Saved", + "New Version Available", + "Disallow program", + "Allow program", + "Select and disallow program.", + "Select and Allow program.", + + } + }); + translations.Add(new Translation + { + Culture = new System.Globalization.CultureInfo("zh-CN"), + Texts = new List + { + $"{UpdateTime}更新 - v{Assembly.GetExecutingAssembly().GetName().Version}", + "软件屏蔽器", + "保存更改", + "打叉以屏蔽", + "打勾以允许", + "添加", + "移除", + "全部允许", + "全部屏蔽", + "检查更新", + "已保存", + "新版本可用", + "屏蔽选定程序", + "允许选定程序", + "选择并屏蔽一个程序.", + "选择并允许一个程序.", + + } + }); + } + } +} diff --git a/src/MalwarePatch/Languages/UpdateLanguage.cs b/src/MalwarePatch/Languages/UpdateLanguage.cs new file mode 100644 index 0000000..76885f9 --- /dev/null +++ b/src/MalwarePatch/Languages/UpdateLanguage.cs @@ -0,0 +1,91 @@ +using Ace.Wpf.Mvvm; +using MalwarePatch.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MalwarePatch.Languages +{ + sealed class UpdateLanguage : Language + { + public enum Keys + { + WindowTitle, + ButtonDownload, + ButtonRetry, + ButtonRestart, + TextProxyLabel, + NewVerisonTitle, + NewVerisonStatus, + CheckingNewVersion, + NoNewVerisonTitle, + NoNewVerisonStatus, + DownloadingStatus, + DownloadCompleteStatus, + CheckFailedStatus, + CheckFailedTitle, + DownloadFailedStatus, + DownloadFailedTitle, + UpdateFromPreupdateFile, + Unknown, + TextProxyPlaceholder, + } + public UpdateLanguage() + { + translations.Add(new Translation + { + Culture = new System.Globalization.CultureInfo("en-US"), + Texts = new List + { + "Check for updates", + "Download", + "Check Again", + "Restart App", + "Proxy:", + "New Verison Available", + "Found new verison ({0}), click Download to update.", + "Checking updates...", + "Up to date", + "You are on latest verison.", + "Downloading...", + "Download complete. Exit app to run update, or click \"Restart App\" to restart app after updating.", + "Check update failed: {0}", + "Check update failed", + "Download failed: {0}", + "Download failed", + $"You cannot download update using a pre-update file ({Updater.UpdateFileName}).", + "Unknown error.", + "Default" + } + }); + translations.Add(new Translation + { + Culture = new System.Globalization.CultureInfo("zh-CN"), + Texts = new List + { + "检查更新", + "下载更新", + "重新检查", + "重启程序", + "代理:", + "新版本可用", + "已发现新版本({0}),点击下载以开始更新。", + "正在检查新版本...", + "已是最新版本", + "没有发现更新的版本。", + "正在下载...", + "下载完成。关闭程序后将进行更新,或点击\"重启程序\"以在更新完成后再次启动。", + "检查更新失败: {0}", + "检查更新失败", + "下载失败: {0}", + "下载失败", + $"你不能在预更新文件({Updater.UpdateFileName})上下载更新。", + "未知错误。", + "默认", + } + }); + } + } +} diff --git a/src/MalwarePatch/Languages/UserCertificateLanguage.cs b/src/MalwarePatch/Languages/UserCertificateLanguage.cs new file mode 100644 index 0000000..c0c9c91 --- /dev/null +++ b/src/MalwarePatch/Languages/UserCertificateLanguage.cs @@ -0,0 +1,60 @@ +using Ace.Wpf.Mvvm; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MalwarePatch.Languages +{ + sealed class UserCertificateLanguage : Language + { + public enum Keys + { + Error, + Tip, + Complete, + TipMessage, + FileNotFound, + FileNotSigned, + Allowed, + Disallowed, + UnknownPublisher, + } + public UserCertificateLanguage() + { + translations.Add(new Translation + { + Culture = new System.Globalization.CultureInfo("en-US"), + Texts = new List + { + "Error", + "Tip", + "Complete", + "Usage: --allow/--disallow=", + "Input file \"{0}\" not found.", + "Input file \"{0}\" is not signed.", + "Allowed programs from \"{0}\".", + "Disallowed programs from \"{0}\".", + "Unknown Publisher", + } + }); + translations.Add(new Translation + { + Culture = new System.Globalization.CultureInfo("zh-CN"), + Texts = new List + { + "错误", + "提示", + "完成", + "用法: --allow/--disallow=<文件名>", + "输入的文件 \"{0}\" 不存在.", + "输入的文件 \"{0}\" 未签名.", + "已允许来自 \"{0}\" 的程序.", + "已屏蔽来自 \"{0}\" 的程序.", + "未知发布者", + } + }); + } + } +} diff --git a/src/MalwarePatch/MalwarePatch.csproj b/src/MalwarePatch/MalwarePatch.csproj new file mode 100644 index 0000000..e3c6131 --- /dev/null +++ b/src/MalwarePatch/MalwarePatch.csproj @@ -0,0 +1,223 @@ + + + + + Debug + AnyCPU + {769D2F79-D71B-4F5F-A61F-B1EF3A4C7414} + WinExe + MalwarePatch + mwp + v4.7.2 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + true + 7.2 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + 7.2 + + + MalwarePatch.ico + + + false + + + LocalIntranet + + + false + + + Properties\app.manifest + + + + .\Ace.dll + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + + + + + + + CheckWindow.xaml + + + + + + + + DialogWindow.xaml + + + + + + + + + + UpdateWindow.xaml + + + + + + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + MainWindow.xaml + Code + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + + + + + + + + + + + + + + + + "$(ProjectDir)BuildTools/InsertIcons.exe" "$(TargetPath)" "$(ProjectDir)AppIcons" +if $(ConfigurationName) == Release ( + xcopy /Y /F "$(TargetPath)" "$(SolutionDir)../$(TargetFileName)" +) + + + \ No newline at end of file diff --git a/src/MalwarePatch/MalwarePatch.ico b/src/MalwarePatch/MalwarePatch.ico new file mode 100644 index 0000000..69eeb39 Binary files /dev/null and b/src/MalwarePatch/MalwarePatch.ico differ diff --git a/src/MalwarePatch/Models/BuiltInCertificates.cs b/src/MalwarePatch/Models/BuiltInCertificates.cs new file mode 100644 index 0000000..890a29e --- /dev/null +++ b/src/MalwarePatch/Models/BuiltInCertificates.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Ace.Files; +using Ace; +using System.Windows; +using System.IO; +using System.Windows.Controls.Primitives; +using System.Windows.Media; +using Ace.Files.Json; +using MalwarePatch.Languages; +using System.Globalization; + +namespace MalwarePatch.Models +{ + sealed class BuiltInCertificates : Certificates + { + private BuiltInCertificates(params string[] names) + { + foreach (var name in names) + { + var uri = new Uri("/Certificates/" + name, UriKind.Relative); + certificateFiles.Add(new CertificateFile(AppResource.GetResourceData(uri))); + } + } + + private static readonly List all = new List(); + private static void loadList() + { + all.Clear(); + + var certificateMap = JsonObject + .Parse(AppResource + .GetResourceData("assets/certificate-map.json") + .ToString(true)); + + var displayNameMap = JsonObject + .Parse(AppResource + .GetResourceData("assets/display-names.json") + .ToString(true)); + + const string fallbackLanguageTag = "en-US"; + var languageTag = CultureInfo.CurrentUICulture.IetfLanguageTag; + + if (displayNameMap.ContainsName(languageTag)) + { + displayNameMap = displayNameMap[languageTag].ObjectValue; + } + else + { + displayNameMap = displayNameMap[fallbackLanguageTag].ObjectValue; + } + + var maps = from key in certificateMap.Select(p => p.Name) + join displayName in displayNameMap + on key equals displayName.Name + select ( + certificate: certificateMap[key].ArrayValue.FilterString().ToArray(), + displayName: displayName.StringValue + ); + foreach (var (certificate, displayName) in maps) + { + all.Add(new BuiltInCertificates(certificate) { DisplayName = displayName }); + } + } + public static List All + { + get + { + if (all.Count == 0) + { + loadList(); + } + return all; + } + } + } + +} \ No newline at end of file diff --git a/src/MalwarePatch/Models/CertificateAdapter.cs b/src/MalwarePatch/Models/CertificateAdapter.cs new file mode 100644 index 0000000..d40901b --- /dev/null +++ b/src/MalwarePatch/Models/CertificateAdapter.cs @@ -0,0 +1,49 @@ +using Ace.Wpf.Mvvm; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MalwarePatch.Models +{ + sealed class CertificateAdapter : NotificationObject + { + private readonly Certificates certificates; + public CertificateAdapter(Certificates certificates) + { + this.certificates = certificates; + UpdateState(); + } + + public string Name => certificates.DisplayName; + + private bool isAllowed; + public bool IsAllowed + { + get => isAllowed; + set + { + isAllowed = value; + OnPropertyChanged(nameof(IsAllowed)); + } + } + public void UpdateState() => IsAllowed = !certificates.IsDisallowed; + + public void Allow() + { + if (IsAllowed && certificates.IsDisallowed) + { + certificates.Allow(); + } + } + + public void Disallow() + { + if (!IsAllowed && !certificates.IsDisallowed) + { + certificates.Disallow(); + } + } + } +} diff --git a/src/MalwarePatch/Models/Certificates.cs b/src/MalwarePatch/Models/Certificates.cs new file mode 100644 index 0000000..fbeb521 --- /dev/null +++ b/src/MalwarePatch/Models/Certificates.cs @@ -0,0 +1,18 @@ +using Ace.Files; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MalwarePatch.Models +{ + public abstract class Certificates + { + protected List certificateFiles = new List(); + public string DisplayName { get; protected set; } + public void Allow() => certificateFiles.ForEach(file => file.Allow()); + public void Disallow() => certificateFiles.ForEach(file => file.Disallow()); + public bool IsDisallowed => certificateFiles.TrueForAll(file => file.IsDisallowed); + } +} diff --git a/src/MalwarePatch/Models/UIElementToImageConverter.cs b/src/MalwarePatch/Models/UIElementToImageConverter.cs new file mode 100644 index 0000000..0bc2933 --- /dev/null +++ b/src/MalwarePatch/Models/UIElementToImageConverter.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; +using System.Windows.Media; +using System.Windows.Media.Imaging; + +namespace MalwarePatch.Models +{ + class UIElementToImageConverter : IValueConverter + { + // https://stackoverflow.com/questions/6676072/get-system-drawing-bitmap-of-a-wpf-area-using-visualbrush + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is UIElement element) + { + var target = new RenderTargetBitmap(96, 96, 96, 96, PixelFormats.Pbgra32); + var brush = new VisualBrush(element); + + var visual = new DrawingVisual(); + var drawingContext = visual.RenderOpen(); + + + drawingContext.DrawRectangle(brush, null, new Rect(new Point(0, 0), + new Point(96, 96))); + + drawingContext.Close(); + + target.Render(visual); + + return target; + } + return null; + } + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} diff --git a/src/MalwarePatch/Models/Updater.cs b/src/MalwarePatch/Models/Updater.cs new file mode 100644 index 0000000..39057f0 --- /dev/null +++ b/src/MalwarePatch/Models/Updater.cs @@ -0,0 +1,186 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Ace; +using Ace.Web; +using System.Windows; +using System.IO; +using System.Diagnostics; +using System.Net; +using System.Reflection; +using System.Threading; +using MalwarePatch.Languages; +using MalwarePatch.Windows.Main; + +namespace MalwarePatch.Models +{ + sealed class Updater + { + /// + /// 更新源的ID + /// + private const string UpdateId = "0B4uebmDoSFx-c0kzcG5yVlZVMlE"; + public string Proxy { get; set; } + private UpdateLanguage Languages { get; } = new UpdateLanguage(); + public DownloadProgressChangedEventHandler ProgressChanged { get; set; } + + public const string + UpdateFileName = "__mwp.exe", + UpdateParameter = "--update", + RestartParameter = "--restart", + RemoveOldFileParameter = "--remove"; + public Task DownloadUpdate() + { + if (Process.GetCurrentProcess().MainModule.FileName.GetFileName() == UpdateFileName) + { + var message = Languages[UpdateLanguage.Keys.UpdateFromPreupdateFile]; + throw new InvalidOperationException(message); + } + if (File.Exists(UpdateFileName)) + { + File.Delete(UpdateFileName); + } + var downloadLink = "https://github.com/the1812/malware-patch/raw/master/mwp.exe"; + //var downloadLink = GoogleDrive.GetDirectLinkFromId(UpdateId); + var info = new DownloadInfo(downloadLink) + { + Proxy = Proxy, + ProgressChanged = ProgressChanged, + }; + return info.DownloadFileAsync(UpdateFileName); + } + public string RestartParameters { get; set; } = ""; + public void SetUpdatePlan() + { + Application.Current.Exit += (s, e) => + { + if (File.Exists(UpdateFileName)) + { + var startInfo = new ProcessStartInfo(UpdateFileName) + { + Arguments = $"{UpdateParameter}={(Process.GetCurrentProcess().MainModule.FileName.GetFileName()).Quotes()} {RestartParameters}", + WorkingDirectory = Environment.CurrentDirectory, + UseShellExecute = false, + }; + Process.Start(startInfo); + } + }; + } + /// + /// 安装更新(如果有)并启动应用 + /// + /// 应用 + /// 命令行参数 + public static void InstallUpdateAndRun(App app, string[] args) + { + const int maxWaitTimes = 60; + var waitTimes = 0; + void removeUpdateFile() + { + var selfFileName = Process.GetCurrentProcess().MainModule.FileName.GetFileName(); + var fileNameToRemove = UpdateFileName; + if (selfFileName != fileNameToRemove + && File.Exists(fileNameToRemove)) + { + //Ensure the old app has exited + while (Utils.IsRunning(fileNameToRemove)) + { + Thread.Sleep(500); + waitTimes++; + if (waitTimes > maxWaitTimes) + { + app.Shutdown(); + } + } + Thread.Sleep(500); + File.Delete(fileNameToRemove); + } + } + void copyUpdateFile(Dictionary dictionary) + { + var targetFileName = dictionary[UpdateParameter].NoQuotes(); + var selfFileName = Process.GetCurrentProcess().MainModule.FileName.GetFileName(); +#if DEBUG + //MessageBox.Show(targetFileName, selfFileName); +#endif + if (!selfFileName.EqualsIgnoreCase(targetFileName)) + { + //Ensure the old app has exited + while (Utils.IsRunning(targetFileName)) + { + Thread.Sleep(500); + waitTimes++; + if (waitTimes > maxWaitTimes) + { + app.Shutdown(); + } + } + //Thread.Sleep(500); + File.Copy(selfFileName, targetFileName, true); + Process.Start(new ProcessStartInfo + { + FileName = targetFileName, + WorkingDirectory = Environment.CurrentDirectory, + Arguments = RemoveOldFileParameter, + }); + //Check if restart is required + if (dictionary.ContainsKey(RestartParameter)) + { + var arguments = new Dictionary(dictionary); + arguments.Remove(RestartParameter); + arguments.Remove(UpdateParameter); + Process.Start(new ProcessStartInfo + { + Arguments = string.Join(" ", arguments.Select(kv => + { + if (kv.Value is null) + { + return kv.Key; + } + else + { + return $"{kv.Key}={kv.Value}"; + } + })), + FileName = targetFileName, + WorkingDirectory = Environment.CurrentDirectory, + }); + } + } + } + if ((args?.Length ?? -1) > 0) + { + var oldVersionParameter = $"{UpdateParameter}:"; + var flattenedArgs = string.Join(" ", args); + Dictionary dictionary = null; + if (!flattenedArgs.Contains(oldVersionParameter)) + { + dictionary = flattenedArgs.SplitToDictionary(" ", "=", true); + } + else + { + dictionary = flattenedArgs.SplitToDictionary(" ", ":", true); + } +#if DEBUG + File.AppendAllText("args.txt", Environment.NewLine + flattenedArgs); +#endif + + if (dictionary.ContainsKey(UpdateParameter)) + { + copyUpdateFile(dictionary); + } + else if (dictionary.ContainsKey(RemoveOldFileParameter)) + { + removeUpdateFile(); + } + } + else + { + new MainWindow().ShowDialog(); + } + app.Shutdown(); + } + } +} diff --git a/src/MalwarePatch/Models/UserCertificate.cs b/src/MalwarePatch/Models/UserCertificate.cs new file mode 100644 index 0000000..ace1030 --- /dev/null +++ b/src/MalwarePatch/Models/UserCertificate.cs @@ -0,0 +1,91 @@ +using Ace; +using Ace.Files; +using MalwarePatch.Languages; +using MalwarePatch.Windows.Dialog; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Security.Cryptography; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading.Tasks; + +namespace MalwarePatch.Models +{ + class UserCertificate + { + private readonly string filename; + private readonly UserCertificateLanguage language = new UserCertificateLanguage(); + private static void dialog(string message, string title) + { + // MessageBox.Show(message, title, MessageBoxButton.OK); + DialogWindow.Show(message, title); + } + public UserCertificate(string filename) + { + this.filename = filename; + } + public void Allow() => processCertificate(allow: true, UserCertificateLanguage.Keys.Allowed); + public void Disallow() => processCertificate(allow: false, UserCertificateLanguage.Keys.Disallowed); + private bool Exists => File.Exists(filename); + private CertificateFile Certificate + { + get + { + try + { + var certificate = new X509Certificate2(filename); + return new CertificateFile(certificate); + } + catch (CryptographicException) + { + return null; + } + } + } + private void processCertificate(bool allow, UserCertificateLanguage.Keys messageKey) + { + if (check()) + { + var cert = Certificate; + if (allow) + { + cert.Allow(); + } + else + { + cert.Disallow(); + } + var name = cert.Certificate.GetNameInfo(X509NameType.SimpleName, false); + if (name.IsNullOrWhiteSpace()) + { + name = language[UserCertificateLanguage.Keys.UnknownPublisher]; + } + dialog(string.Format(language[messageKey], name), + language[UserCertificateLanguage.Keys.Complete]); + } + } + private bool check() + { + if (filename.IsNullOrWhiteSpace()) + { + dialog(language[UserCertificateLanguage.Keys.TipMessage], language[UserCertificateLanguage.Keys.Tip]); + return false; + } + if (!Exists) + { + dialog(string.Format(language[UserCertificateLanguage.Keys.FileNotFound], filename), + language[UserCertificateLanguage.Keys.Error]); + return false; + } + if (Certificate is null) + { + dialog(string.Format(language[UserCertificateLanguage.Keys.FileNotSigned], filename), + language[UserCertificateLanguage.Keys.Error]); + return false; + } + return true; + } + } +} diff --git a/src/MalwarePatch/Models/VersionChecker.cs b/src/MalwarePatch/Models/VersionChecker.cs new file mode 100644 index 0000000..0154d51 --- /dev/null +++ b/src/MalwarePatch/Models/VersionChecker.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using Ace.Web; +using Ace; +using System.Windows; + +namespace MalwarePatch.Models +{ + sealed class VersionChecker + { + public Version NewVersion { get; private set; } + private Version CurrectVerison => Assembly.GetEntryAssembly().GetName().Version; + public string Proxy { get; set; } + + public bool HasNewVersion + { + get + { + //var downloadLink = GoogleDrive.GetDirectLinkFromId(NewVersionId); + var downloadLink = "https://github.com/the1812/malware-patch/raw/master/mwp-ver.txt"; + var info = new DownloadInfo(downloadLink) + { + Proxy = Proxy, + }; + var newVersionString = info.DownloadString(); + NewVersion = new Version(newVersionString); + +//#if DEBUG +// return true; +//#endif + return NewVersion > CurrectVerison; + } + } + } +} diff --git a/src/MalwarePatch/Properties/AssemblyInfo.cs b/src/MalwarePatch/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b0b4f32 --- /dev/null +++ b/src/MalwarePatch/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("Malware Patch")] +[assembly: AssemblyDescription("Malware Patch")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Ace Studio")] +[assembly: AssemblyProduct("Malware Patch")] +[assembly: AssemblyCopyright("Copyright © Ace Studio 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +//若要开始生成可本地化的应用程序,请设置 +//.csproj 文件中的 CultureYouAreCodingWith +//例如,如果您在源文件中使用的是美国英语, +//使用的是美国英语,请将 设置为 en-US。 然后取消 +//对以下 NeutralResourceLanguage 特性的注释。 更新 +//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。 + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //主题特定资源词典所处位置 + //(未在页面中找到资源时使用, + //或应用程序资源字典中找到时使用) + ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置 + //(未在页面中找到资源时使用, + //、应用程序或任何主题专用资源字典中找到时使用) +)] + + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 +// 方法是按如下所示使用“*”: : +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("2.9.1.0")] +[assembly: AssemblyFileVersion("2.9.1.0")] diff --git a/src/MalwarePatch/Properties/Resources.Designer.cs b/src/MalwarePatch/Properties/Resources.Designer.cs new file mode 100644 index 0000000..8825736 --- /dev/null +++ b/src/MalwarePatch/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace MalwarePatch.Properties { + using System; + + + /// + /// 一个强类型的资源类,用于查找本地化的字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// 返回此类使用的缓存的 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MalwarePatch.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 重写当前线程的 CurrentUICulture 属性 + /// 重写当前线程的 CurrentUICulture 属性。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/src/MalwarePatch/Properties/Resources.resx b/src/MalwarePatch/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/src/MalwarePatch/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/MalwarePatch/Properties/Settings.Designer.cs b/src/MalwarePatch/Properties/Settings.Designer.cs new file mode 100644 index 0000000..e61ce64 --- /dev/null +++ b/src/MalwarePatch/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace MalwarePatch.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/src/MalwarePatch/Properties/Settings.cs b/src/MalwarePatch/Properties/Settings.cs new file mode 100644 index 0000000..c10292a --- /dev/null +++ b/src/MalwarePatch/Properties/Settings.cs @@ -0,0 +1,28 @@ +namespace MalwarePatch.Properties { + + + // 通过此类可以处理设置类的特定事件: + // 在更改某个设置的值之前将引发 SettingChanging 事件。 + // 在更改某个设置的值之后将引发 PropertyChanged 事件。 + // 在加载设置值之后将引发 SettingsLoaded 事件。 + // 在保存设置值之前将引发 SettingsSaving 事件。 + internal sealed partial class Settings { + + public Settings() { + // // 若要为保存和更改设置添加事件处理程序,请取消注释下列行: + // + // this.SettingChanging += this.SettingChangingEventHandler; + // + // this.SettingsSaving += this.SettingsSavingEventHandler; + // + } + + private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) { + // 在此处添加用于处理 SettingChangingEvent 事件的代码。 + } + + private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) { + // 在此处添加用于处理 SettingsSaving 事件的代码。 + } + } +} diff --git a/src/MalwarePatch/Properties/Settings.settings b/src/MalwarePatch/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/src/MalwarePatch/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/MalwarePatch/Properties/app.manifest b/src/MalwarePatch/Properties/app.manifest new file mode 100644 index 0000000..804f159 --- /dev/null +++ b/src/MalwarePatch/Properties/app.manifest @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/MalwarePatch/Styles/CertificateSwitch.xaml b/src/MalwarePatch/Styles/CertificateSwitch.xaml new file mode 100644 index 0000000..a59798c --- /dev/null +++ b/src/MalwarePatch/Styles/CertificateSwitch.xaml @@ -0,0 +1,334 @@ + + + #88607D8B + + + #AF26A69A + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/MalwarePatch/Styles/FlatTextBox.xaml b/src/MalwarePatch/Styles/FlatTextBox.xaml new file mode 100644 index 0000000..d145bb4 --- /dev/null +++ b/src/MalwarePatch/Styles/FlatTextBox.xaml @@ -0,0 +1,390 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/MalwarePatch/Styles/LightButton.xaml b/src/MalwarePatch/Styles/LightButton.xaml new file mode 100644 index 0000000..0e3f9cf --- /dev/null +++ b/src/MalwarePatch/Styles/LightButton.xaml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/MalwarePatch/Styles/LightScrollBar.xaml b/src/MalwarePatch/Styles/LightScrollBar.xaml new file mode 100644 index 0000000..7b4796f --- /dev/null +++ b/src/MalwarePatch/Styles/LightScrollBar.xaml @@ -0,0 +1,490 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/MalwarePatch/Styles/LightScrollViewer.xaml b/src/MalwarePatch/Styles/LightScrollViewer.xaml new file mode 100644 index 0000000..abad82f --- /dev/null +++ b/src/MalwarePatch/Styles/LightScrollViewer.xaml @@ -0,0 +1,33 @@ + + + + + + + \ No newline at end of file diff --git a/src/MalwarePatch/Styles/ToolButton.xaml b/src/MalwarePatch/Styles/ToolButton.xaml new file mode 100644 index 0000000..391273d --- /dev/null +++ b/src/MalwarePatch/Styles/ToolButton.xaml @@ -0,0 +1,374 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/MalwarePatch/UpdateID.txt b/src/MalwarePatch/UpdateID.txt new file mode 100644 index 0000000..a660e46 --- /dev/null +++ b/src/MalwarePatch/UpdateID.txt @@ -0,0 +1,6 @@ +Verison = 0B4uebmDoSFx-Tnp2R1V3RE9nRGs +Program = 0B4uebmDoSFx-c0kzcG5yVlZVMlE +// Deprecated: DebugProgram = 0B4uebmDoSFx-VXFLTnUzOXRha1E + +Version Github = https://github.com/the1812/malware-patch/raw/preview/mwp-ver.txt +Program Github = https://github.com/the1812/malware-patch/raw/preview/mwp.exe \ No newline at end of file diff --git a/src/MalwarePatch/Windows/CheckWindow.xaml b/src/MalwarePatch/Windows/CheckWindow.xaml new file mode 100644 index 0000000..bc48492 --- /dev/null +++ b/src/MalwarePatch/Windows/CheckWindow.xaml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/MalwarePatch/Windows/DialogWindow.xaml.cs b/src/MalwarePatch/Windows/DialogWindow.xaml.cs new file mode 100644 index 0000000..6624031 --- /dev/null +++ b/src/MalwarePatch/Windows/DialogWindow.xaml.cs @@ -0,0 +1,43 @@ +using Ace.Wpf; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace MalwarePatch.Windows.Dialog +{ + public partial class DialogWindow : Window + { + public DialogWindow() + { + InitializeComponent(); + buttonOK.Click += (s, e) => Close(); + this.DragMove(this); + } + public static bool? Show(string message, string title) + { + var window = Application.Current.Windows.OfType().SingleOrDefault(x => x.IsActive); + return new DialogWindow() + { + Owner = window ?? null, + WindowStartupLocation = window is null ? + WindowStartupLocation.CenterScreen : + WindowStartupLocation.CenterOwner, + DataContext = new + { + Title = title, + Message = message + } + }.ShowDialog(); + } + } +} diff --git a/src/MalwarePatch/Windows/Main/MainViewModel.Commands.cs b/src/MalwarePatch/Windows/Main/MainViewModel.Commands.cs new file mode 100644 index 0000000..645de70 --- /dev/null +++ b/src/MalwarePatch/Windows/Main/MainViewModel.Commands.cs @@ -0,0 +1,58 @@ +using MalwarePatch.Models; +using MalwarePatch.Commands; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using MalwarePatch.Windows.Update; + +namespace MalwarePatch.Windows.Main +{ + partial class MainViewModel + { + private bool isNotBusy = true; + public bool IsNotBusy + { + get => isNotBusy; + set + { + isNotBusy = value; + OnPropertyChanged(nameof(IsNotBusy)); + } + } + public SaveChangesCommand ButtonSaveCommand => new SaveChangesCommand(Certificates) + { + BeforeExecute = () => IsNotBusy = false, + AfterExecute = () => + { + IsNotBusy = true; + ShowSavedPopup = true; + } + }; + + public ICommand ButtonCheckAllCommand => new BatchCheckCommand(true, Certificates); + public ICommand ButtonUncheckAllCommand => new BatchCheckCommand(false, Certificates); + public ICommand AllowFileCommand => new UserCertificateCommand(true, Certificates); + public ICommand DisallowFileCommand => new UserCertificateCommand(false, Certificates); + + public DirectCommand ButtonUpdateCommand => new DirectCommand + { + ExcuteAction = o => + { + var updateWindow = new UpdateWindow() + { + Owner = View + }; + ShowNewVersionPopup = false; + ShowSavedPopup = false; + updateWindow.ShowDialog(); + } + }; + + } +} diff --git a/src/MalwarePatch/Windows/Main/MainViewModel.cs b/src/MalwarePatch/Windows/Main/MainViewModel.cs new file mode 100644 index 0000000..d9b36c9 --- /dev/null +++ b/src/MalwarePatch/Windows/Main/MainViewModel.cs @@ -0,0 +1,120 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using MalwarePatch.Languages; +using System.ComponentModel; +using System.Windows; +using MalwarePatch.Commands; +using System.Windows.Controls; +using System.Threading; +using MalwarePatch.Models; +using Ace.Wpf.Mvvm; +using System.Collections.ObjectModel; + +namespace MalwarePatch.Windows.Main +{ + sealed partial class MainViewModel : ViewModel + { + public MainViewModel(MainWindow mainWindow) : base(mainWindow) + { + silentCheckUpdate(); + certificates = new ObservableCollection(); + BuiltInCertificates.All.ForEach(cert => certificates.Add(new CertificateAdapter(cert))); + } + private async void silentCheckUpdate() + { +#if DEBUG + await Task.Run(() => + { + //ShowNewVersionPopup = true; + var checker = new VersionChecker(); + var hasNewVersion = false; + try + { + hasNewVersion = checker.HasNewVersion; + } + catch + { + hasNewVersion = false; + } + if (hasNewVersion) + { + ShowNewVersionPopup = true; + } + }); +#else + await Task.Run(() => + { + //ShowNewVersionPopup = true; + var checker = new VersionChecker(); + var hasNewVersion = false; + try + { + hasNewVersion = checker.HasNewVersion; + } + catch + { + hasNewVersion = false; + } + if (hasNewVersion) + { + ShowNewVersionPopup = true; + } + }); +#endif + + } + + private ObservableCollection certificates; + public ObservableCollection Certificates + { + get => certificates; + set + { + certificates = value; + OnPropertyChanged(nameof(Certificates)); + } + } + + private bool showSavedPopup = false; + public bool ShowSavedPopup + { + get => showSavedPopup; + set + { + showSavedPopup = value; + OnPropertyChanged(nameof(ShowSavedPopup)); + if (value) + { + Task.Run(() => + { + Thread.Sleep(2000); + ShowSavedPopup = false; + }); + } + } + } + private bool showNewVersionPopup = false; + public bool ShowNewVersionPopup + { + get => showNewVersionPopup; + set + { + showNewVersionPopup = value; + OnPropertyChanged(nameof(ShowNewVersionPopup)); + if (value) + { + Task.Run(() => + { + Thread.Sleep(5000); + ShowNewVersionPopup = false; + }); + } + } + } + + } +} diff --git a/src/MalwarePatch/Windows/Main/MainWindow.xaml b/src/MalwarePatch/Windows/Main/MainWindow.xaml new file mode 100644 index 0000000..a083bf9 --- /dev/null +++ b/src/MalwarePatch/Windows/Main/MainWindow.xaml @@ -0,0 +1,379 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +