(ANTAG) Adds NTNet DoS Traffic Generator

- Implements DoS traffic generator that is available via software downloads on emagged computers (computer emagging will be added separately)
- This generator sends DoS traffic to the NTNet relay. Amount of generated traffic is linked to connectivity (Wired: 5GQ/s, High Signal: 1GQ/s, Low Signal: 0.25GQ/s)
- NTNet relays dissipate this DoS traffic on their own (at 1GQ/s rate).
- Multiple devices running this program against one relay will have cumulative effect. For example, one wirelessly connected device would not be able to overload the relay, since it dissipates same amount of traffic as wireless device generates. On the other hand, two wirelessly connected devices would eventually result in overload and failure of relay.
- (D)DoS attacks may be stopped by manually shutting down the relay and reactivating it again
- DoS program will trigger an IDS(Intrusion Detection System) alert on execution, which will immediately show on the monitoring console. However, if IDS is disabled, only way to detect this is via the relay's UI (it will show increase in buffered traffic)
- Screenshots: http://i.imgur.com/q0gbWJm.png   http://i.imgur.com/NVobCWa.png     (Visual note: 1s and 0s in the UI change over time, amount of 1s is equivalent to approximate percentage completion of DoS attack)
This commit is contained in:
Atlantis
2015-12-15 23:50:27 +01:00
parent 326922cd8d
commit c93a3c755e
6 changed files with 134 additions and 2 deletions

View File

@@ -0,0 +1,103 @@
/datum/computer_file/program/ntnet_dos
filename = "ntn_dos"
filedesc = "DoS Traffic Generator"
program_icon_state = "hostile"
size = 20
requires_ntnet = 1
available_on_ntnet = 0
available_on_syndinet = 1
nanomodule_path = /datum/nano_module/computer_dos/
var/obj/machinery/ntnet_relay/target = null
var/dos_speed = 0
var/error = ""
var/executed = 0
/datum/computer_file/program/ntnet_dos/process_tick()
dos_speed = 0
switch(ntnet_status)
if(1)
dos_speed = NTNETSPEED_LOWSIGNAL * 10
if(2)
dos_speed = NTNETSPEED_HIGHSIGNAL * 10
if(3)
dos_speed = NTNETSPEED_ETHERNET * 10
if(target && executed)
target.dos_overload += dos_speed
if(target.is_operational())
target.dos_sources.Remove(src)
target = null
error = "Connection to destination relay lost."
/datum/computer_file/program/ntnet_dos/kill_program(var/forced)
target.dos_sources.Remove(src)
target = null
executed = 0
..(forced)
/datum/nano_module/computer_dos
name = "DoS Traffic Generator"
/datum/nano_module/computer_dos/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = default_state)
if(!ntnet_global)
return
var/datum/computer_file/program/ntnet_dos/PRG = program
var/list/data = list()
if(!istype(PRG))
return
data = PRG.get_header_data()
if(PRG.error)
data["error"] = PRG.error
else if(PRG.target && PRG.executed)
data["target"] = 1
data["speed"] = PRG.dos_speed
// This is mostly visual, generate some strings of 1s and 0s
// Probability of 1 is equal of completion percentage of DoS attack on this relay.
// Combined with UI updates this adds quite nice effect to the UI
var/percentage = PRG.target.dos_overload * 100 / PRG.target.dos_capacity
var/list/strings[0]
for(var/j, j<10, j++)
var/string = ""
for(var/i, i<20, i++)
string = "[string][prob(percentage)]"
strings.Add(string)
data["dos_strings"] = strings
else
var/list/relays[0]
for(var/obj/machinery/ntnet_relay/R in ntnet_global.relays)
relays.Add(R.uid)
data["relays"] = relays
data["focus"] = PRG.target ? PRG.target.uid : null
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "ntnet_dos.tmpl", "DoS Traffic Generator", 400, 250, state = state)
ui.auto_update_layout = 1
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
/datum/computer_file/program/ntnet_dos/Topic(href, href_list)
if(..())
return 1
if(href_list["PRG_target_relay"])
for(var/obj/machinery/ntnet_relay/R in ntnet_global.relays)
if("[R.uid]" == href_list["PRG_target_relay"])
target = R
return
if(href_list["PRG_reset"])
target.dos_sources.Remove(src)
target = null
executed = 0
error = ""
return
if(href_list["PRG_execute"])
if(target)
executed = 1
target.dos_sources.Add(src)
if(ntnet_global.intrusion_detection_enabled)
ntnet_global.add_log("IDS WARNING - Excess traffic flood targeting relay [target.uid] detected from device: [computer.network_card.get_network_tag()]")
ntnet_global.intrusion_detection_alarm = 1
return