Jump to content

Welcome to NulledBlog
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. If you already have an account, login here - otherwise create an account for free today!
Photo

Ectune Patcher Fix


  • Please log in to reply
7 replies to this topic

#1
sillieonline

  • Offline
  • Member

  • Posts:
    38
    Reputation:
    16
    Joined:
    16 Aug, 2015

yo guys need some help. Nios build a patcher/keygen for ectune software. whats great but not for the right version.

i got the right files now only the patcher is not patching the new file. i'm not great in visual studio but i found this:

			// Try to patch
			new Thread(() =>
			{
				if (!this.Busy)
				{
					this.Busy = true;
					this.SetStatus("Patching file...");

					Patcher patcher = new Patcher(filepath);
					var results = patcher.Patch();

					if (results.SignatureCheck && results.KeyCheck)
					{
						patcher.Write(destination);
						this.SetStatus(String.Format("File patched: {0}", destination));
					}
					else this.SetStatus("File not patched");

					this.Busy = false;
				}

thats mean the new file is not checks out the (results.SignatureCheck && results.KeyCheck)

 

can someone help whit this problem? 

using System;
using System.Drawing;
using System.IO;
using System.Threading;
using System.Windows.Forms;

namespace eCtuneKeygen
{
	public partial class KeygenForm : Form
	{
		public Boolean Busy { get; private set; }
		public License License { get; private set; }

		public static readonly String DestinationPath = "license.xml";

		public KeygenForm()
		{
			InitializeComponent();
			this.Busy = false;
		}

		private void KeygenForm_Load(object sender, EventArgs e)
		{
			this.License = new License();
			this.NameTextBox.Text = this.License.Name;
			this.OrgTextBox.Text = this.License.Org;
			this.EmailTextBox.Text = this.License.Email;
		}

		private void AboutButton_Click(object sender, EventArgs e)
		{
			AboutForm about = new AboutForm();
			about.ShowDialog(this);
		}

		private void GenerateButton_Click(object sender, EventArgs e)
		{
			this.License.Name = this.NameTextBox.Text;
			this.License.Org = this.OrgTextBox.Text;
			this.License.Email = this.EmailTextBox.Text;
			this.License.Type = this.SelectedLicenseType;


			new Thread(() =>
			{
				if (!this.Busy)
				{
					this.Busy = true;
					this.SetStatus("Generating license file...");

					String license = this.License.ToString();
					File.WriteAllText(DestinationPath, license);

					this.Invoke((MethodInvoker)delegate
					{
						this.SetStatus("Wrote license to " + DestinationPath);
					});

					this.Busy = false;
				}
			}).Start();
		}

		private void LinePanel_Paint(object sender, PaintEventArgs e)
		{
			Panel panel = (Panel)sender;
			Int32 thickness = 1, halfThickness = thickness / 2;
			Int32 w = panel.ClientSize.Width, h = panel.ClientSize.Height;
			using (Pen p = new Pen(Color.White, thickness))
			{
				e.Graphics.FillRectangle(p.Brush, new Rectangle(
					0, (h/2) - halfThickness,
					w, thickness
				));
			}
		}

		private void OstrichButton_Click(object sender, EventArgs e)
		{
			OstrichForm form = new OstrichForm(this.License);
			form.ShowDialog(this);
		}

		private void PatchButton_Click(object sender, EventArgs e)
		{
			String filepath = "eCtune.EXE", destination = "eCtune-patched.EXE";

			if (!File.Exists(filepath))
			{eCtuneKeygen.KeygenForm.PatchButton_Click(object, System.EventArgs)
				filepath = Patcher.GetDefaultInstalledExePath;
				if (!File.Exists(filepath))
				{
					MessageBox.Show(
						"eCtune.EXE not found, copy it to the same directory as the patcher and try again",
						"Patch Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
					return;
				}
			}

			// Try to patch
			new Thread(() =>
			{
				if (!this.Busy)
				{
					this.Busy = true;
					this.SetStatus("Patching file...");

					Patcher patcher = new Patcher(filepath);
					var results = patcher.Patch();

					if (results.SignatureCheck && results.KeyCheck)
					{
						patcher.Write(destination);
						this.SetStatus(String.Format("File patched: {0}", destination));
					}
					else this.SetStatus("File not patched");

					this.Busy = false;
				}
			}).Start();
		}

		public LicenseType SelectedLicenseType
		{
			get
			{
				if (this.DataloggerRadioButton.Checked)
					return LicenseType.DataLogger;
				if (this.DemonRadioButton.Checked)
					return LicenseType.ProDemon;
				if (this.OstrichRadioButton.Checked)
					return LicenseType.ProOstrich;
				if (this.TunerRadioButton.Checked)
					return LicenseType.Tuner;
				if (this.DeveloperRadioButton.Checked)
					return LicenseType.Developer;

				return LicenseType.Free;
			}
		}

		public void SetStatus(String text)
		{
			this.Invoke((MethodInvoker)delegate
			{
				this.StatusBar.Text = text;
			});
		}
	}
}

using System;
using System.IO;
using System.Collections.Generic;
using dnlib.DotNet;
using dnlib.DotNet.Emit;
using dnlib.DotNet.Writer;

namespace eCtuneKeygen
{
	public class Patcher
	{
		public ModuleDefMD Module { get; private set; }

		/// <summary>
		/// Construct a patcher for a file.
		/// </summary>
		/// <param name="filepath">Filepath</param>
		public Patcher(String filepath)
		{
			this.Module = ModuleDefMD.Load(filepath);
		}

		/// <summary>
		/// Attempt to patch the loaded module.
		/// </summary>
		/// <returns>Results of patching</returns>
		public PatchResults Patch()
		{
			if (this.Module == null)
				return null;

			Boolean sigCheckPatched = false, keyCheckPatched = false;

			var types = this.Module.GetTypes();
			foreach(var type in types)
			{
				if (this.PatchLicenseSignatureCheck(type))
				{
					sigCheckPatched = true;

					// Only check for key check methods if in the same class as signature check methods
					if(this.PatchLicenseKeyChecks(type))
					{
						keyCheckPatched = true;
					}
				}
			}

			return new PatchResults(sigCheckPatched, keyCheckPatched);
		}

		/// <summary>
		/// Write the modified module to a file.
		/// </summary>
		/// <param name="filepath">Filepath</param>
		public void Write(String filepath)
		{
			var options = new ModuleWriterOptions(this.Module);
			options.MetaDataOptions.Flags |= MetaDataFlags.PreserveAll;
			options.MetaDataOptions.Flags |= MetaDataFlags.KeepOldMaxStack;
			options.Logger = DummyLogger.NoThrowInstance; // Avoid "ResolutionScope is null" exception
			this.Module.Write(filepath, options);
		}

		/// <summary>
		/// Check for and patch the license signature check to always return true.
		/// </summary>
		/// <param name="type">Type (Class) to inspect and patch if detected</param>
		/// <returns>true if patched, false if not modified</returns>
		private Boolean PatchLicenseSignatureCheck(TypeDef type)
		{
			if (type == null)
				return false;

			MethodDef sigCheckMethod = null, rsaProviderMethod = null;

			IList<MethodDef> methods = type.Methods;
			foreach(var method in methods)
			{
				if (method == null)
					continue;

				// Check for signature verification method
				// Looks like: <private bool method(RSA)>
				if (!method.IsStatic
				&& method.ReturnType.FullName.Equals("System.Boolean")
				&& method.Parameters.Count == 2 && method.Parameters[1].Type.FullName.Equals("System.Security.Cryptography.RSA"))
				{
					sigCheckMethod = method;
				}

				// Check for static RSA service provider method
				// Looks like: <private static RSACryptoServiceProvider method()>
				if(method.IsPrivate && method.IsStatic
				&& method.ReturnType.FullName.Equals("System.Security.Cryptography.RSACryptoServiceProvider")
				&& method.Parameters.Count == 0)
				{
					rsaProviderMethod = method;
				}

				if (sigCheckMethod != null && rsaProviderMethod != null)
				{
					// If found, replace signature verification body with `return true;`
					sigCheckMethod.Body = CreateReturnTrueBody(sigCheckMethod.Body);
					return true;
				}
			}

			return false;
		}

		/// <summary>
		/// Patch LicKey checks.
		/// </summary>
		/// <param name="type">Type (Class)</param>
		/// <returns>true if patched, false if not</returns>
		private Boolean PatchLicenseKeyChecks(TypeDef type)
		{
			Int32 patchCount = 0;

			IList<MethodDef> methods = type.Methods;
			foreach (var method in methods)
			{
				if (method == null)
					continue;

				// Check for key check method
				// Looks like: <bool method()>
				if (!method.IsStatic
				&& method.ReturnType.FullName.Equals("System.Boolean")
				&& method.Parameters.Count == 1
				&& method.Body.Instructions.Count > 10) // Using instruction count is a bit hacky
				{
					method.Body = CreateReturnTrueBody(method.Body);
					patchCount++;
				}
			}

			return patchCount == 2;
		}

		/// <summary>
		/// Create a method body equivalent to `return true;`.
		/// </summary>
		/// <param name="body">Optional existing method body</param>
		/// <returns>Method body</returns>
		public static CilBody CreateReturnTrueBody(CilBody body = null)
		{
			if (body == null)
				body = new CilBody();
			else
			{
				body.KeepOldMaxStack = true;
				body.Instructions.Clear();
			}

			body.Instructions.Add(OpCodes.Ldc_I4_1.ToInstruction()); // ldc.i4.1
			body.Instructions.Add(OpCodes.Ret.ToInstruction());      // ret

			return body;
		}

		/// <summary>
		/// Get the path to X86 Program Files directory.
		/// </summary>
		public static string ProgramFilesX86
		{
			get
			{
				if (8 == IntPtr.Size
					|| (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432"))))
				{
					return Environment.GetEnvironmentVariable("ProgramFiles(x86)");
				}

				return Environment.GetEnvironmentVariable("ProgramFiles");
			}
		}

		/// <summary>
		/// Get the default location of eCtune.EXE if it is installed.
		/// </summary>
		public static String GetDefaultInstalledExePath
		{
			get
			{
				return Path.Combine(Path.Combine(ProgramFilesX86, "eCtune"), "eCtune.EXE");
			}
		}
	}

	/// <summary>
	/// Patch results.
	/// </summary>
	public class PatchResults
	{
		public Boolean SignatureCheck { get; private set; }
		public Boolean KeyCheck { get; private set; }

		public PatchResults(Boolean sigCheck, Boolean keyCheck)
		{
			this.SignatureCheck = sigCheck;
			this.KeyCheck = keyCheck;
		}
	}
}


  • 1

#2
brahramantula

  • Offline
  • Lurker

  • Posts:
    9
    Reputation:
    2
    Joined:
    02 Aug, 2015

As I can see from this topic http://forum.ectune....ewtopic.php?t=5 since version 0.0.2 r4 the Tuner and Developer version can work unlicensed with the Ostrich. I don't know exactly which version you have at the moment, but if it isn't R19 it has probably expired. I have an old Pro version and I'll try to fix the expire problem, but not sure if it will be the same for Tuner version.


  • 0

#3
chukhoa1

  • Offline
  • New Member

  • Posts:
    21
    Reputation:
    7
    Joined:
    15 Jul, 2015

Thank man !!!


  • 1

#4
rom

  • Offline
  • New Member

  • PipPip
  • Posts:
    23
    Reputation:
    5
    Joined:
    22 Sep, 2015
Thank
  • 0

#5
sillieonline

  • Offline
  • Member

  • Posts:
    38
    Reputation:
    16
    Joined:
    16 Aug, 2015
Dear All,
Please find attached update
most people will only need the update rar

1)First Setupif needed for a new install)
http://websrv.ectune.com/eCtune.Setup.current.rar

2) then Update:
http://websrv.ectune.com/eCtune.Tuner.Update.0023r20.date.06.05.2014.rar
password: eCtune0614 " 

  • 0

#6
damaskus

  • Offline
  • Lurker

  • Posts:
    4
    Reputation:
    0
    Joined:
    08 Jan, 2016

Could you post the full source. All the download links are down. So if you could reupload it i could find and fix the patcher. 


  • 0

#7
damaskus

  • Offline
  • Lurker

  • Posts:
    4
    Reputation:
    0
    Joined:
    08 Jan, 2016

Bump still waiting on the full source please.


  • 0

#8
poormansr

  • Offline
  • Member

  • Posts:
    25
    Reputation:
    0
    Joined:
    26 Apr, 2016

BU<MP


  • 0


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users