Skip to content
Permalink
Browse files

Removed IronPython entirely.

  • Loading branch information...
tyranid committed Apr 30, 2019
1 parent fe1f43e commit 47c3306575f1d5d22bff867c06237ccb6b278dab
@@ -3284,14 +3284,6 @@ public static string GetDefaultDbgHelp()
internal static readonly bool IsWindows10RS3OrLess = Environment.OSVersion.Version < new Version(10, 0, 17134);
internal static readonly bool IsWindows10RS4OrLess = Environment.OSVersion.Version < new Version(10, 0, 17763);

private static readonly Lazy<bool> _has_iron_python = new Lazy<bool>(
() => File.Exists(Path.Combine(GetAppDirectory(), "IronPython.dll")));

internal static bool HasIronPython
{
get { return _has_iron_python.Value; }
}

public static string GetPackagePath(string packageId)
{
int length = 0;
@@ -14,9 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with OleViewDotNet. If not, see <http://www.gnu.org/licenses/>.

using IronPython.Hosting;
using Microsoft.Scripting;
using Microsoft.Scripting.Hosting;
using NtApiDotNet;
using OleViewDotNet.Database;
using System;
@@ -240,10 +237,7 @@ public COMRegistryViewer(COMRegistry reg, DisplayMode mode, IEnumerable<COMProce

foreach (FilterMode filter in Enum.GetValues(typeof(FilterMode)))
{
if (filter != FilterMode.Python || COMUtilities.HasIronPython)
{
comboBoxMode.Items.Add(filter);
}
comboBoxMode.Items.Add(filter);
}
comboBoxMode.SelectedIndex = 0;

@@ -1559,34 +1553,6 @@ private static Regex GlobToRegex(string glob, bool ignoreCase)
return new Regex(builder.ToString(), ignoreCase ? RegexOptions.IgnoreCase : RegexOptions.None);
}

private static Func<object, bool> CreatePythonFilter(string filter)
{
StringBuilder builder = new StringBuilder();
builder.AppendLine("from OleViewDotNet import *");
builder.AppendLine("def run_filter(entry):");
builder.AppendFormat(" return {0}", filter);
builder.AppendLine();

ScriptEngine engine = Python.CreateEngine();
ScriptSource source = engine.CreateScriptSourceFromString(builder.ToString(), SourceCodeKind.File);
ScriptScope scope = engine.CreateScope();
scope.Engine.Runtime.LoadAssembly(typeof(COMCLSIDEntry).Assembly);
source.Execute(scope);
return scope.GetVariable<Func<object, bool>>("run_filter");
}

private static bool RunPythonFilter(TreeNode node, Func<object, bool> python_filter)
{
try
{
return python_filter(node.Tag);
}
catch
{
return false;
}
}

private FilterResult RunComplexFilter(TreeNode node, RegistryViewerFilter filter)
{
try
@@ -1726,7 +1692,6 @@ private enum FilterMode
Equals,
Glob,
Regex,
Python,
Accessible,
NotAccessible,
Complex,
@@ -1781,12 +1746,6 @@ private enum FilterMode

return n => r.IsMatch(n.Text);
}
case FilterMode.Python:
{
Func<object, bool> python_filter = CreatePythonFilter(filter);

return n => RunPythonFilter(n, python_filter);
}
default:
throw new ArgumentException("Invalid mode value");
}
Oops, something went wrong.

0 comments on commit 47c3306

Please sign in to comment.
You can’t perform that action at this time.