import { Command } from "@commander-js/extra-typings"; import { commandExchange } from "./commandExchange"; import { commandGoogle } from "./commandGoogle"; import { commandMs } from "./commandMs"; export const email = new Command("email") .description( "Extracts emails from Exchange/Google/MS365 and generates CSV files.", ) .addHelpText( "after", ` In PowerShell, you can extract a PST backup with the command New-MailboxExportRequest, check this link for more information: https://learn.microsoft.com/fr-fr/powershell/module/exchange/new-mailboxexportrequest?view=exchange-ps `, ); email .command("exchange") .description("Extract emails from Exchange users PST files into a CSV file.") .argument("", "Path to the PST file") .argument("", "Destination path for the generated CSV file") .option("--stdout", "Output to standard output.") .action((pst_path, csv_path, options) => { commandExchange(pst_path, csv_path, options); }) .addHelpText( "after", ` Example call: zygon exchange ./enron.pst ./enron.csv`, ); email .command("gmail") .description("Downloads emails from Gmail.") .argument("key_file", "path to service account keyfile") .argument("user_key", "Email to crawl, aka baptiste@zygon.tech") .option( "--out ", "A file the csv will be written to, by default it does it on stdout.", ) .action(commandGoogle); email .command("365") .description("Downloads emails from MS365.") .argument("user_key", "Email to crawl, aka baptiste@zygon.tech") .option( "--out ", "A file the csv will be written to, by default it does it on stdout.", ) .action(commandMs);