ioc-extractor
Version:
IoC (Indicator of Compromise) extractor
24 lines (21 loc) • 536 B
JavaScript
import {
domainRegex
} from "./chunk-2C3BXX7F.js";
import {
ipRegex
} from "./chunk-JJ3RH2QY.js";
// src/aux/url.ts
function urlRegex(options = {
strict: true
}) {
const domainPart = domainRegex(options).source;
const path = '(?:[/?#][^\\s"]*)?';
const protocol = "(?:(?:https?)://)";
const auth = "(?:\\S+(?::\\S*)?@)?";
const port = "(?::\\d{2,5})?";
const regex = `(?:${protocol})${auth}(?:${domainPart}|localhost|${ipRegex.v4().source})${port}${path}`;
return new RegExp(regex, "gi");
}
export {
urlRegex
};