Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color in ouput gives json error #82

Open
marcelo321 opened this issue Jun 25, 2021 · 4 comments
Open

Color in ouput gives json error #82

marcelo321 opened this issue Jun 25, 2021 · 4 comments
Labels

Comments

@marcelo321
Copy link

marcelo321 commented Jun 25, 2021

When providing output from color to send to slack, slacktee gives a json error. I got this error when using a public tool called nuclei which gave a one line output of color, and when piping it to slacktee it gave this error:

slacktee.sh: {"ok":false,"error":"invalid_json"}

I guess this happens because of the color, since when removing it slacktee had no problems. Maybe add a condition to remove colorful output so it doesn't give this error? not sure

@Chikashi-Kato
Copy link
Member

Thank you for the report, @marcelo321 !
If you don’t mind, could you share all of of the command line options you are using for sending the message?
Also, if it’s possible, please share the sample of the input as well.

@marcelo321
Copy link
Author

Here an example:

~# echo "https://docs.zebra.com/" | nuclei -t /root/nuclei-templates/miscellaneous/dir-listing.yaml -tags misc -silent | slacktee.sh 
[2021-06-25 18:44:50] [dir-listing] [http] [info] https://docs.zebra.com/
slacktee.sh: {"ok":false,"error":"invalid_json"}

Editing it with vim:

[^[[36m2021-06-25 18:45:41^[[0m] [^[[92mdir-listing^[[0m] [^[[94mhttp^[[0m] [^[[34minfo^[[0m] https://docs.zebra.com/

@Chikashi-Kato
Copy link
Member

Thank you so much for the detail!
I see, it seems to be caused by escape sequences. Handling this case gracefully might not be easy but let me think about it.

@marcelo321
Copy link
Author

Any update regarding this..? some sed magic like this could do the work echo colorful | sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants