Advertisement
Guest User

game

a guest
Feb 20th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 12.11 KB | None | 0 0
  1. function clear()
  2.     term.clear()
  3.     term.setCursorPos(1,1)
  4. end
  5.  
  6. function displayServer()
  7.   term.setBackgroundColor(colors.black)
  8.   Server1Login = paintutils.loadImage("/server1login")
  9.   paintutils.drawImage(Server1Login, 1, 1)
  10.   term.setCursorPos(18, 12)
  11.   print("Username")
  12.   term.setCursorPos(18, 15)
  13.   print("Password")
  14.   term.setBackgroundColor(colors.black)
  15. end
  16.  
  17. function freeroam(diff)
  18. tonumber(diff)
  19. while true do
  20.     w, h = term.getSize()
  21.     if diff == 1 then
  22.         local possibleSecurity = {}
  23.     elseif diff == 2 then
  24.         local possibleSecurity = {"firewall"}
  25.         local security = "firewall"
  26.     elseif diff == 0 then
  27.         error("Error code 002")
  28.     end
  29.     local serverNames = {"Blocksburg", "Intek. Inc"}
  30.     local serverPasswords = {"spass", "dogdog66", "intek", "verygoodpassword", "password"}
  31.     term.setBackgroundColor(colors.black)
  32.     term.setTextColor(colors.white)
  33.     clear()
  34.     background = paintutils.loadImage("/server1login")
  35.     paintutils.drawImage(background, 1, 1)
  36.     term.setCursorPos(19, 7)
  37.     sNameSec = math.random(1, #serverNames)
  38.     sPassSec = math.random(1, #serverPasswords)
  39.     sUISec = math.random(1, 2)
  40.     cServerName = serverNames[sNameSec]
  41.     cServerPass = serverPasswords[sPassSec]
  42.     term.setBackgroundColor(colors.black)
  43.     print(cServerName)
  44.     term.setCursorPos(1,1)
  45.     term.setTextColor(colors.green)
  46.     term.clearLine()
  47.     if sNameSec == 1 then
  48.         textutils.slowPrint("Connected to server 'Blocksburg Incorporated'...")
  49.     else
  50.         textutils.slowPrint("Connected to server 'Intek. Incorporated'...")
  51.     end
  52.     term.setTextColor(colors.white)
  53.     term.setBackgroundColor(colors.gray)
  54.     term.setCursorPos(18, 12)
  55.     print("Username")
  56.     term.setCursorPos(18, 15)
  57.     print("Password")
  58.     term.setBackgroundColor(colors.black)
  59.     term.setCursorPos(1, math.floor(h - 1))
  60.     term.clearLine()
  61.     write("> ")
  62.     comm = read()
  63.     if comm == "crack" then
  64.         term.setTextColor(colors.green)
  65.         term.setCursorPos(1,1)
  66.         term.clearLine()
  67.         textutils.slowPrint("Cracking password...")
  68.         sleep(0.5)
  69.         term.setCursorPos(1,1)
  70.         term.clearLine()
  71.         textutils.slowPrint("Password found: '"..cServerPass.."'")
  72.         term.setTextColor(colors.white)
  73.         term.setCursorPos(1, math.floor(h - 1))
  74.         term.clearLine()
  75.         write("> ")
  76.         comm = read()
  77.         if true then
  78.             clear()
  79.             term.setCursorPos(1,1)
  80.             term.setTextColor(colors.green)
  81.             if string.find(comm, "login ") and string.find(comm, cServerPass) then
  82.                 term.setCursorPos(1,1)
  83.                 term.clearLine()
  84.                 textutils.slowPrint("Password Entered: '"..cServerPass.."'...")
  85.                 sleep(0.5)
  86.                 clear()
  87.                 term.setCursorPos(1,1)
  88.                 term.clearLine()
  89.                 textutils.slowPrint("Login Attempt Success")
  90.                 if sUISec == 1 then
  91.                     term.setTextColor(colors.white)
  92.                     term.setCursorPos(1, 3)
  93.                     print("File List:")
  94.                     term.setCursorPos(3, 4)
  95.                     print("os.properties")
  96.                     term.setCursorPos(3, 5)
  97.                     print("Documents")
  98.                     term.setCursorPos(1, math.floor(h - 1))
  99.                     term.clearLine()
  100.                     write("> ")
  101.                     comm = read()
  102.                     if comm == "del os.properties" then
  103.                         term.setCursorPos(1,1)
  104.                         term.setTextColor(colors.green)
  105.                         term.clearLine()
  106.                         textutils.slowPrint("Deleting file 'os.properties'...")
  107.                         sleep(0.5)
  108.                         term.setCursorPos(1,1)
  109.                         term.clearLine()
  110.                         textutils.slowPrint("Done.")
  111.                         term.setTextColor(colors.white)
  112.                         term.setCursorPos(3, 4)
  113.                         term.clearLine()
  114.                         print("<Deleted>")
  115.                         term.setCursorPos(1, math.floor(h - 1))
  116.                         term.clearLine()
  117.                         write("> ")
  118.                         comm = read()
  119.                         if comm == "reboot -i" then
  120.                             clear()
  121.                             sleep(0.5)
  122.                             term.setCursorPos(1,3)
  123.                             term.setTextColor(colors.red)
  124.                             print("Internal Server Error: No such file")
  125.                             sleep(1)
  126.                         end
  127.                     end
  128.                 elseif sUISec == 2 then
  129.                     clear()
  130.                     term.setCursorPos(1, 3)
  131.                     term.setTextColor(colors.white)
  132.                     for i=1,w do
  133.                         write("-")
  134.                     end
  135.                     term.setCursorPos(1, 4)
  136.                     term.setTextColor(colors.white)
  137.                     print("Company: "..serverNames[sNameSec])
  138.                     print(" ")
  139.                     balance = math.random(2000, 20000)
  140.                     print("Current Balance: ¥A3"..balance)
  141.                     employees = math.random(100, 300)
  142.                     print("Number of Employees: "..employees)
  143.                     term.setCursorPos(1, math.floor(h - 1))
  144.                     term.clearLine()
  145.                     write("> ")
  146.                     if foundUI2 == false then
  147.                         foundUI2 = true
  148.                         term.setCursorPos(1, math.floor(h - 2))
  149.                         print("This is an information board.")
  150.                         sleep(1)
  151.                         term.setCursorPos(1, math.floor(h - 2))
  152.                         term.clearLine()
  153.                         print("You can type 'bal <Balance>' as one hack.")
  154.                         sleep(1)
  155.                         term.setCursorPos(1, math.floor(h - 2))
  156.                         term.clearLine()
  157.                         print("Try it now: 'bal <Balance>'")
  158.                         term.setCursorPos(1, math.floor(h - 1))
  159.                         term.clearLine()
  160.                         write("> ")
  161.                     end
  162.                     term.setCursorPos(1, math.floor(h - 1))
  163.                     term.clearLine()
  164.                     write("> ")
  165.                     comm = read()
  166.                     if comm == "bal "..balance then
  167.                         clear()
  168.                         term.setTextColor(colors.green)
  169.                         textutils.slowPrint("Accessing Financial Screen...")
  170.                         sleep(1)
  171.                         clear()
  172.                         textutils.slowPrint("Done.")
  173.                         term.setTextColor(colors.white)
  174.                         term.setCursorPos(1, math.floor(h - 1))
  175.                         term.clearLine()
  176.                         write("> ")
  177.                         term.setCursorPos(1,3)
  178.                         for i=1,w do
  179.                             write("-")
  180.                         end
  181.                         term.setCursorPos(1,4)
  182.                         print("Balance: "..balance)
  183.                         financeID = math.random(100000, 999999)
  184.                         print("Finance ID: "..financeID)
  185.                         term.setCursorPos(1, math.floor(h - 1))
  186.                         term.clearLine()
  187.                         write("> ")
  188.                         comm = read()
  189.                         if comm == "fid "..financeID then
  190.                             term.setCursorPos(1, math.floor(h - 1))
  191.                             term.clearLine()
  192.                             write("> ")
  193.                             term.setCursorPos(1,1)
  194.                             term.clearLine()
  195.                             term.setTextColor(colors.green)
  196.                             textutils.slowPrint("Overflowing financial buffer...")
  197.                             sleep(1)
  198.                             clear()
  199.                             textutils.slowPrint("Done.")
  200.                             term.setCursorPos(1, 3)
  201.                             term.setTextColor(colors.white)
  202.                             for i=1,w do
  203.                                 write("-")
  204.                             end
  205.                             term.setCursorPos(1, 4)
  206.                             term.setTextColor(colors.red)
  207.                             print("Internal Server Error: Financial Buffer Error")
  208.                             sleep(2)
  209.                         end
  210.                     end
  211.                 end
  212.             end
  213.         end
  214.     end
  215. end
  216. end
  217.  
  218. local tArgs = {...}
  219. local server1 = false
  220. local foundFirewall = false
  221. local foundProxy = false
  222. local foundUI2 = false
  223.  
  224. clear()
  225.  
  226. if tArgs[1] == nil then
  227.   print("What would you like your username to be?")
  228.   write("Username: ")
  229.   uname = read()
  230.   print(" ")
  231.   print("What would you like your password to be?")
  232.   write("Password: ")
  233.   pword = read("*")
  234. elseif tArgs[1] == "-nologin" then
  235.     uname = "username"
  236.     pword = "password"
  237. elseif tArgs[1] == "-server1" then
  238.     server1 = true
  239.     uname = "username"
  240.     pword = "password"
  241. elseif tArgs[1] == "-crash" and tArgs[2] ~= nil then
  242.     error("Error code "..tArgs[2])
  243. elseif tArgs[1] == "-freeroam" then
  244.     server1 = true
  245.     freeroamEnabled = true
  246.     freeroam()
  247. end
  248.  
  249. w, h = term.getSize()
  250.  
  251. if server1 == false then
  252.   clear()
  253.   term.setCursorPos(math.floor(w / 2 - string.len("-= GenieChat =-")), 1)
  254.   print("-= GenieChat =-")
  255.   print(" ")
  256.   print("Please Login to GenieChat")
  257.   print(" ")
  258.   write("Username: ")
  259.   unameIn = read()
  260.   if unameIn == uname then
  261.     print(" ")
  262.     write("Password: ")
  263.     pwordIn = read("*")
  264.     if pwordIn == pword then
  265.       clear()
  266.       term.setCursorPos(math.floor(w / 2 - string.len("-= GenieChat =-")), 1)
  267.       print("-= GenieChat =-")
  268.       print("Moved to channel #4724")
  269.       print(" ")
  270.       print("<agentli>: Hi!")
  271.       sleep(1.5)
  272.       print("<You>: Hey.")
  273.       sleep(1.5)
  274.       print("<agentli>: So, what do you want to do?")
  275.       sleep(1.5)
  276.       print("<You>: I dunno.")
  277.       sleep(1)
  278.       term.setBackgroundColor(colors.red)
  279.       clear()
  280.       sleep(0.25)
  281.       term.setBackgroundColor(colors.black)
  282.       clear()
  283.       term.setCursorPos(math.floor(w / 2 - string.len("-= GenieChat =-")), 1)
  284.       print("-= GenieChat =-")
  285.       print(" ")
  286.       print("Moved to channel #666")
  287.       print(" ")
  288.       print("<agentls>: What just happened?")
  289.       sleep(1.5)
  290.       print("<You>: I dunno. Your username changed.")
  291.       sleep(1.5)
  292.       print("<agentli>: Better now?")
  293.       sleep(1.5)
  294.       print("<You>: Umm... Yeah, I guess...")
  295.       sleep(1.5)
  296.       print("<agentli>: Ok. Back to the job.")
  297.       sleep(1.5)
  298.       print("<You>: 'job'...?")
  299.       sleep(1.5)
  300.       print("<agentli>: You don't know? I want you to gain access to a server and... let's just say do some damage...")
  301.       sleep(1.5)
  302.       print("<You>: You mean hacking? I don't want to do that!")
  303.       sleep(1.5)
  304.       print("<agentli>: Well... too bad, I guess. Just press a key please.")
  305.       sleep(1)
  306.       print(" ")
  307.       print("-= Please press a key to continue... =-")
  308.       os.pullEvent("key")
  309.       print(" ")
  310.       print("-= Error: Unstability Detected! =-")
  311.       sleep(0.75)
  312.       term.setBackgroundColor(colors.lightBlue)
  313.       sleep(0.75)
  314.       clear()
  315.       term.setBackgroundColor(colors.black)
  316.       clear()
  317.     else
  318.       print(" ")
  319.       print("Incorrect Password.")
  320.       sleep(2)
  321.       os.reboot()
  322.       end
  323.   else
  324.       print(" ")
  325.       print("Invalid Username.")
  326.       sleep(2)
  327.       os.reboot()
  328.   end
  329. end
  330.  
  331. displayServer()
  332. term.setBackgroundColor(colors.black)
  333. term.setCursorPos(1, math.floor(h - 2))
  334. print("This is the server.")
  335. sleep(2)
  336. clear()
  337. displayServer()
  338. term.setCursorPos(1, math.floor(h - 2))
  339. print("Type 'crack' to crack the password.")
  340. term.setCursorPos(1, math.floor(h - 1))
  341. write("> ")
  342. comm = read()
  343. if comm == "crack" then
  344.     term.setCursorPos(1, 1)
  345.     term.setTextColor(colors.green)
  346.     textutils.slowPrint("Cracking password...")
  347.     term.setCursorPos(1,1)
  348.     sleep(0.5)
  349.     term.clearLine()
  350.     textutils.slowPrint("Password Found: 'spass'")
  351.     term.setTextColor(colors.white)
  352.     term.setCursorPos(1, math.floor(h - 2))
  353.     term.clearLine()
  354.     print("Well done. Now, type 'login spass' to login.")
  355.     term.setCursorPos(1, math.floor(h - 1))
  356.     term.clearLine()
  357.     write("> ")
  358.     comm = read()
  359.     if comm == "login spass" then
  360.         term.setCursorPos(1, 1)
  361.         term.setTextColor(colors.green)
  362.         term.clearLine()
  363.         textutils.slowPrint("Password Entered: 'spass'...")
  364.         sleep(0.5)
  365.         clear()
  366.         term.setCursorPos(1,1)
  367.         term.clearLine()
  368.         textutils.slowPrint("Login Attempt Success")
  369.         term.setTextColor(colors.white)
  370.         term.setCursorPos(1, 3)
  371.         print("File List:")
  372.         term.setCursorPos(3, 4)
  373.         print("os.properties")
  374.         term.setCursorPos(3, 5)
  375.         print("Documents")
  376.         term.setCursorPos(1, math.floor(h - 2))
  377.         print("So, type 'del os.properties' to delete the file.")
  378.         term.setCursorPos(1, math.floor(h - 1))
  379.         write("> ")
  380.         comm = read()
  381.         if comm == "del os.properties" then
  382.             term.setCursorPos(1,1)
  383.             term.setTextColor(colors.green)
  384.             term.clearLine()
  385.             textutils.slowPrint("Deleting file 'os.properties'...")
  386.             sleep(0.5)
  387.             term.setCursorPos(1,1)
  388.             term.clearLine()
  389.             textutils.slowPrint("Done.")
  390.             term.setTextColor(colors.white)
  391.             term.setCursorPos(3, 4)
  392.             term.clearLine()
  393.             print("<Deleted>")
  394.             term.setCursorPos(1, math.floor(h - 2))
  395.             print("Now, type 'reboot -i' to reboot the server.")
  396.             term.setCursorPos(1, math.floor(h - 1))
  397.             term.clearLine()
  398.             write("> ")
  399.             comm = read()
  400.             if comm == "reboot -i" then
  401.                 clear()
  402.                 sleep(0.5)
  403.                 term.setCursorPos(1,3)
  404.                 term.setTextColor(colors.red)
  405.                 print("Internal Server Error: No such file")
  406.                 sleep(0.5)
  407.                 term.setCursorPos(1, math.floor(h - 2))
  408.                 term.setTextColor(colors.white)
  409.                 print("Okay. Well done. Just a second, don't type 'exit'!")
  410.                 term.setCursorPos(1, math.floor(h - 1))
  411.                 write("> ")
  412.                 comm = read()
  413.                 if comm == "exit" then
  414.                     freeroamEnabled = true
  415.                 end
  416.             end
  417.         end
  418.     end
  419. end
  420.  
  421. if freeroamEnabled == true then
  422.     freeroam(1)
  423.     --clear()
  424.     --term.setTextColor(colors.white)
  425.     --print("You have completed the demo.")
  426. else -- Error Code 001 = freeroam not enabled, but reached
  427.     error("Error code 001")
  428. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement