Clean up colours from various tools prior to saving it in a file #456

Closed
7a opened this Issue May 6, 2015 · 6 comments

Comments

Projects
None yet
4 participants
@7a
Member

7a commented May 6, 2015

Tools such as hoppy, UA-Tester and others show pretty colours on the CLI.
Unfortunately, as OWTF saves their output and the output files are reviewed, this looks poorly, is harder to read and even wastes some disk space :)

It would be nice if OWTF had a generic "tool output clean-up" filter to avoid saving all this useless garbage.

@7a 7a added the Enhancement label May 6, 2015

@anantshri

This comment has been minimized.

Show comment
Hide comment
@anantshri

anantshri May 7, 2015

Member

a lot of these tools might have some obsecure commandline option which can strip color's. We can try using it. Also if they don't have one lets also go one step more and ask dev's to add an option of non colored output.

Member

anantshri commented May 7, 2015

a lot of these tools might have some obsecure commandline option which can strip color's. We can try using it. Also if they don't have one lets also go one step more and ask dev's to add an option of non colored output.

@7a

This comment has been minimized.

Show comment
Hide comment
@7a

7a May 12, 2015

Member

I think we should have a generic "no colour" wrapper for tools that do not
support "no colour" output, after all, it's us that save stdout into files,
not them :)
On 8 May 2015 22:28, "Bharadwaj Machiraju" notifications@github.com wrote:

We already run such tools like whatweb etc.. by disabling color output. I
couldn't find any such switch for UA-Tester and hoppy


Reply to this email directly or view it on GitHub
#456 (comment).

Member

7a commented May 12, 2015

I think we should have a generic "no colour" wrapper for tools that do not
support "no colour" output, after all, it's us that save stdout into files,
not them :)
On 8 May 2015 22:28, "Bharadwaj Machiraju" notifications@github.com wrote:

We already run such tools like whatweb etc.. by disabling color output. I
couldn't find any such switch for UA-Tester and hoppy


Reply to this email directly or view it on GitHub
#456 (comment).

@tunnelshade

This comment has been minimized.

Show comment
Hide comment
@tunnelshade

tunnelshade May 13, 2015

Member

Yes, wrapper is the way to go ;)

Member

tunnelshade commented May 13, 2015

Yes, wrapper is the way to go ;)

@viyatb

This comment has been minimized.

Show comment
Hide comment
Member

viyatb commented May 13, 2015

There are a number of ready solutions already available at http://unix.stackexchange.com/questions/4527/program-that-passes-stdin-to-stdout-with-color-codes-stripped and http://www.commandlinefu.com/commands/view/3584/remove-color-codes-special-characters-with-sed
Please vote on which will be easiest to implement and also robust. :)

@tunnelshade

This comment has been minimized.

Show comment
Hide comment
@tunnelshade

tunnelshade May 13, 2015

Member

One way that I would recommend is to use a python regex in the blocking shell class itself, which can be used to strip the colors from output just before the return from shell_exec_monitor

Member

tunnelshade commented May 13, 2015

One way that I would recommend is to use a python regex in the blocking shell class itself, which can be used to strip the colors from output just before the return from shell_exec_monitor

viyatb added a commit that referenced this issue Dec 6, 2015

Fixes #456: following @tunnelshade's suggestion, the fix scrubs comm…
…and output for any such control sequences
@viyatb

This comment has been minimized.

Show comment
Hide comment
@viyatb

viyatb Dec 6, 2015

Member

Fixed in 77859e5 (tested, but please check!)

Member

viyatb commented Dec 6, 2015

Fixed in 77859e5 (tested, but please check!)

@viyatb viyatb closed this Dec 6, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment