UNPKG

@hashangit/breachhound

Version:

An efficient OSINT tool for uncovering digital footprints associated with a username. TypeScript port of GoSearch.

53 lines 1.87 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.checkWebsitePresence = checkWebsitePresence; const axios_1 = __importDefault(require("axios")); const utils_1 = require("./utils"); async function checkWebsitePresence(siteConfig, targetUsername) { const profileUrl = (0, utils_1.formatUrl)(siteConfig.base_url, targetUsername); const config = { url: profileUrl, method: 'GET', // Or appropriate method headers: { 'User-Agent': utils_1.DEFAULT_USER_AGENT, // Add other headers as needed }, timeout: 15000, // Example timeout validateStatus: (status) => status >= 200 && status < 400, // Consider valid status codes // Add other axios config options as needed }; try { const response = await (0, axios_1.default)(config); let isPresent = false; let isUncertain = false; let checkStatus = 'not_found'; // ... (switch statement logic for errorType) ... // Modify the logic: instead of console.log/appendToFile, set checkStatus if (isPresent) { checkStatus = 'found'; } else if (isUncertain) { checkStatus = 'uncertain'; } else { checkStatus = 'not_found'; } return { siteName: siteConfig.name, profileUrl: profileUrl, // Use the base URL for reporting status: checkStatus, }; } catch (error) { return { siteName: siteConfig.name, profileUrl: profileUrl, status: 'error', error: error.message, }; } } //# sourceMappingURL=websiteChecker.js.map