commit 630dbfecde883ee3472c626d29d1935021180fc9
parent 8a004ee763d0e2f103326992cbce66dd233206dd
Author: night0721 <[email protected]>
Date: Thu, 3 Feb 2022 04:40:53 +0800
defense ngrok
Diffstat:
3 files changed, 52 insertions(+), 6 deletions(-)
diff --git a/events/messageCreate.js b/events/messageCreate.js
@@ -85,6 +85,16 @@ client.on("messageCreate", async message => {
.replace(/(https|http):\/\/+/g, "")
.match(/\s*([^)]+?)\s*\/+/g, "")[0]
.slice(0, -1)
+ ) ||
+ domains.ngrok.includes(
+ message.content
+ .toLowerCase()
+ .match(
+ /(https|http):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+~-]*[\w.,@?^=%&:/~+~-])+/g
+ )?.[0]
+ .replace(/(https|http):\/\/+/g, "")
+ .match(/\s*([^)]+?)\s*\/+/g, "")[0]
+ .slice(0, -1)
)
) {
const _ = new MessageEmbed()
diff --git a/util/Data/domains.json b/util/Data/domains.json
@@ -4104,7 +4104,24 @@
"staemporewed.xyz"
],
"iplogger": [
- "dlscord.org/nitro-gift",
+ "iplogger.org",
+ "2no.co",
+ "iplogger.com",
+ "iplogger.ru",
+ "yip.su",
+ "iplogger.co",
+ "iplogger.info",
+ "ipgrabber.ru",
+ "ipgraber.ru",
+ "iplis.ru",
+ "02ip.ru",
+ "ezstat.ru",
+ "ps3cfw.com",
+ "ythingy.com",
+ "blasze.tk",
+ "fuekos.com",
+ "myiptest.com",
+ "dlscord.org",
"lovebird.guru",
"trulove.guru",
"dateing.club",
@@ -4127,5 +4144,15 @@
"sportshub.bar",
"herald.sbs",
"locations.quest"
+ ],
+ "ngrok": [
+ "localhost:8888",
+ "localhost:8000",
+ "localhost:8080",
+ "localhost:3000",
+ "127.0.0.1:4040",
+ "127.0.0.1:8000",
+ "127.0.0.1:8080",
+ "ngrok.io"
]
}
diff --git a/util/functions/common.js b/util/functions/common.js
@@ -193,6 +193,7 @@ function attachmentsIdentifier(inpmsg, gun) {
outAttachments = [];
for (let i = 0; i < gun.aments.length; i++) {
+ // Eg: "Stippled Grip Tape" -> ["Stippled", "Grip", "Tape"]
splitAttachmentsDataName.push([
...new Set(
gun.aments[i].name
@@ -201,27 +202,35 @@ function attachmentsIdentifier(inpmsg, gun) {
.map(x => x.trim())
),
]);
+
+ // splitAttachmentsDataName[i] = ["Stippled", "Grip", "Tape"]
for (let j = 0; j < splitAttachmentsDataName[i].length; j++) {
+ // simplify the attachments name
+ // Eg: ["Stippled", "Grip", "Tape"] -> ["stippled", "grip", "tape"]
splitAttachmentsDataName[i][j] =
splitAttachmentsDataName[i][j].Simplify();
}
}
-
+ // after loop: ["stippled", "grip", "tape"]
for (let i = 0; i < inputAttachmentsNames.length; i++) {
- var probables = [];
+ const probables = [];
+ // loop through all the input attachments and split them into words
var splitInputAttachmentsName = inputAttachmentsNames[i]
.split(" ")
.filter(x => x);
function finder() {
+ //splitInputAttachmentsName = [["stippled", "grip", "tape"], ["545", "ammo"], ["owc","lazer", "tactical"]]
for (let j = 0; j < splitAttachmentsDataName.length; j++) {
for (let i2 = 0; i2 < splitAttachmentsDataName[j].length; i2++) {
for (let i3 = 0; i3 < splitInputAttachmentsName.length; i3++) {
+ // if simplified input attachment name is included in the real attachments name
if (
splitAttachmentsDataName[j][i2].includes(
splitInputAttachmentsName[i3].Simplify()
)
) {
+ // if probables list doesn't include the attachment, push
let probablePushed = false;
for (let i4 = 0; i4 < probables.length; i4++) {
if (!probables[i4].includes(j)) {
@@ -230,15 +239,15 @@ function attachmentsIdentifier(inpmsg, gun) {
break;
}
}
- if (!probablePushed) {
- probables.push([j]);
- }
+ // for the first loop as the probables array is emrpty
+ if (!probablePushed) probables.push([j]);
}
}
}
}
}
finder();
+ // finding magazines attachments
if (
(inputAttachmentsNames[i].includes(" rounds mag") ||
inputAttachmentsNames[i].includes(" round mag")) &&