diff --git a/Makefile b/Makefile index 05b17ba..c7f6dc5 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ CC=g++ CXXFLAGS= -I$(IDIR) -Wall -std=c++20 ifeq ($(DEBUG),true) # debugging flags - CXXFLAGS += -g + CXXFLAGS += -g -D DEBUG_MODE RODIR = $(ODIR)/debug else # release flags diff --git a/src/main.cpp b/src/main.cpp index 30ff321..289f4fa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -171,11 +171,13 @@ int main(int argc, char* argv[]) list_fcts(sh, re_fct_exclude); else if(options["list-cmd"]) list_cmds(sh, regex_null); - // output +#ifdef DEBUG_MODE else if(options['J']) { std::cout << gen_json_struc(sh) << std::endl; } +#endif + // output else { // post-listing modifiers diff --git a/src/options.cpp b/src/options.cpp index e25f5e3..443af50 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -20,7 +20,10 @@ ztd::option_set options( { ztd::option('c', "stdout", false, "Output result script to stdout"), ztd::option('e', "exec", false, "Directly execute script"), ztd::option("no-shebang", false, "Don't output shebang"), +#ifdef DEBUG_MODE + ztd::option("\r [Debugging]"), ztd::option('J', "json", false, "Output the json structure"), +#endif ztd::option("\r [Processing]"), ztd::option('m', "minify", false, "Minify code without changing functionality"), ztd::option('M', "minify-full", false, "Enable all minifying features: -m --minify-quotes --minify-var --minify-fct --remove-unused"), diff --git a/src/processing.cpp b/src/processing.cpp index 91a59ff..0d25e21 100644 --- a/src/processing.cpp +++ b/src/processing.cpp @@ -519,6 +519,7 @@ std::string boolstring(bool in) return "false"; } +#ifdef DEBUG_MODE std::string gen_json_struc(_obj* o) { if(o==nullptr) @@ -846,3 +847,4 @@ std::string gen_json_struc(_obj* o) } return gen_json(vec); } +#endif diff --git a/src/shellcode.cpp b/src/shellcode.cpp index 03919e3..84e7edf 100644 --- a/src/shellcode.cpp +++ b/src/shellcode.cpp @@ -5,9 +5,10 @@ #include "struc_helper.hpp" const std::map lxsh_extend_fcts = { - { "_lxsh_random", { "[K]", "Generate a random number between 0 and 2^(K*8). Default 2", RANDOM_SH} }, - { "_lxsh_random_string", { "[N]", "Generate a random alphanumeric string of length N. Default 20", RANDOM_STRING_SH} }, - { "_lxsh_random_tmpfile", { "[N]", "Get a random TMP filepath, with N random chars. Default 20", RANDOM_TMPFILE_SH, {"_lxsh_random_string"} } } + { "_lxsh_random", { "[K]", "Generate a random number between 0 and 2^(K*8). Default 2", RANDOM_SH} }, + { "_lxsh_random_string", { "[N]", "Generate a random alphanumeric string of length N. Default 20", RANDOM_STRING_SH} }, + { "_lxsh_random_tmpfile", { "[N]", "Get a random TMP filepath, with N random chars. Default 20", RANDOM_TMPFILE_SH, {"_lxsh_random_string"} } + } }; const std::map lxsh_array_fcts = {