Andy’s Keygenme Keygen (AutoIt)

Introducción

 Hoy vamos a ver como extraer el script de un ejecutable compilado por Autoit, modificarlo y recompilarlo como nuestro keygen. Como comprobareis si no se ofusca o se toman otro tipo de medidas recuperar información sensible es muy sencillo.

AutoIt es un lenguaje freeware multiproposito y de automatización para Microsoft Windows. Es un Visual Basic Killer, ya que mejora las características de los ejecutables (entre otras portabilidad, velocidad y peso, no fat-coding), y facilitan la programación con un buen repertorio de funciones «pre-diseñadas», y usando un Basic de fácil aprendizaje. Se ha expandido desde sus comienzos de automatización incluyendo muchas mejoras en el diseño del lenguaje de programación y sobre todo en nuevas funcionalidades.

El Script

Func CHECKKEY($USER, $PASS)
Local $OPKEY = "", $SIG = ""
Local $USER_LEN = StringLen($USER)
Local $PASS_LEN = StringLen($PASS)
If $USER_LEN < $PASS_LEN Then
MsgBox(0, "ERROR", "Invalid username or key.")
Exit
ElseIf $USER_LEN < 4 Then
MsgBox(0, "ERROR", "Invalid username or key.")
Exit
EndIf
$PASS_INT = Int($USER_LEN / $PASS_LEN)
$PASS_MOD = Mod($USER_LEN, $PASS_LEN)
$OPKEY = _STRINGREPEAT($PASS, $PASS_INT) & StringLeft($PASS, $PASS_MOD)
For $INDEX = 1 To $USER_LEN
$SIG &= Chr(BitXOR(Asc(StringMid($USER, $INDEX, 1)), Asc(StringMid($OPKEY, $USER_LEN - $INDEX + 1, 1))))
Next
If $SIG = _STRINGREPEAT(Chr(32), $USER_LEN) Then
MsgBox(0, "INFO", "Your key was registered.")
Exit
Else
MsgBox(0, "INFO", "Your key is invalid.")
EndIf
EndFunc

 El Algoritmo

El algoritmo es tremendamente sencillo ya que es nuestro nombre al revés y en mayúsculas.

 Modificando el script para generar nuestro propio keygen

El decompilador se llama myAut2exe y tiene este aspecto.

01-09-2014 11-56-37

Programar en AutoIt es muy sencillo e intuitivo. Nuestro keygen quedaría así.

$MAIN = GUICreate("Another keygen by deurus", 300, 80, -1, -1, 382205952, 385)
$NAME_LBL = GUICtrlCreateLabel("Username", 5, 5, 60, 20, BitOR(4096, 1))
$NAME_INP = GUICtrlCreateInput("", 70, 5, 225, 20, 1)
$PASS_LBL = GUICtrlCreateLabel("Key", 5, 30, 60, 20, BitOR(4096, 1))
$PASS_INP = GUICtrlCreateInput("", 70, 30, 225, 20, 1)
$REGISTER = GUICtrlCreateButton("Register", 5, 55, 60, 20)
$GIVE_UP = GUICtrlCreateButton("Generate", 70, 55, 60, 20)    <- Change name of button, Give Up by Generate
$TASK = GUICtrlCreateButton("?", 140, 55, 20, 20)
$AUTHOR = GUICtrlCreateLabel("keygen by deurus", 165, 55, 130, 20, BitOR(4096, 1))
GUISetState(@SW_SHOW, $MAIN)
While True
    $MSG = GUIGetMsg()
    Switch $MSG
        Case $REGISTER
            Call("CHECKKEY", GUICtrlRead($NAME_INP), GUICtrlRead($PASS_INP))
        Case $GIVE_UP
            Call("GETKEY", GUICtrlRead($NAME_INP), GUICtrlRead($PASS_INP))    <- Add the function to the button
        Case $TASK
            MsgBox(0, "Info", "keygen by deurus")
        Case - 3
            Exit
    EndSwitch
    Sleep(15)
WEnd

Func GETKEY($USER, $PASS)        <- this is our keygen function
    Local $OPKEY = "", $SIG = ""
    Local $USER_LEN = StringLen($USER)
    Local $PASS_LEN = StringLen($USER)
    If $USER_LEN < 4 Then
        GUICtrlSetData($PASS_INP  ,"min 4 chars");
    Else
    For $INDEX = 1 To $USER_LEN
        $SIG = Chr(BitXOR(Asc(StringMid($USER, $INDEX, 1)), 32)) & $SIG
    Next
        GUICtrlSetData($PASS_INP  ,$SIG);
    EndIf
EndFunc

Func CHECKKEY($USER, $PASS)        <- check function, the original
    Local $OPKEY = "", $SIG = ""
    Local $USER_LEN = StringLen($USER)
    Local $PASS_LEN = StringLen($PASS)
    If $USER_LEN < $PASS_LEN Then
        MsgBox(0, "ERROR", "Invalid username or key.")
    ElseIf $USER_LEN < 4 Then
        MsgBox(0, "ERROR", "Invalid username or key.")
        Exit
    EndIf
    $PASS_INT = Int($USER_LEN / $PASS_LEN)
    $PASS_MOD = Mod($USER_LEN, $PASS_LEN)
    $OPKEY = _STRINGREPEAT($PASS, $PASS_INT) & StringLeft($PASS, $PASS_MOD)
    For $INDEX = 1 To $USER_LEN
        $SIG &= Chr(BitXOR(Asc(StringMid($USER, $INDEX, 1)), Asc(StringMid($OPKEY, $USER_LEN - $INDEX + 1, 1))))
    Next
    If $SIG = _STRINGREPEAT(Chr(32), $USER_LEN) Then
        MsgBox(0, "INFO", "Your key was registered.")
    Else
        MsgBox(0, "INFO", "Your key is invalid.")
    EndIf
EndFunc

Este es el resultado.

01-09-2014 12-18-28

Links


Introducción El otro día navegando por la red fuí a dar a un mirror de la gran web "Karpoff Spanish
Warning: This challenge is still active and therefore should not be resolved using this information. Aviso: Este reto sigue en
Warning: This challenge is still active and therefore should not be resolved using this information. Aviso: Este reto sigue en
Intro Antes que nada, es importante saber que un archivo ELF en Linux es equivalente a un archivo EXE en

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

61 − = 53