defense ngrok

This commit is contained in:
night0721 2022-02-03 04:40:53 +08:00
parent 8a004ee763
commit 630dbfecde
3 changed files with 52 additions and 6 deletions

View file

@ -85,6 +85,16 @@ client.on("messageCreate", async message => {
.replace(/(https|http):\/\/+/g, "") .replace(/(https|http):\/\/+/g, "")
.match(/\s*([^)]+?)\s*\/+/g, "")[0] .match(/\s*([^)]+?)\s*\/+/g, "")[0]
.slice(0, -1) .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() const _ = new MessageEmbed()

View file

@ -4104,7 +4104,24 @@
"staemporewed.xyz" "staemporewed.xyz"
], ],
"iplogger": [ "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", "lovebird.guru",
"trulove.guru", "trulove.guru",
"dateing.club", "dateing.club",
@ -4127,5 +4144,15 @@
"sportshub.bar", "sportshub.bar",
"herald.sbs", "herald.sbs",
"locations.quest" "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"
] ]
} }

View file

@ -193,6 +193,7 @@ function attachmentsIdentifier(inpmsg, gun) {
outAttachments = []; outAttachments = [];
for (let i = 0; i < gun.aments.length; i++) { for (let i = 0; i < gun.aments.length; i++) {
// Eg: "Stippled Grip Tape" -> ["Stippled", "Grip", "Tape"]
splitAttachmentsDataName.push([ splitAttachmentsDataName.push([
...new Set( ...new Set(
gun.aments[i].name gun.aments[i].name
@ -201,27 +202,35 @@ function attachmentsIdentifier(inpmsg, gun) {
.map(x => x.trim()) .map(x => x.trim())
), ),
]); ]);
// splitAttachmentsDataName[i] = ["Stippled", "Grip", "Tape"]
for (let j = 0; j < splitAttachmentsDataName[i].length; j++) { 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] =
splitAttachmentsDataName[i][j].Simplify(); splitAttachmentsDataName[i][j].Simplify();
} }
} }
// after loop: ["stippled", "grip", "tape"]
for (let i = 0; i < inputAttachmentsNames.length; i++) { 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] var splitInputAttachmentsName = inputAttachmentsNames[i]
.split(" ") .split(" ")
.filter(x => x); .filter(x => x);
function finder() { function finder() {
//splitInputAttachmentsName = [["stippled", "grip", "tape"], ["545", "ammo"], ["owc","lazer", "tactical"]]
for (let j = 0; j < splitAttachmentsDataName.length; j++) { for (let j = 0; j < splitAttachmentsDataName.length; j++) {
for (let i2 = 0; i2 < splitAttachmentsDataName[j].length; i2++) { for (let i2 = 0; i2 < splitAttachmentsDataName[j].length; i2++) {
for (let i3 = 0; i3 < splitInputAttachmentsName.length; i3++) { for (let i3 = 0; i3 < splitInputAttachmentsName.length; i3++) {
// if simplified input attachment name is included in the real attachments name
if ( if (
splitAttachmentsDataName[j][i2].includes( splitAttachmentsDataName[j][i2].includes(
splitInputAttachmentsName[i3].Simplify() splitInputAttachmentsName[i3].Simplify()
) )
) { ) {
// if probables list doesn't include the attachment, push
let probablePushed = false; let probablePushed = false;
for (let i4 = 0; i4 < probables.length; i4++) { for (let i4 = 0; i4 < probables.length; i4++) {
if (!probables[i4].includes(j)) { if (!probables[i4].includes(j)) {
@ -230,15 +239,15 @@ function attachmentsIdentifier(inpmsg, gun) {
break; break;
} }
} }
if (!probablePushed) { // for the first loop as the probables array is emrpty
probables.push([j]); if (!probablePushed) probables.push([j]);
}
} }
} }
} }
} }
} }
finder(); finder();
// finding magazines attachments
if ( if (
(inputAttachmentsNames[i].includes(" rounds mag") || (inputAttachmentsNames[i].includes(" rounds mag") ||
inputAttachmentsNames[i].includes(" round mag")) && inputAttachmentsNames[i].includes(" round mag")) &&