update make-breach-with-emails to match
This commit is contained in:
Родитель
f09209e636
Коммит
2e4cc228cb
|
@ -105,6 +105,11 @@
|
|||
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
|
||||
"dev": true
|
||||
},
|
||||
"arg": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/arg/-/arg-2.0.0.tgz",
|
||||
"integrity": "sha512-XxNTUzKnz1ctK3ZIcI2XUPlD96wbHP2nGqkPKpvk/HNRlPveYrXIVSTk9m3LcqOgDPg3B1nMvdV/K8wZd7PG4w=="
|
||||
},
|
||||
"argparse": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
"url": "https://github.com/mozilla/blurts-server/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"arg": "^2.0.0",
|
||||
"aws-sdk": "^2.194.0",
|
||||
"body-parser": "^1.18.2",
|
||||
"client-oauth2": "^4.1.0",
|
||||
|
|
|
@ -1,11 +1,24 @@
|
|||
"use strict";
|
||||
|
||||
const arg = require("arg");
|
||||
|
||||
require("dotenv").load();
|
||||
|
||||
const DBUtils = require("../../db/utils");
|
||||
|
||||
|
||||
const extraTestEmail = process.argv[2];
|
||||
const args = arg({
|
||||
"--createAMBreach": Boolean,
|
||||
"--extraTestEmail": String,
|
||||
"--help": Boolean,
|
||||
});
|
||||
|
||||
if (args["--help"]) {
|
||||
console.log("Usage: node make-breach-with-emails.js [--createAMBreach] [--extraTestEmail=<...>]");
|
||||
console.log("--createAMBreach creates the 'AllMusic' test fixture breach.");
|
||||
console.log("--extraTestEmail adds the supplied test email address and includes it in the LinkedIn, Adobe, and AllMusic breaches.");
|
||||
process.exit();
|
||||
}
|
||||
|
||||
const sampleBreaches = [
|
||||
{
|
||||
|
@ -23,12 +36,20 @@ const sampleBreaches = [
|
|||
];
|
||||
|
||||
(async () => {
|
||||
if (args['--createAMBreach']) {
|
||||
const allMusicBreach = await DBUtils.createBreach("AllMusic", {
|
||||
Name: "AllMusic",
|
||||
BreachDate: "2015-012-06",
|
||||
DataClasses: ["Email addresses", "IP addresses", "Passwords", "Usernames", "Website activity"],
|
||||
PwnCount: 1436486,
|
||||
});
|
||||
}
|
||||
for (const sB of sampleBreaches) {
|
||||
const breach = await DBUtils.getBreachByName(sB.name);
|
||||
for (const e of sB.emails) {
|
||||
await DBUtils.addBreachedEmail(sB.name, e);
|
||||
if (extraTestEmail) {
|
||||
DBUtils.addBreachedEmail(sB.name, extraTestEmail);
|
||||
if (args["--extraTestEmail"]) {
|
||||
DBUtils.addBreachedEmail(sB.name, args["--extraTestEmail"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,10 +57,7 @@ const sampleBreaches = [
|
|||
const testEmail = "test1@test.com";
|
||||
const foundBreaches = await DBUtils.getBreachesForEmail(testEmail);
|
||||
await DBUtils.deleteBreach(999999);
|
||||
console.log(`\n\n${testEmail} was found in the following breaches:\n`);
|
||||
console.log(foundBreaches.map(b => b.name));
|
||||
const breach = await DBUtils.getBreachByName("LinkedIn");
|
||||
console.log(breach);
|
||||
await DBUtils.setBreachedHashNotified(breach, testEmail);
|
||||
// eslint-disable-next-line no-process-exit
|
||||
process.exit();
|
||||
|
|
Загрузка…
Ссылка в новой задаче