x=5 --Inital Screen function drawScreen() shell.run("draw") sleep(0.75) term.clear() term.setBackgroundColor(colors.white) term.setTextColor(colors.red) end function drawLoginBox() term.setTextColor(colors.black) term.setCursorPos(9,2) print(" ---------------------------------- ") term.setCursorPos(9,3) print(" | | ") term.setCursorPos(9,4) print(" | | ") term.setCursorPos(9,5) print(" | | ") term.setCursorPos(9,6) print(" | | ") term.setCursorPos(9,7) print(" ---------------------------------- ") end function drawLoginText() term.setCursorPos(12,4) print("Username:") term.setCursorPos(12,6) print("Password:") end function usernameInput() term.setCursorPos(22,4) input=read() if input == ("kai") then passwordInput() elseif input == ("kaioo") then passwordInput() elseif input == ("kaioo132") then passwordInput() else term.clear() term.setCursorPos(1,1) print("Username Incorrect") sleep(0.75) term.clear() drawLoginBox() drawLoginText() usernameInput() end end function passwordInput() term.setCursorPos(22,6) input=read("*") if input == ("nuke") then term.clear() else term.clear() term.setCursorPos(1,1) print("Password Incorrect") sleep(0.75) term.clear() term.setCursorPos(21,4) term.setTextColor(colors.black) print("kai") drawLoginBox() drawLoginText() term.setCursorPos(22,4) print("kai") passwordInput() end end function warning() shell.run("clear") print("Warning! This program is illegal to run") print("on unautharized pc's. This is a system") print("designed for Blue Task (R). Press the") print("F1 key to continue.") while true do event,p1 = os.pullEvent() if (event=="key") and (p1==59) then defcon2() end end end --Inital Screen End --Defcon Determine function defconDetermine() term.setBackgroundColor(colors.white) term.clear() term.setBackgroundColor(colors.white) term.setTextColor(7) if fs.exists("defcon5") then print("You are at Defcon 5") elseif fs.isDir("defcon4") then print("You are at Defcon 4") x=x-1 elseif fs.isDir("defcon3") then print("You are at Defcon 3") x=x-2 elseif fs.isDir("defcon2") then print("You are at Defcon 2") x=x-3 elseif fs.isDir("defcon1") then print("You are at Defcon 1") x=x-4 else print("You are at Defcon 5") fs.makeDir("defcon5") end end --Defcon Determine End-- --API-- function r() term.setBackgroundColor(colors.white) term.clear() term.setCursorPos(1,1) term.setBackgroundColor(colors.white) term.setTextColor(colors.black) if fs.isDir("defcon5") then s=5 elseif fs.isDir("defcon4") then s=4 elseif fs.isDir("defcon3") then s=3 elseif fs.isDir("defcon2") then s=2 elseif fs.isDir("defcon1") then s=1 else fs.makeDir("defcon5") r() end term.clear() term.setTextColor(colors.black) print("You are at Defcon ") term.setCursorPos(19,1) print(s) end function apiText() term.clear() term.setBackgroundColor(colors.white) term.setTextColor(colors.black) term.clear() r() term.setCursorPos(1,2) print("Enter a command to be executed") print("Enter exit() to exit()") end function apiRead() apiText() input=read() if input==("show defcon level") then r() elseif input==("raise defcon level") then defconDetermine() raiseDefconLevel() elseif input==("lower defcon level") then defconDetermine() lowerDefconLevel() elseif input==("rednet") then rednetSide() rednetApi() elseif input==("exit()") then os.reboot() else print("Command does not exist!") apiRead() end end --rednet api function rednetApiText() shell.run("clear") r() term.setCursorPos(1,2) term.setTextColor(colors.red) print("Welcome to the Rednet API! Here you can send") print("infomation wirelessly to computers.") print("Enter a rednet code or enter exit() to") print("return to main menu.") end function rednetApi() rednetApiText() input=read() if input==("send")then rednetSide() rednetSend() elseif input==("exit()") then apiRead() elseif input==("broadcast") then rednetSide() broadcast() else print("Error:Rednet code not found") rednetApiText() rednetApi() end end function rednetSide() term.clear() term.setCursorPos(1,1) if fs.isDir("top") then n="top" rednet.close(n) rednet.open(n) rednetApi() elseif fs.isDir("bottom") then n="bottom" rednet.close(n) rednet.open(n) rednetApi() elseif fs.isDir("left") then n="left" rednet.close(n) rednet.open(n) rednetApi() elseif fs.isDir("right") then n="right" rednet.close(n) rednet.open(n) rednetApi() elseif fs.isDir("front") then n="front" rednet.close(n) rednet.open(n) rednetApi() elseif fs.isDir("back") then R="back" rednet.close(n) rednet.open(n) rednetApi() end end function broadcast() print("Whats your Message?") input=read() rednet.close(n) rednet.open(n) rednet.broadcast(input) sleep(0.75) rednet.broadcast(input) sleep(0.75) rednet.broadcast(input) print("Message Broadcasted!") rednetApi() end --rednet api end function raiseDefconLevel() if fs.isDir("defcon5") then fs.delete("defcon5/") fs.makeDir("defcon4") term.clear() r() apiText() apiRead() elseif fs.isDir("defcon4") then fs.delete("defcon4/") fs.makeDir("defcon3") term.clear() r() apiText() apiRead() elseif fs.isDir("defcon3") then fs.delete("defcon3/") fs.makeDir("defcon2") term.clear() r() apiText() apiRead() elseif fs.isDir("defcon2") then fs.delete("defcon2/") fs.makeDir("defcon1") term.clear() r() apiText() apiRead() elseif fs.isDir("defcon1") then term.setTextColor(colors.red) print("Error: Is at Defcon 1") r() apiText() apiRead() else print("Error: Defcon has no current value") r() apiText() apiRead() end end function lowerDefconLevel() if fs.isDir("defcon1") then fs.delete("defcon1/") fs.makeDir("defcon2") term.clear() r() apiText() apiRead() elseif fs.isDir("defcon2") then fs.delete("defcon2/") fs.makeDir("defcon3") term.clear() r() apiText() apiRead() elseif fs.isDir("defcon3") then fs.delete("defcon3/") fs.makeDir("defcon4") term.clear() r() apiText() apiRead() elseif fs.isDir("defcon4") then fs.delete("defcon4/") fs.makeDir("defcon5") term.clear() r() apiText() apiRead() elseif fs.isDir("defcon5") then print("Error : Is at defcon 5") sleep(0.75) term.clear() r() apiText() apiRead() else print("Error : Defcon had no value") sleep(0.75) term.clear() r() apiText() apiRead() end end --Running code function defcon() drawScreen() drawLoginBox() drawLoginText() usernameInput() warning() end function defcon2() defconDetermine() r() apiRead() apiText() end apiText() apiRead()