Skip to content

Commit

Permalink
allow unpadded b64
Browse files Browse the repository at this point in the history
  • Loading branch information
KTibow committed Mar 16, 2024
1 parent c103022 commit f34faa6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/analysis/webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { file, type Loaded } from "$lib/state";

const whRegex =
/(https?:\/\/(ptb\.|canary\.)?discord(app)?\.com\/api\/webhooks\/(\d{10,20})\/([\w\-]{68}))/g;
const b64Regex = /(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})/g;
const b64Regex = /(?:[A-Za-z0-9+/]{4})*[A-Za-z0-9+/][A-Za-z0-9+/][A-Za-z0-9+/=][A-Za-z0-9+/=]/g;
export const scanWebhooks = async () => {
const fileData = get(file) as Loaded;
const zip = fileData.zip as JSZip & JSZipObject;
Expand All @@ -26,6 +26,7 @@ export const scanWebhooks = async () => {
if (base.length < 40 || base.length > 200) continue;
try {
const decoded = atob(base);
console.log(decoded);
const webhook = decoded.match(whRegex);
if (webhook) {
list.push(webhook[0]);
Expand Down

0 comments on commit f34faa6

Please sign in to comment.