Skip to content

Instantly share code, notes, and snippets.

@terraboops
Created November 1, 2022 05:59
Show Gist options
  • Save terraboops/ef795f82dda52a6c65e24b3fd8e370b4 to your computer and use it in GitHub Desktop.
Save terraboops/ef795f82dda52a6c65e24b3fd8e370b4 to your computer and use it in GitHub Desktop.
knowbe4 google script
// Update the email address below
// Schedule to run every 30 minutes at https://script.google.com/
function phish() {
const threads = GmailApp.search("newer_than:30m");
const totalSpammed = 0;
threads.forEach((thread) => {
thread.getMessages().forEach((message) => {
if(message.getHeader("X-PHISHTEST") !== "") {
thread.moveToSpam();
totalSpammed++;
}
});
});
if(totalSpammed > 0) {
GmailApp.sendEmail("hunter2@leet.com", "PHISHING AVERTED!", `Total messages moved to spam: ${totalSpammed}`);
console.log(`Total messages moved to spam: ${totalSpammed}`);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment