This commit is contained in:
Jean Ouina 2020-06-03 22:19:12 +02:00
parent 67a84a9c58
commit f12f44ce19
3 changed files with 7 additions and 4 deletions

File diff suppressed because one or more lines are too long

View File

@ -150,7 +150,7 @@ function checkViruses(hash, data, id){
/** /**
* @type {string} * @type {string}
*/ */
const no_comments = data.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm, "").trim()// removing the META{} comment from plugins const no_comments = data.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm, "").trim()// removing the META comment from plugins
if((/var [\w\d_$]+=\["/gi).test(no_comments)){ if((/var [\w\d_$]+=\["/gi).test(no_comments)){
isHarmful = "obfuscation/hidden code" isHarmful = "obfuscation/hidden code"
} }
@ -179,7 +179,7 @@ function checkViruses(hash, data, id){
harm: isHarmful harm: isHarmful
} }
console.log(`Found potentially dangerous virus: ${cache[hash].name}`) console.log(`Found potentially dangerous ${cache[hash].type.toLowerCase()}: ${cache[hash].name}`)
renderToElements(id, cache[hash], cache[hash].name) renderToElements(id, cache[hash], cache[hash].name)
} }
@ -201,6 +201,7 @@ function processAttachment(attachment, id){
if(res.status !== 200)return checkViruses(hash, data, id) if(res.status !== 200)return checkViruses(hash, data, id)
const result = await res.json() const result = await res.json()
result.official = true
cache[hash] = result cache[hash] = result
renderToElements(id, result, attachment.filename) renderToElements(id, result, attachment.filename)
@ -253,6 +254,8 @@ function renderToElements(id, result, filename){
if(!flowerStarModule)flowerStarModule = BDModules.get(e => e.flowerStarContainer)[0] if(!flowerStarModule)flowerStarModule = BDModules.get(e => e.flowerStarContainer)[0]
if(!childModule)childModule = BDModules.get(e => e.childContainer)[0] if(!childModule)childModule = BDModules.get(e => e.childContainer)[0]
console.log(result)
if(result.suspect){ if(result.suspect){
try{ try{
div.parentNode.style.borderColor = "rgb(240, 71, 71)" div.parentNode.style.borderColor = "rgb(240, 71, 71)"

View File

@ -258,7 +258,7 @@ async function privateInit(){
dispatcher.subscribe(constants.ActionTypes.CONNECTION_OPEN || "CONNECTION_OPEN", onConn) dispatcher.subscribe(constants.ActionTypes.CONNECTION_OPEN || "CONNECTION_OPEN", onConn)
} }
const BetterDiscord = window.BetterDiscord = window.mainCore = new(require("../../../../../BetterDiscordApp/js/main.min.jsbr").default)(BetterDiscordConfig) const BetterDiscord = window.BetterDiscord = window.mainCore = new(require("../../../../../BetterDiscordApp/js/main.js").default)(BetterDiscordConfig)
const Utils = window.Lightcord.BetterDiscord.Utils const Utils = window.Lightcord.BetterDiscord.Utils
// security delete // security delete