Skip to content

Commit

Permalink
conflict solved
Browse files Browse the repository at this point in the history
  • Loading branch information
byteninjaa0 committed Jan 5, 2024
1 parent d179527 commit eb47f71
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 260 deletions.
91 changes: 0 additions & 91 deletions librz/main/rizin.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@
#define USE_THREADS 1
#define ALLOW_THREADED 0
#define UNCOLORIZE_NONTTY 0
<<<<<<< HEAD
#define COLOR_GREEN "\x1b[32m"
#define COLOR_RESET "\x1b[0m"
#define COLOR_LIGHT_BLUE "\x1b[36m"
#define COLOR_YELLOW "\x1b[33m"
=======
>>>>>>> f60893219b (updated)

#include <rz_core.h>
#include <rz_demangler.h>
Expand Down Expand Up @@ -95,93 +88,10 @@ static int rz_main_version_verify(int show) {
}
return ret;
}
<<<<<<< HEAD
static void printColoredText(const char* color, const char* text) {
printf("%s %-9s %s", color, text, COLOR_GREEN);
}

static void printOption(const char* option, const char* arg,const char* description) {
size_t optionWidth = strlen(option);
size_t maxSpaces = 14 - optionWidth;

printf(" %-.*s", (int)optionWidth, option); // Dynamically align option based on width

if (arg[0] != '\0') {
printColoredText(COLOR_YELLOW, arg);
}
else {
printf("%-*.*s", (int)maxSpaces, (int)maxSpaces, ""); // Dynamically add spaces when arg is not present
}

printColoredText(COLOR_RESET, description);
printf("\n");
}
=======
>>>>>>> f60893219b (updated)

