Created
November 3, 2020 18:15
-
-
Save glennzw/82a6805015290a5cf06dda59af0a8c03 to your computer and use it in GitHub Desktop.
Poll gophish campaign for submitted data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
e.g output: | |
[email protected] submitted data at November 3rd 2020, 7:12:25 pm | |
[email protected] submitted data at October 1st 2020, 6:15:48 pm | |
[email protected] submitted data at October 1st 2020, 6:15:41 pm | |
[email protected] submitted data at October 1st 2020, 6:13:52 pm | |
*/ | |
function checkSubmitted(id) { | |
resultsL = [] | |
api.campaignId.results(id) | |
.success(function (campaign) { | |
$.each(campaign.results, function (j, result) { | |
if (result.status == "Submitted Data"){ | |
resultsL.push(result) | |
} | |
}) | |
}).then(function(){ | |
resultsL.sort((a, b) => (a.modified_date < b.modified_date) ? 1 : -1) // Sort by | |
$.each(resultsL, function(index, r) { | |
console.log(r.email + " submitted data at " + moment(r.modified_date).format('MMMM Do YYYY, h:mm:ss a')) | |
}); | |
}) | |
} | |
(function(){ | |
console.clear() | |
checkSubmitted(campaign.id) // Or set whatever campaign id you want | |
setTimeout(arguments.callee, 5000); | |
})(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment