From 26859306a2affd060fb4ebebed7525a5d88e967c Mon Sep 17 00:00:00 2001 From: bloodstalker Date: Sun, 11 Feb 2018 23:59:49 +0330 Subject: 2 major bug fixed for bruiser, a lot of little improvements and bug fixed here and there --- obfuscator/compile_commands.json | 2 +- obfuscator/makefile | 4 ++-- obfuscator/obfuscator.cpp | 5 +++++ obfuscator/run.sh | 7 ++++--- 4 files changed, 12 insertions(+), 6 deletions(-) (limited to 'obfuscator') diff --git a/obfuscator/compile_commands.json b/obfuscator/compile_commands.json index 5b4729c..6fa5c24 100644 --- a/obfuscator/compile_commands.json +++ b/obfuscator/compile_commands.json @@ -1,6 +1,6 @@ [ { - "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 -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 obfuscator.o obfuscator.cpp", + "command": "c++ -c -v -I/home/bloodstalker/extra/llvm-6/llvm/include -I/home/bloodstalker/extra/llvm-6/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 -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/bloodstalker/extra/llvm-6/llvm/tools/clang/include -I/home/bloodstalker/extra/llvm-6/build/tools/clang/include -std=c++1z -stdlib=libstdc++ -UNDEBUG -fexceptions -o obfuscator.o obfuscator.cpp", "directory": "/home/bloodstalker/devi/hell2/obfuscator", "file": "/home/bloodstalker/devi/hell2/obfuscator/obfuscator.cpp" } diff --git a/obfuscator/makefile b/obfuscator/makefile index 11a3219..9a9981f 100644 --- a/obfuscator/makefile +++ b/obfuscator/makefile @@ -21,10 +21,10 @@ depend: .depend -include ./.depend .cpp.o: - $(CXX) $(CXX_FLAGS) -c $< -o $@ + $(CXX) -v $(CXX_FLAGS) -c $< -o $@ $(OBSC): $(OBSC).o ../mutator_aux.o - $(CXX) $^ $(LD_FLAGS) -o $@ + $(CXX) -v $^ $(LD_FLAGS) -o $@ clean: rm -f *.o *~ $(OBSC) diff --git a/obfuscator/obfuscator.cpp b/obfuscator/obfuscator.cpp index 2cbbd73..f6df690 100644 --- a/obfuscator/obfuscator.cpp +++ b/obfuscator/obfuscator.cpp @@ -445,10 +445,12 @@ class BlankDiagConsumer : public clang::DiagnosticConsumer class MyASTConsumer : public ASTConsumer { public: MyASTConsumer(Rewriter &R) : funcDeclHandler(R), HandlerForVar(R), HandlerForClass(R), HandlerForCalledFunc(R), HandlerForCalledVar(R) { +#if 1 Matcher.addMatcher(functionDecl().bind("funcdecl"), &funcDeclHandler); Matcher.addMatcher(varDecl(anyOf(unless(hasDescendant(expr(anything()))), hasDescendant(expr(anything()).bind("expr")))).bind("vardecl"), &HandlerForVar); Matcher.addMatcher(recordDecl(isClass()).bind("classdecl"), &HandlerForClass); Matcher.addMatcher(declRefExpr().bind("calledvar"), &HandlerForCalledVar); +#endif } void HandleTranslationUnit(ASTContext &Context) override { @@ -471,6 +473,7 @@ public: delete BDCProto; delete tee; } + void EndSourceFileAction() override { std::error_code EC; std::string OutputFilename = TEMP_FILE; @@ -608,6 +611,7 @@ class WhitespaceWarper { /**********************************************************************************************************************/ /*Main*/ int main(int argc, const char **argv) { +#if 1 CommonOptionsParser op(argc, argv, ObfuscatorCat); const std::vector &SourcePathList = op.getSourcePathList(); ClangTool Tool(op.getCompilations(), op.getSourcePathList()); @@ -616,6 +620,7 @@ int main(int argc, const char **argv) { CW.run(); dumpHashFilenames(hashFilenames(SourcePathList)); dumpDirList(listDirs("./test")); +#endif #if 0 for (auto &iter : SourcePathList) { std::cout << "name: " << std::get<0>(getNameFromPath(iter)) << "\t" << "extension: " << std::get<1>(getNameFromPath(iter)) << "\tpath: " << std::get<2>(getNameFromPath(iter)) << "\n"; diff --git a/obfuscator/run.sh b/obfuscator/run.sh index d5197d5..68d0632 100755 --- a/obfuscator/run.sh +++ b/obfuscator/run.sh @@ -1,6 +1,7 @@ #!/bin/bash - -#make +cd $(dirname $0) "./obfuscator" ./test/test.cpp "./obfuscator" ./test/header.hpp -- -#less dupe.cpp +"g++" ./FILE15118982290295364091.cpp +#expected to return 128 +./a.out -- cgit v1.2.3