Last active
March 2, 2025 07:46
-
-
Save LordJZ/9387644 to your computer and use it in GitHub Desktop.
JpegMini Crack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Reflection; | |
using ICVT.JPEGMini.Common; | |
namespace JpegMini.Crack.Runtime | |
{ | |
public static class OnStartup | |
{ | |
public static void Run() | |
{ | |
try | |
{ | |
ActivationManager a = ActivationManager.Current; | |
a.DailyLimitChanged += OnDailyLimitChanged; | |
OnDailyLimitChanged(0); | |
} | |
catch (Exception e) | |
{ | |
File.WriteAllText("injected_exception.txt", e.ToString()); | |
} | |
} | |
static readonly object[] s_args = { int.MaxValue / 2 }; | |
static MethodInfo s_dailyLimitSetter; | |
static void OnDailyLimitChanged(int v) | |
{ | |
try | |
{ | |
ActivationManager a = ActivationManager.Current; | |
if (a == null) | |
throw new Exception("a is null"); | |
MethodInfo m = s_dailyLimitSetter ?? (s_dailyLimitSetter = GetDailyLimitSetter(a)); | |
if (m == null) | |
throw new Exception("m is null"); | |
m.Invoke(a, s_args); | |
} | |
catch (Exception e) | |
{ | |
File.WriteAllText("injected_exception2.txt", e.ToString()); | |
} | |
} | |
static MethodInfo GetDailyLimitSetter(ActivationManager a) | |
{ | |
return a.GetType() | |
.GetProperty("RemindedDailyLimit") | |
.GetSetMethod(true); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Reflection; | |
using Mono.Cecil; | |
using Mono.Cecil.Cil; | |
using Mono.Collections.Generic; | |
namespace JpegMini.Crack | |
{ | |
class Program | |
{ | |
static void Injected() | |
{ | |
Assembly.Load("JpegMini.Crack.Runtime") | |
.GetType("JpegMini.Crack.Runtime.OnStartup") | |
.GetMethod("Run") | |
.Invoke(null, null); | |
} | |
static void Main() | |
{ | |
AssemblyDefinition a = AssemblyDefinition.ReadAssembly("log4net.dll"); | |
MethodDefinition cctor = a.MainModule.GetType("log4net.LogManager").Methods.Single(m => m.Name == ".cctor"); | |
Collection<Instruction> insns = cctor.Body.Instructions; | |
int last = insns.Count - 1; | |
if (insns[last].OpCode != OpCodes.Ret) | |
throw new InvalidOperationException(); | |
insns.RemoveAt(last); | |
string injectedName = new Action(Injected).Method.Name; | |
Collection<Instruction> injected = | |
AssemblyDefinition.ReadAssembly("JpegMini.Crack.exe") | |
.MainModule.GetType(typeof(Program).FullName) | |
.Methods | |
.Single(m => m.Name == injectedName) | |
.Body.Instructions; | |
foreach (Instruction insn in injected) | |
{ | |
if (insn.OpCode == OpCodes.Call || insn.OpCode == OpCodes.Callvirt) | |
{ | |
MethodReference op = (MethodReference)insn.Operand; | |
insn.Operand = a.MainModule.Import(op); | |
} | |
insns.Add(insn); | |
} | |
a.Write("log4net.injected.dll"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does it work?