Skip to content

Commit

Permalink
Merge pull request #40 from OleksandrBlack/distress_methods
Browse files Browse the repository at this point in the history
add methods
  • Loading branch information
opengs authored Mar 7, 2024
2 parents f45118b + ae1f736 commit 477dafe
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 17 deletions.
24 changes: 18 additions & 6 deletions lib/module/distress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ import { Module, Version, InstallProgress, InstallationTarget, BaseConfig, Modul
import { getCPUArchitecture } from './archLib'

export interface Config extends BaseConfig {
// Enable UDP flood or not
directUDPFailover: boolean;
// Disable UDP flood or not
DisableUDPFlood: boolean;
// Enable ICMP flood or not
EnableICMPFlood: boolean;
// Enable PACKET flood or not
EnablePACKETFlood: boolean;
// Number of concurrent tasks
concurrency: number;
// Number of Tor connections
Expand Down Expand Up @@ -31,7 +35,9 @@ export class Distress extends Module<Config> {
autoUpdate: true,
executableArguments: [],
concurrency: 4096,
directUDPFailover: false,
DisableUDPFlood: false,
EnableICMPFlood: false,
EnablePACKETFlood: false,
useMyIP: 0,
useTor: 0
}
Expand Down Expand Up @@ -72,7 +78,7 @@ export class Distress extends Module<Config> {
if (settings.itarmy.uuid !== '') {
args.push('--user-id', settings.itarmy.uuid)
}
args.push('--disable-auto-update', '--json-logs')
args.push('--json-logs')
if (config.concurrency > 0) {
args.push('--concurrency', config.concurrency.toString())
}
Expand All @@ -82,8 +88,14 @@ export class Distress extends Module<Config> {
if (config.useMyIP > 0) {
args.push('--use-my-ip', config.useMyIP.toString())
}
if (config.useMyIP > 0 && config.directUDPFailover) {
args.push('--direct-udp-mixed-flood')
if (config.useMyIP > 0 && config.DisableUDPFlood) {
args.push('--disable-udp-flood')
}
if (config.useMyIP > 0 && config.EnableICMPFlood) {
args.push('--enable-icmp-flood')
}
if (config.useMyIP > 0 && config.EnablePACKETFlood) {
args.push('--enable-packet-flood')
}
args.push('--source', "itarmykit")
args.push(...config.executableArguments.filter(arg => arg !== ''))
Expand Down
8 changes: 6 additions & 2 deletions src/i18n/en-US/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@ export default {
torConnectionsDescription: "Use Tor connections for the attack",
useMyIp: "Use My IP",
useMyIpDescription: "Percentage of using your own IP address or VPN, if configured",
udpFlood: "UDP Flood",
udpFloodDescription: "Allow UDP flood attack. Works if you use your own IP or VPN"
UDPFlood: "Disable UDP Flood",
UDPFloodDescription: "Disallow UDP flood attack. Works if you use your own IP",
ICMPFlood: "Enable ICMP Flood",
ICMPFloodDescription: "Allow ICMP flood attack. Works if you use your own IP",
PACKETFlood: "Enable PACKET Flood",
PACKETFloodDescription: "Not work in OS Windows! Allow PACKET flood attack. Works if you use your own IP"
}
},
top: {
Expand Down
8 changes: 6 additions & 2 deletions src/i18n/ua-UA/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@ export default {
torConnectionsDescription: "Використовувати підключення Tor для атаки",
useMyIp: "Задіяти мій IP",
useMyIpDescription: "Відсоток використання власної IP-адреси або VPN, якщо налаштовано",
udpFlood: "UDP-флуд",
udpFloodDescription: "Дозволити атаку UDP-флуд. Працює, якщо ви використовуєте свій власний IP або VPN"
UDPFlood: "Вимкнути UDP-флуд",
UDPFloodDescription: "Заборонити атаку UDP-флуд. Працює, якщо ви використовуєте свій власний IP",
ICMPFlood: "Активувати ICMP-флуд",
ICMPFloodDescription: "Дозволити атаку ICMP-флуд. Працює, якщо ви використовуєте свій власний IP",
PACKETFlood: "Активувати PACKET-флуд",
PACKETFloodDescription: "Не працює на ОС Windows! Дозволити атаку PACKET-флуд. Працює, якщо ви використовуєте свій власний IP"
}
},
top: {
Expand Down
41 changes: 34 additions & 7 deletions src/pages/modules/distressPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,34 @@
</div>
<q-item class="row q-pa-none q-pt-sm">
<q-item-section>
<q-item-label>{{ $t('modules.distress.udpFlood') }}</q-item-label>
<q-item-label caption><b>{{ $t('modules.distress.udpFloodDescription') }}</b></q-item-label>
<q-item-label>{{ $t('modules.distress.UDPFlood') }}</q-item-label>
<q-item-label caption><b>{{ $t('modules.distress.UDPFloodDescription') }}</b></q-item-label>
</q-item-section>
<q-item-section side top>
<q-toggle color="primary" v-model="configAllowUdpFlood" @update:model-value="setConfigDebouced"/>
<q-toggle color="primary" v-model="configDisableUDPFlood" @update:model-value="setConfigDebouced"/>
</q-item-section>
</q-item>

<q-item class="row q-pa-none q-pt-sm">
<q-item-section>
<q-item-label>{{ $t('modules.distress.ICMPFlood') }}</q-item-label>
<q-item-label caption><b>{{ $t('modules.distress.ICMPFloodDescription') }}</b></q-item-label>
</q-item-section>
<q-item-section side top>
<q-toggle color="primary" v-model="configEnableICMPFlood" @update:model-value="setConfigDebouced"/>
</q-item-section>
</q-item>

<q-item class="row q-pa-none q-pt-sm">
<q-item-section>
<q-item-label>{{ $t('modules.distress.PACKETFlood') }}</q-item-label>
<q-item-label caption><b>{{ $t('modules.distress.PACKETFloodDescription') }}</b></q-item-label>
</q-item-section>
<q-item-section side top>
<q-toggle color="primary" v-model="configEnablePACKETFlood" @update:model-value="setConfigDebouced"/>
</q-item-section>
</q-item>

<div class="row q-pt-sm">
<div class="col-12 text-subtitle1">{{ $t('modules.available.arguments') }}</div>
<q-input outlined v-model="configExecutableArguments" dense class="col-12" hint="" :prefix="configExecutableArgumentsPrefix" @update:model-value="setConfigDebouced"/>
Expand Down Expand Up @@ -85,13 +106,15 @@ import { Config } from 'lib/module/distress'
const configSelectedVersion = ref(null as string | null)
const configAutoUpdate = ref(true)
const configAllowUdpFlood = ref(true)
const configDisableUDPFlood = ref(false)
const configEnableICMPFlood = ref(false)
const configEnablePACKETFlood = ref(false)
const configConcurrency = ref(4096)
const configUseMyIP = ref(0)
const configTorConnections = ref(0)
const configExecutableArguments = ref("")
const configExecutableArgumentsPrefix = computed(() => {
return `--disable-auto-update --json-logs --concurrency ${configConcurrency.value}` + (configUseMyIP.value != 0 ? ` --use-my-ip ${configUseMyIP.value}` : "") + (configTorConnections.value != 0 ? ` --use-tor ${configTorConnections.value}` : "") + (configAllowUdpFlood.value ? ` --direct-udp-mixed-flood` : "")
return `--json-logs --concurrency ${configConcurrency.value}` + (configUseMyIP.value != 0 ? ` --use-my-ip ${configUseMyIP.value}` : "") + (configTorConnections.value != 0 ? ` --use-tor ${configTorConnections.value}` : "") + (configDisableUDPFlood.value ? ` --disable-udp-flood` : "") + (configEnableICMPFlood.value ? ` --enable-icmp-flood` : "") + (configEnablePACKETFlood.value ? ` --enable-packet-flood` : "")
})
const installedVersions = ref([] as string[])
Expand All @@ -100,7 +123,9 @@ async function loadConfig() {
const config = await window.modulesAPI.getConfig<Config>('DISTRESS')
configSelectedVersion.value = config.selectedVersion || null
configAutoUpdate.value = config.autoUpdate
configAllowUdpFlood.value = config.directUDPFailover
configDisableUDPFlood.value = config.DisableUDPFlood
configEnableICMPFlood.value = config.EnableICMPFlood
configEnablePACKETFlood.value = config.EnablePACKETFlood
configConcurrency.value = Number(config.concurrency)
configUseMyIP.value = Number(config.useMyIP)
configTorConnections.value = Number(config.useTor)
Expand All @@ -116,7 +141,9 @@ async function setConfig() {
executableArguments: configExecutableArguments.value.split(" "),
useMyIP: Number(configUseMyIP.value),
useTor: Number(configTorConnections.value),
directUDPFailover: configAllowUdpFlood.value,
DisableUDPFlood: configDisableUDPFlood.value,
EnableICMPFlood: configEnableICMPFlood.value,
EnablePACKETFlood: configEnablePACKETFlood.value,
} as Config
await window.modulesAPI.setConfig<Config>('DISTRESS', config)
Expand Down

0 comments on commit 477dafe

Please sign in to comment.