demovfuscator icon indicating copy to clipboard operation
demovfuscator copied to clipboard

Issue compiling - likely due to changes in Z3

Open Reyyn opened this issue 5 years ago • 5 comments

I am receiving the following errors while attempting to compile. Screenshot from 2019-03-19 19-34-40

Reyyn avatar Mar 20 '19 00:03 Reyyn

Just ran into the same problem but managed to fix it:

Edit the following lines in demovfuscator/stackMachine.hpp: line 61 becomes: if (Z3_get_numeral_uint64(ctx, cn, (unsigned __int64*) &ret)) { and line 78 becomes: ret = ctx->bv_val((__uint64) cur.imm, (unsigned)32);

Afterwards you should be able to compile.

P.S.: See also PullRequest

MatthiasHeinz avatar Apr 06 '19 13:04 MatthiasHeinz

Works like a charm!

An blocks a bit later... :')

make
clang++ -Wall -Wextra -pedantic -std=c++11 -O3 -c demov.cpp
clang++ -Wall -Wextra -pedantic -std=c++11 -O3 -c test.cpp
clang++ -Wall -Wextra -pedantic -std=c++11 -O3 -c memhlp.cpp
clang++ -Wall -Wextra -pedantic -std=c++11 -O3 -c dishlp.cpp
clang++ -Wall -Wextra -pedantic -std=c++11 -O3 -c utils.cpp
clang++ -Wall -Wextra -pedantic -std=c++11 -O3 -c ctlhlp.cpp
clang++ -Wall -Wextra -pedantic -std=c++11 -O3 -c ctlelem.cpp
clang++ -Wall -Wextra -pedantic -std=c++11 -O3 -c node.cpp
clang++ -Wall -Wextra -pedantic -std=c++11 -O3 -c asmhlp.cpp
clang++ -Wall -Wextra -pedantic -std=c++11 -lcapstone -lkeystone -lz3 -lssl -lcrypto elfhlp.o demov.o test.o memhlp.o dishlp.o utils.o ctlhlp.o ctlelem.o node.o asmhlp.o -o demov
asmhlp.o: In function `asmhlp::asmhlp()':
asmhlp.cpp:(.text+0x3f): undefined reference to `ks_open'
asmhlp.o: In function `asmhlp::~asmhlp()':
asmhlp.cpp:(.text+0xcb): undefined reference to `ks_close'
asmhlp.o: In function `asmhlp::replace(cs_insn*, cs_insn*, symbl)':
asmhlp.cpp:(.text+0x1599): undefined reference to `ks_asm'
asmhlp.cpp:(.text+0x1642): undefined reference to `ks_free'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:8: recipe for target 'demov' failed
make: *** [demov] Error 1

laluka avatar May 04 '19 14:05 laluka

clang++ -v  -Wall -Wextra -pedantic -std=c++11 -lcapstone -lkeystone -lz3 -lssl -lcrypto elfhlp.o demov.o test.o memhlp.o dishlp.o utils.o ctlhlp.o ctlelem.o node.o asmhlp.o -o demov
clang version 3.8.1-24 (tags/RELEASE_381/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.3.0
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
 "/usr/bin/ld" --hash-style=both --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o demov /usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../x86_64-linux-gnu/crt1.o /usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../x86_64-linux-gnu/crti.o /usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/crtbegin.o -L/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0 -L/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../x86_64-linux-gnu -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../.. -L/usr/lib/llvm-3.8/bin/../lib -L/lib -L/usr/lib -lcapstone -lkeystone -lz3 -lssl -lcrypto elfhlp.o demov.o test.o memhlp.o dishlp.o utils.o ctlhlp.o ctlelem.o node.o asmhlp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/crtend.o /usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../x86_64-linux-gnu/crtn.o
asmhlp.o: In function `asmhlp::asmhlp()':
asmhlp.cpp:(.text+0x3f): undefined reference to `ks_open'
asmhlp.o: In function `asmhlp::~asmhlp()':
asmhlp.cpp:(.text+0xcb): undefined reference to `ks_close'
asmhlp.o: In function `asmhlp::replace(cs_insn*, cs_insn*, symbl)':
asmhlp.cpp:(.text+0x1599): undefined reference to `ks_asm'
asmhlp.cpp:(.text+0x1642): undefined reference to `ks_free'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:8: recipe for target 'demov' failed
make: *** [demov] Error 1

laluka avatar May 04 '19 14:05 laluka

you are missing keystone

leetonidas avatar May 05 '19 12:05 leetonidas

I had it installed, lib build, I've been able to use the compiled version, but not to compile mine :/ Went to an other way to break my crackme so... :shrunk:

laluka avatar May 05 '19 22:05 laluka