chrismaddalena / Goreport

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

Problem processing campaign ID - Errorno 22 #30

Open Pintag opened 2 years ago

Pintag commented 2 years ago

[+] Processed detailed analysis for 198 of 201. [+] Processed detailed analysis for 199 of 201. [+] Processed detailed analysis for 200 of 201. [+] Processed detailed analysis for 201 of 201. [+] Finished writing detailed analysis... [!] There was a problem processing campaign ID 689! L.. Details: [Errno 22] Invalid argument: 'Gophish Results for Login\t.xlsx'

If I run the report in Word, the same result. Any suggestions on how to fix this?

chrismaddalena commented 2 years ago

Hey @Pintag! I think I see the problem. It seems very likely the \ in your campaign name is causing "Gophish Results for" to be read as a directory, so the script is trying to create t.xlsx inside ./Gophish Results for/.

I'll take a look at fixing this. In the meantime, I expect changing the campaign's name to remove the \ will let you produce your report. Let me know if that doesn't work.

chrismaddalena commented 2 years ago

I've spent some time refactoring the code to address other issues and requests and could not reproduce any issues with a campaign name with a slash. It could be something specific to the OS.

[Errno 22] Invalid argument is raised when the named file cannot be accessed. I don't encounter any issues on macOS or Linux with campaign names and special characters, but it's still good to sanitize the campaign name.

In this latest commit, the campaign names will be stripped of any non-alphanumeric characters before being used for the filename. I expect that will resolve the issue. Let me know if you have trouble :)