Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ The following are needed if you want email notifications:
* `SMTP_FROM_EMAIL`: The email address of your email account on the SMTP server (e.g. `[email protected]`).
* `SMTP_RECEIVER_EMAIL`: What email the notifications will be sent to. This may be the same as the above but could be different.

The following are needed if you want slack notifications:

* `SLACK_NOTIFICATIONS_ENABLED`: Leave enabled to receive slack notifications (you must set this up via the below configurations as well).
* `SLACK_WEBHOOK`: The slack webhook that you get once you setup integration.
* `SLACK_CHANNEL`: The slack channel that the webhook will post to.
* `SLACK_USERNAME`: The username given to the slack message (e.g. `XSS Hunter Alerts`).
* `SLACK_EMOJI`: The Emoji used as the porfile picture on slack (e.g. `warning`).

Finally, the following is worth considering for the security conscious:

* `CONTROL_PANEL_ENABLED`: If you want to minimize the attack surface of your instance you can disable the web control panel. This makes it so you'll only receive emails of payload fires (results will still be stored on disk and in the database).
Expand Down
4 changes: 4 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ async function get_app_server() {
payload_fire_data.screenshot_url = `https://${process.env.HOSTNAME}/screenshots/${payload_fire_data.screenshot_id}.png`;
await notification.send_email_notification(payload_fire_data);
}
if (process.env.SLACK_NOTIFICATIONS_ENABLED === "true") {
payload_fire_data.screenshot_url = `https://${process.env.HOSTNAME}/screenshots/${payload_fire_data.screenshot_id}.png`;
await notification.send_slack_notification(payload_fire_data);
}
});

app.get('/screenshots/:screenshotFilename', async (req, res) => {
Expand Down
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ services:
- SMTP_PASSWORD=YourEmailPassword
- [email protected]
- [email protected]
# Whether or not to enable slack notifications via
# Webhook for XSS payload fires.
- SLACK_NOTIFICATIONS_ENABLED=true
- SLACK_WEBHOOK=https://hooks.slack.com/services/
- SLACK_CHANNEL=xssalerting
- SLACK_USERNAME=XSS-Hunter
- SLACK_EMOJI=hackerman
# THERE IS NO NEED TO MODIFY BELOW THIS LINE
# ------------------------------------------
# FEEL FREE, BUT KNOW WHAT YOU'RE DOING.
Expand Down
25 changes: 24 additions & 1 deletion notification.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const nodemailer = require('nodemailer');
const mustache = require('mustache');
const fs = require('fs');
const axios = require('axios');

const XSS_PAYLOAD_FIRE_EMAIL_TEMPLATE = fs.readFileSync(
'./templates/xss_email_template.htm',
Expand Down Expand Up @@ -34,4 +35,26 @@ async function send_email_notification(xss_payload_fire_data) {
console.log("Message sent: %s", info.messageId);
}

module.exports.send_email_notification = send_email_notification;
async function send_slack_notification(xss_payload_fire_data) {
var slack_message = {
"channel": process.env.SLACK_CHANNEL,
"username": process.env.SLACK_USERNAME,
"icon_emoji": `:${process.env.SLACK_EMOJI}:`,
"blocks": [
{
"type": "section",
"text": {
"type": "plain_text",
"text": `XSS Payload Fired On ${xss_payload_fire_data.url}`
}
},
]
};

await axios.post(process.env.SLACK_WEBHOOK, JSON.stringify(slack_message));

console.log("Message sent to slack");
}

module.exports.send_email_notification = send_email_notification;
module.exports.send_slack_notification = send_slack_notification;
Loading