mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-26 01:52:15 +00:00
(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:
@@ -21,7 +21,7 @@ var/global/datum/ntnet/ntnet_global = new()
|
||||
var/setting_disabled = 0 // Setting to 1 will disable all wireless, independently on relays status.
|
||||
|
||||
var/intrusion_detection_enabled = 1 // Whether the IDS warning system is enabled
|
||||
var/intrusion_detection_alarm = 0 // Set when there is an IDS warning due to malicious (antag) software. Currently only for monitor UI testing, things that would set it are not coded yet
|
||||
var/intrusion_detection_alarm = 0 // Set when there is an IDS warning due to malicious (antag) software.
|
||||
|
||||
|
||||
// If new NTNet datum is spawned, it replaces the old one.
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
var/datum/ntnet/NTNet = null // This is mostly for backwards reference and to allow varedit modifications from ingame.
|
||||
var/enabled = 1 // Set to 0 if the relay was turned off
|
||||
var/dos_failure = 0 // Set to 1 if the relay failed due to (D)DoS attack
|
||||
var/list/dos_sources = list() // Backwards reference for qdel() stuff
|
||||
|
||||
// Denial of Service attack variables
|
||||
var/dos_overload = 0 // Amount of DoS "packets" in this relay's buffer
|
||||
@@ -86,6 +87,8 @@
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/ntnet_relay/New()
|
||||
uid = gl_uid
|
||||
gl_uid++
|
||||
component_parts = list()
|
||||
component_parts += new /obj/item/stack/cable_coil(src,15)
|
||||
component_parts += new /obj/item/weapon/circuitboard/ntnet_relay(src)
|
||||
@@ -101,6 +104,9 @@
|
||||
ntnet_global.relays.Remove(src)
|
||||
ntnet_global.add_log("Quantum relay connection severed. Current amount of linked relays: [NTNet.relays.len]")
|
||||
NTNet = null
|
||||
for(var/datum/computer_file/program/ntnet_dos/D in dos_sources)
|
||||
D.target = null
|
||||
D.error = "Connection to quantum relay severed"
|
||||
..()
|
||||
|
||||
/obj/machinery/ntnet_relay/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user