
Research
GemStuffer Campaign Abuses RubyGems as Exfiltration Channel Targeting UK Local Government
GemStuffer abuses RubyGems as an exfiltration channel, packaging scraped UK council portal data into junk gems published from new accounts.
gmail-tester-extended
Advanced tools
A simple NodeJS gmail client which checks the inbox for specific message existance
A simple Node.js Gmail client which checks/returns email message(s) straight from any Gmail-powered account (both private and company).
There are two main functionalities this library provides:
check_inbox(): Polls a mailbox for a given amount of time. At the end of the operation, the desired message is returned (if found).get_messages(): Can be used to perform various assertions on the email objects (see example below).reply_email(): Can be used to perform various assertions on the email objects.P.S, I have written a story on medium, how using Cypress, we are testing our user registration process at Tastewise.
npm:npm install --save-dev gmail-tester-extended
credentials.json inside an accessible directory (see instructions below).node <node_modules>/gmail-tester-extended/init.js <path-to-credentials.json> <path-to-token.json> <target-email>
<path-to-credentials.json> Is the path to OAuth2 Authentication file.
<path-to-token.json> Is the path to OAuth2 token. If it doesn't exist, the script will create it.
The script will prompt you to go to google.com to activate a token.
Go to the given link, and select the account for <target-email>. Grant permission to view your email messages and settings. At the end of the process you should see the token:
Hit the copy button and paste it to init.js script.
The process should look like this:
(project-name) with your project name.
The credentials.json file should look like this:
If everything is done right, the last output from the script should be
[gmail] Found!
gmail-tester-extended is ready to use.get_messages(credentials_json, token_path, options)credentials_json: Path to credentials JSON file.
token_path: Path to OAuth2 token file.
options:
from: String. Filter on the email address of the receiver.to: String. Filter on the email address of the sender.subject: String. Filter on the subject of the email.include_body: boolean. Set to true to fetch decoded email bodies.before: Date. Filter messages received after the specified date.after: Date. Filter messages received before the specified date.Returns:
An array of email objects with the following fields:
[
{
from: "Human Friendly Name <sender@email-address>",
receiver: "your@email-address",
subject: "string",
body: {
html: "string",
text: "string"
}
}
// ...
];
Some senders will send you text/html content, the others will send you plain/text, and some will send you both. Make sure you are looking for the content in the right body field.
check_inbox(credentials_json, token_path, options = {})credentials_json: Path to credentials JSON file.
token_path: Path to OAuth2 token file.
options:
from: String. Filter on the email address of the receiver.to: String. Filter on the email address of the sender.subject: String. Filter on the subject of the email.include_body: boolean. Set to true to fetch decoded email bodies.before: Date. Filter messages received after the specified date.after: Date. Filter messages received before the specified date.wait_time_sec: Integer. Interval between inbox checks (in seconds). Default: 30 seconds.max_wait_time_sec: Integer. Maximum wait time (in seconds). When reached and the email was not found, the script exits. Default: 60 seconds.Returns:
An array of email objects with the following fields:
[
{
from: "Human Friendly Name <sender@email-address>",
receiver: "your@email-address",
subject: "string",
body: {
html: "string",
text: "string"
}
}
// ...
];
In addition, verbose messages will be written to console.
check_inbox() to look for a specific message:const path = require("path");
const gmail = require("gmail-tester-extended");
const email = await gmail.check_inbox(
path.resolve(__dirname, "credentials.json"), // Assuming credentials.json is in the current directory.
path.resolve(__dirname, "gmail_token.json"), // Look for gmail_token.json in the current directory (if it doesn't exists, it will be created by the script).
"Activate Your Account", // We are looking for 'Activate Your Account' in the subject of the message.
"no-reply@domain.com", // We are looking for a sender header which is 'no-reply@domain.com'.
"<target-email>", // Which inbox to poll. credentials.json should contain the credentials to it.
10, // Poll interval (in seconds).
30, // Maximum poll time (in seconds), after which we'll giveup.
{ include_body: true } // If we want to include the body of messages (optional)
);
if (email) {
console.log("Email was found!");
} else {
console.log("Email was not found!");
}
get_messages() to assert email body using Cypressexamples\cypress\plugins\index.js:
/// <reference types="Cypress" />
const debug = require("debug");
const path = require("path");
const gmail_tester = require("../../../../../gmail-tester-extended");
module.exports = (on, config) => {
on("before:browser:launch", (browser = {}, args) => {
if (browser.name === "chrome") {
args.push("--remote-debugging-port=9221");
return args;
}
});
on("task", {
"gmail:get-messages": async args => {
const messages = await gmail_tester.get_messages(
path.resolve(__dirname, "credentials.json"),
path.resolve(__dirname, "token.json"),
args.options
);
return messages;
}
});
};
examples\cypress\integration\gmail.spec.js:
/// <reference types="Cypress" />
describe("Email assertion:", () => {
it("Look for an email with specific subject and link in email body", function() {
// debugger; //Uncomment for debugger to work...
cy
.task("gmail:get-messages", {
options: {
from: "AccountSupport@ubi.com",
subject: "Ubisoft Password Change Request",
include_body: true,
before: new Date(2019, 8, 24, 12, 31, 13), // Before September 24rd, 2019 12:31:13
after: new Date(2019, 7, 23) // After August 23, 2019
}
})
.then(emails => {
assert.isAtLeast(
emails.length,
1,
"Expected to find at least one email, but none were found!"
);
const body = emails[0].body.html;
assert.isTrue(
body.indexOf(
"https://account-uplay.ubi.com/en-GB/action/change-password?genomeid="
) >= 0,
"Found reset link!"
);
});
});
});
Please feel free to contribute to this project.
FAQs
A simple NodeJS gmail client which checks the inbox for specific message existance
The npm package gmail-tester-extended receives a total of 1,703 weekly downloads. As such, gmail-tester-extended popularity was classified as popular.
We found that gmail-tester-extended demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
GemStuffer abuses RubyGems as an exfiltration channel, packaging scraped UK council portal data into junk gems published from new accounts.

Company News
Socket was named to the Rising in Cyber 2026 list, recognizing 30 private cybersecurity startups selected by CISOs and security executives.

Research
Socket detected 84 compromised TanStack npm package artifacts modified with suspected CI credential-stealing malware.