@hashangit/breachhound
Version:
An efficient OSINT tool for uncovering digital footprints associated with a username. TypeScript port of GoSearch.
40 lines • 1.63 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.crackPasswordHash = crackPasswordHash;
const axios_1 = __importDefault(require("axios"));
const utils_1 = require("../utils");
/**
* Attempts to crack a password hash using the Weakpass API.
* @param hash The hash string to crack.
* @returns The cracked password string or null if not found or an error occurred.
*/
async function crackPasswordHash(hash) {
if (!hash) {
return null; // Don't attempt to crack empty hashes
}
// Weakpass API endpoint structure
const url = `https://weakpass.com/api/v1/search/${encodeURIComponent(hash)}.json`;
try {
const response = await axios_1.default.get(url, {
headers: {
'User-Agent': utils_1.DEFAULT_USER_AGENT,
'Accept': 'application/json'
},
timeout: 10000, // Timeout for Weakpass API
// Weakpass might return 404 if hash not found, treat as not cracked
validateStatus: (status) => (status >= 200 && status < 300) || status === 404,
});
if (response.status === 200 && response.data?.found && response.data.pass) {
return response.data.pass; // Return cracked password
}
return null; // Hash not found or response malformed
}
catch (error) {
// Log error internally? For now, just return null on error.
return null;
}
}
//# sourceMappingURL=weakpass.js.map