slacktee
slacktee copied to clipboard
Color in ouput gives json error
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
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.
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/
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.
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'