elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Trabajando con las ramas de git (tercera parte)


  Mostrar Temas
Páginas: [1]
1  Programación / Ingeniería Inversa / Ayuda sugerencias con crack en .NET en: 12 Septiembre 2015, 19:17 pm
saludos,

Estoy tratando de hacer un crack para un programa que se llama PBU, es un programa que se usa para cabinas de fotos, en esencia lo que hace es tomar una foto aplicarle efectos, imprimirla y compartirla en redes sociales.
Conseguí la versión Trial del programa que da 15 días de prueba.

Lo que hice hasta ahora fue lo siguiente: primero analice el ejecutable con el RDG Packer Detector y el resultado es que el mismo esta compilado en Visual Basic .NET, y no esta ofuscado y no tiene ninguna protección.
Procedí entonces a desensamblarlo con el Reflector y usando el dotNET_Tracer  ubique la "zona caliente" donde el programa  valida  la cantidad de días restantes del periodo de prueba y también donde valida si la licencia es trial o es pro..etc.
Ese código estaba ubicado en el archivo PhotoBoothUpload.dll  y dentro de esta dll hay esta la  clase  PhotoPartyUpload.PhotoBoothUpload.Registration  y ahí están los métodos que se muestran  en el dotNET_Tracer  específicamente:   CheckRegistration().

El codigo en Visual. Net de Checkregistration es:

************************************************************
************************************************************
 
Código
  1. Public Function CheckRegistration() As RegistrationState
  2.    If Me.IsRegistrationDisabled Then
  3.        Return RegistrationState.Registered
  4.    End If
  5.    Dim unregisteredTrial As RegistrationState = RegistrationState.UnregisteredTrial
  6.    Dim data As LicenseData = Me.LoadLicenseData
  7.    Dim regData As RegistrationData = Me.LoadRegistrationData
  8.    If (regData Is Nothing) Then
  9.        regData = New RegistrationData With { _
  10.            .FirstRunDate = DateTime.Now, _
  11.            .LatestDetectedDate = DateTime.Now _
  12.        }
  13.    End If
  14.    Dim currentTime As DateTime = Me.GetCurrentTime
  15.    If (currentTime > regData.LatestDetectedDate) Then
  16.        regData.LatestDetectedDate = currentTime
  17.    End If
  18.    Me.RegData = regData
  19.    Me.SaveRegistrationData(regData)
  20.    Dim time2 As DateTime = regData.FirstRunDate.AddDays(1000)
  21.    If (Me.RegData.LatestDetectedDate > time2) Then
  22.        unregisteredTrial = RegistrationState.UnregisteredTrialExpired
  23.        Me._isProLicense = False
  24.    Else
  25.        unregisteredTrial = RegistrationState.UnregisteredTrial
  26.        Me._isProLicense = True
  27.    End If
  28.    If (Not data Is Nothing) Then
  29.        Me.LicenseData = data
  30.        If (Me.RegData.LatestDetectedDate > data.LicenseExpiryDate) Then
  31.            unregisteredTrial = RegistrationState.RegisteredExpired
  32.        Else
  33.            unregisteredTrial = RegistrationState.Registered
  34.        End If
  35.        Me._isProLicense = data.IsProVersion
  36.        Me._licenseCode = data.RegCode
  37.    End If
  38.    Me._registrationState = unregisteredTrial
  39.    Return unregisteredTrial
  40. End Function
*************************************************************
*************************************************************

El codigo IL de la funcion es:

