Updates Part Eleven

This commit is contained in:
Unknown
2019-04-13 19:30:30 -04:00
parent ced7e8d3b0
commit 042720823a
14 changed files with 271 additions and 28 deletions

View File

@@ -0,0 +1,107 @@
/datum/computer_file/program/access_decrypter
filename = "nt_accrypt"
filedesc = "NTNet Access Decrypter"
program_icon_state = "hostile"
program_key_state = "security_key"
program_menu_icon = "unlocked"
extended_desc = "This highly advanced script can very slowly decrypt operational codes used in almost any network. These codes can be downloaded to an ID card to expand the available access. The system administrator will probably notice this."
size = 34
requires_ntnet = 1
available_on_ntnet = 0
available_on_syndinet = 1
nanomodule_path = /datum/nano_module/program/access_decrypter/
var/message = ""
var/running = FALSE
var/progress = 0
var/target_progress = 300
/datum/computer_file/program/access_decrypter/kill_program(var/forced)
reset()
..(forced)
/datum/computer_file/program/access_decrypter/proc/reset()
running = FALSE
message = ""
progress = 0
/datum/computer_file/program/access_decrypter/process_tick()
. = ..()
if(!running)
return
var/obj/item/weapon/computer_hardware/processor_unit/CPU = computer.processor_unit
var/obj/item/weapon/computer_hardware/card_slot/RFID = computer.card_slot
if(!istype(CPU) || !CPU.check_functionality() || !istype(RFID) || !RFID.check_functionality())
message = "A fatal hardware error has been detected."
return
if(!istype(RFID.stored_card))
message = "RFID card has been removed from the device. Operation aborted."
return
progress += CPU.max_idle_programs
if(progress >= target_progress)
reset()
var/datum/access/A = get_access_by_id(pick(get_all_station_access()))
RFID.stored_card.access |= A.id
if(ntnet_global.intrusion_detection_enabled)
ntnet_global.add_log("IDS WARNING - Unauthorised access to primary keycode database from device: [computer.network_card.get_network_tag()] - downloaded access codes for: [A.desc].")
ntnet_global.intrusion_detection_alarm = 1
message = "Successfully decrypted and saved operational key codes. Downloaded access codes for: [A.desc]"
/datum/computer_file/program/access_decrypter/Topic(href, href_list)
if(..())
return 1
if(href_list["PRG_reset"])
reset()
return 1
if(href_list["PRG_execute"])
if(running)
return 1
var/obj/item/weapon/computer_hardware/processor_unit/CPU = computer.processor_unit
var/obj/item/weapon/computer_hardware/card_slot/RFID = computer.card_slot
if(!istype(CPU) || !CPU.check_functionality() || !istype(RFID) || !RFID.check_functionality())
message = "A fatal hardware error has been detected."
return
if(!istype(RFID.stored_card))
message = "RFID card is not present in the device. Operation aborted."
return
running = TRUE
if(ntnet_global.intrusion_detection_enabled)
ntnet_global.add_log("IDS WARNING - Unauthorised access attempt to primary keycode database from device: [computer.network_card.get_network_tag()]")
ntnet_global.intrusion_detection_alarm = 1
return 1
/datum/nano_module/program/access_decrypter
name = "NTNet Access Decrypter"
/datum/nano_module/program/access_decrypter/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = GLOB.default_state)
if(!ntnet_global)
return
var/datum/computer_file/program/access_decrypter/PRG = program
var/list/data = list()
if(!istype(PRG))
return
data = PRG.get_header_data()
if(PRG.message)
data["message"] = PRG.message
else if(PRG.running)
data["running"] = 1
data["rate"] = PRG.computer.processor_unit.max_idle_programs
// Stolen from DOS traffic generator, generates strings of 1s and 0s
var/percentage = (PRG.progress / PRG.target_progress) * 100
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
ui = GLOB.nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "access_decrypter.tmpl", "NTNet Access Decrypter", 550, 400, state = state)
ui.auto_update_layout = 1
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)

View File

@@ -31,6 +31,7 @@
data["ntnetlogs"] = ntnet_global.logs
data["ntnetmaxlogs"] = ntnet_global.setting_maxlogcount
data["banned_nids"] = list(ntnet_global.banned_nids)
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
@@ -41,21 +42,19 @@
ui.open()
ui.set_auto_update(1)
/datum/nano_module/computer_ntnetmonitor/Topic(href, href_list)
/datum/nano_module/computer_ntnetmonitor/Topic(href, href_list, state)
var/mob/user = usr
if(..())
return 1
if(href_list["resetIDS"])
. = 1
if(ntnet_global)
ntnet_global.resetIDS()
return 1
if(href_list["toggleIDS"])
. = 1
if(ntnet_global)
ntnet_global.toggleIDS()
return 1
if(href_list["toggleWireless"])
. = 1
if(!ntnet_global)
return 1
@@ -65,7 +64,6 @@
return 1
// NTNet is enabled and user is about to shut it down. Let's ask them if they really want to do it, as wirelessly connected computers won't connect without NTNet being enabled (which may prevent people from turning it back on)
var/mob/user = usr
if(!user)
return 1
var/response = alert(user, "Really disable NTNet wireless? If your computer is connected wirelessly you won't be able to turn it back on! This will affect all connected wireless devices.", "NTNet shutdown", "Yes", "No")
@@ -73,17 +71,30 @@
ntnet_global.setting_disabled = 1
return 1
if(href_list["purgelogs"])
. = 1
if(ntnet_global)
ntnet_global.purge_logs()
return 1
if(href_list["updatemaxlogs"])
. = 1
var/mob/user = usr
var/logcount = text2num(input(user,"Enter amount of logs to keep in memory ([MIN_NTNET_LOGS]-[MAX_NTNET_LOGS]):"))
if(ntnet_global)
ntnet_global.update_max_log_count(logcount)
return 1
if(href_list["toggle_function"])
. = 1
if(!ntnet_global)
return 1
ntnet_global.toggle_function(href_list["toggle_function"])
return 1
if(href_list["ban_nid"])
if(!ntnet_global)
return 1
var/nid = input(user,"Enter NID of device which you want to block from the network:", "Enter NID") as null|num
if(nid && CanUseTopic(user, state))
ntnet_global.banned_nids |= nid
return 1
if(href_list["unban_nid"])
if(!ntnet_global)
return 1
var/nid = input(user,"Enter NID of device which you want to unblock from the network:", "Enter NID") as null|num
if(nid && CanUseTopic(user, state))
ntnet_global.banned_nids -= nid
return 1