UNPKG

firmament-vita

Version:

Firmament module for automating VITA tasks

97 lines 4.17 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; Object.defineProperty(exports, "__esModule", { value: true }); var inversify_1 = require("inversify"); var inversify_config_1 = require("../../inversify.config"); var deepExtend = require('deep-extend'); var VitaCommandImpl = (function () { function VitaCommandImpl(commandUtil, vitaTasks) { this.commandUtil = commandUtil; this.vitaTasks = vitaTasks; this.aliases = []; this.command = ''; this.commandDesc = ''; this.handler = function (argv) { }; this.options = {}; this.subCommands = []; this.buildCommandTree(); } VitaCommandImpl_1 = VitaCommandImpl; VitaCommandImpl.prototype.buildCommandTree = function () { this.aliases = ['vita']; this.command = '<subCommand>'; this.commandDesc = 'Run VITA tasks'; this.pushProcessCommand(); this.pushJsonOutCommand(); }; VitaCommandImpl.prototype.pushJsonOutCommand = function () { var me = this; var jsonOutCommand = inversify_config_1.default.get('CommandImpl'); jsonOutCommand.aliases = ['json-out']; jsonOutCommand.commandDesc = 'Create JSON execution graph for later processing'; jsonOutCommand.options = { 'write': { alias: 'w', type: 'string', desc: 'Output path for JSON file. Writes to stdout if not specified' } }; deepExtend(jsonOutCommand.options, VitaCommandImpl_1.processingOptions); jsonOutCommand.handler = this.vitaTasks.jsonOut.bind(this.vitaTasks); me.subCommands.push(jsonOutCommand); }; VitaCommandImpl.prototype.pushProcessCommand = function () { var me = this; var processCommand = inversify_config_1.default.get('CommandImpl'); processCommand.aliases = ['process']; processCommand.commandDesc = 'Process encrypted PCAP archives'; processCommand.options = { 'json-in': { type: 'string', desc: 'Name of execution graph to process' } }; deepExtend(processCommand.options, VitaCommandImpl_1.processingOptions); processCommand.handler = this.vitaTasks.process.bind(this.vitaTasks); me.subCommands.push(processCommand); }; VitaCommandImpl.processingOptions = { output: { alias: 'o', type: 'string', desc: "Name of merged PCAP file" }, input: { alias: 'i', type: 'array', desc: "Space delimited list of PCAP archives. Archive files expected to have '.enc' extension" }, password: { alias: 'p', type: 'string', desc: "OpenSSL passphrase for encrypted PCAP archive" } }; VitaCommandImpl = VitaCommandImpl_1 = __decorate([ inversify_1.injectable(), __param(0, inversify_1.inject('CommandUtil')), __param(1, inversify_1.inject('VitaTasks')), __metadata("design:paramtypes", [Object, Object]) ], VitaCommandImpl); return VitaCommandImpl; var VitaCommandImpl_1; }()); exports.VitaCommandImpl = VitaCommandImpl; //# sourceMappingURL=vita-command-impl.js.map