mirror of
https://github.com/trufflesecurity/xsshunter
synced 2024-12-18 00:33:04 +00:00
7fb21d7adf
* client gpg * first pass on pgp * completing backend save * displaying encrypted data * add migrations * fixing the download button * fixing image download * fixing image download * fixing image download * fixing email template bugs * fixing download button * final touches * final touches * final touches * final touches * final touches * Update Settings.vue * final touches * final touches * final touches * add sentry logging and stream file --------- Co-authored-by: counter <counter@counters-MacBook-Air.local> Co-authored-by: Dustin Decker <dustin@trufflesec.com>
42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
const sendgrid = require('@sendgrid/mail')
|
|
sendgrid.setApiKey(process.env.SENDGRID_API_KEY)
|
|
const mustache = require('mustache');
|
|
const fs = require('fs');
|
|
|
|
const XSS_PAYLOAD_FIRE_EMAIL_TEMPLATE = fs.readFileSync(
|
|
'./templates/xss_email_template.htm',
|
|
'utf8'
|
|
);
|
|
|
|
async function send_email_notification(xss_payload_fire_data, email) {
|
|
const notification_html_email_body = mustache.render(
|
|
XSS_PAYLOAD_FIRE_EMAIL_TEMPLATE,
|
|
xss_payload_fire_data
|
|
);
|
|
|
|
const fire_location = (!xss_payload_fire_data.encrypted ? xss_payload_fire_data.url : 'With An Encryption Key');
|
|
|
|
const msg = {
|
|
from: process.env.EMAIL_FROM,
|
|
to: email,
|
|
subject: `[XSS Hunter Express] XSS Payload Fired On ${fire_location}`,
|
|
text: "Only HTML reports are available, please use an email client which supports this.",
|
|
html: notification_html_email_body,
|
|
asm: {
|
|
groupId: parseInt(process.env.SENDGRID_UNSUBSRIBE_GROUP_ID),
|
|
groupsToDisplay: [
|
|
parseInt(process.env.SENDGRID_UNSUBSRIBE_GROUP_ID)
|
|
]
|
|
},
|
|
}
|
|
response = await sendgrid
|
|
.send(msg)
|
|
.catch((error) => {
|
|
console.error(error);
|
|
})
|
|
|
|
console.debug("Message emailed with status %d", response[0].statusCode);
|
|
return true;
|
|
}
|
|
|
|
module.exports.send_email_notification = send_email_notification;
|