Skip to content

Instantly share code, notes, and snippets.

@glennzw
Created November 3, 2020 18:15
Show Gist options
  • Save glennzw/82a6805015290a5cf06dda59af0a8c03 to your computer and use it in GitHub Desktop.
Save glennzw/82a6805015290a5cf06dda59af0a8c03 to your computer and use it in GitHub Desktop.
Poll gophish campaign for submitted data
/*
e.g output:
benjaminsteele@widgets.com submitted data at November 3rd 2020, 7:12:25 pm
morganatkinson@widgets.com submitted data at October 1st 2020, 6:15:48 pm
muhammadrose@widgets.com submitted data at October 1st 2020, 6:15:41 pm
alfiemoran@widgets.com 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