Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d80f089
commit fc92acf
Showing
27 changed files
with
507 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,15 @@ | ||
CFLAGS=-O2 | ||
mrproper: triad clean | ||
debug: CFLAGS=-g | ||
debug: triad | ||
triad: main.o elf_parser.o jump_block.o function.o var.o lang_gen.o | ||
gcc $(CFLAGS) main.o elf_parser.o jump_block.o function.o var.o lang_gen.o -o triad -lcapstone | ||
sys_tests: test arith_test control_flow_test sys_tests64 | ||
sys_tests64: test64 arith_test64 control_flow_test64 | ||
test: test.c | ||
gcc -m32 test.c -o test | ||
arith_test: arith_test.c | ||
gcc -m32 arith_test.c -o arith_test | ||
control_flow_test: control_flow_test.c | ||
gcc -m32 control_flow_test.c -o control_flow_test | ||
test64: test.c | ||
gcc test.c -o test64 | ||
arith_test64: arith_test.c | ||
gcc arith_test.c -o arith_test64 | ||
control_flow_test64: control_flow_test.c | ||
gcc control_flow_test.c -o control_flow_test64 | ||
main.o: main.c elf_parser.h function.h | ||
gcc $(CFLAGS) -c main.c | ||
elf_parser.o: elf_parser.h elf_parser.c | ||
gcc $(CFLAGS) -c elf_parser.c | ||
jump_block.o: jump_block.c jump_block.h datastructs.h elf_parser.h | ||
gcc $(CFLAGS) -c jump_block.c | ||
function.o: function.c function.h datastructs.h jump_block.h | ||
gcc $(CFLAGS) -c function.c | ||
var.o: var.c var.h datastructs.h | ||
gcc $(CFLAGS) -c var.c | ||
lang_gen.o: lang_gen.c lang_gen.h var.h function.h jump_block.h | ||
gcc $(CFLAGS) -c lang_gen.c | ||
mrproper: triad sys_tests sys_tests64 clean clean_tests | ||
debug: | ||
make -C src debug | ||
triad: | ||
make -C src triad | ||
sys_tests: | ||
make -C tests sys_tests && tests/do_tests.sh | ||
sys_tests64: | ||
make -C tests sys_tests64 && tests/do_tests64.sh | ||
clean: | ||
rm main.o var.o lang_gen.o jump_block.o elf_parser.o function.o | ||
make -C src clean | ||
clean_tests: | ||
make -C tests clean | ||
install: | ||
install ./triad /usr/bin/triad | ||
install src/triad /usr/bin/triad |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
CFLAGS=-O2 | ||
mrproper: triad clean | ||
debug: CFLAGS=-g | ||
debug: triad | ||
triad: main.o elf_parser.o jump_block.o function.o var.o lang_gen.o | ||
gcc $(CFLAGS) main.o elf_parser.o jump_block.o function.o var.o lang_gen.o -o triad -lcapstone | ||
|
||
main.o: main.c elf_parser.h function.h | ||
gcc $(CFLAGS) -c main.c | ||
elf_parser.o: elf_parser.h elf_parser.c | ||
gcc $(CFLAGS) -c elf_parser.c | ||
jump_block.o: jump_block.c jump_block.h datastructs.h elf_parser.h | ||
gcc $(CFLAGS) -c jump_block.c | ||
function.o: function.c function.h datastructs.h jump_block.h | ||
gcc $(CFLAGS) -c function.c | ||
var.o: var.c var.h datastructs.h | ||
gcc $(CFLAGS) -c var.c | ||
lang_gen.o: lang_gen.c lang_gen.h var.h function.h jump_block.h | ||
gcc $(CFLAGS) -c lang_gen.c | ||
|
||
clean: | ||
rm main.o var.o lang_gen.o jump_block.o elf_parser.o function.o |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
sys_tests: test arith_test control_flow_test | ||
|
||
sys_tests64: test64 arith_test64 control_flow_test64 | ||
|
||
test: test.c | ||
gcc -m32 test.c -o test | ||
arith_test: arith_test.c | ||
gcc -m32 arith_test.c -o arith_test | ||
control_flow_test: control_flow_test.c | ||
gcc -m32 control_flow_test.c -o control_flow_test | ||
test64: test.c | ||
gcc test.c -o test64 | ||
arith_test64: arith_test.c | ||
gcc arith_test.c -o arith_test64 | ||
control_flow_test64: control_flow_test.c | ||
gcc control_flow_test.c -o control_flow_test64 | ||
|
||
clean: | ||
rm test test64 arith_test arith_test64 control_flow_test control_flow_test64 *trial |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
|
||
int main (void) | ||
{ | ||
int a; | ||
int e; | ||
int d; | ||
int c; | ||
register long long esi; | ||
register long long eax; | ||
register long long edx; | ||
int b; | ||
|
||
a = 2; | ||
b = 3; | ||
edx = b; | ||
eax = a; | ||
esi = edx; | ||
edx = eax; | ||
eax = func1 (); | ||
c = eax; | ||
edx = b; | ||
eax = a; | ||
esi = edx; | ||
edx = eax; | ||
eax = func2 (); | ||
d = eax; | ||
edx = b; | ||
eax = a; | ||
esi = edx; | ||
edx = eax; | ||
eax = func3 (); | ||
e = eax; | ||
edx = c; | ||
eax = d; | ||
edx += eax; | ||
eax = e; | ||
eax += edx; | ||
return eax; | ||
} | ||
|
||
|
||
int func3 (void) | ||
{ | ||
int f; | ||
register long long r15; | ||
register long long eax; | ||
register long long esi; | ||
int g; | ||
register long long edi; | ||
|
||
f = edi; | ||
g = esi; | ||
eax = f; | ||
eax *= g; | ||
return eax; | ||
r15 = edi; | ||
r15 = (long long)&rip; | ||
} | ||
|
||
|
||
int func2 (void) | ||
{ | ||
int h; | ||
register long long eax; | ||
register long long esi; | ||
int i; | ||
register long long edi; | ||
|
||
h = edi; | ||
i = esi; | ||
eax = i; | ||
eax -= h; | ||
return eax; | ||
} | ||
|
||
|
||
int func1 (void) | ||
{ | ||
int j; | ||
register long long eax; | ||
register long long esi; | ||
int k; | ||
register long long edi; | ||
|
||
j = edi; | ||
k = esi; | ||
edi = j; | ||
eax = k; | ||
eax += edi; | ||
return eax; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
|
||
int main (void) | ||
{ | ||
register int ecx; | ||
int f; | ||
register int edx; | ||
int e; | ||
int d; | ||
register int eax; | ||
int c; | ||
int b; | ||
int a; | ||
|
||
ecx = (int)&esp; | ||
a = 2; | ||
b = 3; | ||
eax = func1 (a, b, *(int*)(ecx+(-4))); | ||
c = eax; | ||
eax = func2 (a, b); | ||
d = eax; | ||
eax = func3 (a, b); | ||
e = eax; | ||
edx = c; | ||
eax = d; | ||
edx += eax; | ||
eax = e; | ||
eax += edx; | ||
ecx = f; | ||
return eax; | ||
} | ||
|
||
|
||
int func3 (int g, int h) | ||
{ | ||
register int eax; | ||
|
||
eax = g; | ||
eax *= h; | ||
return eax; | ||
} | ||
|
||
|
||
int func2 (int j, int i) | ||
{ | ||
register int eax; | ||
|
||
eax = i; | ||
eax -= j; | ||
return eax; | ||
} | ||
|
||
|
||
int func1 (int k, int l) | ||
{ | ||
register int edx; | ||
register int eax; | ||
|
||
edx = k; | ||
eax = l; | ||
eax += edx; | ||
return eax; | ||
} | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
|
||
int main (void) | ||
{ | ||
int a; | ||
register long long edi; | ||
register long long r15; | ||
register long long eax; | ||
int d; | ||
int c; | ||
int b; | ||
|
||
a = 1; | ||
b = 10; | ||
0x4004c8: | ||
c = 11; | ||
d = 0; | ||
while (a > 0) | ||
{ | ||
a -= 1; | ||
if (b != 0) | ||
{ | ||
break; | ||
} | ||
b += 1; | ||
} | ||
do | ||
{ | ||
b -= 1; | ||
if (c != 0) | ||
{ | ||
continue; | ||
} | ||
c -= 1; | ||
eax = b; | ||
} while (eax >= a); | ||
if (b != 0) | ||
{ | ||
if (a != 0) | ||
{ | ||
c = 1; | ||
} | ||
else | ||
{ | ||
c = 2; | ||
} | ||
} | ||
else | ||
{ | ||
if (d == 0) | ||
{ | ||
c = 6; | ||
} | ||
} | ||
a = 0; | ||
if (a != 0) | ||
{ | ||
a = 2; | ||
} | ||
else | ||
{ | ||
a = 3; | ||
} | ||
while (a <= 9) | ||
{ | ||
a += 1; | ||
} | ||
a = 11; | ||
eax = c; | ||
if (eax == b) | ||
{ | ||
goto 0x4004c8; | ||
} | ||
c = 10; | ||
eax = c; | ||
b = eax; | ||
eax = c; | ||
return eax; | ||
r15 = edi; | ||
r15 = (long long)&rip; | ||
} | ||
|
Oops, something went wrong.