The document describes decompiling two Visual Basic programs using the VD Decompiler program. The first program is a calculator application that is decompiled to produce its source code. The second program performs matrix operations and its decompilation results in a block of code for matrix addition, multiplication, and subtraction. Decompilation allows viewing the original source code of programs compiled to an executable file format.
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
VB Decompiler Output
1. PONTIFICIA UNIVERSIDAD CATÓLICA DEL ECUADOR SEDE IBARRA
Santiago Guzmán
21/04/2017
TRABAJO DE COMPILADORES
Investigación Ensambladores y De-compiladores
Como primer paso descargamos el programa VD Decompiler, en este caso la versión 10.3 para luego
proceder a descompilar algún programa que existe en Visual Basic 6.
Una vez descargado procedemos a la instalación dando click en siguiente (Next).
Aceptamos las condiciones de la licencia y damos click en siguiente.
2. Escogemos la carpeta donde va a ser instalada y luego click en siguiente.
Escogemos la opción si deseamos un icono en el menú Start de nuestra computadora (opcional)
Seleccionamos el idioma en el que deseamos que funcione la aplicación.
Una vez configurado todo, procedemos a dar click en Instalar (Install).
3. Esperamos a que termine de instalar.
Finalmente damos click en finalizar (Finish) para poder ejecutar el programa.
A continuación procedemos a Insertar nuevo Programa desde Archivo y seleccionamos el programa
que deseamos descompilar, abrimos y esperamos que el descompilador automáticamente
descompile el programa siempre y cuando no exista alguna clave.
En el siguiente ejemplo vamos a descompilar una calculadora realizada en Visual Basic 6, para esto
debemos seleccionar siempre el archivo ejecutable (.EXE) y luego obtendremos el programa
descompilado.
4. Finalmente obtenemos el código fuente del programa antes mencionado teniendo el siguiente
resultado.
VERSION 5.00 Begin
VB.Form Form1 Caption = "Calculadora by marco" ScaleMode = 1 AutoRedraw = False
FontTransparent = True BorderStyle = 4 'Fixed ToolWindow 'Icon = n/a LinkTopic = "Form1"
MaxButton = 0 'False MinButton = 0 'False ClientLeft = 45 ClientTop = 285 ClientWidth = 3975
ClientHeight = 3195 ShowInTaskbar = 0 'False StartUpPosition = 3 'Windows Default Begin
CommandButton salir Caption = "Salir" Left = 2160 Top = 2520 Width = 1695 Height = 495 TabIndex =
11 End Begin CommandButton new Caption = "Nuevo calculo" Left = 120 Top = 2520 Width = 1695
Height = 495 TabIndex = 10 End Begin CommandButton dividir Caption = "/" Left = 3240 Top = 1800
Width = 615 Height = 495 TabIndex = 9 BeginProperty Font Name = "MS Sans Serif" Size = 13.5
Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty
End Begin CommandButton por Caption = "x" Left = 2160 Top = 1800 Width = 615 Height = 495
TabIndex = 8 BeginProperty Font Name = "MS Sans Serif" Size = 13.5 Charset = 0 Weight = 400
Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty End Begin CommandButton
restar Caption = "-" Left = 1200 Top = 1800 Width = 615 Height = 495 TabIndex = 7 BeginProperty
Font Name = "MS Sans Serif" Size = 13.5 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False
Strikethrough = 0 'False EndProperty End Begin CommandButton sumar Caption = "+" Left = 120 Top
= 1800 Width = 615 Height = 495 TabIndex = 6 BeginProperty Font Name = "MS Sans Serif" Size =
13.5 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False
EndProperty End Begin TextBox res Left = 1680 Top = 1080 Width = 1215 Height = 405 TabIndex = 5
BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False
Italic = 0 'False Strikethrough = 0 'False EndProperty End Begin TextBox can2 Left = 1680 Top = 600
Width = 1215 Height = 405 TabIndex = 4 BeginProperty Font Name = "MS Sans Serif" Size = 9.75
Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty
End Begin TextBox can1 Left = 1680 Top = 120 Width = 1215 Height = 405 TabIndex = 3
BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 400 Underline = 0 'False
Italic = 0 'False Strikethrough = 0 'False EndProperty End Begin Label Label3 Caption = "Resultado"
5. Left = 240 Top = 1200 Width = 1095 Height = 255 TabIndex = 2 BeginProperty Font Name = "MS Sans
Serif" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0
'False EndProperty End Begin Label Label2 Caption = "Cantidad2" Left = 240 Top = 720 Width = 1095
Height = 615 TabIndex = 1 BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight
= 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty End Begin Label
Label1 Caption = "Cantidad1" Left = 240 Top = 240 Width = 1215 Height = 495 TabIndex = 0
BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False
Italic = 0 'False Strikethrough = 0 'False EndProperty End End Attribute VB_Name = "Form1"
Ahora tenemos otro ejemplo de suma de números que descompilamos de la misma manera.
Y se obtiene el siguiente código fuente.
VERSION 5.00
Begin VB.Form OPERACIONES BackColor = &H80000003& Caption = "OPERACIONES CON
MATRICES 3*3" ClientHeight = 5325 ClientLeft = 60 ClientTop = 420 ClientWidth =
8250 LinkTopic = "OPERACIONES MATRICES" ScaleHeight = 5325 ScaleWidth = 8250
StartUpPosition = 3 'Windows Default Begin VB.CommandButton Command4 Caption =
"LIMPIAR" BeginProperty Font Name = "MS Sans Serif" Size = 9.75
Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False
Strikethrough = 0 'False EndProperty Height = 495 Left = 5640 TabIndex
= 35 Top = 3360 Width = 2055 End Begin VB.CommandButton SALIR
Caption = "SALIR" BeginProperty Font Name = "MS Sans Serif" Size =
9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0
'False Strikethrough = 0 'False EndProperty Height = 495 Left = 600
TabIndex = 33 Top = 3360 Width = 1935 End Begin VB.CommandButton
Command3 Caption = "-" BeginProperty Font Name = "MS Sans Serif"
Size = 18 Charset = 0 Weight = 700 Underline = 0 'False
6. Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left
= 5040 TabIndex = 32 Top = 1560 Width = 735 End Begin
VB.CommandButton Command2 Caption = "X" BeginProperty Font Name =
"MS Sans Serif" Size = 12 Charset = 0 Weight = 700 Underline
= 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height
= 375 Left = 5040 TabIndex = 31 Top = 2040 Width = 735 End
Begin VB.CommandButton Command1 Caption = "+" BeginProperty Font Name
= "MS Sans Serif" Size = 18 Charset = 0 Weight = 700 Underline
= 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height
= 375 Left = 5040 TabIndex = 30 Top = 1080 Width = 735 End
Begin VB.TextBox C13 Height = 375 Left = 7440 TabIndex = 28 Top
= 1080 Width = 495 End Begin VB.TextBox C21 Height = 375 Left =
6120 TabIndex = 27 Top = 1560 Width = 495 End Begin VB.TextBox C22
Height = 375 Left = 6840 TabIndex = 26 Top = 1560 Width
= 495 End Begin VB.TextBox C31 Height = 375 Left = 6120 TabIndex =
25 Top = 2040 Width = 495 End Begin VB.TextBox C32 Height = 375
Left = 6840 TabIndex = 24 Top = 2040 Width = 495 End Begin
VB.TextBox C33 Height = 375 Left = 7440 TabIndex = 23 Top =
2040 Width = 495 End Begin VB.TextBox C12 Height = 375 Left = 6840
TabIndex = 22 Top = 1080 Width = 495 End Begin VB.TextBox C11
Height = 375 Left = 6120 TabIndex = 21 Top = 1080 Width
= 495 End Begin VB.TextBox C23 Height = 375 Left = 7440 TabIndex =
20 Top = 1560 Width = 495 End Begin VB.TextBox B13 Height = 375
Left = 4200 TabIndex = 18 Top = 1080 Width = 495 End Begin
VB.TextBox B21 Height = 375 Left = 2880 TabIndex = 17 Top =
1560 Width = 495 End Begin VB.TextBox B22 Height = 375 Left = 3600
TabIndex = 16 Top = 1560 Width = 495 End Begin VB.TextBox B31
Height = 375 Left = 2880 TabIndex = 15 Top = 2040 Width
= 495 End Begin VB.TextBox B23 Height = 375 Left = 4200 TabIndex =
14 Top = 1560 Width = 495 End Begin VB.TextBox B33 Height = 375
Left = 4200 TabIndex = 13 Top = 2040 Width = 495 End Begin
VB.TextBox A12 Height = 375 Left = 1320 TabIndex = 12 Top =
1080 Width = 495 End Begin VB.TextBox B12 Height = 375 Left = 3600
TabIndex = 11 Top = 1080 Width = 495 End Begin VB.TextBox B11
Height = 375 Left = 2880 TabIndex = 10 Top = 1080 Width
= 495 End Begin VB.TextBox A13 Height = 375 Left = 2040 TabIndex =
8 Top = 1080 Width = 495 End Begin VB.TextBox A21 Height = 375
Left = 600 TabIndex = 7 Top = 1560 Width = 495 End Begin
VB.TextBox A22 Height = 375 Left = 1320 TabIndex = 6 Top =
1560 Width = 495 End Begin VB.TextBox A23 Height = 375 Left = 2040
TabIndex = 5 Top = 1560 Width = 495 End Begin VB.TextBox A31
Height = 375 Left = 600 TabIndex = 4 Top = 2040 Width =
495 End Begin VB.TextBox A32 Height = 375 Left = 1320 TabIndex = 3
Top = 2040 Width = 495 End Begin VB.TextBox A33 Height = 375 Left
= 2040 TabIndex = 2 Top = 2040 Width = 495 End Begin VB.TextBox
B32 Height = 375 Left = 3600 TabIndex = 1 Top = 2040 Width
= 495 End Begin VB.TextBox A11 Height = 375 Left = 600 TabIndex = 0
Top = 1080 Width = 495 End Begin VB.Image Image1 Enabled = 0 'False
Height = 1485 Left = 2880 Picture = "OPERACIONES CON
MATRICES.frx":0000 Stretch = -1 'True Top = 2760 Width = 2400 End
Begin VB.Line Line4 X1 = 120 X2 = 8160 Y1 = 5280 Y2 =
7. 5280 End Begin VB.Line Line3 X1 = 8160 X2 = 8160 Y1 = 5280
Y2 = 120 End Begin VB.Line Line2 BorderColor = &H80000006& X1 = 120
X2 = 8160 Y1 = 120 Y2 = 120 End Begin VB.Line Line1 X1 =
120 X2 = 120 Y1 = 120 Y2 = 5280 End Begin VB.Label Label4
BackColor = &H80000003& Caption = $"OPERACIONES CON MATRICES.frx":3262
BeginProperty Font Name = "Comic Sans MS" Size = 8.25 Charset =
0 Weight = 700 Underline = 0 'False Italic = 0 'False
Strikethrough = 0 'False EndProperty ForeColor = &H00000040& Height = 855
Left = 480 TabIndex = 34 Top = 4440 Width = 7575 End Begin
VB.Label Label3 BackColor = &H80000003& Caption = "RESULTADO"
BeginProperty Font Name = "MS Sans Serif" Size = 12 Charset = 0
Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0
'False EndProperty Height = 255 Left = 6240 TabIndex = 29 Top
= 720 Width = 1695 End Begin VB.Label Label2 BackColor = &H80000003&
Caption = "MATRIZ B" BeginProperty Font Name = "MS Sans Serif" Size
= 12 Charset = 0 Weight = 700 Underline = 0 'False Italic =
0 'False Strikethrough = 0 'False EndProperty Height = 255 Left = 3120
TabIndex = 19 Top = 720 Width = 1455 End Begin VB.Label Label1
BackColor = &H80000003& Caption = "MATRIZ A" BeginProperty Font Name
= "MS Sans Serif" Size = 12 Charset = 0 Weight = 700 Underline
= 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height
= 255 Left = 720 TabIndex = 9 Top = 720 Width = 1455 End
End Attribute VB_Name = "OPERACIONES" Attribute VB_GlobalNameSpace = False Attribute
VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub
Command1_Click() C11 = Val(A11) + Val(B11) C12 = Val(A12) + Val(B12) C13 = Val(A13) + Val(B13)
C21 = Val(A21) + Val(B21) C22 = Val(A22) + Val(B22) C23 = Val(A23) + Val(B23) C31 = Val(A31) +
Val(B31) C32 = Val(A32) + Val(B32) C33 = Val(A33) + Val(B33) End Sub Private Sub VScroll1_Change()
A11 = VScroll1.Value End Sub Private Sub Command2_Click() C11 = Val(A11 * B11) + Val(A12 * B21) +
Val(A13 * B31) C12 = Val(A11 * B12) + Val(A12 * B22) + Val(A13 * B32) C13 = Val(A11 * B13) +
Val(A12 * B23) + Val(A13 * B33) C21 = Val(A21 * B11) + Val(A22 * B21) + Val(A23 * B31) C22 =
Val(A21 * B12) + Val(A22 * B22) + Val(A23 * B32) C23 = Val(A21 * B13) + Val(A22 * B23) + Val(A23 *
B33) C31 = Val(A31 * B11) + Val(A32 * B21) + Val(A33 * B31) C32 = Val(A31 * B12) + Val(A32 * B22) +
Val(A33 * B32) C33 = Val(A31 * B13) + Val(A32 * B23) + Val(A33 * B33) End Sub Private Sub
Command3_Click() C11 = Val(A11) - Val(B11) C12 = Val(A12) - Val(B12) C13 = Val(A13) - Val(B13) C21
= Val(A21) - Val(B21) C22 = Val(A22) - Val(B22) C23 = Val(A23) - Val(B23) C31 = Val(A31) - Val(B31)
C32 = Val(A32) - Val(B32) C33 = Val(A33) - Val(B33) End Sub Private Sub VScroll2_Change() A12 =
VScroll1.Value End Sub End Sub Private Sub Picture1_Click() End Sub Private Sub Command4_Click()
A11.Text = Empty A12.Text = Empty A13.Text = Empty A21.Text = Empty A22.Text = Empty A23.Text =
Empty A31.Text = Empty A32.Text = Empty A33.Text = Empty B11.Text = Empty B12.Text = Empty
B13.Text = Empty B21.Text = Empty B22.Text = Empty B23.Text = Empty B31.Text = Empty B32.Text =
Empty B33.Text = Empty C11.Text = Empty C12.Text = Empty C13.Text = Empty C21.Text = Empty
C22.Text = Empty C23.Text = Empty C31.Text = Empty C32.Text = Empty C33.Text = Empty End Sub
Private Sub SALIR_Click() End End Sub
8. De igual forma se obtuvo el programa Java Decompiler
Este programa es solo ejecutable por tal motivo no necesita instalación
Luego de descompilar se puede obtener las carpetas y el código del programa fuente en este caso es
una librería que nos permite realizar el cálculo de una ecuación.
package org.nfunk.jep; import java.util.Observable; public class Variable extends Observable {
protected String name; private Object value; private boolean isConstant = false; private boolean
validValue = false; protected Variable(String paramString) { this.name = paramString; this.value =
null; this.validValue = false; } protected Variable(String paramString, Object paramObject) {
this.name = paramString; this.value = paramObject; this.validValue = (paramObject != null); } public
String getName() { return this.name; } public boolean isConstant() { return this.isConstant; } public
void setIsConstant(boolean paramBoolean) { this.isConstant = paramBoolean; } public Object
getValue() { return this.value; } public boolean hasValidValue() { return this.validValue; } public void
setValidValue(boolean paramBoolean) { if (isConstant()) { return; } this.validValue = paramBoolean; }
public boolean setValue(Object paramObject) { if (!setValueRaw(paramObject)) { return false; }
setChanged(); notifyObservers(paramObject); return true; } protected boolean setValueRaw(Object
paramObject) { if (this.isConstant) { return false; } this.validValue = true; this.value = paramObject;
return true; } public String toString() { if ((!this.validValue) || (this.value == null)) { return this.name +
": null"; } if (this.isConstant) { return this.name + ": " + this.value.toString() + " (Constant)"; } return
this.name + ": " + this.value.toString(); } }
9. Aquí esta otro ejemplo donde descompilaremos la librería que nos permite realizar el cálculo de las
derivadas.
Y aquí obtenemos el código fuente.
package org.lsmp.djep.vectorJep.function;
import org.lsmp.djep.vectorJep.Dimensions;
import org.lsmp.djep.vectorJep.values.MatrixValueI;
import org.lsmp.djep.vectorJep.values.Tensor;
import org.nfunk.jep.ParseException;
import org.nfunk.jep.function.Divide;
public class ElementDivide
extends Divide
implements BinaryOperatorI
{
public Dimensions calcDim(Dimensions paramDimensions1, Dimensions paramDimensions2)
{
if (paramDimensions1.equals(paramDimensions2)) {
return paramDimensions1;
}
return null;
}
public MatrixValueI calcValue(MatrixValueI paramMatrixValueI1, MatrixValueI paramMatrixValueI2, MatrixValueI
paramMatrixValueI3)
throws ParseException
{
int i = paramMatrixValueI1.getNumEles();
for (int j = 0; j < i; j++) {
paramMatrixValueI1.setEle(j, super.div(paramMatrixValueI2.getEle(j), paramMatrixValueI3.getEle(j)));
}
return paramMatrixValueI1;
}
public Object div(Object paramObject1, Object paramObject2)
throws ParseException
{
if (((paramObject1 instanceof MatrixValueI)) && ((paramObject2 instanceof MatrixValueI))) {
return div((MatrixValueI)paramObject1, (MatrixValueI)paramObject2);
}
MatrixValueI localMatrixValueI1;
MatrixValueI localMatrixValueI2;
int i;
if ((paramObject1 instanceof MatrixValueI))
{
10. localMatrixValueI1 = (MatrixValueI)paramObject1;
localMatrixValueI2 = Tensor.getInstance(localMatrixValueI1.getDim());
for (i = 0; i < localMatrixValueI2.getNumEles(); i++) {
localMatrixValueI2.setEle(i, super.div(localMatrixValueI1.getEle(i), paramObject2));
}
return localMatrixValueI2;
}
if ((paramObject2 instanceof MatrixValueI))
{
localMatrixValueI1 = (MatrixValueI)paramObject2;
localMatrixValueI2 = Tensor.getInstance(localMatrixValueI1.getDim());
for (i = 0; i < localMatrixValueI2.getNumEles(); i++) {
localMatrixValueI2.setEle(i, super.div(paramObject1, localMatrixValueI1.getEle(i)));
}
return localMatrixValueI2;
}
return super.div(paramObject1, paramObject2);
}
public Object div(MatrixValueI paramMatrixValueI1, MatrixValueI paramMatrixValueI2)
throws ParseException
{
Dimensions localDimensions = calcDim(paramMatrixValueI1.getDim(), paramMatrixValueI2.getDim());
MatrixValueI localMatrixValueI = Tensor.getInstance(localDimensions);
return calcValue(localMatrixValueI, paramMatrixValueI1, paramMatrixValueI2);
}
}