Código:
.method public hidebysig instance valuetype PhotoPartyUpload.PhotoBoothUpload.Registration.RegistrationState CheckRegistration() cil managed
{
    .maxstack 2
    .locals init (
        [0] valuetype PhotoPartyUpload.PhotoBoothUpload.Registration.RegistrationState state,
        [1] class PhotoPartyUpload.PhotoBoothUpload.Registration.LicenseData data,
        [2] class PhotoPartyUpload.PhotoBoothUpload.Registration.RegistrationData data2,
        [3] valuetype [mscorlib]System.DateTime time,
        [4] valuetype [mscorlib]System.DateTime time2)

    L_0000: ldarg.0
    L_0001: ldfld bool PhotoPartyUpload.PhotoBoothUpload.Registration.Registration::IsRegistrationDisabled
    L_0006: brfalse.s L_000a
    L_0008: ldc.i4.2
    L_0009: ret
    L_000a: ldc.i4.0
    L_000b: stloc.0
    L_000c: ldarg.0
    L_000d: call instance class PhotoPartyUpload.PhotoBoothUpload.Registration.LicenseData PhotoPartyUpload.PhotoBoothUpload.Registration.Registration::LoadLicenseData()
    L_0012: stloc.1
    L_0013: ldarg.0
    L_0014: call instance class PhotoPartyUpload.PhotoBoothUpload.Registration.RegistrationData PhotoPartyUpload.PhotoBoothUpload.Registration.Registration::LoadRegistrationData()
    L_0019: stloc.2
    L_001a: ldloc.2
    L_001b: brtrue.s L_0039

    L_001d: newobj instance void PhotoPartyUpload.PhotoBoothUpload.Registration.RegistrationData::.ctor()
    L_0022: stloc.2
    L_0023: ldloc.2
    L_0024: call valuetype [mscorlib]System.DateTime [mscorlib]System.DateTime::get_Now()
    L_0029: stfld valuetype [mscorlib]System.DateTime PhotoPartyUpload.PhotoBoothUpload.Registration.RegistrationData::FirstRunDate
    L_002e: ldloc.2
    L_002f: call valuetype [mscorlib]System.DateTime [mscorlib]System.DateTime::get_Now()
    L_0034: stfld valuetype [mscorlib]System.DateTime PhotoPartyUpload.PhotoBoothUpload.Registration.RegistrationData::LatestDetectedDate
    L_0039: ldarg.0
    L_003a: call instance valuetype [mscorlib]System.DateTime PhotoPartyUpload.PhotoBoothUpload.Registration.Registration::GetCurrentTime()
    L_003f: stloc.3
    L_0040: ldloc.3
    L_0041: ldloc.2
    L_0042: ldfld valuetype [mscorlib]System.DateTime PhotoPartyUpload.PhotoBoothUpload.Registration.RegistrationData::LatestDetectedDate
    L_0047: call bool [mscorlib]System.DateTime::op_GreaterThan(valuetype [mscorlib]System.DateTime, valuetype [mscorlib]System.DateTime)
    L_004c: brfalse.s L_0055
    L_004e: ldloc.2
    L_004f: ldloc.3
    L_0050: stfld valuetype [mscorlib]System.DateTime PhotoPartyUpload.PhotoBoothUpload.Registration.RegistrationData::LatestDetectedDate
    L_0055: ldarg.0
    L_0056: ldloc.2
    L_0057: stfld class PhotoPartyUpload.PhotoBoothUpload.Registration.RegistrationData PhotoPartyUpload.PhotoBoothUpload.Registration.Registration::RegData
    L_005c: ldarg.0
    L_005d: ldloc.2
    L_005e: call instance void PhotoPartyUpload.PhotoBoothUpload.Registration.Registration::SaveRegistrationData(class PhotoPartyUpload.PhotoBoothUpload.Registration.RegistrationData)
    L_0063: ldloc.2
    L_0064: ldflda valuetype [mscorlib]System.DateTime PhotoPartyUpload.PhotoBoothUpload.Registration.RegistrationData::FirstRunDate
    L_0069: ldc.r8 1000
    L_0072: call instance valuetype [mscorlib]System.DateTime [mscorlib]System.DateTime::AddDays(float64)
    L_0077: stloc.s time2
    L_0079: ldarg.0
    L_007a: ldfld class PhotoPartyUpload.PhotoBoothUpload.Registration.RegistrationData PhotoPartyUpload.PhotoBoothUpload.Registration.Registration::RegData
    L_007f: ldfld valuetype [mscorlib]System.DateTime PhotoPartyUpload.PhotoBoothUpload.Registration.RegistrationData::LatestDetectedDate
    L_0084: ldloc.s time2
    L_0086: call bool [mscorlib]System.DateTime::op_GreaterThan(valuetype [mscorlib]System.DateTime, valuetype [mscorlib]System.DateTime)
    L_008b: brfalse.s L_0098
    L_008d: ldc.i4.1
    L_008e: stloc.0
    L_008f: ldarg.0
    L_0090: ldc.i4.0
    L_0091: stfld bool PhotoPartyUpload.PhotoBoothUpload.Registration.Registration::_isProLicense
    L_0096: br.s L_00a1
    L_0098: ldc.i4.0
    L_0099: stloc.0
    L_009a: ldarg.0
    L_009b: ldc.i4.1
    L_009c: stfld bool PhotoPartyUpload.PhotoBoothUpload.Registration.Registration::_isProLicense
    L_00a1: ldloc.1
    L_00a2: brfalse.s L_00e1
    L_00a4: ldarg.0
    L_00a5: ldloc.1
    L_00a6: call instance void PhotoPartyUpload.PhotoBoothUpload.Registration.Registration::set_LicenseData(class PhotoPartyUpload.PhotoBoothUpload.Registration.LicenseData)
    L_00ab: ldarg.0
    L_00ac: ldfld class PhotoPartyUpload.PhotoBoothUpload.Registration.RegistrationData PhotoPartyUpload.PhotoBoothUpload.Registration.Registration::RegData
    L_00b1: ldfld valuetype [mscorlib]System.DateTime PhotoPartyUpload.PhotoBoothUpload.Registration.RegistrationData::LatestDetectedDate
    L_00b6: ldloc.1
    L_00b7: ldfld valuetype [mscorlib]System.DateTime PhotoPartyUpload.PhotoBoothUpload.Registration.LicenseData::LicenseExpiryDate
    L_00bc: call bool [mscorlib]System.DateTime::op_GreaterThan(valuetype [mscorlib]System.DateTime, valuetype [mscorlib]System.DateTime)
    L_00c1: brfalse.s L_00c7
    L_00c3: ldc.i4.3
    L_00c4: stloc.0
    L_00c5: br.s L_00c9
    L_00c7: ldc.i4.2
    L_00c8: stloc.0
    L_00c9: ldarg.0
    L_00ca: ldloc.1
    L_00cb: ldfld bool PhotoPartyUpload.PhotoBoothUpload.Registration.LicenseData::IsProVersion
    L_00d0: stfld bool PhotoPartyUpload.PhotoBoothUpload.Registration.Registration::_isProLicense
    L_00d5: ldarg.0
    L_00d6: ldloc.1
    L_00d7: ldfld string PhotoPartyUpload.PhotoBoothUpload.Registration.LicenseData::RegCode
    L_00dc: stfld string PhotoPartyUpload.PhotoBoothUpload.Registration.Registration::_licenseCode
    L_00e1: ldarg.0
    L_00e2: ldloc.0
    L_00e3: stfld valuetype PhotoPartyUpload.PhotoBoothUpload.Registration.RegistrationState PhotoPartyUpload.PhotoBoothUpload.Registration.Registration::_registrationState
    L_00e8: ldloc.0
    L_00e9: ret
}
**************************************************************
**************************************************************

