chrismaddalena / Goreport

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

Miscalculation of unique events #19

Open Cycl0pe opened 5 years ago

Cycl0pe commented 5 years ago

First of all, thanks for your useful tool!

When generating a report, I noticed a little error concerning the variable "total_unique_opened".

You should take into account the fact that if someone clicks on the link in the email, he should have opened the e-mail before (That's the logic applied in Gophish) even if he did not activate the display of the tracker in the email.

You should also take into account the fact that if someone submitted data, he implicitly opened the email and clicked on the link.

Cycl0pe

chrismaddalena commented 5 years ago

You raise a good point. I can see about making modifications to the counts so certain events trigger +1 to other counts under certain conditions.

chrismaddalena commented 2 years ago

@Cycl0pe I'm only now able to get to this. I added in some logic to increment the "email opened" counter when a recipient has a timeline event for clicking the link but no event for loading the tracking image.

The Gophish demo database doesn't emulate that sort of behavior, so I haven't fully tested it. It's a simple change, so it should work. I'm going to put together a script to emulate events for different test cases later.

if target.email in self.targets_clicked:
    temp_dict["clicked"] = True
    self.total_unique_clicked += 1
    # Incremement the total number of opens for this target if they clicked
    # but did not display the tracking image in the email
    if target.email not in self.targets_opened:
        self.total_unique_opened += 1