From c61c7b4a33a04d5470961fc559be61e8f8cc5ef2 Mon Sep 17 00:00:00 2001 From: bloodstalker Date: Sat, 21 Jul 2018 13:10:18 +0430 Subject: updated the README with the mirror repo links for luatablegen, delf and dwasm --- README.md | 51 +++++++++++++++++++++++--------------------- bruiser/bruiser.cpp | 5 +++-- bruiser/lua-scripts/misc.lua | 35 ++++++++++++++++++++++++++++++ bruiser/makefile | 3 +++ 4 files changed, 68 insertions(+), 26 deletions(-) create mode 100644 bruiser/lua-scripts/misc.lua diff --git a/README.md b/README.md index 87ac1df..b8bca55 100644 --- a/README.md +++ b/README.md @@ -52,25 +52,28 @@ mutator is a suite of tools aimed at analysis and automation of C,C++ and machin Here's a detailed list of what's currently available:
### bruiser -Essentially bruiser is a Lua REPL plus: -* You get tab-completion, suggestions and history(like a shell).
+Essentially bruiser is a Lua REPL plus: +* You get tab-completion, suggestions and history(like a shell).
* bruiser comes with its own extensions and libraries implemented in C and Cpp.
* Through bruiser's Xobj feature, you can pull in functions from object code, run them and get the result back.
* Through the ASMRewriter functionality you can manipulate the machine code and push it back in the object. For more detail you can look at the wiki or check out bruiser's README.md.
* Luarocks: You can use your Luarocks modules/libraries in bruiser too. Just make sure `luarocks` is in your path and bruiser will take care of the rest.
-### delf +### delf `delf` is a custom ELF dump script developed for bruiser. bruiser uses it to interact with ELF files.
You can also use the script as a standalone to dump info on the ELF file to stdout.
+delf is also hosted ona mirror repo (here)[https://github.com/bloodstalker/delf].
### dwasm 'dwasm' is a custom WASM dump script. bruiser uses it to interact with WASM object files.
The script is also usable in an standalone manner.
+dwasm is also hosted on a mirror repo (here)[https://github.com/bloodstalker/dwasm].
### luatablegen `luatablegen` is a python script that takes a json file including the details of a C structure, and generates C source and header files, a lua file including some convinience fields for the lua table and a markdown file including a summary of the table fields and their expected arg types and return types.
+luatablegen is also hosted on a mirror repo (here)[https://github.com/bloodstalker/luatablegen].
-### obfuscator +### obfuscator Is a C/C++ source code obfuscator.
### m0 @@ -79,7 +82,7 @@ m0's reports are generated in XML,JSON and simple text(AWK-friendly:`RS="\n";FS= `m0` also accpets a formatted file as its input, passing it all the options needed to run it. This feature is only available if `m0` is called through `mutator.sh`. For an example please look below.
Also to refrain from confusions, `m0`'s executable is actually named `mutator-lvl0` but for the sake of berevity it will be referred to as m0.
-### Safercpp +### Safercpp Runs the automatic refactoring sets on your source code, automatically changing your code to use the SaferCpp libraries.
SaferCPlusPlus is essentially a collection of safe data types that are compatible with, and can substitute for, common unsafe native C++ types. You can read more [here](https://github.com/duneroadrunner/SaferCPlusPlus).
@@ -194,12 +197,12 @@ Here Are the build options:
* Running `make target-name` will only build the target. So for example, if you are only interested in building the Misra-C rule checker you can run `make mutator-lvl0`.
* The makefile option `CXX` tells the makefile which compiler to use. The default value is `clang++`. Currently the only two supported values are `clang++` and `g++`.
* The makefile option `BUILD_MODE` determines the build mode regarding coverage and support for builds with `g++`.
- * `COV_USE` and `COV_GEN` are for use with the `profdata` format. This option can only be used to build with `clang++`.
- * `COV_GNU` will generate `gcov` compliant coverage data. This option can only be used to build with `clang++`.
- * `COV_NO_CLANG` will build the executable with no source coverage instrumentation. This option can only be used to build with `clang++`.
- * `COV_NO_CLANG_1Z` will build with support for C++1z support. I use this for dev builds.
- * `WIN_BUILD` will later be used to support Windows builds. It assumes there is a llvm-config and it's in windows path.
- * `GNU_MODE` will build the executable with no source code coverage instrumentation for `g++`. Can only be used to build with `g++`.
+ * `COV_USE` and `COV_GEN` are for use with the `profdata` format. This option can only be used to build with `clang++`.
+ * `COV_GNU` will generate `gcov` compliant coverage data. This option can only be used to build with `clang++`.
+ * `COV_NO_CLANG` will build the executable with no source coverage instrumentation. This option can only be used to build with `clang++`.
+ * `COV_NO_CLANG_1Z` will build with support for C++1z support. I use this for dev builds.
+ * `WIN_BUILD` will later be used to support Windows builds. It assumes there is a llvm-config and it's in windows path.
+ * `GNU_MODE` will build the executable with no source code coverage instrumentation for `g++`. Can only be used to build with `g++`.
* The `LLVM_CONF` option is used to tell the compiler which `llvm-config` to use. The default value is `llvm-config`.
* The `PY_CONF` option tells make which `python-config` to use. The default is `python3-config`.
@@ -233,22 +236,22 @@ To run any of the executables, just give a filename or a whitespace-separated li To run the executables with the mutator UI, you can use `mutator.sh`. For a list of available options, you can type `./mutator.sh -h`.
* `-h, --help` prints out the help.
-* `-f, --file` tells mutator to run the commands from the file.
+* `-f, --file` tells mutator to run the commands from the file.
* `-c, --command` specifies the command you want to use.
- * `clean` runs make clean.
- * `build-all` runs make all.
- * `run` runs the `mutator` and `mutator-lvl2` executables on the inputs.
- * `default` runs build-all and then run.
- * `format` calls `clang-format` to format the mutant. Later to be used for the test command.
- * `test` runs the tests on the executables and checks the results (not implemented yet).
- * `misrac` checks for misrac rules.
+ * `clean` runs make clean.
+ * `build-all` runs make all.
+ * `run` runs the `mutator` and `mutator-lvl2` executables on the inputs.
+ * `default` runs build-all and then run.
+ * `format` calls `clang-format` to format the mutant. Later to be used for the test command.
+ * `test` runs the tests on the executables and checks the results (not implemented yet).
+ * `misrac` checks for misrac rules.
* `-v, --version` prints out the version.
* `-i, --input, -input` lets you choose the input file(or a white-space-separated list of files) that is going to be passed to the mutator executable(s).
* `-o, --output, -output` lets you choose where to put the mutant.
-* `-pp, --print-pretty`, prints the output in a pretty format in a new file. The new file has the same name with a "-pretty" added to the name in the same directory.
-* `-t, --test`, runs the tests on the built executables. It should be followed by an executable name and the test to run on it. The accepted options are: tdd,valgrind. For example: `-test mutator-lvl0 valgrind`.
-* `-opts --options, pass options to the executable(s). The executables support all the clang options. please enclose all the options in double quatation. This is basically a pass-through option. Everything appearing inside will be passed through to the executable.`
-* `-copts --customoptions`, just like `-opts` but passes the custom options defined for each executable. It is pass-through. Example: `-copts "-MainOnly=false -SysHeader"`.
+* `-pp, --print-pretty`, prints the output in a pretty format in a new file. The new file has the same name with a "-pretty" added to the name in the same directory.
+* `-t, --test`, runs the tests on the built executables. It should be followed by an executable name and the test to run on it. The accepted options are: tdd,valgrind. For example: `-test mutator-lvl0 valgrind`.
+* `-opts --options, pass options to the executable(s). The executables support all the clang options. please enclose all the options in double quatation. This is basically a pass-through option. Everything appearing inside will be passed through to the executable.`
+* `-copts --customoptions`, just like `-opts` but passes the custom options defined for each executable. It is pass-through. Example: `-copts "-MainOnly=false -SysHeader"`.
`m0` options:
@@ -404,7 +407,7 @@ If you run into an issue please make a new issue.
### Suggestions and Feature Requests You can make a new issue for requests and suggestion. Label them with "Feauture Request".
-Besides that, If you have any suggestions or have any feature requests for project mutator, you can send them to `thabogre@gmail.com`. I'll try to keep an open mind, so even if you feel like it might not be right up mutator's alley, do send them. Worst case, I'll just say no.
+Besides that, If you have any suggestions or have any feature requests for project mutator, you can send them to `thabogre@gmail.com`. I'll try to keep an open mind, so even if you feel like it might not be right up mutator's alley, do send them. Worst case, I'll just say no.
### TODO List For a list of things that need to be done, take a look at the list of issues.
diff --git a/bruiser/bruiser.cpp b/bruiser/bruiser.cpp index 56ea865..04c194d 100644 --- a/bruiser/bruiser.cpp +++ b/bruiser/bruiser.cpp @@ -87,7 +87,7 @@ namespace { // start of anonymous namespace std::vector PushToLua; bruiser::M0_ERR m0_err [[maybe_unused]]; - bruiser::BruiserReport BruiseRep; + //bruiser::BruiserReport BruiseRep; struct ShellGlobal { ShellGlobal() = default; @@ -822,7 +822,7 @@ public: /*@DEVI-obviously the best way to do this is to use the main signature already used, instead of going with a general predefined one. the current form is a temp.*/ Rewrite.InsertTextAfter(SLE.getLocWithOffset(1U), StringRef("\n\nint main(int argc, const char **argv)\n{\n\treturn sub_main(argc, argv);\n}\n")); - BruiseRep.PrintToLog("hijacked main main."); + //BruiseRep.PrintToLog("hijacked main main."); } } @@ -2315,6 +2315,7 @@ int main(int argc, const char **argv) { if (strcmp(argv[i], "--keepalive") == 0) {KEEPALIVE = true; continue;} if (strcmp(argv[i], "--lua") == 0) {NonCLILuaScript = argv[i+1]; argc_n--; continue;} if (strcmp(argv[i], "--luadefault") == 0) {LuaDefault = argv[i+1]; argc_n--; continue;} + if (strcmp(argv[i], "--history") == 0) {SHELL_HISTORY_FILE = argv[i+1]; argc_n--; continue;} argv_n.push_back(argv[i]); argc_n++; } diff --git a/bruiser/lua-scripts/misc.lua b/bruiser/lua-scripts/misc.lua new file mode 100644 index 0000000..711f795 --- /dev/null +++ b/bruiser/lua-scripts/misc.lua @@ -0,0 +1,35 @@ + +------------------------------------------------Project Mutator----------------------------------------------- +--bruiser's lua functions that fall under misc or util +--Copyright (C) 2018 Farzad Sadeghi + +--This program is free software; you can redistribute it and/or +--modify it under the terms of the GNU General Public License +--as published by the Free Software Foundation; either version 3 +--of the License, or (at your option) any later version. + +--This program is distributed in the hope that it will be useful, +--but WITHOUT ANY WARRANTY; without even the implied warranty of +--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +--GNU General Public License for more details. + +--You should have received a copy of the GNU General Public License +--along with this program; if not, write to the Free Software +--Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.*/ +-------------------------------------------------------------------------------------------------------------- +--start of xobj module +local misc = {} + +function misc.pgrep(name) + local handle = io.popen("pgrep "..name) + local ret = {} + for line in handle:lines() do + table.insert(ret, tonumber(line)) + end + return ret +end + +--end of xobj module +return misc +-------------------------------------------------------------------------------------------------------------- + diff --git a/bruiser/makefile b/bruiser/makefile index b0cac30..cde4611 100644 --- a/bruiser/makefile +++ b/bruiser/makefile @@ -74,6 +74,9 @@ clean: rm .dependc $(MAKE) -C luatablegen clean +install: + mkdir $$(HOME)/.bruiser + deepclean: rm -f *.o *~ $(BRUISER) rm .depend -- cgit v1.2.3