UNPKG

ioc-extractor

Version:

IoC (Indicator of Compromise) extractor

115 lines (112 loc) 1.98 kB
import { urlRegex } from "./chunk-JDWFL65M.js"; import { emailRegex } from "./chunk-B2TB3BWS.js"; import { domainRegex } from "./chunk-2C3BXX7F.js"; import { asnRegex, btcRegex, cveRegExp, ethRegex, gaPubIDRegex, gaTrackIDRegex, macAddressRegex, md5Regex, sha1Regex, sha256Regex, sha512Regex, ssdeepRegex, xmrRegex } from "./chunk-A2GVSYTG.js"; import { ipRegex } from "./chunk-JJ3RH2QY.js"; // src/aux/validators.ts function check(s, regexp) { const match = s.match(regexp); if (match === null) { return false; } return match[0].length == s.length; } function isMD5(s) { return check(s, md5Regex); } function isSHA1(s) { return check(s, sha1Regex); } function isSHA256(s) { return check(s, sha256Regex); } function isSHA512(s) { return check(s, sha512Regex); } function isSSDEEP(s) { return check(s, ssdeepRegex); } function isASN(s) { return check(s, asnRegex); } function isDomain(s, options = { strict: true }) { const regex = domainRegex(options); return check(s, regex); } function isEmail(s, options = { strict: true }) { const regex = emailRegex(options); return check(s, regex); } function isIPv4(s) { return check(s, ipRegex.v4()); } function isIPv6(s) { return check(s, ipRegex.v6()); } function isURL(s, options = { strict: true }) { const regex = urlRegex(options); return check(s, regex); } function isCVE(s) { return check(s, cveRegExp); } function isBTC(s) { return check(s, btcRegex); } function isXMR(s) { return check(s, xmrRegex); } function isGAPubID(s) { return check(s, gaPubIDRegex); } function isGATrackID(s) { return check(s, gaTrackIDRegex); } function isMacAddress(s) { return check(s, macAddressRegex); } function isETH(s) { return check(s, ethRegex); } export { isMD5, isSHA1, isSHA256, isSHA512, isSSDEEP, isASN, isDomain, isEmail, isIPv4, isIPv6, isURL, isCVE, isBTC, isXMR, isGAPubID, isGATrackID, isMacAddress, isETH };