Se que hay varias maneras de Crackearlo pero se me ocurrió que la más simple era cambiar en el método CheckRegistration().

Como se ve en el codigo anterior  al inicio de la función hay un condicional que verifica si esta deshabilitado el registro (es decir si  ya está registrado de antemano), y cambia el estado de la variable “RegistrationEstate”a “Registered”.  La idea que tengo es agregar otro condicional para que al entrar a la función la primera vez cambie el estado de la variable “Isprolicencia” a “true” y  la variable "IsRegistrationDisabled" tambien cambie a "True", asi siempre va a entrar en el siguiente condicional y retornar el estado "Registered",  la primera parte del codigo modificado quedaria de la siguiente forma:


Código
  1.  If Not Me.IsRegistrationDisabled Then
  2.      Me._isProLicense = True
  3.      Me.IsregistrationDisabled=True
  4.  End if
  5.   If Me.IsRegistrationDisabled Then
  6.        Return RegistrationState.Registered
  7.  End If

Lo pensé de esta manera porque solo con cambiar solo RegistrationState  a “registred” no funciona, ya que en alguna otra parte del código el programa verifica el tipo de licencia y sigue figurando trial y  quedan  las fotos con una marca de agua. Por lo tanto en este punto de la función quiero tambien de una vez cambiar es estado de “IsProLicence” y talvez sea necesario en este punto  cambiar los demás datos de la licencia como “LicenceexpireDate” y “LicenceCode”, para que no falle la verificación en otros puntos del programa, pero quiero probar primero cambiando solo las varibles antes mencionadas.

El problema es que no logro modificar el codigo IL para que quede de la forma anterior, modifique las primeras instrucciones Il con el Reflexil de la siguiente manera pero no funciona:

Código:
L_0000: ldfld bool PhotoPartyUpload.PhotoBoothUpload.Registration.Registration::IsRegistrationDisabled
    L_0005: brtrue.s L_0013
    L_0007: ldc.i4.1
    L_0008: stfld bool PhotoPartyUpload.PhotoBoothUpload.Registration.Registration::_isProLicense
    L_000d: ldc.i4.1
    L_000e: stfld bool PhotoPartyUpload.PhotoBoothUpload.Registration.Registration::IsRegistrationDisabled
    L_0013: ldarg.0
    L_0014: ldfld bool PhotoPartyUpload.PhotoBoothUpload.Registration.Registration::IsRegistrationDisabled
    L_0019: brfalse.s L_001d
    L_001b: ldc.i4.2
    L_001c: ret

me sale un error en el reflector de "Pila vacia"...

Agradezco si alguien puede indicarme como modificar el codigo en el Reflexil para que quede como quiero, o me de alguna otra sugerencia.
Tambien me seria de mucha ayuda si pueden indicarme un buen turorial de CIL, he buscado pero no encontre ninguno que sea bien completo, y entiendo que debo mejorar mis conocimientos en CIL.

Muchas gracias


Mod: Los códigos deben ir en etiquetas de GeSHi o en su defecto en etiquetas de código






Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines