19-10-17, 03:26 AM
أخي أحمد بارك الله فيك أتمنى منك أن لا تبخل معي في إيجاد حل
لكن أنا ما أحاول فعله الناتج يكون مفكوك التشفير لا جميع السترينغ
أريد فقط رقم 1 و 2 ينفك التشفير تاعهم و ينتج لي البرنامج نفسه لكن مكان 1 و 2 تكون مفكوكة
هذا مشروع أخر لو تلقي نظرة فيه ستفهم قصدي أخي
لكن أنا ما أحاول فعله الناتج يكون مفكوك التشفير لا جميع السترينغ
أريد فقط رقم 1 و 2 ينفك التشفير تاعهم و ينتج لي البرنامج نفسه لكن مكان 1 و 2 تكون مفكوكة
هذا مشروع أخر لو تلقي نظرة فيه ستفهم قصدي أخي
كود :
using System;
using System.Collections.Generic;
using System.Text;
using dnlib.DotNet;
using dnlib.DotNet.Emit;
namespace ConsoleApplication2
{
class Program
{
static List<int> ints = new List<int>();
static Dictionary<double, string> MyDictionary = new Dictionary<double, string>();
static void Main(string[] args)
{
var DeobMe = @"C:\1.exe";
var module = ModuleDefMD.Load(DeobMe);
var types = module.GetTypes();
foreach (var type in types)
{
if (!type.HasFields)
continue;
// Get value field
#region
var ctor = type.FindDefaultConstructor();
foreach (var ils_ctor in ctor.Body.Instructions)
{
if (!ils_ctor.IsLdcI4())
continue;
ints.Add(ils_ctor.GetLdcI4Value());
}
#endregion
foreach (var method in type.Methods)
{
if (!method.HasBody)
continue;
// Get value for Dictionary
#region
if (method.IsPublic && !method.HasReturnType)
{
if (method.IsSpecialName || method.IsRuntimeSpecialName)
continue;
double num = default(double);
string str = string.Empty;
foreach (var ils in method.Body.Instructions)
{
if (ils.OpCode == OpCodes.Ldc_R8)
num = (double)ils.Operand;
if (ils.OpCode != OpCodes.Ldstr)
continue;
str = ils.Operand as string;
MyDictionary.Add(num, str);
}
}
#endregion
}
// String Decrypter
foreach (var method in type.Methods)
{
var _ils = method.Body.Instructions;
for (int i = 0; i < _ils.Count; i++)
{
if (_ils[i].OpCode == OpCodes.Callvirt && _ils[i + 1].OpCode == OpCodes.Call)
{
var MD = _ils[i + 1].Operand as MethodDef;
if (!MD.IsStatic && !MD.IsPublic)
continue;
if (!MD.HasParamDefs && !MD.HasReturnType)
continue;
if (MD.ParamDefs.Count != 1 && MD.ParamDefs[1].ElementType != ElementType.String)
continue;
int val = (int)_ils[i - 15].GetLdcI4Value();
string strop = BTS(MyDictionary[value(val)]);
_ils[i + 1].OpCode = OpCodes.Ldstr;
_ils[i + 1].Operand = strop;
for (int numero = i; numero > i - 18; numero--)
_ils[numero].OpCode = OpCodes.Nop;
}
}
}
}
module.Write(@"C:\2.exe");
}
static double value(int param)
{
return (Math.Pow((double)Math.Abs(param), (double)ints[0]) + (double)ints[1]) * (double)ints[2];
}
public static string BTS(string s)
{
return Encoding.UTF8.GetString(Convert.FromBase64String(s));
}
}
}