commit c870321cd8a438c3b737321752abd8b8dfb51511 Author: Huang-158 Date: Thu Jul 16 15:34:14 2026 +0800 MemScan-EDR v2.0: AI-powered memory detection engine with 3-layer detection pipeline diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..51593a9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,36 @@ +# Build output +bin/ +obj/ +publish/ +*.exe +*.dll +*.pdb + +# IDE +.vs/ +*.user +*.suo +.vscode/ + +# OS +.DS_Store +Thumbs.db + +# Logs / Data +*.log +data/ +logs/ +dumps/ +reports/ +settings.json +crash.log + +# Python +__pycache__/ +*.pyc +venv/ +.venv/ + +# MCP +ce-mcp-server/ +ce-mcp-server-http/ diff --git a/MemScanEDR.sln b/MemScanEDR.sln new file mode 100644 index 0000000..67b0316 --- /dev/null +++ b/MemScanEDR.sln @@ -0,0 +1,19 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MemScanEDR", "src-csharp\MemScanEDR\MemScanEDR.csproj", "{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Debug|x64.ActiveCfg = Debug|x64 + {A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Debug|x64.Build.0 = Debug|x64 + {A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Release|x64.ActiveCfg = Release|x64 + {A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Release|x64.Build.0 = Release|x64 + EndGlobalSection +EndGlobal diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 0000000..6f6ecdd --- /dev/null +++ b/scripts/README.md @@ -0,0 +1,16 @@ +# MemScan-EDR v2.0 - Build & Tools + +This directory contains build scripts and utility tools for MemScan-EDR v2.0. + +## Build Scripts + +- `build_csharp.bat` - One-click build for the C# WPF application (Windows x64, self-contained single-file EXE) + +## Prerequisites + +- .NET 8 SDK +- Windows 10/11 x64 (for building and running) + +## Usage + +Run `build_csharp.bat` from this directory to build the full application. diff --git a/scripts/build_csharp.bat b/scripts/build_csharp.bat new file mode 100644 index 0000000..9d0daf2 --- /dev/null +++ b/scripts/build_csharp.bat @@ -0,0 +1,48 @@ +@echo off +chcp 65001 >nul +echo ============================================ +echo MemScan-EDR v2.0 - Build Script +echo AI-Powered Memory Detection +echo ============================================ +echo. + +:: Check .NET 8 SDK +where dotnet >nul 2>&1 +if %ERRORLEVEL% NEQ 0 ( + echo [ERROR] .NET SDK not found. Please install .NET 8 SDK. + pause + exit /b 1 +) + +echo [1/3] Restoring NuGet packages... +dotnet restore src-csharp/MemScanEDR/MemScanEDR.csproj +if %ERRORLEVEL% NEQ 0 ( + echo [ERROR] Restore failed. + pause + exit /b 1 +) + +echo [2/3] Building Release (win-x64, self-contained)... +dotnet publish src-csharp/MemScanEDR/MemScanEDR.csproj ^ + -c Release ^ + -r win-x64 ^ + --self-contained true ^ + -p:PublishSingleFile=true ^ + -p:IncludeNativeLibrariesForSelfExtract=true ^ + -o publish +if %ERRORLEVEL% NEQ 0 ( + echo [ERROR] Build failed. + pause + exit /b 1 +) + +echo [3/3] Copying assets... +if exist "rules" xcopy /E /I /Y "rules" "publish\rules\" >nul +if exist "..\MemScan-EDR\rules" xcopy /E /I /Y "..\MemScan-EDR\rules" "publish\rules\" >nul + +echo. +echo ============================================ +echo BUILD SUCCESSFUL! +echo Output: publish\MemScan-EDR.exe +echo ============================================ +pause diff --git a/src-csharp/MemScanEDR/App.xaml b/src-csharp/MemScanEDR/App.xaml new file mode 100644 index 0000000..abb2fe8 --- /dev/null +++ b/src-csharp/MemScanEDR/App.xaml @@ -0,0 +1,5 @@ + + diff --git a/src-csharp/MemScanEDR/App.xaml.cs b/src-csharp/MemScanEDR/App.xaml.cs new file mode 100644 index 0000000..f855b06 --- /dev/null +++ b/src-csharp/MemScanEDR/App.xaml.cs @@ -0,0 +1,55 @@ +using System; +using System.IO; +using System.Windows; +using System.Windows.Threading; + +namespace MemScanEDR +{ + public partial class App : Application + { + private static readonly string LogPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "crash.log"); + + protected override void OnStartup(StartupEventArgs e) + { + DispatcherUnhandledException += OnDispatcherUnhandledException; + AppDomain.CurrentDomain.UnhandledException += OnDomainUnhandledException; + + base.OnStartup(e); + + try + { + Directory.CreateDirectory("data"); + Directory.CreateDirectory("logs"); + Directory.CreateDirectory("dumps"); + Directory.CreateDirectory("reports"); + } + catch (Exception ex) + { + LogError("Directory creation failed", ex); + } + } + + private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) + { + LogError("UI Exception", e.Exception); + MessageBox.Show($"Error logged to crash.log:\n\n{e.Exception.Message}", "MemScan-EDR v2.0", + MessageBoxButton.OK, MessageBoxImage.Error); + e.Handled = true; + } + + private void OnDomainUnhandledException(object sender, UnhandledExceptionEventArgs e) + { + LogError("Fatal Exception", e.ExceptionObject as Exception); + } + + private static void LogError(string context, Exception? ex) + { + try + { + var msg = $"[{DateTime.Now:yyyy-MM-dd HH:mm:ss}] {context}\n{ex}\n\n"; + File.AppendAllText(LogPath, msg); + } + catch { } + } + } +} diff --git a/src-csharp/MemScanEDR/MainWindow.xaml b/src-csharp/MemScanEDR/MainWindow.xaml new file mode 100644 index 0000000..d5e0e73 --- /dev/null +++ b/src-csharp/MemScanEDR/MainWindow.xaml @@ -0,0 +1,464 @@ + + + + #f0f2f5 + #1e293b + #ffffff + #ffffff + #f1f5f9 + #e2e8f0 + #1e293b + #64748b + #94a3b8 + #ef4444 + #3b82f6 + #22c55e + #f59e0b + #8b5cf6 + #eff6ff + #cbd5e1 + #64748b + #334155 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +