chrismaddalena / Goreport

A Python script to collect campaign data from Gophish and generate a report
BSD 3-Clause "New" or "Revised" License
180 stars 50 forks source link

Some non ASCII characters are not encoded and script fails #14

Closed juancarlosm83 closed 6 years ago

juancarlosm83 commented 6 years ago

I have some user's Full Names which were imported from a CSV file and the non ASCII charcters were turned into symbols. Specifically names with characters with tildes like the following character: é

The script will see non ASCII characters and fail, if possible could a fix be introduced to allow the script to skip the character or add a random character and continue to finish the report for later editing? The error I received was:

[!] There was a problem processing campaign ID 32! L.. Details: 'ascii' codec can't encode character u'\ufffd' in position 16: ordinal not in range(128)

Quick search online says to use .encode() to encode a string instead of using str

Source: https://stackoverflow.com/questions/9942594/unicodeencodeerror-ascii-codec-cant-encode-character-u-xa0-in-position-20

Thank you, JC

chrismaddalena commented 6 years ago

I'll look into this. I can't address it this week, but can probably throw together a test case with some names and emails next week. It should be a fairly simple fix.

vincentcox commented 6 years ago

Any news on this?

vincentcox commented 6 years ago

Please note that this appears only an issue for when using python instead of python3.

chrismaddalena commented 6 years ago

I intend to work on this issue this week.

Do you mean you do not see this problem when you use Python 3? GoPhish is written for Python 3 and will not work properly if you use Python 2.7.

vincentcox commented 6 years ago

It is properly working for python3. I was confused by the documentation because it is stating: pip install -r requirements.txt instead of pip3 install -r requirements.txt My bad.

chrismaddalena commented 6 years ago

Thanks for the update! I may change the README to point people in the direction of using pipenv to avoid these sorts of issues.

Let me know if you run into any issues!