Skip to content

Commit

Permalink
feat: prevent loading plugins using iphlpapi
Browse files Browse the repository at this point in the history
  • Loading branch information
azeier committed Oct 26, 2023
1 parent b9d5dab commit 3c76f49
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Hearthstone Deck Tracker/Plugins/PluginManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Hearthstone_Deck_Tracker.Utility.Logging;

Expand Down Expand Up @@ -193,12 +194,20 @@ public void LoadPlugins(IEnumerable<FileInfo> files)
}
}

// Blizzard has kindly asked us to stop supporting reconnector plugins
private readonly string[] _prohibitedImports = { "iphlpapi.dll" };
private IEnumerable<PluginWrapper> GetModule(string pFileName, Type pTypeInterface)
{
var plugins = new List<PluginWrapper>();
try
{
var assembly = Assembly.LoadFrom(pFileName);
var hasProhibitedImport = assembly.GetTypes().Any(t => t.GetMethods()
.Any(m => m.GetCustomAttributes<DllImportAttribute>()
.Any(a => _prohibitedImports.Contains(a.Value))));
if(hasProhibitedImport)
return plugins;

// trigger the loading of embedded dependencies
TriggerAssembly(assembly);
foreach(var type in assembly.GetTypes())
Expand Down

0 comments on commit 3c76f49

Please sign in to comment.