forked from DevT02/PointMutationRemover
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathProgram.cs
130 lines (129 loc) · 6.28 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
using dnlib.DotNet;
using dnlib.DotNet.Writer;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace IntptrPoint
{
class Program
{
public static string Asmpath;
public static ModuleDefMD module;
public static Assembly asm;
static void Main(string[] args)
{
Console.Title = "Point Remover by OFF_LINE";
Console.ForegroundColor = ConsoleColor.White;
string lol = @" _____ _ _ _____
| __ \ (_) | | | __ \
| |__) |__ _ _ __ | |_ | |__) |___ _ __ ___ _____ _____ _ __
| ___/ _ \| | '_ \| __| | _ // _ \ '_ ` _ \ / _ \ \ / / _ \ '__|
| | | (_) | | | | | |_ | | \ \ __/ | | | | | (_) \ V / __/ |
|_| \___/|_|_| |_|\__| |_| \_\___|_| |_| |_|\___/ \_/ \___|_|
";
Console.WriteLine(lol);
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine(" Original Application by OFF_LINE");
Console.WriteLine();
Console.ForegroundColor = ConsoleColor.Magenta;
Console.WriteLine(" Mod by misonothx");
Console.ForegroundColor = ConsoleColor.DarkMagenta;
Console.WriteLine(" |- TimeSpan Cleaner");
Console.WriteLine(" |- Simple Math Cleaner");
Console.WriteLine(" |- CUI Changes & fixes");
Console.WriteLine();
Console.ForegroundColor = ConsoleColor.White;
try
{
Program.module = ModuleDefMD.Load(args[0], (ModuleCreationOptions) null);
}
catch (Exception)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(" [!] Not a .NET Assembly");
Console.ResetColor();
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
System.Environment.Exit(0);
}
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(" Successfully loaded assembly!");
try
{
Console.WriteLine();
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine(" Now cleaning...");
Console.WriteLine();
}
catch (Exception ex)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(" Failed to clean. (" + ex.Message + ")");
}
IntptrPoint.PointRemover.Clean();
Console.WriteLine();
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(" Removed " + IntptrPoint.PointRemover.mathFixed + " Math calculations");
Console.WriteLine(" Removed " + PointRemover.timeSpanCleaned + " TimeSpan mutations");
Console.WriteLine(" Removed " + IntptrPoint.PointRemover.amount + " Point mutations");
Console.WriteLine();
ModuleWriterOptions writerOptions = new ModuleWriterOptions(Program.module);
writerOptions.MetaDataOptions.Flags |= MetaDataFlags.PreserveAll;
writerOptions.Logger = DummyLogger.NoThrowInstance;
NativeModuleWriterOptions NativewriterOptions = new NativeModuleWriterOptions(Program.module);
NativewriterOptions.MetaDataOptions.Flags |= MetaDataFlags.PreserveAll;
NativewriterOptions.Logger = DummyLogger.NoThrowInstance;
bool isILOnly = Program.module.IsILOnly;
if (isILOnly)
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine(" Now saving " + Path.GetFileNameWithoutExtension(args[0]) + "-IL" + Path.GetExtension(args[0]) + " (IL)...");
try
{
Program.module.Write(Path.GetFileNameWithoutExtension(args[0]) + "-IL" + Path.GetExtension(args[0]), writerOptions);
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(" (IL) '" + Path.GetFileNameWithoutExtension(args[0]) + "-IL" + Path.GetExtension(args[0]) + "' successfully saved!");
Console.ResetColor();
Console.WriteLine(" Press any key to exit...");
Console.ReadKey();
}
catch (Exception ex)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(" [!] Failed to save '" + Path.GetFileNameWithoutExtension(args[0]) + "-IL" + Path.GetExtension(args[0]) + "' (IL)");
Console.ResetColor();
Console.WriteLine(" Press any key to exit...");
Console.ReadKey();
System.Environment.Exit(0);
}
}
else
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine(" Now saving '" + Path.GetFileNameWithoutExtension(args[0]) + "-Native" + Path.GetExtension(args[0]) + "' (Native)...");
try
{
Program.module.NativeWrite(Path.GetFileNameWithoutExtension(args[0]) + "-Native" + Path.GetExtension(args[0]), NativewriterOptions);
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(" (Native) '" + Path.GetFileNameWithoutExtension(args[0]) + "-Native" + Path.GetExtension(args[0]) + "' successfully saved!");
Console.ResetColor();
Console.WriteLine(" Press any key to exit...");
Console.ReadKey();
}
catch (Exception ex)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(" [!] Failed to save (Native) application");
Console.ResetColor();
Console.WriteLine(" Press any key to exit...");
Console.ReadKey();
System.Environment.Exit(0);
}
}
}
}
}