aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2018-08-19 19:36:45 +0000
committerbloodstalker <thabogre@gmail.com>2018-08-19 19:36:45 +0000
commitc0959b173b1358ce8b4e3e02c3cd9166186b1f2e (patch)
tree24f1f8d455847cb184f43427129a2d04f0532ff4
parentmakefile updates for obfuscator and bruiser (diff)
downloadmutator-c0959b173b1358ce8b4e3e02c3cd9166186b1f2e.tar.gz
mutator-c0959b173b1358ce8b4e3e02c3cd9166186b1f2e.zip
fixes #47. probably a good idea to just wipe and re-clone. also moved m0 to its own folder.
-rw-r--r--bruiser/bruiser.cpp2
-rw-r--r--bruiser/lua-5.3.4/Makefile2
-rw-r--r--bruiser/lua-5.3.4/src/Makefile4
-rw-r--r--bruiser/luatablegen/makefile25
-rw-r--r--bruiser/makefile30
-rw-r--r--compile_commands.json57
-rw-r--r--daemon/makefile113
-rw-r--r--json/makefile19
-rw-r--r--m0/makefile187
-rw-r--r--m0/mutator-lvl0.cpp (renamed from mutator-lvl0.cpp)0
-rw-r--r--m0/mutator-lvl0.h (renamed from mutator-lvl0.h)0
-rw-r--r--m0/mutator-lvl1.cpp (renamed from mutator-lvl1.cpp)0
-rw-r--r--m0/mutator-lvl2.cpp (renamed from mutator-lvl2.cpp)0
-rw-r--r--m0/mutator_aux.cpp (renamed from mutator_aux.cpp)11
-rw-r--r--m0/mutator_aux.h (renamed from mutator_aux.h)10
-rw-r--r--m0/mutator_report.cpp (renamed from mutator_report.cpp)4
-rw-r--r--m0/mutator_report.h (renamed from mutator_report.h)2
-rw-r--r--makefile55
-rw-r--r--obfuscator/makefile33
-rw-r--r--obfuscator/obfuscator.cpp2
-rw-r--r--safercpp/makefile166
-rw-r--r--safercpp/safercpp-arr.cpp2
-rw-r--r--tinyxml2/makefile17
23 files changed, 539 insertions, 202 deletions
diff --git a/bruiser/bruiser.cpp b/bruiser/bruiser.cpp
index e47d37c..65564b4 100644
--- a/bruiser/bruiser.cpp
+++ b/bruiser/bruiser.cpp
@@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.*
/*project headers*/
#include "bruiser.h"
#include "CompletionHints.h"
-#include "../mutator_aux.h"
+#include "../m0/mutator_aux.h"
#include "mutagen.h"
#include "ORCmutation.h"
#include "executioner.h"
diff --git a/bruiser/lua-5.3.4/Makefile b/bruiser/lua-5.3.4/Makefile
index 119110d..e97f52a 100644
--- a/bruiser/lua-5.3.4/Makefile
+++ b/bruiser/lua-5.3.4/Makefile
@@ -4,7 +4,7 @@
# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT =======================
# Your platform. See PLATS for possible values.
-PLAT= none
+PLAT= linux
# Where to install. The installation starts in the src and doc directories,
# so take care if INSTALL_TOP is not an absolute path. See the local target.
diff --git a/bruiser/lua-5.3.4/src/Makefile b/bruiser/lua-5.3.4/src/Makefile
index 0eb167f..202d0c9 100644
--- a/bruiser/lua-5.3.4/src/Makefile
+++ b/bruiser/lua-5.3.4/src/Makefile
@@ -4,7 +4,7 @@
# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT =======================
# Your platform. See PLATS for possible values.
-PLAT= none
+PLAT= linux
CC= gcc -std=gnu99
CFLAGS= -fpic -O2 -Wall -Wextra -DLUA_COMPAT_MODULE -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS)
@@ -49,7 +49,7 @@ ALL_A= $(LUA_A)
# Targets start here.
default: $(PLAT)
-all: $(ALL_T)
+all: $(ALL_A)
o: $(ALL_O)
diff --git a/bruiser/luatablegen/makefile b/bruiser/luatablegen/makefile
index 472c591..b59a216 100644
--- a/bruiser/luatablegen/makefile
+++ b/bruiser/luatablegen/makefile
@@ -1,16 +1,25 @@
CC=clang
CC?=clang
-CC_FLAGS=$(shell $(PY_CONF) --includes) -fpic
+CC_FLAGS=-fpic
CC_EXTRA?=
CC_FLAGS+=$(CC_EXTRA)
SRCS=$(wildcard *.c)
TBG_OBJLIST=$(patsubst %.c, %.o , $(wildcard *.c))
+TBG_OBJLIST_DBG=$(patsubst %.c, %.odbg , $(wildcard *.c))
+TBG_OBJLIST_COV=$(patsubst %.c, %.ocov , $(wildcard *.c))
+ADD_SANITIZERS_CC= -g -fsanitize=address -fno-omit-frame-pointer
+ADD_SANITIZERS_LD= -g -fsanitize=address
+MEM_SANITIZERS_CC= -g -fsanitize=memory -fno-omit-frame-pointer
+MEM_SANITIZERS_LD= -g -fsanitize=memory
+UB_SANITIZERS_CC= -g -fsanitize=undefined -fno-omit-frame-pointer
+UB_SANITIZERS_LD= -g -fsanitize=undefined
+COV_CC= -fprofile-instr-generate -fcoverage-mapping
.DEFAULT:all
.PHONY:all clean help
-all:$(TBG_OBJLIST)
+all:$(TBG_OBJLIST) $(TBG_OBJLIST_DBG) $(TBG_OBJLIST_COV)
@echo $(TBG_OBJLIST)
@echo $(TBG_OBJLIST_INC)
@@ -19,14 +28,22 @@ depend:.depend
.depend:$(SRCS)
rm -rf .depend
$(CC) -MM $(CC_FLAGS) $^ > ./.depend
+ echo $(patsubst %.o:, %.odbg:, $(shell $(CC) -MM $(CC_FLAGS) $^)) | sed -r 's/[A-Za-z0-9\-\_]+\.odbg/\n&/g' >> ./.depend
+ echo $(patsubst %.o:, %.ocov:, $(shell $(CC) -MM $(CC_FLAGS) $^)) | sed -r 's/[A-Za-z0-9\-\_]+\.ocov/\n&/g' >> ./.depend
-include ./.depend
.c.o:
- $(CC) $(CC_FLAGS) -c $< -o $@
+ $(CC) $(CC_FLAGS) -c $< -o $@
+
+%.odbg:%.c
+ $(CC) $(CC_FLAGS) -g -c $< -o $@
+
+%.ocov:%.c
+ $(CC) $(CC_FLAGS) $(COV_CC) -c $< -o $@
clean:
- rm -f *.o *~ $(TARGET)
+ rm -f *.o *~ $(TARGET) *.ocov *.odbg
rm .depend
help:
diff --git a/bruiser/makefile b/bruiser/makefile
index a5194c0..4a61d66 100644
--- a/bruiser/makefile
+++ b/bruiser/makefile
@@ -72,8 +72,10 @@ SRCS:=$(wildcard *.cpp)
C_SRCS:=$(wildcard *.c)
CXX_FLAGS+=$(CXX_EXTRA)
EXTRA_LD_FLAGS+=$(shell $(PY_CONF) --ldflags) -lffi -lcapstone -lkeystone -L./lua-5.3.4/src -llua
-TBG_OBJLIST_INC=$(patsubst ./luatablegen/%.c, ./luatablegen/%.o, $(wildcard ./luatablegen/*.c))
LD_FLAGS+=$(EXTRA_LD_FLAGS)
+TBG_OBJLIST_INC=$(patsubst ./luatablegen/%.c, ./luatablegen/%.o, $(wildcard ./luatablegen/*.c))
+TBG_OBJLIST_DBG_INC=$(patsubst ./luatablegen/%.c, ./luatablegen/%.odbg, $(wildcard ./luatablegen/*.c))
+TBG_OBJLIST_COV_INC=$(patsubst ./luatablegen/%.c, ./luatablegen/%.ocov, $(wildcard ./luatablegen/*.c))
.DEFAULT:all
@@ -104,11 +106,17 @@ dependc:.dependc
.c.o:
$(CC) $(CC_FLAGS) -c $< -o $@
+%.ocov:%.c
+ $(CC) $(CC_FLAGS) $(COV_CXX) -c $< -o $@
+
+%.odbg:%.c
+ $(CC) $(CC_FLAGS) -g -c $< -o $@
+
.cpp.o:
$(CXX) $(CXX_FLAGS) -c $< -o $@
-../mutator_aux.o:../mutator_aux.cpp
- $(CXX) $(CXX_FLAGS) -c $< -o $@
+#../mutator_aux.o:../mutator_aux.cpp
+ #$(CXX) $(CXX_FLAGS) -c $< -o $@
linenoise.o:
$(CC) $(CC_FLAGS) linenoise/linenoise.c -c -o linenoise.o
@@ -123,7 +131,7 @@ linenoise.o:
$(MAKE) -C luatablegen
$(LIB_LUA):
- $(MAKE) -C lua-5.3.4/src linux a
+ $(MAKE) -C lua-5.3.4/src linux
%.odbg:%.cpp
$(CXX) $(CXX_FLAGS) -g -c $< -o $@
@@ -131,16 +139,17 @@ $(LIB_LUA):
%.ocov:%.cpp
$(CXX) $(CXX_FLAGS) $(COV_CXX) -c $< -o $@
-$(TARGET): $(TARGET).o ../mutator_aux.o ../tinyxml2/tinyxml2.o linenoise.o CompletionHints.o mutagen.o ORCmutation.o bruiserffi.o asmrewriter.o bruisercapstone.o ramdump.o ffs.o $(LIB_LUA) $(TBG_OBJLIST_INC)
+$(TARGET): $(TARGET).o ../m0/mutator_aux.o ../tinyxml2/tinyxml2.o linenoise.o CompletionHints.o mutagen.o ORCmutation.o bruiserffi.o asmrewriter.o bruisercapstone.o ramdump.o ffs.o $(LIB_LUA) $(TBG_OBJLIST_INC)
$(CXX) $^ $(LD_FLAGS) -o $@
-$(TARGET)-static: $(TARGET).o ../mutator_aux.o ../tinyxml2/tinyxml2.o linenoise.o CompletionHints.o mutagen.o ORCmutation.o bruiserffi.o asmrewriter.o bruisercapstone.o ramdump.o ffs.o $(LIB_LUA) $(TBG_OBJLIST_INC)
+# currently broken since it needs a static libpython
+$(TARGET)-static: $(TARGET).o ../m0/mutator_aux.o ../tinyxml2/tinyxml2.o linenoise.o CompletionHints.o mutagen.o ORCmutation.o bruiserffi.o asmrewriter.o bruisercapstone.o ramdump.o ffs.o $(LIB_LUA) $(TBG_OBJLIST_INC)
$(CXX) $^ $(LD_FLAGS) -static -o $@
-$(TARGET)-dbg: $(TARGET).odbg ../mutator_aux.o ../tinyxml2/tinyxml2.o linenoise.o CompletionHints.o mutagen.o ORCmutation.o bruiserffi.o asmrewriter.o bruisercapstone.o ramdump.o ffs.o $(LIB_LUA) $(TBG_OBJLIST_INC)
+$(TARGET)-dbg: $(TARGET).odbg ../m0/mutator_aux.odbg ../tinyxml2/tinyxml2.o linenoise.o CompletionHints.odbg mutagen.o ORCmutation.o bruiserffi.odbg asmrewriter.odbg bruisercapstone.odbg ramdump.odbg ffs.odbg $(LIB_LUA) $(TBG_OBJLIST_DBG_INC)
$(CXX) $^ $(LD_FLAGS) -g -o $@
-$(TARGET)-cov: $(TARGET).ocov ../mutator_aux.o ../tinyxml2/tinyxml2.o linenoise.o CompletionHints.o mutagen.o ORCmutation.o bruiserffi.o asmrewriter.o bruisercapstone.o ramdump.o ffs.o $(LIB_LUA) $(TBG_OBJLIST_INC)
+$(TARGET)-cov: $(TARGET).ocov ../m0/mutator_aux.ocov ../tinyxml2/tinyxml2.o linenoise.o CompletionHints.ocov mutagen.o ORCmutation.o bruiserffi.ocov asmrewriter.ocov bruisercapstone.ocov ramdump.ocov ffs.ocov $(LIB_LUA) $(TBG_OBJLIST_COV_INC)
$(CXX) $^ $(LD_FLAGS) $(COV_LD) -o $@
cov:
@@ -168,10 +177,10 @@ tags:$(SRCS)
%.dis: %.o
objdump -r -d -M intel -S $< > $@
-$(TARGET).so: $(TARGET).o ../mutator_aux.o ../tinyxml2/tinyxml2.o linenoise.o CompletionHints.o mutagen.o ORCmutation.o bruiserffi.o asmrewriter.o bruisercapstone.o ramdump.o ffs.o $(LIB_LUA) $(TBG_OBJLIST_INC)
+$(TARGET).so: $(TARGET).o ../m0/mutator_aux.o ../tinyxml2/tinyxml2.o linenoise.o CompletionHints.o mutagen.o ORCmutation.o bruiserffi.o asmrewriter.o bruisercapstone.o ramdump.o ffs.o $(LIB_LUA) $(TBG_OBJLIST_INC)
$(CXX) $^ $(LD_FLAGS) -shared -o $@
-$(TARGET).a: $(TARGET).o ../mutator_aux.o ../tinyxml2/tinyxml2.o linenoise.o CompletionHints.o mutagen.o ORCmutation.o bruiserffi.o asmrewriter.o bruisercapstone.o ramdump.o ffs.o $(LIB_LUA) $(TBG_OBJLIST_INC)
+$(TARGET).a: $(TARGET).o ../m0/mutator_aux.o ../tinyxml2/tinyxml2.o linenoise.o CompletionHints.o mutagen.o ORCmutation.o bruiserffi.o asmrewriter.o bruisercapstone.o ramdump.o ffs.o $(LIB_LUA) $(TBG_OBJLIST_INC)
ar rcs $(TARGET).a $(TARGET).o
clean:
@@ -182,7 +191,6 @@ deepclean:
rm -f *.o *.dis *.odbg *.ocov *~ $(TARGET) $(TARGET).so tags $(TARGET)-static $(TARGET)-dbg $(TARGET).a $(TARGET)-cov FILE*.cpp FILE*.hpp
rm .depend
$(MAKE) -C lua-5.3.4 clean
- $(MAKE) -C LuaJIT clean
$(MAKE) -C luatablegen clean
help:
diff --git a/compile_commands.json b/compile_commands.json
deleted file mode 100644
index 99561f1..0000000
--- a/compile_commands.json
+++ /dev/null
@@ -1,57 +0,0 @@
-[
- {
- "command": "c++ -c -I/home/bloodstalker/extra/llvm-clang-4/llvm/include -I/home/bloodstalker/extra/llvm-clang-4/build/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O2 -fno-exceptions -DLLVM_BUILD_GLOBAL_ISEL -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/bloodstalker/extra/llvm-clang-4/llvm/tools/clang/include -I/home/bloodstalker/extra/llvm-clang-4/build/tools/clang/include -std=c++1z -stdlib=libstdc++ -UNDEBUG -fexceptions -o mutator-lvl0.o mutator-lvl0.cpp",
- "directory": "/home/bloodstalker/devi/hell2",
- "file": "/home/bloodstalker/devi/hell2/mutator-lvl0.cpp"
- },
- {
- "command": "c++ -c -I/home/bloodstalker/extra/llvm-clang-4/llvm/include -I/home/bloodstalker/extra/llvm-clang-4/build/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O2 -fno-exceptions -DLLVM_BUILD_GLOBAL_ISEL -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/bloodstalker/extra/llvm-clang-4/llvm/tools/clang/include -I/home/bloodstalker/extra/llvm-clang-4/build/tools/clang/include -std=c++1z -stdlib=libstdc++ -UNDEBUG -fexceptions -o tinyxml2.o tinyxml2.cpp",
- "directory": "/home/bloodstalker/devi/hell2/tinyxml2",
- "file": "/home/bloodstalker/devi/hell2/tinyxml2/tinyxml2.cpp"
- },
- {
- "command": "c++ -c -I/home/bloodstalker/extra/llvm-clang-4/llvm/include -I/home/bloodstalker/extra/llvm-clang-4/build/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O2 -fno-exceptions -DLLVM_BUILD_GLOBAL_ISEL -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/bloodstalker/extra/llvm-clang-4/llvm/tools/clang/include -I/home/bloodstalker/extra/llvm-clang-4/build/tools/clang/include -std=c++1z -stdlib=libstdc++ -UNDEBUG -fexceptions -o mutator_aux.o mutator_aux.cpp",
- "directory": "/home/bloodstalker/devi/hell2",
- "file": "/home/bloodstalker/devi/hell2/mutator_aux.cpp"
- },
- {
- "command": "c++ -c -I/home/bloodstalker/extra/llvm-clang-4/llvm/include -I/home/bloodstalker/extra/llvm-clang-4/build/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O2 -fno-exceptions -DLLVM_BUILD_GLOBAL_ISEL -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/bloodstalker/extra/llvm-clang-4/llvm/tools/clang/include -I/home/bloodstalker/extra/llvm-clang-4/build/tools/clang/include -std=c++1z -stdlib=libstdc++ -UNDEBUG -fexceptions -o mutator_report.o mutator_report.cpp",
- "directory": "/home/bloodstalker/devi/hell2",
- "file": "/home/bloodstalker/devi/hell2/mutator_report.cpp"
- },
- {
- "command": "c++ -c -I/home/bloodstalker/extra/llvm-clang-4/llvm/include -I/home/bloodstalker/extra/llvm-clang-4/build/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O2 -fno-exceptions -DLLVM_BUILD_GLOBAL_ISEL -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/bloodstalker/extra/llvm-clang-4/llvm/tools/clang/include -I/home/bloodstalker/extra/llvm-clang-4/build/tools/clang/include -std=c++1z -stdlib=libstdc++ -UNDEBUG -fexceptions -o mutator-lvl1.o mutator-lvl1.cpp",
- "directory": "/home/bloodstalker/devi/hell2",
- "file": "/home/bloodstalker/devi/hell2/mutator-lvl1.cpp"
- },
- {
- "command": "c++ -c -I/home/bloodstalker/extra/llvm-clang-4/llvm/include -I/home/bloodstalker/extra/llvm-clang-4/build/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O2 -fno-exceptions -DLLVM_BUILD_GLOBAL_ISEL -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/bloodstalker/extra/llvm-clang-4/llvm/tools/clang/include -I/home/bloodstalker/extra/llvm-clang-4/build/tools/clang/include -std=c++1z -stdlib=libstdc++ -UNDEBUG -fexceptions -o mutator-lvl2.o mutator-lvl2.cpp",
- "directory": "/home/bloodstalker/devi/hell2",
- "file": "/home/bloodstalker/devi/hell2/mutator-lvl2.cpp"
- },
- {
- "command": "cc -c -o mutatorclient.o mutatorclient.c",
- "directory": "/home/bloodstalker/devi/hell2/daemon",
- "file": "/home/bloodstalker/devi/hell2/daemon/mutatorclient.c"
- },
- {
- "command": "cc -c -o mutatord.o mutatord.c",
- "directory": "/home/bloodstalker/devi/hell2/daemon",
- "file": "/home/bloodstalker/devi/hell2/daemon/mutatord.c"
- },
- {
- "command": "cc -c -o daemon_aux.o daemon_aux.c",
- "directory": "/home/bloodstalker/devi/hell2/daemon",
- "file": "/home/bloodstalker/devi/hell2/daemon/daemon_aux.c"
- },
- {
- "command": "cc -c -o mutatorserver.o mutatorserver.c",
- "directory": "/home/bloodstalker/devi/hell2/daemon",
- "file": "/home/bloodstalker/devi/hell2/daemon/mutatorserver.c"
- },
- {
- "command": "c++ -c -I/home/bloodstalker/extra/llvm-clang-4/llvm/include -I/home/bloodstalker/extra/llvm-clang-4/build/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O2 -fno-exceptions -DLLVM_BUILD_GLOBAL_ISEL -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/bloodstalker/extra/llvm-clang-4/llvm/tools/clang/include -I/home/bloodstalker/extra/llvm-clang-4/build/tools/clang/include -std=c++1z -stdlib=libstdc++ -UNDEBUG -fexceptions -o safercpp/safercpp-arr.o safercpp/safercpp-arr.cpp",
- "directory": "/home/bloodstalker/devi/hell2",
- "file": "/home/bloodstalker/devi/hell2/safercpp/safercpp-arr.cpp"
- }
-] \ No newline at end of file
diff --git a/daemon/makefile b/daemon/makefile
index 2fac344..8db570e 100644
--- a/daemon/makefile
+++ b/daemon/makefile
@@ -1,30 +1,77 @@
-
-##################################VARS#################################
CC=clang
-CC_FLAGS=
+CC?=clang
+SHELL=bash
+SHELL?=bash
+CC_FLAGS=-fpic
LD_FLAGS=
TARGETD=mutatord
TARGETS=mutatorserver
TARGETC=mutatorclient
-SRCS=$(wildcard *.c)
-##################################RULES################################
+COV_CC= -fprofile-instr-generate -fcoverage-mapping
+COV_LD= -fprofile-instr-generate
+SRCS:=$(wildcard *.c)
+OBJ_LIST:=$(patsubst %.c, %.o, $(wildcard *.c))
+ASM_LIST:=$(patsubst %.c, %.dis, $(wildcard *.c))
+CTAGS_I_PATH?=./
+
+ifeq ($(BUILD_MODE), ADDSAN)
+ifeq ($(CC), gcc)
+$(error This build mode is only useable with clang.)
+endif
+CC_EXTRA+=$(ADD_SANITIZERS_CC)
+EXTRA_LD_FLAGS+=$(ADD_SANITIZERS_LD)
+endif
+
+ifeq ($(BUILD_MODE), MEMSAN)
+ifeq ($(CC), gcc)
+$(error This build mode is only useable with clang.)
+endif
+CC_EXTRA+=$(MEM_SANITIZERS_CC)
+EXTRA_LD_FLAGS+=$(MEM_SANITIZERS_LD)
+endif
+
+ifeq ($(BUILD_MODE), UBSAN)
+ifeq ($(CC), gcc)
+$(error This build mode is only useable with clang.)
+endif
+CC_EXTRA+=$(UB_SANITIZERS_CC)
+EXTRA_LD_FLAGS+=$(UB_SANITIZERS_LD)
+endif
+
+CC_FLAGS+=$(CC_EXTRA)
+LD_FLAGS+=$(EXTRA_LD_FLAGS)
+
.DEFAULT:all
-.PHONY:all clean help depend
+.PHONY:all clean help
all:$(TARGETC) $(TARGETS) $(TARGETD)
+everything: $(TARGETC) $(TARGETD) $(TARGETS) $(TARGETC)-dbg $(TARGETD)-dbg $(TARGETS)-dbg $(TARGETC)-cov $(TARGETD)-cov $(TARGETS)-cov ASM TAGS $(TARGETC)-static $(TARGETD)-static $(TARGETS)-static
+
depend:.depend
.depend:$(SRCS)
- rm -f ./.depend
+ rm -rf .depend
$(CC) -MM $(CC_FLAGS) $^ > ./.depend
+ echo $(patsubst %.o:, %.odbg:, $(shell $(CC) -MM $(CC_FLAGS) $^)) | sed -r 's/[A-Za-z0-9\-\_]+\.odbg/\n&/g' >> ./.depend
+ echo $(patsubst %.o:, %.ocov:, $(shell $(CC) -MM $(CC_FLAGS) $^)) | sed -r 's/[A-Za-z0-9\-\_]+\.ocov/\n&/g' >> ./.depend
-include .depend
+ASM: $(ASM_LIST)
+
+TAGS: tags
+
.c.o:
$(CC) $(CC_FLAGS) -c $< -o $@
+%.odbg:%.c
+ $(CC) $(CC_FLAGS) -g -c $< -o $@
+
+%.ocov:%.c
+ $(CC) $(CC_FLAGS) $(COV_CC) -c $< -o $@
+
$(TARGETC): $(TARGETC).o
$(CC) $^ $(LD_FLAGS) -o $@
@@ -34,15 +81,57 @@ $(TARGETS): $(TARGETS).o daemon_aux.o
$(TARGETD): $(TARGETD).o daemon_aux.o
$(CC) $^ $(LD_FLAGS) -o $@
+$(TARGETC)-dbg: $(TARGETC).odbg
+ $(CC) $^ $(LD_FLAGS) -o $@
+
+$(TARGETS)-dbg: $(TARGETS).odbg daemon_aux.odbg
+ $(CC) $^ $(LD_FLAGS) -o $@
+
+$(TARGETD)-dbg: $(TARGETS).odbg daemon_aux.odbg
+ $(CC) $^ $(LD_FLAGS) -o $@
+
+$(TARGETC)-cov: $(TARGETC).ocov
+ $(CC) $^ $(LD_FLAGS) $(COV_LD) -o $@
+
+$(TARGETS)-cov: $(TARGETS).ocov daemon_aux.ocov
+ $(CC) $^ $(LD_FLAGS) $(COV_LD) -o $@
+
+$(TARGETD)-cov: $(TARGETD).ocov daemon_aux.ocov
+ $(CC) $^ $(LD_FLAGS) $(COV_LD) -o $@
+
+$(TARGETC)-static: $(TARGETC).o
+ $(CC) $^ $(LD_FLAGS) -static -o $@
+
+$(TARGETS)-static: $(TARGETS).o daemon_aux.o
+ $(CC) $^ $(LD_FLAGS) -static -o $@
+
+$(TARGETD)-static: $(TARGETD).o daemon_aux.o
+ $(CC) $^ $(LD_FLAGS) -static -o $@
+
+%.dis: %.o
+ objdump -r -d -M intel -S $< > $@
+
+tags:$(SRCS)
+ $(shell $(CC) -c -I $(CTAGS_I_PATH) -M $(SRCS)|\
+ sed -e 's/[\\ ]/\n/g'|sed -e '/^$$/d' -e '/\.o:[ \t]*$$/d'|\
+ ctags -L - --c++-kinds=+p --fields=+iaS --extra=+q)
+
+cov:
+ @llvm-profdata merge -sparse ./default.profraw -o ./default.profdata
+ @llvm-cov show $(TARGET)-cov -instr-profile=default.profdata
+
+covrep:
+ @llvm-profdata merge -sparse ./default.profraw -o ./default.profdata
+ @llvm-cov report $(TARGET)-cov -instr-profile=default.profdata
+
clean:
- rm -f *.o *~ $(TARGETD) $(TARGETS) $(TARGETC)
rm ./.depend
+ rm -f *.o *~ $(TARGETD) $(TARGETS) $(TARGETC) *.ocov *.odbg $(TARGETD)-cov $(TARGETC)-cov $(TARGETS)-cov $(TARGETD)-dbg $(TARGETC)-dbg $(TARGETS)-dbg tags $(TARGETD)-static $(TARGETC)-static $(TARGETS)-static
help:
@echo 'all builds the daemon, the server and the client. all is the default.'
@echo 'mutatord builds the daemon with the server'
@echo 'mutatorc builds the client'
- @echo 'mutators builds the standalone server'
- @echo 'clean runs clean.'
- @echo 'help runs help.'
-
+ @echo 'mutators builds the standalone server(deprecated)'
+ @echo 'clean'
+ @echo 'help'
diff --git a/json/makefile b/json/makefile
index 9f02064..15e3604 100644
--- a/json/makefile
+++ b/json/makefile
@@ -1,16 +1,19 @@
-######################################INCLUDES#################################
include ../macros.mk
+COV_CXX= -fprofile-instr-generate -fcoverage-mapping
-###############################################################################
+.DEFAULT: json.o
-####################################RULES######################################
-.DEFAULT: json
-
-.PHONY: json
+everything: json.o json.ocov json.odbg
json.o: json.hpp
- $(CXX) $(CXX_FLAGS) -c $< -o $@
+ $(CXX) $(CXX_FLAGS) -x c++ -c $< -o $@
+
+json.odbg: json.hpp
+ $(CXX) $(CXX_FLAGS) -x c++ -g -c $< -o $@
+
+json.ocov: json.hpp
+ $(CXX) $(CXX_FLAGS) $(COV_CXX) -x c++ -c $< -o $@
clean:
- rm -f *.o
+ rm -f *.o *.odbg *.ocov
diff --git a/m0/makefile b/m0/makefile
new file mode 100644
index 0000000..f1f9cb2
--- /dev/null
+++ b/m0/makefile
@@ -0,0 +1,187 @@
+TARGET=mutator-lvl0
+SHELL=bash
+SHELL?=bash
+CC=clang
+CC?=clang
+CFLAGS=-fpic -std=c11
+CXX=clang++
+CXX?=clang++
+CXX_FLAGS=-fpic
+CXX_EXTRA?=
+CTAGS_I_PATH?=./
+LD_FLAGS=
+EXTRA_LD_FLAGS?=
+ADD_SANITIZERS_CC= -g -fsanitize=address -fno-omit-frame-pointer
+ADD_SANITIZERS_LD= -g -fsanitize=address
+MEM_SANITIZERS_CC= -g -fsanitize=memory -fno-omit-frame-pointer
+MEM_SANITIZERS_LD= -g -fsanitize=memory
+UB_SANITIZERS_CC= -g -fsanitize=undefined -fno-omit-frame-pointer
+UB_SANITIZERS_LD= -g -fsanitize=undefined
+COV_CXX= -fprofile-instr-generate -fcoverage-mapping
+COV_LD= -fprofile-instr-generate
+# BUILD_MODES are=RELEASE(default), DEBUG,ADDSAN,MEMSAN,UBSAN
+BUILD_MODE?=RELEASE
+OBJ_LIST:=$(patsubst %.cpp, %.o, $(wildcard *.cpp))
+ASM_LIST:=$(patsubst %.cpp, %.dis, $(wildcard *.cpp))
+
+LLVM_CONF?=llvm-config
+LLVM_CXX_FLAGS=$(shell $(LLVM_CONF) --cxxflags)
+LLVM_CXX_FLAGS+=-I$(shell $(LLVM_CONF) --src-root)/tools/clang/include\
+ -I$(shell $(LLVM_CONF) --obj-root)/tools/clang/include\
+ -stdlib=libstdc++ -std=c++17 -fexceptions
+LLVM_LD_FLAGS=-Wl,--start-group -lclangAST -lclangAnalysis -lclangBasic\
+ -lclangDriver -lclangEdit -lclangFrontend -lclangFrontendTool\
+ -lclangLex -lclangParse -lclangSema -lclangEdit -lclangASTMatchers\
+ -lclangRewrite -lclangRewriteFrontend -lclangStaticAnalyzerFrontend\
+ -lclangStaticAnalyzerCheckers -lclangStaticAnalyzerCore\
+ -lclangSerialization -lclangToolingCore -lclangTooling -lstdc++\
+ -lLLVMRuntimeDyld -lm -Wl,--end-group
+LLVM_LD_FLAGS+=$(shell $(LLVM_CONF) --ldflags --libs --system-libs)
+
+CXX_FLAGS+=$(LLVM_CXX_FLAGS)
+LD_FLAGS+=$(LLVM_LD_FLAGS)
+
+MAKEFLAGS+=--warn-undefined-variables
+ifeq ($(BUILD_MODE), ADDSAN)
+ifeq ($(CXX), g++)
+$(error This build mode is only useable with clang++.)
+endif
+CXX_EXTRA+=$(ADD_SANITIZERS_CC)
+EXTRA_LD_FLAGS+=$(ADD_SANITIZERS_LD)
+endif
+
+ifeq ($(BUILD_MODE), MEMSAN)
+ifeq ($(CXX), g++)
+$(error This build mode is only useable with clang++.)
+endif
+CXX_EXTRA+=$(MEM_SANITIZERS_CC)
+EXTRA_LD_FLAGS+=$(MEM_SANITIZERS_LD)
+endif
+
+ifeq ($(BUILD_MODE), UBSAN)
+ifeq ($(CXX), g++)
+$(error This build mode is only useable with clang++.)
+endif
+CXX_EXTRA+=$(UB_SANITIZERS_CC)
+EXTRA_LD_FLAGS+=$(UB_SANITIZERS_LD)
+endif
+
+SRCS:=$(wildcard *.cpp)
+CXX_FLAGS+=$(CXX_EXTRA)
+LD_FLAGS+=$(EXTRA_LD_FLAGS)
+
+.DEFAULT:all
+
+.PHONY:all clean help ASM SO TAGS
+
+all:$(TARGET)
+
+everything:$(TARGET) A ASM SO $(TARGET)-dbg TAGS $(TARGET)-cov
+
+depend:.depend
+
+.depend:$(SRCS)
+ rm -rf .depend
+ $(CXX) -MM $(CXX_FLAGS) $^ > ./.depend
+ echo $(patsubst %.o:, %.odbg:, $(shell $(CXX) -MM $(CXX_FLAGS) $^)) | sed -r 's/[A-Za-z0-9\_\-]+\.odbg/\n&/g' >> ./.depend
+ echo $(patsubst %.o:, %.ocov:, $(shell $(CXX) -MM $(CXX_FLAGS) $^)) | sed -r 's/[A-Za-z0-9\_\-]+\.ocov/\n&/g' >> ./.depend
+
+-include ./.depend
+
+../json/json.o:../json/json.hpp
+ $(MAKE) -C ../json json.o
+
+../json/json.odbg:../json/json.hpp
+ $(MAKE) -C ../json json.odbg
+
+../json/json.ocov:../json/json.hpp
+ $(MAKE) -C ../json json.ocov
+
+../tinyxml2/tinyxml2.o:../tinyxml2/tinyxml2.cpp
+ $(MAKE) -C ../tinyxml2 tinyxml2.o
+
+../tinyxml2/tinyxml2.odbg:../tinyxml2/tinyxml2.cpp
+ $(MAKE) -C ../tinyxml2 tinyxml2.odbg
+
+../tinyxml2/tinyxml2.ocov:../tinyxml2/tinyxml2.cpp
+ $(MAKE) -C ../tinyxml2 tinyxml2.ocov
+
+./keccak-tiny/.o:./keccak-tiny/.c
+ $(CC) $(CFLAGS) -c $< -o $@
+
+.cpp.o:
+ $(CXX) $(CXX_FLAGS) -c $< -o $@
+
+%.odbg:%.cpp
+ $(CXX) $(CXX_FLAGS) -g -c $< -o $@
+
+%.ocov:%.cpp
+ $(CXX) $(CXX_FLAGS) $(COV_CXX) -c $< -o $@
+
+$(TARGET): $(TARGET).o ../tinyxml2/tinyxml2.o ./mutator_aux.o ./mutator_report.o ../json/json.o
+ $(CXX) $^ $(LD_FLAGS) -o $@
+
+$(TARGET)-static: $(TARGET).o ../tinyxml2/tinyxml2.o ./mutator_aux.o ./mutator_report.o ../json/json.o
+ $(CXX) $^ $(LD_FLAGS) -static -o $@
+
+$(TARGET)-dbg: $(TARGET).odbg ../tinyxml2/tinyxml2.odbg ./mutator_aux.odbg ./mutator_report.odbg ../json/json.odbg
+ $(CXX) $^ $(LD_FLAGS) -g -o $@
+
+$(TARGET)-cov: $(TARGET).ocov ../tinyxml2/tinyxml2.ocov ./mutator_aux.ocov ./mutator_report.ocov ../json/json.ocov
+ $(CXX) $^ $(LD_FLAGS) $(COV_LD) -o $@
+
+cov:
+ @llvm-profdata merge -sparse ./default.profraw -o ./default.profdata
+ @llvm-cov show $(TARGET)-cov -instr-profile=default.profdata
+
+covrep:
+ @llvm-profdata merge -sparse ./default.profraw -o ./default.profdata
+ @llvm-cov report $(TARGET)-cov -instr-profile=default.profdata
+
+ASM:$(ASM_LIST)
+
+SO:$(TARGET).so
+
+A:$(TARGET).a
+
+TAGS:tags
+
+tags:$(SRCS)
+ $(shell $(CXX) -c $(shell $(LLVM_CONF) --cxxflags) -I$(shell $(LLVM_CONF) --src-root)/tools/clang/include -I$(shell $(LLVM_CONF) --obj-root)/tools/clang/include -I $(CTAGS_I_PATH) -M $(SRCS)|\
+ sed -e 's/[\\ ]/\n/g'|sed -e '/^$$/d' -e '/\.o:[ \t]*$$/d'|\
+ ctags -L - --c++-kinds=+p --fields=+iaS --extra=+q)
+
+%.dis: %.o
+ objdump -r -d -M intel -S $< > $@
+
+$(TARGET).so: $(TARGET).o ../tinyxml2/tinyxml2.o ./mutator_aux.o ./mutator_report.o ../json/json.o
+ $(CXX) $^ $(LD_FLAGS) -shared -o $@
+
+$(TARGET).a: $(TARGET).o ../tinyxml2/tinyxml2.o ./mutator_aux.o ./mutator_report.o ../json/json.o
+ ar rcs $(TARGET).a $(TARGET).o
+
+clean:
+ rm -f *.o *.dis *.odbg *.ocov *~ $(TARGET) $(TARGET).so $(TARGET)-static $(TARGET)-dbg $(TARGET).a $(TARGET)-cov ./keccak-tiny/*.o
+
+deepclean:
+ rm -f *.o *.dis *.odbg *.ocov *~ $(TARGET) $(TARGET).so tags $(TARGET)-static $(TARGET)-dbg $(TARGET).a $(TARGET)-cov FILE*.cpp FILE*.hpp ./keccak-tiny/*.o
+ rm .depend
+ $(MAKE) -C ../tinyxml2 clean
+ $(MAKE) -C ../json clean
+
+help:
+ @echo "--all is the default target, runs $(TARGET) target"
+ @echo "--everything will build everything"
+ @echo "--SO will generate the so"
+ @echo "--ASM will generate assembly files"
+ @echo "--TAGS will generate tags file"
+ @echo "--$(TARGET) builds the dynamically-linked executable"
+ @echo "--$(TARGET)-dbg will generate the debug build. BUILD_MODE should be set to DEBUG to work"
+ @echo "--$(TARGET)-static will statically link the executable to the libraries"
+ @echo "--$(TARGET)-cov is the coverage build"
+ @echo "--cov will print the line coverage report"
+ @echo "--covrep will print the coverage report"
+ @echo "--A will build the static library"
+ @echo "--TAGS will build the tags file"
+ @echo "--clean"
+ @echo "--deepclean will clean almost everything"
diff --git a/mutator-lvl0.cpp b/m0/mutator-lvl0.cpp
index 53b3ac5..53b3ac5 100644
--- a/mutator-lvl0.cpp
+++ b/m0/mutator-lvl0.cpp
diff --git a/mutator-lvl0.h b/m0/mutator-lvl0.h
index c1e452a..c1e452a 100644
--- a/mutator-lvl0.h
+++ b/m0/mutator-lvl0.h
diff --git a/mutator-lvl1.cpp b/m0/mutator-lvl1.cpp
index c6082f9..c6082f9 100644
--- a/mutator-lvl1.cpp
+++ b/m0/mutator-lvl1.cpp
diff --git a/mutator-lvl2.cpp b/m0/mutator-lvl2.cpp
index c585734..c585734 100644
--- a/mutator-lvl2.cpp
+++ b/m0/mutator-lvl2.cpp
diff --git a/mutator_aux.cpp b/m0/mutator_aux.cpp
index a382764..83211f5 100644
--- a/mutator_aux.cpp
+++ b/m0/mutator_aux.cpp
@@ -28,8 +28,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.*
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Rewrite/Core/Rewriter.h"
-#include "tinyxml2/tinyxml2.h"
-#include "json/json.hpp"
+#include "../tinyxml2/tinyxml2.h"
+#include "../json/json.hpp"
/*********************************************************************************************************************/
using namespace clang;
/*********************************************************************************************************************/
@@ -56,8 +56,7 @@ SourceLocation SourceLocationHasMacro [[deprecated("doesnt work")]] (SourceLocat
}
#endif
-SourceLocation SourceLocationHasMacro(SourceLocation __sl, Rewriter &__rewrite)
-{
+SourceLocation SourceLocationHasMacro(SourceLocation __sl, Rewriter &__rewrite) {
if (__sl.isMacroID()) {
return __rewrite.getSourceMgr().getSpellingLoc(__sl);
} else {
@@ -66,8 +65,8 @@ SourceLocation SourceLocationHasMacro(SourceLocation __sl, Rewriter &__rewrite)
}
SourceLocation getSLSpellingLoc(SourceLocation __sl, Rewriter &__rewrite) {
- if (__sl.isMacroID()) {return __rewrite.getSourceMgr().getSpellingLoc(__sl);}
- else {return __sl;}
+ if (__sl.isMacroID()) return __rewrite.getSourceMgr().getSpellingLoc(__sl);
+ else return __sl;
}
/*********************************************************************************************************************/
/*********************************************************************************************************************/
diff --git a/mutator_aux.h b/m0/mutator_aux.h
index 3670df8..9f22a5a 100644
--- a/mutator_aux.h
+++ b/m0/mutator_aux.h
@@ -41,31 +41,21 @@ using namespace clang;
/*********************************************************************************************************************/
namespace Devi {
enum class NodeKind {NoValue, VarDecl, FieldDecl, RecordDecl, LabelDecl, FunctionDecl, TypedefDecl, ParmVarDecl, EnumDecl, EnumConstDecl};
-
enum class Scope {NoValue, TU, Block};
-
enum class FunctionDeclKind {NoValue, Definition, Declaration};
/*********************************************************************************************************************/
SourceLocation SourceLocationHasMacro(SourceLocation SL, Rewriter &Rewrite, std::string Kind);
-
SourceLocation SourceLocationHasMacro(SourceLocation __sl, Rewriter &__rewrite);
-
SourceLocation getSLSpellingLoc(SourceLocation __sl, Rewriter &__rewrite);
/*********************************************************************************************************************/
bool IsTheMatchInSysHeader(bool SysHeaderFlag, const ast_matchers::MatchFinder::MatchResult &MR, SourceLocation SL);
-
bool IsTheMatchInSysHeader(bool SysHeaderFlag, const SourceManager &SM, SourceLocation SL);
-
bool IsTheMatchInSysHeader(bool SysHeaderFlag, bool SysHeader, SourceLocation SL);
-
bool IsTheMatchInSysHeader(bool SysHeaderFlag, bool SysHeader);
/*********************************************************************************************************************/
bool IsTheMatchInMainFile(bool MainFileFlag, const ast_matchers::MatchFinder::MatchResult &MR, SourceLocation SL);
-
bool IsTheMatchInMainFile(bool MainFileFlag, const SourceManager &SM, SourceLocation SL);
-
bool IsTheMatchInMainFile(bool MainFileFlag, bool MainFile, SourceLocation SL);
-
bool IsTheMatchInMainFile(bool MainFileFlag, bool MainFile);
/*********************************************************************************************************************/
/*end of namespace Devi*/
diff --git a/mutator_report.cpp b/m0/mutator_report.cpp
index 51fd342..1e0459f 100644
--- a/mutator_report.cpp
+++ b/m0/mutator_report.cpp
@@ -28,8 +28,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.*
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Rewrite/Core/Rewriter.h"
-#include "tinyxml2/tinyxml2.h"
-#include "json/json.hpp"
+#include "../tinyxml2/tinyxml2.h"
+#include "../json/json.hpp"
/*********************************************************************************************************************/
using namespace clang;
using namespace tinyxml2;
diff --git a/mutator_report.h b/m0/mutator_report.h
index ad3b843..0be06f6 100644
--- a/mutator_report.h
+++ b/m0/mutator_report.h
@@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.*
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Rewrite/Core/Rewriter.h"
-#include "tinyxml2/tinyxml2.h"
+#include "../tinyxml2/tinyxml2.h"
/*********************************************************************************************************************/
using namespace clang;
using namespace tinyxml2;
diff --git a/makefile b/makefile
index ede3200..ece81c4 100644
--- a/makefile
+++ b/makefile
@@ -1,8 +1,5 @@
-######################################INCLUDES#################################
include macros.mk
-#######################################VARS####################################
-EXTRA_LD_FLAGS+=tinyxml2/tinyxml2.o
TARGET0=mutator-lvl0
TARGET1=mutator-lvl1
@@ -13,35 +10,21 @@ TARGETS=mutatorserver
SFCPP01=safercpp-arr
BRUISER=bruiser
OBSC=obfuscator
-SRCS=$(wildcard *.cpp)
-######################################RULES####################################
-.DEFAULT: all
-
-.PHONY:all clean install help TAGS $(BRUISER) $(OBSC) $(TARGETC) $(TARGETD) $(TARGETS) $(SFCPP01)
-
-all: $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETC) $(TARGETD) $(TARGETS) $(SFCPP01) $(BRUISER) $(OBSC)
-
-depend:.depend
-.depend:$(SRCS)
- rm -f ./.depend
- $(CXX) -MM $(CXX_FLAGS) $^ > ./.depend
+.DEFAULT: all
--include ./.depend
+.PHONY:all clean install help $(BRUISER) $(OBSC) $(TARGETC) $(TARGETD) $(TARGETS) $(SFCPP01)
-.cpp.o:
- $(CXX) $(CXX_FLAGS) -c $< -o $@
- $(MAKE) -C tinyxml2 CXX=$(CXX) LLVM_CONF=$(LLVM_CONF) BUILD_MODE=$(BUILD_MODE)
- $(MAKE) -C json CXX=$(CXX) LLVM_CONF=$(LLVM_CONF) BUILD_MODE=$(BUILD_MODE)
+all: $(TARGET0) $(TARGETC) $(TARGETD) $(TARGETS) $(SFCPP01) $(BRUISER) $(OBSC)
-$(TARGET1): $(TARGET1).o mutator_aux.o
+$(TARGET1):
$(CXX) $^ $(LD_FLAGS) -o $@
-$(TARGET2): $(TARGET2).o mutator_aux.o
+$(TARGET2):
$(CXX) $^ $(LD_FLAGS) -o $@
-$(TARGET0): $(TARGET0).o mutator_aux.o mutator_report.o
- $(CXX) $^ $(LD_FLAGS) -o $@
+$(TARGET0):
+ $(MAKE) -C m0 CXX=$(CXX) LLVM_CONF=$(LLVM_CONF) BUILD_MODE=$(BUILD_MODE)
$(SFCPP01):
$(MAKE) -C safercpp CXX=$(CXX) LLVM_CONF=$(LLVM_CONF) BUILD_MODE=$(BUILD_MODE)
@@ -61,18 +44,14 @@ $(TARGETD):
$(TARGETS):
$(MAKE) -C daemon mutatorserver
-TAGS: $(SRCS)
- $(CTAGS) $(SRCS)
-
clean:
- rm -f *.o *~ $(TARGET0) $(TARGET1) $(TARGET2)
- rm ./.depend
$(MAKE) -C tinyxml2 clean
$(MAKE) -C json clean
$(MAKE) -C daemon clean
$(MAKE) -C safercpp clean
$(MAKE) -C bruiser clean
$(MAKE) -C obfuscator clean
+ $(MAKE) -C m0 clean
install:
chmod +x ./mutator.sh
@@ -88,20 +67,4 @@ install:
$(shell echo MUTATOR_HOME=$$(pwd) > ./daemon/mutator.config)
help:
- @echo '- There is help.'
- @echo '- All is the default.'
- @echo '- install makes the scripts executable. Also creates the reliquary.'
- @echo '- Clean.'
- @echo '- TAGS will run ctags on the C/C++ source files.'
- @echo '- You can use the target names as build targets to just build one executable.'
- @echo '- LLVM_CONF will tell the makefile the name of llvm-config. llvm-config is the default.'
- @echo '- CXX will let you set the compiler. currently the only accepted values are clang++ and g++. clang++ is the default.'
- @echo '- BUILD_MODE will let you choose to build for different coverage formats. the default is COV_NO_CLANG. the supported values are:'
- @echo ' COV_USE: adds the clang -fprofile-instr-use option(clang++ only mode).'
- @echo ' COV_GEN: adds the clang -fprofile-instr-generate option(clang++ only mode).'
- @echo ' COV_GNU: generates coverage for the build compatible with gcov(clang++ only mode).'
- @echo ' COV_NO_CLANG: this build mode will not support any coverage format and is meant to be used with clang++(clang++ only mode).'
- @echo ' COV_NO_CLANG_1Z: does not instrument the code for any coverage and uses -std=c++1z (clang++ only mode).'
- @echo ' GNU_MODE: meant to be used for builds with g++. supports no coverage(g++ only mode).'
- @echo ' WIN_MODE: to support windows builds'
- @echo '- Press tab for more targets if you have zsh!'
+ @echo "Under Construction"
diff --git a/obfuscator/makefile b/obfuscator/makefile
index f1ab5ab..fda9c20 100644
--- a/obfuscator/makefile
+++ b/obfuscator/makefile
@@ -28,7 +28,7 @@ LLVM_CONF?=llvm-config
LLVM_CXX_FLAGS=$(shell $(LLVM_CONF) --cxxflags)
LLVM_CXX_FLAGS+=-I$(shell $(LLVM_CONF) --src-root)/tools/clang/include\
-I$(shell $(LLVM_CONF) --obj-root)/tools/clang/include\
- -stdlib=libstdc++ -std=c++17
+ -stdlib=libstdc++ -std=c++17 -fexceptions
LLVM_LD_FLAGS=-Wl,--start-group -lclangAST -lclangAnalysis -lclangBasic\
-lclangDriver -lclangEdit -lclangFrontend -lclangFrontendTool\
-lclangLex -lclangParse -lclangSema -lclangEdit -lclangASTMatchers\
@@ -76,21 +76,27 @@ LD_FLAGS+=$(EXTRA_LD_FLAGS)
all:$(TARGET)
-everything:$(TARGET) A ASM SO $(TARGET)-static $(TARGET)-dbg TAGS $(TARGET)-cov
+everything:$(TARGET) A ASM SO $(TARGET)-dbg TAGS $(TARGET)-cov
depend:.depend
.depend:$(SRCS)
rm -rf .depend
$(CXX) -MM $(CXX_FLAGS) $^ > ./.depend
- echo $(patsubst %.o:, %.odbg:, $(shell $(CXX) -MM $(CXX_FLAGS) $^)) | sed -r 's/[a-z0-9\-\_]+\.odbg/\n&/g' >> ./.depend
- echo $(patsubst %.o:, %.ocov:, $(shell $(CXX) -MM $(CXX_FLAGS) $^)) | sed -r 's/[a-z0-9\-\_]+\.ocov/\n&/g' >> ./.depend
+ echo $(patsubst %.o:, %.odbg:, $(shell $(CXX) -MM $(CXX_FLAGS) $^)) | sed -r 's/[A-Za-z0-9\-\_]+\.odbg/\n&/g' >> ./.depend
+ echo $(patsubst %.o:, %.ocov:, $(shell $(CXX) -MM $(CXX_FLAGS) $^)) | sed -r 's/[A-Za-z0-9\-\_]+\.ocov/\n&/g' >> ./.depend
-include ./.depend
-./keccak-tiny/.o:./keccak-tiny/.c
+./keccak-tiny/%.o:./keccak-tiny/%.c
$(CC) $(CFLAGS) -c $< -o $@
+./keccak-tiny/%.ocov:./keccak-tiny/%.c
+ $(CC) $(CFLAGS) $(COV_CXX) -c $< -o $@
+
+./keccak-tiny/%.odbg:./keccak-tiny/%.c
+ $(CC) $(CFLAGS) -g -c $< -o $@
+
.cpp.o:
$(CXX) $(CXX_FLAGS) -c $< -o $@
@@ -100,15 +106,16 @@ depend:.depend
%.ocov:%.cpp
$(CXX) $(CXX_FLAGS) $(COV_CXX) -c $< -o $@
-$(TARGET): $(TARGET).o ../mutator_aux.o ./keccak-tiny/keccak-tiny.o
+$(TARGET): $(TARGET).o ../m0/mutator_aux.o ./keccak-tiny/keccak-tiny.o
$(CXX) $^ $(LD_FLAGS) -o $@
-$(TARGET)-static: $(TARGET).o ../mutator_aux.o ./keccak-tiny/keccak-tiny.o
+
+$(TARGET)-static: $(TARGET).o ../m0/mutator_aux.o ./keccak-tiny/keccak-tiny.o
$(CXX) $^ $(LD_FLAGS) -static -o $@
-$(TARGET)-dbg: $(TARGET).odbg ../mutator_aux.o ./keccak-tiny/keccak-tiny.o
+$(TARGET)-dbg: $(TARGET).odbg ../m0/mutator_aux.odbg ./keccak-tiny/keccak-tiny.odbg
$(CXX) $^ $(LD_FLAGS) -g -o $@
-$(TARGET)-cov: $(TARGET).ocov ../mutator_aux.o ./keccak-tiny/keccak-tiny.o
+$(TARGET)-cov: $(TARGET).ocov ../m0/mutator_aux.ocov ./keccak-tiny/keccak-tiny.ocov
$(CXX) $^ $(LD_FLAGS) $(COV_LD) -o $@
cov:
@@ -135,17 +142,17 @@ tags:$(SRCS)
%.dis: %.o
objdump -r -d -M intel -S $< > $@
-$(TARGET).so: $(TARGET).o ../mutator_aux.o ./keccak-tiny/keccak-tiny.o
+$(TARGET).so: $(TARGET).o ../m0/mutator_aux.o ./keccak-tiny/keccak-tiny.o
$(CXX) $^ $(LD_FLAGS) -shared -o $@
-$(TARGET).a: $(TARGET).o ../mutator_aux.o ./keccak-tiny/keccak-tiny.o
+$(TARGET).a: $(TARGET).o ../m0/mutator_aux.o ./keccak-tiny/keccak-tiny.o
ar rcs $(TARGET).a $(TARGET).o
clean:
- rm -f *.o *.dis *.odbg *.ocov *~ $(TARGET) $(TARGET).so $(TARGET)-static $(TARGET)-dbg $(TARGET).a $(TARGET)-cov ./keccak-tiny/*.o
+ rm -f *.o *.dis *.odbg *.ocov *~ $(TARGET) $(TARGET).so $(TARGET)-static $(TARGET)-dbg $(TARGET).a $(TARGET)-cov ./keccak-tiny/*.o ./keccak-tiny/*.ocov ./keccak-tiny/*.odbg
deepclean:
- rm -f *.o *.dis *.odbg *.ocov *~ $(TARGET) $(TARGET).so tags $(TARGET)-static $(TARGET)-dbg $(TARGET).a $(TARGET)-cov FILE*.cpp FILE*.hpp ./keccak-tiny/*.o
+ rm -f *.o *.dis *.odbg *.ocov *~ $(TARGET) $(TARGET).so tags $(TARGET)-static $(TARGET)-dbg $(TARGET).a $(TARGET)-cov FILE*.cpp FILE*.hpp ./keccak-tiny/*.o ./keccak-tiny/*.ocov ./keccak-tiny/*.odbg
rm .depend
help:
diff --git a/obfuscator/obfuscator.cpp b/obfuscator/obfuscator.cpp
index 7920535..9ab7310 100644
--- a/obfuscator/obfuscator.cpp
+++ b/obfuscator/obfuscator.cpp
@@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.*
/**********************************************************************************************************************/
/*included modules*/
/*project headers*/
-#include "../mutator_aux.h"
+#include "../m0/mutator_aux.h"
#include "./keccak-tiny/keccak-tiny.hpp"
/*standard headers*/
#include <cassert>
diff --git a/safercpp/makefile b/safercpp/makefile
index 57ef94d..d4ba05f 100644
--- a/safercpp/makefile
+++ b/safercpp/makefile
@@ -1,40 +1,166 @@
+TARGET=safercpp-arr
+SHELL=bash
+SHELL?=bash
+CC=clang
+CC?=clang
+CFLAGS=-fpic -std=c11
+CXX=clang++
+CXX?=clang++
+CXX_FLAGS=-fpic
+CXX_EXTRA?=
+CTAGS_I_PATH?=./
+LD_FLAGS=
+EXTRA_LD_FLAGS?=
+ADD_SANITIZERS_CC= -g -fsanitize=address -fno-omit-frame-pointer
+ADD_SANITIZERS_LD= -g -fsanitize=address
+MEM_SANITIZERS_CC= -g -fsanitize=memory -fno-omit-frame-pointer
+MEM_SANITIZERS_LD= -g -fsanitize=memory
+UB_SANITIZERS_CC= -g -fsanitize=undefined -fno-omit-frame-pointer
+UB_SANITIZERS_LD= -g -fsanitize=undefined
+COV_CXX= -fprofile-instr-generate -fcoverage-mapping
+COV_LD= -fprofile-instr-generate
+# BUILD_MODES are=RELEASE(default), DEBUG,ADDSAN,MEMSAN,UBSAN
+BUILD_MODE?=RELEASE
+OBJ_LIST:=$(patsubst %.cpp, %.o, $(wildcard *.cpp))
+ASM_LIST:=$(patsubst %.cpp, %.dis, $(wildcard *.cpp))
-######################################INCLUDES#################################
-include ../macros.mk
-
-#######################################VARS####################################
-CXX_FLAGS+=-frtti
-SFCPP01=safercpp-arr
-SRCS=$(wildcard *.cpp)
+LLVM_CONF?=llvm-config
ifeq ($(shell $(LLVM_CONF) --has-rtti), NO)
$(error your llvm-config says you dont have rtti. you cant build safercpparr without rtti support.)
endif
-######################################RULES####################################
-.DEFAULT: all
+LLVM_CXX_FLAGS=$(shell $(LLVM_CONF) --cxxflags)
+LLVM_CXX_FLAGS+=-I$(shell $(LLVM_CONF) --src-root)/tools/clang/include\
+ -I$(shell $(LLVM_CONF) --obj-root)/tools/clang/include\
+ -stdlib=libstdc++ -std=c++17 -frtti -fexceptions
+LLVM_LD_FLAGS=-Wl,--start-group -lclangAST -lclangAnalysis -lclangBasic\
+ -lclangDriver -lclangEdit -lclangFrontend -lclangFrontendTool\
+ -lclangLex -lclangParse -lclangSema -lclangEdit -lclangASTMatchers\
+ -lclangRewrite -lclangRewriteFrontend -lclangStaticAnalyzerFrontend\
+ -lclangStaticAnalyzerCheckers -lclangStaticAnalyzerCore\
+ -lclangSerialization -lclangToolingCore -lclangTooling -lstdc++\
+ -lLLVMRuntimeDyld -lm -Wl,--end-group
+LLVM_LD_FLAGS+=$(shell $(LLVM_CONF) --ldflags --libs --system-libs)
+
+CXX_FLAGS+=$(LLVM_CXX_FLAGS)
+LD_FLAGS+=$(LLVM_LD_FLAGS)
-.PHONY: all clean help
+#MAKEFLAGS+=--warn-undefined-variables
+ifeq ($(BUILD_MODE), ADDSAN)
+ifeq ($(CXX), g++)
+$(error This build mode is only useable with clang++.)
+endif
+CXX_EXTRA+=$(ADD_SANITIZERS_CC)
+EXTRA_LD_FLAGS+=$(ADD_SANITIZERS_LD)
+endif
-all: $(SFCPP01)
+ifeq ($(BUILD_MODE), MEMSAN)
+ifeq ($(CXX), g++)
+$(error This build mode is only useable with clang++.)
+endif
+CXX_EXTRA+=$(MEM_SANITIZERS_CC)
+EXTRA_LD_FLAGS+=$(MEM_SANITIZERS_LD)
+endif
-%cpp:.depend
+ifeq ($(BUILD_MODE), UBSAN)
+ifeq ($(CXX), g++)
+$(error This build mode is only useable with clang++.)
+endif
+CXX_EXTRA+=$(UB_SANITIZERS_CC)
+EXTRA_LD_FLAGS+=$(UB_SANITIZERS_LD)
+endif
+
+SRCS:=$(wildcard *.cpp)
+CXX_FLAGS+=$(CXX_EXTRA)
+LD_FLAGS+=$(EXTRA_LD_FLAGS)
+
+.DEFAULT:all
+
+.PHONY:all clean help ASM SO TAGS
+
+all:$(TARGET)
+
+everything:$(TARGET) ASM SO A $(TARGET)-dbg TAGS $(TARGET)-cov
+
+depend:.depend
.depend:$(SRCS)
+ rm -rf .depend
$(CXX) -MM $(CXX_FLAGS) $^ > ./.depend
+ echo $(patsubst %.o:, %.odbg:, $(shell $(CXX) -MM $(CXX_FLAGS) $^)) | sed -r 's/[A-Za-z0-9\_\-]+\.odbg/\n&/g' >> ./.depend
+ echo $(patsubst %.o:, %.ocov:, $(shell $(CXX) -MM $(CXX_FLAGS) $^)) | sed -r 's/[A-Za-z0-9\_\-]+\.ocov/\n&/g' >> ./.depend
--include .depend
+-include ./.depend
.cpp.o:
$(CXX) $(CXX_FLAGS) -c $< -o $@
-$(SFCPP01): $(SFCPP01).o ../mutator_aux.o
+%.odbg:%.cpp
+ $(CXX) $(CXX_FLAGS) -g -c $< -o $@
+
+%.ocov:%.cpp
+ $(CXX) $(CXX_FLAGS) $(COV_CXX) -c $< -o $@
+
+$(TARGET): $(TARGET).o ../m0/mutator_aux.o
$(CXX) $^ $(LD_FLAGS) -o $@
+$(TARGET)-static: $(TARGET).o ../m0/mutator_aux.o
+ $(CXX) $^ $(LD_FLAGS) -static -o $@
+
+$(TARGET)-dbg: $(TARGET).odbg ../m0/mutator_aux.odbg
+ $(CXX) $^ $(LD_FLAGS) -g -o $@
+
+$(TARGET)-cov: $(TARGET).ocov ../m0/mutator_aux.ocov
+ $(CXX) $^ $(LD_FLAGS) $(COV_LD) -o $@
+
+cov:
+ @llvm-profdata merge -sparse ./default.profraw -o ./default.profdata
+ @llvm-cov show $(TARGET)-cov -instr-profile=default.profdata
+
+covrep:
+ @llvm-profdata merge -sparse ./default.profraw -o ./default.profdata
+ @llvm-cov report $(TARGET)-cov -instr-profile=default.profdata
+
+ASM:$(ASM_LIST)
+
+SO:$(TARGET).so
+
+A:$(TARGET).a
+
+TAGS:tags
+
+tags:$(SRCS)
+ $(shell $(CXX) -c $(shell $(LLVM_CONF) --cxxflags) -I$(shell $(LLVM_CONF) --src-root)/tools/clang/include -I$(shell $(LLVM_CONF) --obj-root)/tools/clang/include -I $(CTAGS_I_PATH) -M $(SRCS)|\
+ sed -e 's/[\\ ]/\n/g'|sed -e '/^$$/d' -e '/\.o:[ \t]*$$/d'|\
+ ctags -L - --c++-kinds=+p --fields=+iaS --extra=+q)
+
+%.dis: %.o
+ objdump -r -d -M intel -S $< > $@
+
+$(TARGET).so: $(TARGET).o ../mutator_aux.o
+ $(CXX) $^ $(LD_FLAGS) -shared -o $@
+
+$(TARGET).a: $(TARGET).o ../mutator_aux.o
+ ar rcs $(TARGET).a $(TARGET).o
clean:
- rm -f *.o *~ $(SFCPP01)
- rm ./.depend
+ rm -f *.o *.dis *.odbg *.ocov *~ $(TARGET) $(TARGET).so $(TARGET)-static $(TARGET)-dbg $(TARGET).a $(TARGET)-cov
+
+deepclean:
+ rm -f *.o *.dis *.odbg *.ocov *~ $(TARGET) $(TARGET).so tags $(TARGET)-static $(TARGET)-dbg $(TARGET).a $(TARGET)-cov FILE*.cpp FILE*.hpp
+ rm .depend
help:
- @echo 'There is help.'
- @echo 'All is the defualt target.'
- @echo 'Clean runs clean.'
- @echo 'For a more complete and detaild list of BUILD_MODE and other things look at the main makefiles help under project root.'
+ @echo "--all is the default target, runs $(TARGET) target"
+ @echo "--everything will build everything"
+ @echo "--SO will generate the so"
+ @echo "--ASM will generate assembly files"
+ @echo "--TAGS will generate tags file"
+ @echo "--$(TARGET) builds the dynamically-linked executable"
+ @echo "--$(TARGET)-dbg will generate the debug build. BUILD_MODE should be set to DEBUG to work"
+ @echo "--$(TARGET)-static will statically link the executable to the libraries"
+ @echo "--$(TARGET)-cov is the coverage build"
+ @echo "--cov will print the line coverage report"
+ @echo "--covrep will print the coverage report"
+ @echo "--A will build the static library"
+ @echo "--TAGS will build the tags file"
+ @echo "--clean"
+ @echo "--deepclean will clean almost everything"
diff --git a/safercpp/safercpp-arr.cpp b/safercpp/safercpp-arr.cpp
index ee00e19..99bd3a5 100644
--- a/safercpp/safercpp-arr.cpp
+++ b/safercpp/safercpp-arr.cpp
@@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.*
/*included modules*/
/*Project Headers*/
#include "safercpp-arr.h"
-#include "../mutator_aux.h"
+#include "../m0/mutator_aux.h"
/*Standard headers*/
#include <string>
#include <iostream>
diff --git a/tinyxml2/makefile b/tinyxml2/makefile
index 3613b79..fd189dc 100644
--- a/tinyxml2/makefile
+++ b/tinyxml2/makefile
@@ -1,14 +1,19 @@
-######################################INCLUDES#################################
include ../macros.mk
+COV_CXX= -fprofile-instr-generate -fcoverage-mapping
-######################################RULES####################################
-.DEFAULT: tinyxml2
+.DEFAULT: tinyxml2.o
-.PHONY: tinyxml2
+everything: tinyxml2.o tinyxml2.ocov tinyxml2.odbg
tinyxml2.o: tinyxml2.cpp
- $(CXX) $(CXX_FLAGS) -c $< -o $@
+ $(CXX) $(CXX_FLAGS) -c $< -o $@
+
+tinyxml2.odbg: tinyxml2.cpp
+ $(CXX) $(CXX_FLAGS) -g -c $< -o $@
+
+tinyxml2.ocov: tinyxml2.cpp
+ $(CXX) $(CXX_FLAGS) $(COV_CXX) -c $< -o $@
clean:
- rm -f *.o
+ rm -f *.o *.odbg *.ocov