about summary refs log tree commit diff stats
path: root/example/samples
diff options
context:
space:
mode:
Diffstat (limited to 'example/samples')
-rw-r--r--example/samples/arm_sc.S17
-rw-r--r--example/samples/arm_simple.S24
-rw-r--r--example/samples/armt.S27
-rwxr-xr-xexample/samples/box_upx.exebin0 -> 14659 bytes
-rwxr-xr-xexample/samples/md5_armbin0 -> 15381 bytes
-rw-r--r--example/samples/mips32.S12
-rw-r--r--example/samples/msp430.S8
-rw-r--r--example/samples/sc_connect_back.binbin0 -> 290 bytes
-rw-r--r--example/samples/simple_test.binbin0 -> 141 bytes
-rw-r--r--example/samples/simple_test.c26
-rw-r--r--example/samples/x86_32_enc.S38
-rw-r--r--example/samples/x86_32_manip_ptr.S50
-rw-r--r--example/samples/x86_32_mod.S35
-rw-r--r--example/samples/x86_32_mod_self.S20
-rw-r--r--example/samples/x86_32_repmod.S46
-rw-r--r--example/samples/x86_32_sc.bin1
-rw-r--r--example/samples/x86_32_simple.S12
-rw-r--r--example/samples/x86_64.S13
18 files changed, 329 insertions, 0 deletions
diff --git a/example/samples/arm_sc.S b/example/samples/arm_sc.S
new file mode 100644
index 00000000..e9a0787f
--- /dev/null
+++ b/example/samples/arm_sc.S
@@ -0,0 +1,17 @@
+main:
+    MOV R1, R0
+    MOV R2, 0x100
+    LDR R3, [PC, mykey1-$]
+loop:
+    ADD R2, R1, R2
+    ADD R1, R1, 1
+    LDR R3, [PC, mykey2-$]
+    CMP R1, R3
+    BEQ loop
+
+    ADD R0, R1, R2
+    BX LR
+mykey1:
+.long 0x1
+mykey2:
+.long 0x2
diff --git a/example/samples/arm_simple.S b/example/samples/arm_simple.S
new file mode 100644
index 00000000..f6dcf81e
--- /dev/null
+++ b/example/samples/arm_simple.S
@@ -0,0 +1,24 @@
+main:
+  STMFD  SP!, {R4, R5, LR}
+  MOV    R0, mystr & 0xffff
+  ORR    R0, R0, mystr & 0xffff0000
+  MOV    R4, R0
+  MOV    R1, mystrend & 0xffff
+  ORR    R1, R1, mystrend & 0xffff0000
+xxx:
+  LDRB    R2, [PC, key-$]
+loop:
+  LDRB   R3, [R0]
+  EOR    R3, R3, R2
+  STRB   R3, [R0], 1
+  CMP    R0, R1
+  BNE    loop
+end:
+  MOV    R0, R4
+  LDMFD  SP!, {R4, R5, PC}
+key:
+.byte 0x11
+mystr:
+.string "test string"
+mystrend:
+.long 0
diff --git a/example/samples/armt.S b/example/samples/armt.S
new file mode 100644
index 00000000..c50075a6
--- /dev/null
+++ b/example/samples/armt.S
@@ -0,0 +1,27 @@
+memcpy:
+     PUSH    {R0-R3, LR}
+     B       test_end
+loop:
+     LDRB    R3, [R1]
+     STRB    R3, [R0]
+     ADDS    R0, R0, 1
+     ADDS    R1, R1, 1
+     SUBS    R2, R2, 1
+test_end:
+     CMP     R2, 0
+     BNE     loop
+     POP     {R0-R3, PC}
+main:
+     PUSH    {LR}
+     SUB     SP, 0x100
+     MOV     R0, SP
+     ADD     R1, PC, mystr-$+6
+     MOV     R0, R0
+     EORS    R2, R2
+     ADDS    R2, R2, 0x4
+     BL      memcpy
+     ADD     SP, 0x100
+     POP     {PC}
+
+mystr:
+.string "toto"
diff --git a/example/samples/box_upx.exe b/example/samples/box_upx.exe
new file mode 100755
index 00000000..d0776ec2
--- /dev/null
+++ b/example/samples/box_upx.exe
Binary files differdiff --git a/example/samples/md5_arm b/example/samples/md5_arm
new file mode 100755
index 00000000..148e0611
--- /dev/null
+++ b/example/samples/md5_arm
Binary files differdiff --git a/example/samples/mips32.S b/example/samples/mips32.S
new file mode 100644
index 00000000..ae44d52f
--- /dev/null
+++ b/example/samples/mips32.S
@@ -0,0 +1,12 @@
+main:
+    ADDIU      A0, ZERO, 0x10
+    ADDIU      A1, ZERO, 0
+loop:
+    ADDIU      A1, A1, 0x1
+    BNE        A0, ZERO, loop
+    ADDIU      A0, A0, 0xFFFFFFFF
+
+    ADDIU      A2, A2, 0x1
+    MOVN       A1, ZERO, ZERO
+    JR         RA
+    ADDIU      A2, A2, 0x1
diff --git a/example/samples/msp430.S b/example/samples/msp430.S
new file mode 100644
index 00000000..77f4b448
--- /dev/null
+++ b/example/samples/msp430.S
@@ -0,0 +1,8 @@
+main:
+    mov.w      0x10, R10
+    mov.w      0x0, R11
+loop:
+    add.w      1, R11
+    sub.w      1, R10
+    jnz        loop
+    mov.w      @SP+, PC
diff --git a/example/samples/sc_connect_back.bin b/example/samples/sc_connect_back.bin
new file mode 100644
index 00000000..9e9c80a5
--- /dev/null
+++ b/example/samples/sc_connect_back.bin
Binary files differdiff --git a/example/samples/simple_test.bin b/example/samples/simple_test.bin
new file mode 100644
index 00000000..60f4e768
--- /dev/null
+++ b/example/samples/simple_test.bin
Binary files differdiff --git a/example/samples/simple_test.c b/example/samples/simple_test.c
new file mode 100644
index 00000000..8e344f18
--- /dev/null
+++ b/example/samples/simple_test.c
@@ -0,0 +1,26 @@
+int test(unsigned int argc, char** argv)
+{
+	unsigned int ret;
+	if (argc == 0)
+		ret = 0x1001;
+	else if (argc < 2)
+		ret = 0x1002;
+	else if (argc <= 5)
+		ret = 0x1003;
+	else if (argc != 7 && argc*2 == 14)
+		ret = 0x1004;
+	else if (argc*2 == 14)
+		ret = 0x1005;
+	else if (argc & 0x30)
+		ret = 0x1006;
+	else if (argc + 3 == 0x45)
+		ret = 0x1007;
+	else
+		ret = 0x1008;
+	return ret;
+}
+
+int main(int argc, char** argv)
+{
+	return test(argc, argv);
+}
diff --git a/example/samples/x86_32_enc.S b/example/samples/x86_32_enc.S
new file mode 100644
index 00000000..92379838
--- /dev/null
+++ b/example/samples/x86_32_enc.S
@@ -0,0 +1,38 @@
+main:
+    CALL cipher_code
+    CALL msgbox_encrypted_start
+    CALL cipher_code
+    RET
+
+cipher_code:
+    PUSH EBP
+    MOV  EBP, ESP
+
+    LEA  ESI, DWORD PTR [msgbox_encrypted_start]
+    LEA  EDI, DWORD PTR [msgbox_encrypted_stop]
+
+loop:
+    XOR  BYTE PTR [ESI], 0x42
+    INC  ESI
+    CMP  ESI, EDI
+    JBE  loop
+
+    MOV  ESP, EBP
+    POP  EBP
+    RET
+
+msgbox_encrypted_start:
+    PUSH 0
+    PUSH title
+    PUSH msg
+    PUSH 0
+    CALL DWORD PTR [ MessageBoxA ]
+    RET
+.dontsplit
+msgbox_encrypted_stop:
+.long 0
+
+title:
+.string "Hello!"
+msg:
+.string "World!"
diff --git a/example/samples/x86_32_manip_ptr.S b/example/samples/x86_32_manip_ptr.S
new file mode 100644
index 00000000..43e4ed73
--- /dev/null
+++ b/example/samples/x86_32_manip_ptr.S
@@ -0,0 +1,50 @@
+main:
+   PUSH EBP
+   MOV  EBP, ESP
+   SUB  ESP, 0x100
+   MOV  EAX, 0x1337
+   ; test ptr manip
+   LEA  ESI, DWORD PTR [mystr^toto]
+   CALL toto
+mystr:
+.string "test string"
+ toto:
+   POP  EDI
+
+   PUSH EDI
+   ; test scasb
+   XOR  EAX, EAX
+   XOR  ECX, ECX
+   DEC  ECX
+   REPNE SCASB
+   NOT  ECX
+   DEC  ECX
+
+   ; test movsb
+   POP  ESI
+   LEA  EDI, DWORD PTR [EBP-0x100]
+   REPE  MOVSB
+
+   ; test float
+   PUSH 0
+   FLD1
+   FLD1
+   FADD ST, ST(1)
+   FIST  DWORD PTR [ESP]
+   POP  EAX
+
+   ; test cond mnemo
+   NOP
+   NOP
+   CMOVZ EAX, EBX
+   ; test shr
+   NOP
+   SHR EAX, 1
+   NOP
+   NOP
+   SHR EAX, CL
+   NOP
+
+   MOV  ESP, EBP
+   POP  EBP
+   RET
diff --git a/example/samples/x86_32_mod.S b/example/samples/x86_32_mod.S
new file mode 100644
index 00000000..df7792af
--- /dev/null
+++ b/example/samples/x86_32_mod.S
@@ -0,0 +1,35 @@
+main:
+    CALL test_automod
+    CALL test_automod
+    RET
+
+test_automod:
+    PUSH EBP
+    MOV  EBP, ESP
+
+loop:
+    MOV  EAX, 0
+    CMP  EAX, 0
+    JMP  mod_addr
+mod_addr:
+    JNZ  end
+
+    PUSH 0
+    PUSH title
+    PUSH msg
+    PUSH 0
+    CALL DWORD PTR [ MessageBoxA ]
+
+    ; automodif code
+    MOV BYTE PTR [mod_addr], 0xEB
+    JMP loop
+end:
+    MOV BYTE PTR [mod_addr], 0x75
+    MOV ESP, EBP
+    POP EBP
+    RET
+
+title:
+.string "Hello!"
+msg:
+.string "World!"
diff --git a/example/samples/x86_32_mod_self.S b/example/samples/x86_32_mod_self.S
new file mode 100644
index 00000000..398438ec
--- /dev/null
+++ b/example/samples/x86_32_mod_self.S
@@ -0,0 +1,20 @@
+main:
+    PUSH EBP
+    MOV  EBP, ESP
+    MOV  BYTE PTR [myint], 0x90
+myint:
+    INT 0x3
+
+    PUSH 0
+    PUSH title
+    PUSH msg
+    PUSH 0
+    CALL DWORD PTR [ MessageBoxA ]
+    MOV ESP, EBP
+    POP EBP
+    RET
+
+title:
+.string "Hello!"
+msg:
+.string "World!"
diff --git a/example/samples/x86_32_repmod.S b/example/samples/x86_32_repmod.S
new file mode 100644
index 00000000..332a876c
--- /dev/null
+++ b/example/samples/x86_32_repmod.S
@@ -0,0 +1,46 @@
+main:
+    CALL test_automod
+    RET
+
+lbl_good:
+    NOP
+    NOP
+    NOP
+    NOP
+    NOP
+    NOP
+    NOP
+    NOP
+    NOP
+
+test_automod:
+    PUSH EBP
+    MOV  EBP, ESP
+
+    LEA EDI, DWORD PTR [lbl_mod]
+    LEA ESI, DWORD PTR [lbl_good]
+
+    MOV ECX, 0x8
+    REPE MOVSB
+lbl_mod:
+    XOR EAX, EAX
+    MOV DWORD PTR [EAX], 0xDEADC0DE
+
+    NOP
+    NOP
+    NOP
+
+    PUSH 0
+    PUSH title
+    PUSH msg
+    PUSH 0
+    CALL DWORD PTR [ MessageBoxA ]
+
+    MOV ESP, EBP
+    POP EBP
+    RET
+
+title:
+.string "Hello!"
+msg:
+.string "World!"
diff --git a/example/samples/x86_32_sc.bin b/example/samples/x86_32_sc.bin
new file mode 100644
index 00000000..c1931ce0
--- /dev/null
+++ b/example/samples/x86_32_sc.bin
@@ -0,0 +1 @@
+I[t[[
\ No newline at end of file
diff --git a/example/samples/x86_32_simple.S b/example/samples/x86_32_simple.S
new file mode 100644
index 00000000..f38c232f
--- /dev/null
+++ b/example/samples/x86_32_simple.S
@@ -0,0 +1,12 @@
+main:
+    PUSH 0
+    PUSH title
+    PUSH msg
+    PUSH 0
+    CALL DWORD PTR [ MessageBoxA ]
+    RET
+
+title:
+.string "Hello!"
+msg:
+.string "World!"
diff --git a/example/samples/x86_64.S b/example/samples/x86_64.S
new file mode 100644
index 00000000..d090a01b
--- /dev/null
+++ b/example/samples/x86_64.S
@@ -0,0 +1,13 @@
+main:
+    MOV R9, 0x0
+    MOV R8, title
+    MOV RDX, msg
+    MOV RCX, 0x0
+    MOV RAX, QWORD PTR [ MessageBoxA ]
+    CALL RAX
+    RET
+
+title:
+.string "Hello!"
+msg:
+.string "World!"