static int main_help(int line) {

if (line < 2) {
<<<<<<< HEAD
printf("%s%s",COLOR_LIGHT_BLUE,"Usage:");
printColoredText(COLOR_RESET, "rizin [-ACdfLMnNqStuvwzX] [-P patch] [-p prj] [-a arch] [-b bits] [-i file]\n"
" [-s addr] [-B baddr] [-m maddr] [-c cmd] [-e k=v] file|pid|-|--|=\n");
}
if (line != 1) {
const char* options[] = {
"--", "", "run rizin without opening any file",
" =", "", " same as 'rizin malloc://512",
" -", "", " read file from stdin",
" -=", "", " perform R=! command to run all commands remotely",
" -0", "", " print \\x00 after init and every command",
" -2", "", " close stderr file descriptor (silent warning messages)",
" -a" ,"[arch]", " set asm.arch",
" -A", "", " run 'aaa' command to analyze all referenced code",
" -b" ,"[bits]", " set asm.bits",
" -B" ,"[baddr]", " set base address for PIE binaries",
" -c 'cmd..'", "", " execute rizin command",
" -C", "", " file is host:port (alias for -cR+http://%%s/cmd/)",
" -d", "", " debug the executable 'file' or running process 'pid",
" -D" ,"[backend]", " enable debug mode (e cfg.debug=true)",
" -e k=v", "", " evaluate config var",
" -f", "", " block size = file size",
" -F" ,"[binplug]", " force to use that rbin plugin",
" -h, -hh", "", " show help message, -hh for long",
" -H" ,"([var])", " display variable",
" -i" ,"[file]", " run script file",
" -I" ,"[file]", " run script file before the file is opened",
" -k" ,"[OS/kern]", " set asm.os (linux, macos, w32, netbsd, ...)",
" -l" ,"[lib]", " load plugin file",
" -L", "", " list supported IO plugins",
" -m" ,"[addr]", " map file at given address (loadaddr)",
" -M","", " do not demangle symbol names",
" -n, -nn","", " do not load RzBin info (-nn only load bin structures)",
" -N","", " do not load user settings and scripts",
" -NN","", " do not load any script or plugin",
" -q","", " quiet mode (no prompt) and quit after -i",
" -qq","", " quit after running all -c and -i",
" -Q","", " quiet mode (no prompt) and quit faster (quickLeak=true)",
" -p", "[p.rzdb]", " load project file",
" -r", "[rz-run]", " specify rz-run profile to load (same as -e dbg.profile=X)",
" -R", "[rule]", " specify custom rz-run directive",
" -s","[addr]", " initial seek",
#if USE_THREADS && ALLOW_THREADED
" -t",""," load rz-bin info in thread",
#endif
" -T ","", " do not compute file hashes",
" -u ","", " set bin.filter=false to get raw sym/sec/cls names",
" -v, -V ","", " show rizin version (-V show lib versions)",
" -w ","", " open file in write mode",
" -x ","", " open without exec-flag (asm.emu will not work), See io.exec",
" -X ","", " same as -e bin.usextr=false (useful for dyldcache)",
" -z, -zz" ,""," do not load strings or load them even in raw",
};
// Print options and descriptions using a loop
for (int i = 0; i < sizeof(options) / sizeof(options[0]); i += 3) {
if (i + 1 < sizeof(options) / sizeof(options[0])) {
printOption(options[i], options[i + 1],options[i + 2]);
}
=======
printf("%s%s", COLOR_LIGHT_BLUE, "Usage: ");
printf(Color_RESET "rizin [-ACdfLMnNqStuvwzX] [-P patch] [-p prj] [-a arch] [-b bits] [-i file]\n"
" [-s addr] [-B baddr] [-m maddr] [-c cmd] [-e k=v] file|pid|-|--|=\n");
Expand Down Expand Up @@ -249,7 +159,6 @@ static int main_help(int line) {
if (i + 1 < sizeof(options) / sizeof(options[0])) {
print_colored_help_tools(options[i], options[i + 1], options[i + 2],maxOptionAndArgLength);
}
>>>>>>> f60893219b (updated)
}
}
if (line == 2) {
Expand Down
80 changes: 0 additions & 80 deletions librz/main/rz-asm.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@
#include <string.h>
#include <rz_main.h>
#include <rz_core.h>
<<<<<<< HEAD
#define COLOR_GREEN "\x1b[32m"
#define COLOR_RESET "\x1b[0m"
#define COLOR_LIGHT_BLUE "\x1b[36m"
#define COLOR_YELLOW "\x1b[33m"
=======
>>>>>>> f60893219b (updated)

typedef struct {
RzLib *l;
Expand Down Expand Up @@ -173,78 +166,6 @@ static int show_analinfo(RzAsmState *as, const char *arg, ut64 offset) {
free(buf);
return ret;
}
<<<<<<< HEAD
static void printColoredText(const char* color, const char* text) {
printf("%s %-8s %s", color, text, COLOR_GREEN);
}
static void printOption(const char* option, const char* arg,const char* description) {
size_t optionWidth = strlen(option);
size_t maxSpaces = 12 - optionWidth;

printf(" %-.*s", (int)optionWidth, option); // Dynamically align option based on width

if (arg[0] != '\0') {
printColoredText(COLOR_YELLOW, arg);
} else {
printf("%-*.*s", (int)maxSpaces, (int)maxSpaces, ""); // Dynamically add spaces when arg is not present
}

printColoredText(COLOR_RESET, description);
printf("\n");
}

static int rasm_show_help(int v) {
if (v < 2) {
printf("%s%s",COLOR_LIGHT_BLUE,"Usage:");
printColoredText(COLOR_RESET, "rz-asm [-ACdDehLBvw] [-a arch] [-b bits] [-o addr] [-s syntax]\n"
" [-f file] [-F fil:ter] [-i skip] [-l len] 'code'|hex|-\n");
}
const char* options[] = {
"-a","[arch]", " Set architecture to assemble/disassemble (see -L)",
" -A","", " Show Analysis information from given hexpairs",
" -b","[bits]", " Set cpu register size (8, 16, 32, 64) (RZ_ASM_BITS)",
" -B","", " Binary input/output (-l is mandatory for binary input)",
" -c","[cpu]", " Select specific CPU (depends on arch)",
" -C","", " Output in C format",
" -d, -D","", " Disassemble from hexpair bytes (-D show hexpairs)",
" -e","", " Use big endian instead of little endian",
" -I","", " Display lifted RzIL code (same input as in -d, IL is also validated)",
" -E","", " Display ESIL expression (same input as in -d)",
" -f","[file]", " Read data from file",
" -F","[in:out]", " Specify input and/or output filters (att2intel, x86.pseudo, ...)",
" -h, -hh","", " Show this help, -hh for long",
" -i","[len]", " ignore/skip N bytes of the input buffer",
" -j","", " output in json format",
" -k","[kernel]", " Select operating system (linux, windows, darwin, ..)",
" -l","[len]", " Input/Output length",
" -L","", " List Asm plugins: (a=asm, d=disasm, A=analyze, e=ESIL)",
" -o,-@","[addr]", "Set start address for code (default 0)",
" -O","[file]", " Output file name (rz-asm -Bf a.asm -O a)",
" -p","", " Run SPP over input for assembly",
" -q","", " quiet mode",
" -r","", " output in rizin commands",
" -s","[syntax]", " Select syntax (intel, att)",
" -v","", " Show version information",
" -x","", " Use hex dwords instead of hex pairs when assembling.",
" -w","", " What's this instruction for? describe opcode",
};
if (v != 1){
for (int i = 0; i < sizeof(options) / sizeof(options[0]); i += 3) {
if (i + 1 < sizeof(options) / sizeof(options[0])) {
printOption(options[i], options[i + 1],options[i + 2]);
}
}
}
printf("%s%s", COLOR_RESET, " If '-l' value is greater than output length, output is padded with nops\n\
If the last argument is '-' reads from stdin\n\
Environment:\n\
RZ_NOPLUGINS do not load shared plugins (speedup loading)\n\
RZ_ASM_ARCH same as rz-asm -a\n\
RZ_ASM_BITS same as rz-asm -b\n\
RZ_DEBUG if defined, show error messages and crash signal\n"
);

=======

static int rasm_show_help(int v) {
if (v < 2) {
Expand Down Expand Up @@ -305,7 +226,6 @@ static int rasm_show_help(int v) {
" RZ_ASM_BITS same as rz-asm -b\n"
" RZ_DEBUG if defined, show error messages and crash signal\n"
"");
>>>>>>> f60893219b (updated)
if (v == 2) {
printf("Supported Assembler directives:\n");
rz_asm_list_directives();
Expand Down
91 changes: 2 additions & 89 deletions librz/main/rz-diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,95 +194,13 @@ typedef struct diff_hex_view_t {
#define rz_diff_ctx_set_type(x, t) rz_diff_ctx_set_def(x, type, DIFF_TYPE_UNKNOWN, t)
#define rz_diff_ctx_set_mode(x, m) rz_diff_ctx_set_def(x, mode, DIFF_MODE_STANDARD, m)
#define rz_diff_ctx_set_opt(x, o) rz_diff_ctx_set_def(x, option, DIFF_OPT_UNKNOWN, o)
<<<<<<< HEAD
#define COLOR_GREEN "\x1b[32m"
#define COLOR_RESET "\x1b[0m"
#define COLOR_LIGHT_BLUE "\x1b[36m"
#define COLOR_YELLOW "\x1b[33m"

static void printColoredText(const char* color, const char* text) {
printf("%s %-9s %s", color, text, COLOR_GREEN);
}
static void printOption(const char* option, const char* arg,const char* description) {
size_t optionWidth = strlen(option);
size_t maxSpaces = 13 - optionWidth;

printf(" %-.*s", (int)optionWidth, option); // Dynamically align option based on width

if (arg[0] != '\0') {
printColoredText(COLOR_YELLOW, arg);
} else {
printf("%-*.*s", (int)maxSpaces, (int)maxSpaces, ""); // Dynamically add spaces when arg is not present
}

printColoredText(COLOR_RESET, description);
printf("\n");
}

static void rz_diff_show_help(bool usage_only) {
printf("%s%s",COLOR_LIGHT_BLUE,"Usage:");
printColoredText(COLOR_RESET, "rz-diff [options] <file0> <file1>\n");
=======

static void rz_diff_show_help(bool usage_only) {
<<<<<<< HEAD
printf("%s%s%s", COLOR_LIGHT_BLUE, "Usage:", COLOR_RESET);
printf(COLOR_RESET "rz-diff [options] <file0> <file1>\n");
>>>>>>> f60893219b (updated)
=======
printf("%s%s%s", COLOR_LIGHT_BLUE, "Usage:", Color_RESET);
printf(Color_RESET "rz-diff [options] <file0> <file1>\n");
>>>>>>> a6f4477e07 (modified)
printf("%s%s%s", COLOR_LIGHT_BLUE, "Usage: ", Color_RESET);
printf("rz-diff [options] <file0> <file1>\n");
if (usage_only) {
return;
}
<<<<<<< HEAD
printf(
" -a [arch] specify architecture plugin to use (x86, arm, ..)\n"
" -b [bits] specify register size for arch (16 (thumb), 32, 64, ..)\n"
" -d [algo] compute edit distance based on the choosen algorithm:\n"
" myers | Eugene W. Myers' O(ND) algorithm (no substitution)\n"
" leven | Levenshtein O(N^2) algorithm (with substitution)\n"
" ssdeep | Context triggered piecewise hashing comparison\n"
" -i use command line arguments instead of files (only for -d)\n"
" -H hexadecimal visual mode\n"
" -h show the help message\n"
" -j json output\n"
" -q quite output\n"
" -V show version information\n"
" -v be more verbose (stderr output)\n"
" -e [k=v] set an evaluable config variable\n"
" -A compare virtual and physical addresses\n"
" -B run 'aaa' when loading the bin\n"
" -C disable colors\n"
" -T show timestamp information\n"
" -S [WxH] sets the width and height of the terminal for visual mode\n"
" -0 [cmd] input for file0 when option -t 'commands' is given.\n"
" the same value will be set for file1, if -1 is not set.\n"
" -1 [cmd] input for file1 when option -t 'commands' is given.\n"
" -t [type] compute the difference between two files based on its type:\n"
" bytes | compares raw bytes in the files (only for small files)\n"
" lines | compares text files\n"
" functions | compares functions found in the files\n"
" classes | compares classes found in the files\n"
" command | compares command output returned when executed in both files\n"
" | requires -0 <cmd> and -1 <cmd> is optional\n"
" entries | compares entries found in the files\n"
" fields | compares fields found in the files\n"
" graphs | compares 2 functions and outputs in graphviz/dot format\n"
" | requires -0 <fcn name|offset> and -1 <fcn name|offset> is optional\n"
" imports | compares imports found in the files\n"
" libraries | compares libraries found in the files\n"
" sections | compares sections found in the files\n"
" strings | compares strings found in the files\n"
" symbols | compares symbols found in the files\n"
" palette colors can be changed by adding the following lines\n"
" inside the $HOME/.rizinrc file\n"
" ec diff.unknown blue | offset color\n"
" ec diff.match green | match color\n"
" ec diff.unmatch red | mismatch color\n"
"");
=======
const char *options[] = {
"-a","[arch]","specify architecture plugin to use (x86, arm, ..)",
"-b","[bits]","specify register size for arch (16 (thumb), 32, 64, ..)",
Expand Down Expand Up @@ -344,14 +262,9 @@ static void rz_diff_show_help(bool usage_only) {
"ec diff.unknown blue | offset color\n"
"ec diff.match green | match color\n"
"ec diff.unmatch red | mismatch color\n");
<<<<<<< HEAD
=======

}
>>>>>>> f60893219b (updated)

}
>>>>>>> 814f81abb7 (coloring help output of rizin,rz-diff,rz-asm)
static bool rz_diff_is_file(const char *file) {
if (IS_NULLSTR(file)) {
rz_diff_error_ret(false, "cannot open a file without a name.\n");
Expand Down

0 comments on commit eb47f71

Please sign in to comment.