Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
npm install gmail-node --save
var gmailNode = require('gmail-node');
var clientSecret = {
installed: {
client_id: "k677725446467-6li25pcqgkcllsoh6f6dijcvse64n9pf.apps.googleusercontent.com",
project_id: "clean-node-119606",
auth_uri: "https://accounts.google.com/o/oauth2/auth",
token_uri: "https://accounts.google.com/o/oauth2/token",
auth_provider_x509_cert_url: "https://www.googleapis.com/oauth2/v1/certs",
client_secret: "kF7DvoA_ZrNfa65GnU2zQBgw7",
redirect_uris: [
"urn:ietf:wg:oauth:2.0:oob",
"http://localhost"
]
}
};
gmailNode.init(clientSecret, './token.json', function(err,data){ ... });
var emailMessage = {
to: 'guptkashish@gmail.com',
subject: 'Test Subject',
message: 'Test Email'
};
gmailNode.send(emailMessage, function (err, data) { ... });
var emailMessage = {
to: 'guptkashish@gmail.com',
subject: 'Test Subject',
message: '<h1>Test Email</h1>'
};
gmailNode.sendHTML(emailMessage, function (err, data) { ... });
Method: generateUrl()
:
This will return the URL, which user have to open to get code.gmailNode.generateUrl(clientSecret);
code
generate from URL
Method: generateToken()
:gmailNode.generateToken(clientSecret, '4/bZ94wJNeLj4b1nZ0nUhQ7fbqfjIYd4basm_GuG3br2s',(err, data)=>{
console.log(err || data)
});
Token
and Credenctial
then you can directly use Method: sendWithToken or sendHTMLWithToken
No need to call Method: init()
:gmailNode.sendWithToken(testMessage, clientSecret, token,function (err, data) {
console.log(err,data);
});
gmailNode.sendHTMLWithToken(testMessage, clientSecret, token,function (err, data) {
console.log(err,data);
});
gmailNode.clearToken();
/* Client-Secret Downloaded from Google Development */
var clientSecret = {
installed: {
client_id: "k677725446467-6li25pcqgkcllsoh6f6dijcvse64n9pf.apps.googleusercontent.com",
project_id: "clean-node-119606",
auth_uri: "https://accounts.google.com/o/oauth2/auth",
token_uri: "https://accounts.google.com/o/oauth2/token",
auth_provider_x509_cert_url: "https://www.googleapis.com/oauth2/v1/certs",
client_secret: "kF7DvoA_ZrNfa65GnU2zQBgw7",
redirect_uris: [
"urn:ietf:wg:oauth:2.0:oob",
"http://localhost"
]
}
};
var gmailNode = require('gmail-node');
// Message
var testMessage = {
to: 'guptkashish@gmail.com',
subject: 'Test Subject',
message: '<h1>Test Email</h1>'
};
// ClientSecret:
gmailNode.init(clientSecret, './token.json', initComplete);
function initComplete(err, dataObject) {
if(err){
console.log('Error ', err);
}else {
gmailNode.send(testMessage, function (err, data) {
console.log(err,data);
});
// OR
gmailNode.sendHTML(testMessage, function (err, data) {
console.log(err,data);
});
}
}
It's an open source project, you can report issue and form this repository to create pull request to add features.
FAQs
It makes Gmail interation easy using Node.js
The npm package gmail-node receives a total of 0 weekly downloads. As such, gmail-node popularity was classified as not popular.
We found that gmail-node 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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.