Skip to content

Instantly share code, notes, and snippets.

@LordJZ
Last active September 20, 2022 05:22
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save LordJZ/9387644 to your computer and use it in GitHub Desktop.
Save LordJZ/9387644 to your computer and use it in GitHub Desktop.
JpegMini Crack
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);
}
}
}
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");
}
}
}
@tarungupta0311
Copy link

HI friend,

could you please help me how to use above code, to make jpegmini lifetime free

@badnose
Copy link

badnose commented Jan 10, 2019

HI friend,

could you please help me how to use above code, to make jpegmini lifetime free

Hallo mein freund
Weißt du schon wie der code funktioniert? Oder kannst du ihn mir schicken oder ihn hier reinschreiben

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment