Gator96100 / ProxSpace

Proxmark III develoment environment for Windows
269 stars 70 forks source link

mingw ansi colors inside pm3 client #14

Closed iceman1001 closed 5 years ago

iceman1001 commented 5 years ago

One thing that has been on my mind is the strangeness with ansi colors in the mingw based proxspace environment. Since there is color when we start the mingw env but once we start the proxmark3 client the output stops being able to translate the escape sequences correct.

Does someone have a solution for this?

merlokk commented 5 years ago

It the same for me. I dont know why.

Gator96100 commented 5 years ago

It might have to do with readline6. Readline7 might work. I'll check it out.

Gator96100 commented 5 years ago

Is there an existing command that should have a colored output?

iceman1001 commented 5 years ago

you can modify "showBanner" function in client/proxmark.c (for RRG or iceman based repo) It has colors

Gator96100 commented 5 years ago

MinGW is a toolchain to compile on Windows natively with no POSIX emulation layer. That means if you want colored output, you need to do it the Windows way. Prior to Windows 10 there were no ansi sequences. The only way is:

SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED );
printf("Hello World!");
SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 0x0f);

The reason why there is colored output when you start Proxspace is that the MinGW packages are compiled with msys2 as POSIX emulation layer. Here is a pretty good summery MSYS2 Shell or MinGW-w64 Shell

There are some possibilities to enable colored output:

iceman1001 commented 5 years ago

Does that setconsoletextattribute work? I tried a somewhat similar techneque with enableing vt escapes but it didn't work.

iceman1001 commented 5 years ago

and yes, that did work, to answer my own question.

iceman1001 commented 5 years ago

mingw is compiled with msys2 and proxmark3 client is compiled with mingw-toolchain (which doesn't have that ansi stuff).. It makes more sense now. However I have a hard time seeing the SetConsoleTextAttribute in a simple define macro way like on linux/apple.

Gator96100 commented 5 years ago

I tried to compile the Proxmark client with msys2 to see what would happen. The problem is that every Makefile and .c/.h file that differentiate between mingw and linux/macOS need to be changed as msys does set other variables that mingw does. I might look into it again when I have more time available.

iceman1001 commented 5 years ago

how about we drop this one?