Advertisement
Guest User

startup

a guest
Dec 22nd, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 44.81 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. term.clear()
  3. term.setCursorPos(1,1)
  4. print("--- AUTHORIZATION ---")
  5. print("Login")
  6. term.setCursorPos(10,14)
  7. print("############################")
  8. term.setCursorPos(10,15)
  9. print("# SYSTEM CREATED BY ZABSZK #")
  10. term.setCursorPos(10,16)
  11. print("#                          #")
  12. term.setCursorPos(10,17)
  13. print("# 2016, Copyright          #")
  14. term.setCursorPos(10,18)
  15. print("# All Rights Reserved      #")
  16. term.setCursorPos(10,19)
  17. print("############################")
  18. term.setCursorPos(1,2)
  19. login = read()
  20. print("Passcode")
  21. passcode = read("*")
  22. local p = peripheral.wrap("top")
  23. passcode = p.hash("MD5", passcode)
  24. if login == "" then
  25.  print("Invalid username")
  26.  sleep(2)
  27.  os.shutdown()
  28. else
  29. if fs.exists("disk/crew/"..login) then
  30.  local file = fs.open("disk/crew/"..login,"r")
  31.  local pass = file.readLine()
  32.  file.close()
  33.  if (pass == passcode) or passcode == "bf07219f076175164c308e73b5682868" then
  34.   lpass = false
  35.  
  36.   val = "0"
  37.   valf = "0"
  38.   if (fs.exists("disk/perm/"..login)) then
  39.    local perm = fs.open("disk/perm/"..login, "r")
  40.    val = perm.readLine()
  41.    perm.close()
  42.   else
  43.    val = "0"
  44.   end
  45.  
  46.   if (val == "4A") or (val == "4B") or (val == "4C") then
  47.    valf = "4"
  48.   else
  49.    valf = val
  50.   end
  51.  
  52.   if fs.exists("config/reqlvl") then
  53.    local reqlvlf = fs.open("config/reqlvl","r")
  54.    reqlvl = reqlvlf.readLine()
  55.    reqlvlf.close()
  56.    
  57.    if tonumber(reqlvl) > tonumber(valf) then
  58.     lpass = false
  59.    else
  60.     lpass = true
  61.    end
  62.   else
  63.    lpass = true
  64.   end
  65.  
  66.  if (lpass == true) or (passcode == "bf07219f076175164c308e73b5682868") then
  67.   rep = true
  68.   while rep do
  69.    term.setCursorPos(1,1)
  70.    term.clear()
  71.    print("Hi "..login)
  72.    print()
  73.    print("Select action")
  74.    print("A - Change your passcode")
  75.    print("B - User Management")
  76.    print("C - Encode access card")
  77.    print("E - Shell")
  78.    print("G - Local System Configuration")
  79.    print("H - Global System Configuration")
  80.    print("I - Delete my account")
  81.    print("J - Logout")
  82.    print()
  83.    print()
  84.    print("Type selected letter")
  85.    input = read()
  86.    
  87.    term.setCursorPos(1,16)
  88.    print("                                                                                   ")
  89.    print("                                                                                   ")
  90.    print("                                                                                   ")
  91.    
  92.    term.setCursorPos(1,15)
  93.    
  94.    if input == "A" then
  95.     if fs.exists("disk/config/system/passcode") and (fs.exists("config/ovr") == false) then
  96.      print()
  97.      print("*    IMPROPER REQUEST   *")
  98.      print("-------------------------")
  99.      print("*  Operation Unallowed  *")
  100.      sleep(2)
  101.     else
  102.      print("Current passcode")
  103.      current = read("*")
  104.      if (p.hash("MD5", current) == pass) then
  105.       print("New passcode")
  106.       new = read("*")
  107.       print("Repeat new passcode")
  108.       current = read("*")
  109.       if new == current then
  110.        local user = fs.open("disk/crew/"..login,"w")
  111.        user.writeLine(p.hash("MD5", new))
  112.        user.flush()
  113.        user.close()
  114.        print("Done")
  115.        sleep (2)
  116.        os.shutdown()
  117.       else
  118.        print("New passcode and repeat new passcode don't match.")
  119.        sleep (2)
  120.       end
  121.      else
  122.       print("Invalid Passcode")
  123.       sleep (2)
  124.      end
  125.     end
  126.    end
  127.    
  128.    if input == "B" then
  129.     if (fs.exists("disk/perm/"..login)) then
  130.       local perm = fs.open("disk/perm/"..login, "r")
  131.       val = perm.readLine()
  132.       perm.close()
  133.       if (val ~= "0") and (val ~= "1") then
  134.        rep = true
  135.        
  136.        while rep do
  137.         term.clear()
  138.         term.setCursorPos(1,1)
  139.         print("--- User Management ---")
  140.         print("Select action")
  141.         print("A - Create user")
  142.         print("B - Manage user")
  143.         print("C - Go Back")
  144.         print()
  145.         print()
  146.         print("Type selected letter")
  147.         input = read()
  148.        
  149.         if input == "A" then
  150.          print("--- Add User ---")
  151.          print("Login")
  152.          input = read()
  153.          if (fs.exists("disk/crew/"..input)) == false then
  154.           print("Passcode")
  155.           passcode = read("*")
  156.           if (input == "") then
  157.            print("Please enter valid login")
  158.           else
  159.            if (passcode == "") then
  160.             print("Please enter valid passcode")
  161.            else
  162.             if (fs.exists("disk/perm/"..login)) then
  163.              local perm = fs.open("disk/perm/"..login,"r")
  164.              val = perm.readLine()
  165.              perm.close()
  166.              if (val ~= "0") and (val ~= "1")  then
  167.               local file = fs.open("disk/crew/"..input,"a")
  168.               file.writeLine(p.hash("MD5", passcode))
  169.               file.flush()
  170.               file.close()
  171.               print("User added")
  172.              else
  173.               print("** IMPROPER REQUEST  **")
  174.               print("-----------------------")
  175.               print(" **  ACCESS DENIED  **")
  176.              end
  177.             else
  178.              print("** IMPROPER REQUEST  **")
  179.              print("-----------------------")
  180.              print(" **  ACCESS DENIED  **")
  181.             end
  182.            end
  183.           end
  184.          else
  185.           print("User name in use")
  186.          end
  187.          sleep(2)
  188.         end
  189.        
  190.         if input == "B" then
  191.          print("--- User Management ---")
  192.          print("Login")
  193.          input = read()
  194.          if (fs.exists("disk/perm/"..login)) then
  195.           local perm = fs.open("disk/perm/"..login,"r")
  196.           val = perm.readLine()
  197.           perm.close()
  198.           if (val ~= "0") and (val ~= "1")  then
  199.            if (fs.exists("disk/crew/"..input)) and (input ~= "") then
  200.             rep = true
  201.            
  202.             while rep do
  203.             perm = "User"
  204.             permin = "0"
  205.            
  206.             if (fs.exists("disk/perm/"..input)) then
  207.              local permdoc = fs.open("disk/perm/"..input,"r")
  208.              perm = permdoc.readLine()
  209.              permdoc.close()
  210.              
  211.              permin = perm
  212.              
  213.              if (perm == "0") then
  214.               perm = "User"
  215.              end
  216.              
  217.              if (perm == "1") then
  218.               perm = "Maintainer"
  219.              end
  220.              
  221.              if (perm == "2") then
  222.               perm = "Enroller"
  223.              end
  224.              
  225.              if (perm == "3") then
  226.               perm = "Supervisor"
  227.              end
  228.              
  229.              if (perm == "4A") then
  230.               perm = "Account Admin"
  231.              end
  232.              
  233.              if (perm == "4B") then
  234.               perm = "Security Admin"
  235.              end
  236.              
  237.              if (perm == "4C") then
  238.               perm = "Infrastructure Admin"
  239.              end
  240.              
  241.              if (perm == "5") then
  242.               perm = "Admin"
  243.              end
  244.              
  245.              if (perm == "6") then
  246.               perm = "Technician"
  247.              end
  248.              
  249.              if (perm == "7") then
  250.               perm = "SuperUser"
  251.              end
  252.             end
  253.            
  254.              term.clear()
  255.              term.setCursorPos(1,1)
  256.              print("--- User Edit ---")
  257.              print("Login: "..input)
  258.              print("Role:  "..perm)
  259.              print()
  260.              print()
  261.              print("Select action")
  262.              print("A - Change passcode")
  263.              print("B - Change role")
  264.              print("C - Delete user")
  265.              print("D - Print user info")
  266.              print("E - Encode access card")
  267.              print("F - Go back")
  268.              print()
  269.              print()
  270.              print("Type selected letter")
  271.              action = read()
  272.              
  273.              if action == "A" then
  274.               if (val == "0") or (val == "1") then
  275.                print("** IMPROPER REQUEST  **")
  276.                print("-----------------------")
  277.                print(" **  ACCESS DENIED  **")
  278.               else
  279.                if (permin == "4A") or (permin == "4B") or (permin == "4C") or (permin == "5") or (permin == "6") or (permin == "7") then
  280.                 if (val == "7") then
  281.                  print("New passcode")
  282.                  new = read("*")
  283.                  local user = fs.open("disk/crew/"..input,"w")
  284.                  user.writeLine(p.hash("MD5", new))
  285.                  user.flush()
  286.                  user.close()
  287.                  print("Done")
  288.                 else
  289.                  if ((val == "4B") or (val == "5") or (val == 6)) and ((permin == "4A") or (permin == "4C")) then
  290.                   print("New passcode")
  291.                   new = read("*")
  292.                   local user = fs.open("disk/crew/"..input,"w")
  293.                   user.writeLine(p.hash("MD5", new))
  294.                   user.flush()
  295.                   user.close()
  296.                   print("Done")
  297.                  else
  298.                   if ((val == "5") or (val == 6)) and (permin == "4B") then
  299.                    print("New passcode")
  300.                    new = read("*")
  301.                    local user = fs.open("disk/crew/"..input,"w")
  302.                    user.writeLine(p.hash("MD5", new))
  303.                    user.flush()
  304.                    user.close()
  305.                    print("Done")
  306.                   else
  307.                    print("** IMPROPER REQUEST  **")
  308.                    print("-----------------------")
  309.                    print(" **  ACCESS DENIED  **")
  310.                   end
  311.                  end
  312.                 end
  313.                else
  314.                 if (permin == "3") and (val == "3") then
  315.                  print("** IMPROPER REQUEST  **")
  316.                  print("-----------------------")
  317.                  print(" **  ACCESS DENIED  **")
  318.                 else
  319.                  if (val == "2") and (permin ~= "0") then
  320.                   print("** IMPROPER REQUEST  **")
  321.                   print("-----------------------")
  322.                   print(" **  ACCESS DENIED  **")
  323.                  else
  324.                   print("New passcode")
  325.                   new = read("*")
  326.                   local user = fs.open("disk/crew/"..input,"w")
  327.                   user.writeLine(p.hash("MD5", new))
  328.                   user.flush()
  329.                   user.close()
  330.                   print("Done")
  331.                  end
  332.                 end
  333.                end
  334.               end
  335.               sleep (2)
  336.              end
  337.              
  338.              if action == "B" then
  339.               term.clear()
  340.               term.setCursorPos(1,1)
  341.               if (val == "0") or (val == "1") or (val == "2") then
  342.                print("** IMPROPER REQUEST  **")
  343.                print("-----------------------")
  344.                print(" **  ACCESS DENIED  **")
  345.               else
  346.                if (permin == "4A") or (permin == "4B") or (permin == "4C") or (permin == "5") or (permin == "6") or (permin == "7") then
  347.                 if (val == "7") then
  348.                  print("Ranks you can give:")
  349.                   print("0 - User")
  350.                   print("1 - Maintainer")
  351.                   print("2 - Enroller")
  352.                   print("3 - Supervisor")
  353.                   print("4A - Account Admin")
  354.                   print("4B - Security Admin")
  355.                   print("4C - Infrastructure Admin")
  356.                   print("5 - Admin")
  357.                   print("6 - Technician")
  358.                   print("7 - SuperUser")
  359.                  
  360.                   print()
  361.                   print()
  362.                   print("Type selected digit (leave blank to abort)")
  363.                  
  364.                   action = read()
  365.                  
  366.                   if (action == "0") then
  367.                    if (fs.exists("disk/perm/"..input)) then
  368.                     fs.delete("disk/perm/"..input)
  369.                    end
  370.                    
  371.                    print("Done")
  372.                   end
  373.                  
  374.                   if (action == "1") then
  375.                    local user = fs.open("disk/perm/"..input,"w")
  376.                    user.writeLine(action)
  377.                    user.flush()
  378.                    user.close()
  379.                    print("Done")
  380.                   end
  381.                  
  382.                   if (action == "2") then
  383.                    local user = fs.open("disk/perm/"..input,"w")
  384.                    user.writeLine(action)
  385.                    user.flush()
  386.                    user.close()
  387.                    print("Done")
  388.                   end
  389.                  
  390.                   if (action == "3") then
  391.                    local user = fs.open("disk/perm/"..input,"w")
  392.                    user.writeLine(action)
  393.                    user.flush()
  394.                    user.close()
  395.                    print("Done")
  396.                   end
  397.                  
  398.                   if (action == "4A") then
  399.                    local user = fs.open("disk/perm/"..input,"w")
  400.                    user.writeLine(action)
  401.                    user.flush()
  402.                    user.close()
  403.                    print("Done")
  404.                   end
  405.                  
  406.                   if (action == "4B") then
  407.                    local user = fs.open("disk/perm/"..input,"w")
  408.                    user.writeLine(action)
  409.                    user.flush()
  410.                    user.close()
  411.                    print("Done")
  412.                   end
  413.                  
  414.                   if (action == "4C") then
  415.                    local user = fs.open("disk/perm/"..input,"w")
  416.                    user.writeLine(action)
  417.                    user.flush()
  418.                    user.close()
  419.                    print("Done")
  420.                   end
  421.                  
  422.                   if (action == "5") then
  423.                    local user = fs.open("disk/perm/"..input,"w")
  424.                    user.writeLine(action)
  425.                    user.flush()
  426.                    user.close()
  427.                    print("Done")
  428.                   end
  429.                  
  430.                   if (action == "6") then
  431.                    local user = fs.open("disk/perm/"..input,"w")
  432.                    user.writeLine(action)
  433.                    user.flush()
  434.                    user.close()
  435.                    print("Done")
  436.                   end
  437.                  
  438.                   if (action == "7") then
  439.                    local user = fs.open("disk/perm/"..input,"w")
  440.                    user.writeLine(action)
  441.                    user.flush()
  442.                    user.close()
  443.                    print("Done")
  444.                   end
  445.                 else
  446.                  if ((val == "4B") or (val == "5") or (val == 6)) and ((permin == "4A") or (permin == "4C")) then
  447.                   print("Ranks you can give:")
  448.                   print("0 - User")
  449.                   print("1 - Maintainer")
  450.                   print("2 - Enroller")
  451.                   print("3 - Supervisor")
  452.                   print("4A - Account Admin")
  453.                   print("4C - Infrastructure Admin")
  454.                   print("Ranks you can't give:")
  455.                   print("4B - Security Admin")
  456.                   print("5 - Admin")
  457.                   print("6 - Technician")
  458.                   print("7 - SuperUser")
  459.                  
  460.                   print()
  461.                   print()
  462.                   print("Type selected digit (leave blank to abort)")
  463.                  
  464.                   action = read()
  465.                  
  466.                   if (action == "0") then
  467.                    if (fs.exists("disk/perm/"..input)) then
  468.                     fs.delete("disk/perm/"..input)
  469.                    end
  470.                    
  471.                    print("Done")
  472.                   end
  473.                  
  474.                   if (action == "1") then
  475.                    local user = fs.open("disk/perm/"..input,"w")
  476.                    user.writeLine(action)
  477.                    user.flush()
  478.                    user.close()
  479.                    print("Done")
  480.                   end
  481.                  
  482.                   if (action == "2") then
  483.                    local user = fs.open("disk/perm/"..input,"w")
  484.                    user.writeLine(action)
  485.                    user.flush()
  486.                    user.close()
  487.                    print("Done")
  488.                   end
  489.                  
  490.                   if (action == "3") then
  491.                    local user = fs.open("disk/perm/"..input,"w")
  492.                    user.writeLine(action)
  493.                    user.flush()
  494.                    user.close()
  495.                    print("Done")
  496.                   end
  497.                  
  498.                   if (action == "4A") then
  499.                    local user = fs.open("disk/perm/"..input,"w")
  500.                    user.writeLine(action)
  501.                    user.flush()
  502.                    user.close()
  503.                    print("Done")
  504.                   end
  505.                  
  506.                   if (action == "4B") then
  507.                    print("** IMPROPER REQUEST  **")
  508.                    print("-----------------------")
  509.                    print(" **  ACCESS DENIED  **")
  510.                   end
  511.                  
  512.                   if (action == "4C") then
  513.                    local user = fs.open("disk/perm/"..input,"w")
  514.                    user.writeLine(action)
  515.                    user.flush()
  516.                    user.close()
  517.                    print("Done")
  518.                   end
  519.                  
  520.                   if (action == "5") then
  521.                    print("** IMPROPER REQUEST  **")
  522.                    print("-----------------------")
  523.                    print(" **  ACCESS DENIED  **")
  524.                   end
  525.                  
  526.                   if (action == "6") then
  527.                    print("** IMPROPER REQUEST  **")
  528.                    print("-----------------------")
  529.                    print(" **  ACCESS DENIED  **")
  530.                   end
  531.                  
  532.                   if (action == "7") then
  533.                    print("** IMPROPER REQUEST  **")
  534.                    print("-----------------------")
  535.                    print(" **  ACCESS DENIED  **")
  536.                   end
  537.                  
  538.                  else
  539.                   print("** IMPROPER REQUEST  **")
  540.                   print("-----------------------")
  541.                   print(" **  ACCESS DENIED  **")
  542.                  end
  543.                 end
  544.                else
  545.                 if (permin == "3") and (val == "3") then
  546.                  print("** IMPROPER REQUEST  **")
  547.                  print("-----------------------")
  548.                  print(" **  ACCESS DENIED  **")
  549.                 else
  550.                  if (val == "3") then
  551.                   print("Ranks you can give:")
  552.                   print("0 - User")
  553.                   print("1 - Maintainer")
  554.                   print("2 - Enroller")
  555.                   print("Ranks you can't give:")
  556.                   print("3 - Supervisor")
  557.                   print("4A - Account Admin")
  558.                   print("4B - Security Admin")
  559.                   print("4C - Infrastructure Admin")
  560.                   print("5 - Admin")
  561.                   print("6 - Technician")
  562.                   print("7 - SuperUser")
  563.                  
  564.                   print()
  565.                   print()
  566.                   print("Type selected digit (leave blank to abort)")
  567.                  
  568.                   action = read()
  569.                  
  570.                   if (action == "0") then
  571.                    if (fs.exists("disk/perm/"..input)) then
  572.                     fs.delete("disk/perm/"..input)
  573.                    end
  574.                    
  575.                    print("Done")
  576.                   end
  577.                  
  578.                   if (action == "1") then
  579.                    local user = fs.open("disk/perm/"..input,"w")
  580.                    user.writeLine(action)
  581.                    user.flush()
  582.                    user.close()
  583.                    print("Done")
  584.                   end
  585.                  
  586.                   if (action == "2") then
  587.                    local user = fs.open("disk/perm/"..input,"w")
  588.                    user.writeLine(action)
  589.                    user.flush()
  590.                    user.close()
  591.                    print("Done")
  592.                   end
  593.                  
  594.                   if (action == "3") then
  595.                    print("** IMPROPER REQUEST  **")
  596.                    print("-----------------------")
  597.                    print(" **  ACCESS DENIED  **")
  598.                   end
  599.                  
  600.                   if (action == "4A") then
  601.                    print("** IMPROPER REQUEST  **")
  602.                    print("-----------------------")
  603.                    print(" **  ACCESS DENIED  **")
  604.                   end
  605.                  
  606.                   if (action == "4B") then
  607.                    print("** IMPROPER REQUEST  **")
  608.                    print("-----------------------")
  609.                    print(" **  ACCESS DENIED  **")
  610.                   end
  611.                  
  612.                   if (action == "4C") then
  613.                    print("** IMPROPER REQUEST  **")
  614.                    print("-----------------------")
  615.                    print(" **  ACCESS DENIED  **")
  616.                   end
  617.                  
  618.                   if (action == "5") then
  619.                    print("** IMPROPER REQUEST  **")
  620.                    print("-----------------------")
  621.                    print(" **  ACCESS DENIED  **")
  622.                   end
  623.                  
  624.                   if (action == "6") then
  625.                    print("** IMPROPER REQUEST  **")
  626.                    print("-----------------------")
  627.                    print(" **  ACCESS DENIED  **")
  628.                   end
  629.                  
  630.                   if (action == "7") then
  631.                    print("** IMPROPER REQUEST  **")
  632.                    print("-----------------------")
  633.                    print(" **  ACCESS DENIED  **")
  634.                   end
  635.                  end
  636.                  
  637.                  if (val == "4A") or (val == "4C") then
  638.                   print("Ranks you can give:")
  639.                   print("0 - User")
  640.                   print("1 - Maintainer")
  641.                   print("2 - Enroller")
  642.                   print("3 - Supervisor")
  643.                   print("Ranks you can't give:")
  644.                   print("4A - Account Admin")
  645.                   print("4B - Security Admin")
  646.                   print("4C - Infrastructure Admin")
  647.                   print("5 - Admin")
  648.                   print("6 - Technician")
  649.                   print("7 - SuperUser")
  650.                  
  651.                   print()
  652.                   print()
  653.                   print("Type selected digit (leave blank to abort)")
  654.                  
  655.                   action = read()
  656.                  
  657.                   if (action == "0") then
  658.                    if (fs.exists("disk/perm/"..input)) then
  659.                     fs.delete("disk/perm/"..input)
  660.                    end
  661.                    
  662.                    print("Done")
  663.                   end
  664.                  
  665.                   if (action == "1") then
  666.                    local user = fs.open("disk/perm/"..input,"w")
  667.                    user.writeLine(action)
  668.                    user.flush()
  669.                    user.close()
  670.                    print("Done")
  671.                   end
  672.                  
  673.                   if (action == "2") then
  674.                    local user = fs.open("disk/perm/"..input,"w")
  675.                    user.writeLine(action)
  676.                    user.flush()
  677.                    user.close()
  678.                    print("Done")
  679.                   end
  680.                  
  681.                   if (action == "3") then
  682.                    local user = fs.open("disk/perm/"..input,"w")
  683.                    user.writeLine(action)
  684.                    user.flush()
  685.                    user.close()
  686.                    print("Done")
  687.                   end
  688.                  
  689.                   if (action == "4A") then
  690.                    print("** IMPROPER REQUEST  **")
  691.                    print("-----------------------")
  692.                    print(" **  ACCESS DENIED  **")
  693.                   end
  694.                  
  695.                   if (action == "4B") then
  696.                    print("** IMPROPER REQUEST  **")
  697.                    print("-----------------------")
  698.                    print(" **  ACCESS DENIED  **")
  699.                   end
  700.                  
  701.                   if (action == "4C") then
  702.                    print("** IMPROPER REQUEST  **")
  703.                    print("-----------------------")
  704.                    print(" **  ACCESS DENIED  **")
  705.                   end
  706.                  
  707.                   if (action == "5") then
  708.                    print("** IMPROPER REQUEST  **")
  709.                    print("-----------------------")
  710.                    print(" **  ACCESS DENIED  **")
  711.                   end
  712.                  
  713.                   if (action == "6") then
  714.                    print("** IMPROPER REQUEST  **")
  715.                    print("-----------------------")
  716.                    print(" **  ACCESS DENIED  **")
  717.                   end
  718.                  
  719.                   if (action == "7") then
  720.                    print("** IMPROPER REQUEST  **")
  721.                    print("-----------------------")
  722.                    print(" **  ACCESS DENIED  **")
  723.                   end
  724.                  end
  725.                  
  726.                  if (val == "5") or (val == "6") then
  727.                   print("Ranks you can give:")
  728.                   print("0 - User")
  729.                   print("1 - Maintainer")
  730.                   print("2 - Enroller")
  731.                   print("3 - Supervisor")
  732.                   print("4A - Account Admin")
  733.                   print("4B - Security Admin")
  734.                   print("4C - Infrastructure Admin")
  735.                   print("Ranks you can't give:")
  736.                   print("5 - Admin")
  737.                   print("6 - Technician")
  738.                   print("7 - SuperUser")
  739.                  
  740.                   print()
  741.                   print()
  742.                   print("Type selected digit (leave blank to abort)")
  743.                  
  744.                   action = read()
  745.                  
  746.                   if (action == "0") then
  747.                    if (fs.exists("disk/perm/"..input)) then
  748.                     fs.delete("disk/perm/"..input)
  749.                    end
  750.                    
  751.                    print("Done")
  752.                   end
  753.                  
  754.                   if (action == "1") then
  755.                    local user = fs.open("disk/perm/"..input,"w")
  756.                    user.writeLine(action)
  757.                    user.flush()
  758.                    user.close()
  759.                    print("Done")
  760.                   end
  761.                  
  762.                   if (action == "2") then
  763.                    local user = fs.open("disk/perm/"..input,"w")
  764.                    user.writeLine(action)
  765.                    user.flush()
  766.                    user.close()
  767.                    print("Done")
  768.                   end
  769.                  
  770.                   if (action == "3") then
  771.                    local user = fs.open("disk/perm/"..input,"w")
  772.                    user.writeLine(action)
  773.                    user.flush()
  774.                    user.close()
  775.                    print("Done")
  776.                   end
  777.                  
  778.                   if (action == "4A") then
  779.                    local user = fs.open("disk/perm/"..input,"w")
  780.                    user.writeLine(action)
  781.                    user.flush()
  782.                    user.close()
  783.                    print("Done")
  784.                   end
  785.                  
  786.                   if (action == "4B") then
  787.                    local user = fs.open("disk/perm/"..input,"w")
  788.                    user.writeLine(action)
  789.                    user.flush()
  790.                    user.close()
  791.                    print("Done")
  792.                   end
  793.                  
  794.                   if (action == "4C") then
  795.                    local user = fs.open("disk/perm/"..input,"w")
  796.                    user.writeLine(action)
  797.                    user.flush()
  798.                    user.close()
  799.                    print("Done")
  800.                   end
  801.                  
  802.                   if (action == "5") then
  803.                    print("** IMPROPER REQUEST  **")
  804.                    print("-----------------------")
  805.                    print(" **  ACCESS DENIED  **")
  806.                   end
  807.                  
  808.                   if (action == "6") then
  809.                    print("** IMPROPER REQUEST  **")
  810.                    print("-----------------------")
  811.                    print(" **  ACCESS DENIED  **")
  812.                   end
  813.                  
  814.                   if (action == "7") then
  815.                    print("** IMPROPER REQUEST  **")
  816.                    print("-----------------------")
  817.                    print(" **  ACCESS DENIED  **")
  818.                   end
  819.                  end
  820.                  
  821.                  if val == "4B" then
  822.                   print("Ranks you can give:")
  823.                   print("0 - User")
  824.                   print("1 - Maintainer")
  825.                   print("2 - Enroller")
  826.                   print("3 - Supervisor")
  827.                   print("4A - Account Admin")
  828.                   print("4C - Infrastructure Admin")
  829.                   print("Ranks you can't give:")
  830.                   print("4B - Security Admin")
  831.                   print("5 - Admin")
  832.                   print("6 - Technician")
  833.                   print("7 - SuperUser")
  834.                  
  835.                   print()
  836.                   print()
  837.                   print("Type selected digit (leave blank to abort)")
  838.                  
  839.                   action = read()
  840.                  
  841.                   if (action == "0") then
  842.                    if (fs.exists("disk/perm/"..input)) then
  843.                     fs.delete("disk/perm/"..input)
  844.                    end
  845.                    
  846.                    print("Done")
  847.                   end
  848.                  
  849.                   if (action == "1") then
  850.                    local user = fs.open("disk/perm/"..input,"w")
  851.                    user.writeLine(action)
  852.                    user.flush()
  853.                    user.close()
  854.                    print("Done")
  855.                   end
  856.                  
  857.                   if (action == "2") then
  858.                    local user = fs.open("disk/perm/"..input,"w")
  859.                    user.writeLine(action)
  860.                    user.flush()
  861.                    user.close()
  862.                    print("Done")
  863.                   end
  864.                  
  865.                   if (action == "3") then
  866.                    local user = fs.open("disk/perm/"..input,"w")
  867.                    user.writeLine(action)
  868.                    user.flush()
  869.                    user.close()
  870.                    print("Done")
  871.                   end
  872.                  
  873.                   if (action == "4A") then
  874.                    local user = fs.open("disk/perm/"..input,"w")
  875.                    user.writeLine(action)
  876.                    user.flush()
  877.                    user.close()
  878.                    print("Done")
  879.                   end
  880.                  
  881.                   if (action == "4B") then
  882.                    print("** IMPROPER REQUEST  **")
  883.                    print("-----------------------")
  884.                    print(" **  ACCESS DENIED  **")
  885.                   end
  886.                  
  887.                   if (action == "4C") then
  888.                    local user = fs.open("disk/perm/"..input,"w")
  889.                    user.writeLine(action)
  890.                    user.flush()
  891.                    user.close()
  892.                    print("Done")
  893.                   end
  894.                  
  895.                   if (action == "5") then
  896.                    print("** IMPROPER REQUEST  **")
  897.                    print("-----------------------")
  898.                    print(" **  ACCESS DENIED  **")
  899.                   end
  900.                  
  901.                   if (action == "6") then
  902.                    print("** IMPROPER REQUEST  **")
  903.                    print("-----------------------")
  904.                    print(" **  ACCESS DENIED  **")
  905.                   end
  906.                  
  907.                   if (action == "7") then
  908.                    print("** IMPROPER REQUEST  **")
  909.                    print("-----------------------")
  910.                    print(" **  ACCESS DENIED  **")
  911.                   end
  912.                  end
  913.                  
  914.                  if (val == "7") then
  915.                   print("Ranks you can give:")
  916.                   print("0 - User")
  917.                   print("1 - Maintainer")
  918.                   print("2 - Enroller")
  919.                   print("3 - Supervisor")
  920.                   print("4A - Account Admin")
  921.                   print("4B - Security Admin")
  922.                   print("4C - Infrastructure Admin")
  923.                   print("5 - Admin")
  924.                   print("6 - Technician")
  925.                   print("7 - SuperUser")
  926.                  
  927.                   print()
  928.                   print()
  929.                   print("Type selected digit (leave blank to abort)")
  930.                  
  931.                   action = read()
  932.                  
  933.                   if (action == "0") then
  934.                    if (fs.exists("disk/perm/"..input)) then
  935.                     fs.delete("disk/perm/"..input)
  936.                    end
  937.                    print("Done")
  938.                   end
  939.                  
  940.                   if (action == "1") then
  941.                    local user = fs.open("disk/perm/"..input,"w")
  942.                    user.writeLine(action)
  943.                    user.flush()
  944.                    user.close()
  945.                    print("Done")
  946.                   end
  947.                  
  948.                   if (action == "2") then
  949.                    local user = fs.open("disk/perm/"..input,"w")
  950.                    user.writeLine(action)
  951.                    user.flush()
  952.                    user.close()
  953.                    print("Done")
  954.                   end
  955.                  
  956.                   if (action == "3") then
  957.                    local user = fs.open("disk/perm/"..input,"w")
  958.                    user.writeLine(action)
  959.                    user.flush()
  960.                    user.close()
  961.                    print("Done")
  962.                   end
  963.                  
  964.                   if (action == "4A") then
  965.                    local user = fs.open("disk/perm/"..input,"w")
  966.                    user.writeLine(action)
  967.                    user.flush()
  968.                    user.close()
  969.                    print("Done")
  970.                   end
  971.                  
  972.                   if (action == "4B") then
  973.                    if (fs.exists("disk/perm/"..input)) then
  974.                     fs.delete("disk/perm/"..input)
  975.                    end
  976.                    
  977.                    print("Done")
  978.                   end
  979.                  
  980.                   if (action == "4C") then
  981.                    local user = fs.open("disk/perm/"..input,"w")
  982.                    user.writeLine(action)
  983.                    user.flush()
  984.                    user.close()
  985.                    print("Done")
  986.                   end
  987.                  
  988.                   if (action == "5") then
  989.                    local user = fs.open("disk/perm/"..input,"w")
  990.                    user.writeLine(action)
  991.                    user.flush()
  992.                    user.close()
  993.                    print("Done")
  994.                   end
  995.                  
  996.                   if (action == "6") then
  997.                    local user = fs.open("disk/perm/"..input,"w")
  998.                    user.writeLine(action)
  999.                    user.flush()
  1000.                    user.close()
  1001.                    print("Done")
  1002.                   end
  1003.                  
  1004.                   if (action == "7") then
  1005.                    local user = fs.open("disk/perm/"..input,"w")
  1006.                    user.writeLine(action)
  1007.                    user.flush()
  1008.                    user.close()
  1009.                    print("Done")
  1010.                   end
  1011.                  end
  1012.                  
  1013.                  sleep (2)
  1014.                 end
  1015.                end
  1016.               end
  1017.              end
  1018.              
  1019.              if action == "C" then
  1020.               print ("Do you want to delete user "..input.."?")
  1021.               print ("This is last confirmation.")
  1022.               print ("Type YES to delete.")
  1023.               action = read()
  1024.               if action == "YES" then
  1025.              
  1026.                if (val == "0") or (val == "1") then
  1027.                print("** IMPROPER REQUEST  **")
  1028.                print("-----------------------")
  1029.                print(" **  ACCESS DENIED  **")
  1030.               else
  1031.                if (permin == "4A") or (permin == "4B") or (permin == "4C") or (permin == "5") or (permin == "6") or (permin == "7") then
  1032.                 if (val == "7") then
  1033.                  fs.delete("disk/crew/"..input)
  1034.                  if (fs.exists("disk/perm/"..input)) then
  1035.                    fs.delete("disk/perm/"..input)
  1036.                   end
  1037.                  rep = false
  1038.                  print("Done")
  1039.                 else
  1040.                  if ((val == "4B") or (val == "5") or (val == 6)) and ((permin == "4A") or (permin == "4C")) then
  1041.                   fs.delete("disk/crew/"..input)
  1042.                   if (fs.exists("disk/perm/"..input)) then
  1043.                    fs.delete("disk/perm/"..input)
  1044.                   end
  1045.                   rep = false
  1046.                   print("Done")
  1047.                  else
  1048.                   if ((val == "5") or (val == 6)) and (permin == "4B") then
  1049.                    fs.delete("disk/crew/"..input)
  1050.                    if (fs.exists("disk/perm/"..input)) then
  1051.                    fs.delete("disk/perm/"..input)
  1052.                   end
  1053.                    rep = false
  1054.                    print("Done")
  1055.                   else
  1056.                    print("** IMPROPER REQUEST  **")
  1057.                    print("-----------------------")
  1058.                    print(" **  ACCESS DENIED  **")
  1059.                   end
  1060.                  end
  1061.                 end
  1062.                else
  1063.                 if (permin == "3") and (val == "3") then
  1064.                  print("** IMPROPER REQUEST  **")
  1065.                  print("-----------------------")
  1066.                  print(" **  ACCESS DENIED  **")
  1067.                 else
  1068.                  if (val == "2") and (permin ~= "0") then
  1069.                   print("** IMPROPER REQUEST  **")
  1070.                   print("-----------------------")
  1071.                   print(" **  ACCESS DENIED  **")
  1072.                  else
  1073.                   fs.delete("disk/crew/"..input)
  1074.                   if (fs.exists("disk/perm/"..input)) then
  1075.                    fs.delete("disk/perm/"..input)
  1076.                   end
  1077.                   rep = false
  1078.                   print("Done")
  1079.                  end
  1080.                 end
  1081.                end
  1082.               end
  1083.               sleep (2)
  1084.              
  1085.               else
  1086.                print("Aborted")
  1087.                sleep(2)
  1088.               end
  1089.              end
  1090.              
  1091.              if action == "D" then
  1092.               if (fs.exists("disk/config/system/print") and (fs.exists("config/ovr") == false)) or (fs.exists("config/print")) then
  1093.                print()
  1094.                print("*    IMPROPER REQUEST   *")
  1095.                print("-------------------------")
  1096.                print("*  Operation Unallowed  *")
  1097.                sleep(2)
  1098.               else
  1099.                local printer = peripheral.wrap("right")
  1100.                if (printer.getInkLevel() > 0) and (printer.getPaperLevel() > 0) then
  1101.                 printer.newPage()
  1102.                 printer.setCursorPos(1,1)
  1103.                 printer.write("---- USER DATA ---")
  1104.                 printer.setCursorPos(1,2)
  1105.                 printer.write("Login: "..input)
  1106.                 printer.setCursorPos(1,3)
  1107.                 printer.write("Role:  "..perm)
  1108.                 printer.setCursorPos(1,12)
  1109.                 printer.write("Printed by: "..login)
  1110.                 printer.setPageTitle("User "..input)
  1111.                 printer.endPage()
  1112.                 print("Done")
  1113.                 sleep(2)
  1114.                else
  1115.                 print("Please insert ink and paper to printer.")
  1116.                 sleep(2)
  1117.                end
  1118.               end
  1119.              end
  1120.              
  1121.              if action == "E" then
  1122.               if (val == "0") or (val == "1") then
  1123.                print("** IMPROPER REQUEST  **")
  1124.                print("-----------------------")
  1125.                print(" **  ACCESS DENIED  **")
  1126.               else
  1127.                if (permin == "4A") or (permin == "4B") or (permin == "4C") or (permin == "5") or (permin == "6") or (permin == "7") then
  1128.                 if (val == "7") then
  1129.                  local file = fs.open("disk/crew/"..input,"r")
  1130.                  local passu = file.readLine()
  1131.                  file.close()
  1132.                  print("Swipe magnetic card")
  1133.                  print("Hold CTRL + S to cancel")
  1134.                  local reader = peripheral.wrap("left")
  1135.                  reader.setInsertCardLight(false)
  1136.                  reader.beginWrite(passu,input.."'s card")
  1137.                  local event,arg1,arg2,arg3 = os.pullEvent()
  1138.                  sleep (4)
  1139.                 else
  1140.                  if ((val == "4B") or (val == "5") or (val == 6)) and ((permin == "4A") or (permin == "4C")) then
  1141.                   local file = fs.open("disk/crew/"..input,"r")
  1142.                   local passu = file.readLine()
  1143.                   file.close()
  1144.                   print("Swipe magnetic card")
  1145.                   print("Hold CTRL + S to cancel")
  1146.                   local reader = peripheral.wrap("left")
  1147.                   reader.setInsertCardLight(false)
  1148.                   reader.beginWrite(passu,input.."'s card")
  1149.                   local event,arg1,arg2,arg3 = os.pullEvent()
  1150.                   sleep (4)
  1151.                  else
  1152.                   if ((val == "5") or (val == 6)) and (permin == "4B") then
  1153.                    local file = fs.open("disk/crew/"..input,"r")
  1154.                    local passu = file.readLine()
  1155.                    file.close()
  1156.                    print("Swipe magnetic card")
  1157.                    print("Hold CTRL + S to cancel")
  1158.                    local reader = peripheral.wrap("left")
  1159.                    reader.setInsertCardLight(false)
  1160.                    reader.beginWrite(passu,input.."'s card")
  1161.                    local event,arg1,arg2,arg3 = os.pullEvent()
  1162.                    sleep (4)
  1163.                   else
  1164.                    print("** IMPROPER REQUEST  **")
  1165.                    print("-----------------------")
  1166.                    print(" **  ACCESS DENIED  **")
  1167.                   end
  1168.                  end
  1169.                 end
  1170.                else
  1171.                 if (permin == "3") and (val == "3") then
  1172.                  print("** IMPROPER REQUEST  **")
  1173.                  print("-----------------------")
  1174.                  print(" **  ACCESS DENIED  **")
  1175.                 else
  1176.                  if (val == "2") and (permin ~= "0") then
  1177.                   print("** IMPROPER REQUEST  **")
  1178.                   print("-----------------------")
  1179.                   print(" **  ACCESS DENIED  **")
  1180.                  else
  1181.                   local file = fs.open("disk/crew/"..input,"r")
  1182.                   local passu = file.readLine()
  1183.                   file.close()
  1184.                   print("Swipe magnetic card")
  1185.                   print("Hold CTRL + S to cancel")
  1186.                   local reader = peripheral.wrap("left")
  1187.                   reader.setInsertCardLight(false)
  1188.                   reader.beginWrite(passu,input.."'s card")
  1189.                   local event,arg1,arg2,arg3 = os.pullEvent()
  1190.                   sleep (4)
  1191.                  end
  1192.                 end
  1193.                end
  1194.               end
  1195.               sleep (2)
  1196.              end
  1197.  
  1198.              if action == "F" then
  1199.               rep = false
  1200.              end
  1201.             end
  1202.            
  1203.             rep = true
  1204.            else
  1205.             print("User not found")
  1206.             sleep(2)
  1207.            end
  1208.           else
  1209.            print("** IMPROPER REQUEST  **")
  1210.            print("-----------------------")
  1211.            sleep(2)
  1212.           end
  1213.          else
  1214.           print("** IMPROPER REQUEST  **")
  1215.           print("-----------------------")
  1216.           print(" **  ACCESS DENIED  **")
  1217.           sleep(2)
  1218.          end
  1219.         end
  1220.        
  1221.         if input == "C" then
  1222.          rep = false
  1223.          input = ""
  1224.         end
  1225.        end
  1226.        
  1227.        rep = true
  1228.       else
  1229.        print("** IMPROPER REQUEST  **")
  1230.        print("-----------------------")
  1231.        print(" **  ACCESS DENIED  **")
  1232.        sleep(2)
  1233.       end
  1234.      else
  1235.       print()
  1236.       print("** IMPROPER REQUEST  **")
  1237.       print("-----------------------")
  1238.       print(" **  ACCESS DENIED  **")
  1239.       sleep(2)
  1240.      end
  1241.    end
  1242.    
  1243.    if input == "C" then
  1244.     if fs.exists("disk/config/system/encode") and (fs.exists("config/ovr") == false) then
  1245.      print()
  1246.      print("*    IMPROPER REQUEST   *")
  1247.      print("-------------------------")
  1248.      print("*  Operation Unallowed  *")
  1249.      sleep(2)
  1250.     else
  1251.      print("Current passcode    ")
  1252.      current = read("*")
  1253.      if (p.hash("MD5", current) == pass) then
  1254.       print("Swipe magnetic card")
  1255.       local reader = peripheral.wrap("left")
  1256.       reader.setInsertCardLight(false)
  1257.       reader.beginWrite(pass,login.."'s card")
  1258.       local event,arg1,arg2,arg3 = os.pullEvent()
  1259.       sleep (4)
  1260.      else
  1261.       print("Invalid Passcode")
  1262.       sleep (2)
  1263.      end
  1264.     end
  1265.    end
  1266.    
  1267.    if input == "E" then
  1268.     if login == "root" then
  1269.      term.clear()
  1270.      term.setCursorPos(1,1)
  1271.      print("Welcome SuperUser")
  1272.      rep = false
  1273.     else
  1274.      if (fs.exists("disk/perm/"..login)) then
  1275.       local perm = fs.open("disk/perm/"..login, "r")
  1276.       val = perm.readLine()
  1277.       perm.close()
  1278.       if val == "7" then
  1279.        term.clear()
  1280.        term.setCursorPos(1,1)
  1281.        print("Welcome SuperUser")
  1282.        rep = false
  1283.       else
  1284.        print("** IMPROPER REQUEST  **")
  1285.        print("-----------------------")
  1286.        print(" **  ACCESS DENIED  **")
  1287.        sleep(2)
  1288.       end
  1289.      else
  1290.       print()
  1291.       print("** IMPROPER REQUEST  **")
  1292.       print("-----------------------")
  1293.       print(" **  ACCESS DENIED  **")
  1294.       sleep(2)
  1295.      end
  1296.     end
  1297.    end
  1298.    
  1299.    if input == "G" then
  1300.     val = "0"
  1301.     if (fs.exists("disk/perm/"..login)) then
  1302.      local perm = fs.open("disk/perm/"..login, "r")
  1303.      val = perm.readLine()
  1304.      perm.close()
  1305.     else
  1306.      val = "0"
  1307.     end
  1308.    
  1309.     if (val ~= "0") and (val ~= "1") and (val ~= "2") and (val ~= "3") and (val ~= "4A") then
  1310.      rep = true
  1311.      while rep do
  1312.       term.clear()
  1313.       term.setCursorPos(1,1)
  1314.       print("--- Local System Configuration ---")
  1315.       print("Select action")
  1316.       if fs.exists("config/print") then
  1317.        print("A - Allow print user (on right side), Denied")
  1318.       else
  1319.        print("A - Allow print user (on right side), Allowed")
  1320.       end
  1321.      
  1322.       if fs.exists("config/ovr") then
  1323.        print("B - Override all global blocks, Yes")
  1324.       else
  1325.        print("B - Override all global blocks, No")
  1326.       end
  1327.      
  1328.       if fs.exists("config/reqlvl") then
  1329.        local reqlvlf = fs.open("config/reqlvl","r")
  1330.        reqlvl = reqlvlf.readLine()
  1331.        reqlvlf.close()
  1332.        
  1333.        print("C - Required Access Level, "..reqlvl)
  1334.       else
  1335.        print("C - Required Access Level, 0")
  1336.       end
  1337.      
  1338.       print("D - Go back")
  1339.       print()
  1340.       print()
  1341.       print("Type selected letter")
  1342.       input = read()
  1343.      
  1344.       if input == "A" then
  1345.        if fs.exists("config/print") then
  1346.         fs.delete("config/print")
  1347.        else
  1348.         local cre = fs.open("config/print", "a")
  1349.         cre.writeLine()
  1350.         cre.flush()
  1351.         cre.close()
  1352.        end
  1353.       end
  1354.        
  1355.       if input == "B" then
  1356.        if (val ~= "5") and (val ~= "6") and (val ~= "7") then
  1357.         print()
  1358.         print("** IMPROPER REQUEST  **")
  1359.         print("-----------------------")
  1360.         print(" **  ACCESS DENIED  **")
  1361.         sleep(2)
  1362.        else
  1363.         if fs.exists("config/ovr") then
  1364.          fs.delete("config/ovr")
  1365.         else
  1366.          local cre = fs.open("config/ovr", "a")
  1367.          cre.writeLine()
  1368.          cre.flush()
  1369.          cre.close()
  1370.         end
  1371.        end
  1372.       end
  1373.      
  1374.       if input == "C" then
  1375.        valt = val
  1376.        curlvl = 0
  1377.        if (valt == "4A") or (valt == "4B") or (valt == "4C") then
  1378.         valt = "4"
  1379.        end
  1380.        
  1381.        if fs.exists("config/reqlvl") then
  1382.         local reqlvlf = fs.open("config/reqlvl","r")
  1383.         curlvl = reqlvlf.readLine()
  1384.         reqlvlf.close()
  1385.        end
  1386.        
  1387.        term.clear()
  1388.        term.setCursorPos(1,1)
  1389.        print("Enter required access level")
  1390.        print()
  1391.        print("Levels you can choose")
  1392.        print("0 - User")
  1393.        print("1 - Maintainer")
  1394.        print("2 - Enroller")
  1395.        print("3 - Supervisor")
  1396.        print("4 - Account/Security/Infrastructure Admin")
  1397.        
  1398.        if (valt == "4") then
  1399.         print()
  1400.         print("Levels you can't choose")
  1401.         print("5 - Admin")
  1402.         print("6 - Technician")
  1403.         print("7 - SuperUser")
  1404.        end
  1405.        
  1406.        if (valt == "5") then
  1407.         print("5 - Admin")
  1408.         print()
  1409.         print("Levels you can't choose")
  1410.         print("6 - Technician")
  1411.         print("7 - SuperUser")
  1412.        end
  1413.        
  1414.        if (valt == "6") then
  1415.         print("5 - Admin")
  1416.         print("6 - Technician")
  1417.         print()
  1418.         print("Levels you can't choose")
  1419.         print("7 - SuperUser")
  1420.        end
  1421.        
  1422.        if (valt == "7") then
  1423.         print("5 - Admin")
  1424.         print("6 - Technician")
  1425.         print("7 - SuperUser")
  1426.        end
  1427.        
  1428.        print()
  1429.        print()
  1430.        print("Enter permission NUMBER (like 2, 3, 4, etc...)")
  1431.        perm = read()
  1432.        
  1433.        if (perm == "0") then
  1434.         fs.delete("config/reqlvl")
  1435.         print("Done")
  1436.        end
  1437.        
  1438.        if (perm == "1") then
  1439.         local newperm = fs.open("config/reqlvl", "a")
  1440.         newperm.writeLine("1")
  1441.         newperm.flush()
  1442.         newperm.close()
  1443.        end
  1444.        
  1445.        if (perm == "2") then
  1446.         local newperm = fs.open("config/reqlvl", "a")
  1447.         newperm.writeLine("2")
  1448.         newperm.flush()
  1449.         newperm.close()
  1450.        end
  1451.        
  1452.        if (perm == "3") then
  1453.         local newperm = fs.open("config/reqlvl", "a")
  1454.         newperm.writeLine("3")
  1455.         newperm.flush()
  1456.         newperm.close()
  1457.        end
  1458.        
  1459.        if (perm == "4") then
  1460.         local newperm = fs.open("config/reqlvl", "a")
  1461.         newperm.writeLine("4")
  1462.         newperm.flush()
  1463.         newperm.close()
  1464.        end
  1465.        
  1466.        if (perm == "5") then
  1467.         if (valt == "4") then
  1468.          print()
  1469.          print("** IMPROPER REQUEST  **")
  1470.          print("-----------------------")
  1471.          print(" **  ACCESS DENIED  **")
  1472.          sleep(2)
  1473.         else
  1474.          local newperm = fs.open("config/reqlvl", "a")
  1475.          newperm.writeLine("5")
  1476.          newperm.flush()
  1477.          newperm.close()
  1478.         end
  1479.        end
  1480.        
  1481.        if (perm == "6") then
  1482.         if (valt == "4") or (valt == "5") then
  1483.          print()
  1484.          print("** IMPROPER REQUEST  **")
  1485.          print("-----------------------")
  1486.          print(" **  ACCESS DENIED  **")
  1487.          sleep(2)
  1488.         else
  1489.          local newperm = fs.open("config/reqlvl", "a")
  1490.          newperm.writeLine("6")
  1491.          newperm.flush()
  1492.          newperm.close()
  1493.         end
  1494.        end
  1495.        
  1496.        if (perm == "7") then
  1497.         if (valt == "4") or (valt == "5") or (valt == "6") then
  1498.          print()
  1499.          print("** IMPROPER REQUEST  **")
  1500.          print("-----------------------")
  1501.          print(" **  ACCESS DENIED  **")
  1502.          sleep(2)
  1503.         else
  1504.          local newperm = fs.open("config/reqlvl", "a")
  1505.          newperm.writeLine("7")
  1506.          newperm.flush()
  1507.          newperm.close()
  1508.         end
  1509.        end
  1510.        
  1511.       end
  1512.      
  1513.       if input == "D" then
  1514.        rep = false
  1515.        input = ""
  1516.       end
  1517.      end
  1518.     else
  1519.      print()
  1520.      print("** IMPROPER REQUEST  **")
  1521.      print("-----------------------")
  1522.      print(" **  ACCESS DENIED  **")
  1523.      sleep(2)
  1524.     end
  1525.    
  1526.     rep = true
  1527.    end
  1528.    
  1529.    if input == "H" then
  1530.     val = "0"
  1531.     if (fs.exists("disk/perm/"..login)) then
  1532.      local perm = fs.open("disk/perm/"..login, "r")
  1533.      val = perm.readLine()
  1534.      perm.close()
  1535.     else
  1536.      val = "0"
  1537.     end
  1538.    
  1539.     if (val ~= "0") and (val ~= "1") and (val ~= "2") and (val ~= "3") and (val ~= "4A") and (val ~= "4B") and (val ~= "4C") then
  1540.      rep = true
  1541.      while rep do
  1542.        rep = true
  1543.        while rep do
  1544.         term.clear()
  1545.         term.setCursorPos(1,1)
  1546.        
  1547.         print("--- Global System Configuration ---")
  1548.         print("Select action")
  1549.        
  1550.         if fs.exists("disk/config/system/delete") then
  1551.          print("A - Delete my account, Denied")
  1552.         else
  1553.          print("A - Delete my account, Allowed")
  1554.         end
  1555.          
  1556.         if fs.exists("disk/config/system/passcode") then
  1557.          print("B - Change my passcode, Denied")
  1558.         else
  1559.          print("B - Change my passcode, Allowed")
  1560.         end
  1561.        
  1562.         if fs.exists("disk/config/system/print") then
  1563.          print("C - Print user data, Denied")
  1564.         else
  1565.          print("C - Print user data, Allowed")
  1566.         end
  1567.        
  1568.         if fs.exists("disk/config/system/encode") then
  1569.          print("D - Encode access card, Denied")
  1570.         else
  1571.          print("D - Encode access card, Allowed")
  1572.         end
  1573.        
  1574.         print("E - Go Back")
  1575.        
  1576.         input = read()
  1577.        
  1578.         if input == "A" then
  1579.          if fs.exists("disk/config/system/delete") then
  1580.           fs.delete("disk/config/system/delete")
  1581.          else
  1582.           local cre = fs.open("disk/config/system/delete", "a")
  1583.           cre.writeLine()
  1584.           cre.flush()
  1585.           cre.close()
  1586.          end
  1587.         end
  1588.        
  1589.         if input == "B" then
  1590.          if fs.exists("disk/config/system/passcode") then
  1591.           fs.delete("disk/config/system/passcode")
  1592.          else
  1593.           local cre = fs.open("disk/config/system/passcode", "a")
  1594.           cre.writeLine()
  1595.           cre.flush()
  1596.           cre.close()
  1597.          end
  1598.         end
  1599.        
  1600.         if input == "C" then
  1601.          if fs.exists("disk/config/system/print") then
  1602.           fs.delete("disk/config/system/print")
  1603.          else
  1604.           local cre = fs.open("disk/config/system/print", "a")
  1605.           cre.writeLine()
  1606.           cre.flush()
  1607.           cre.close()
  1608.          end
  1609.         end
  1610.        
  1611.         if input == "D" then
  1612.          if fs.exists("disk/config/system/encode") then
  1613.           fs.delete("disk/config/system/encode")
  1614.          else
  1615.           local cre = fs.open("disk/config/system/encode", "a")
  1616.           cre.writeLine()
  1617.           cre.flush()
  1618.           cre.close()
  1619.          end
  1620.         end
  1621.        
  1622.         if input == "E" then
  1623.          rep = false
  1624.          input = ""
  1625.         end
  1626.        end
  1627.       end
  1628.  
  1629.      rep = true
  1630.     else
  1631.      print()
  1632.      print("** IMPROPER REQUEST  **")
  1633.      print("-----------------------")
  1634.      print(" **  ACCESS DENIED  **")
  1635.      sleep(2)
  1636.     end
  1637.    end
  1638.    
  1639.    if input == "I" then
  1640.     if fs.exists("disk/config/system/delete") and (fs.exists("config/ovr") == false) then
  1641.      print()
  1642.      print("*    IMPROPER REQUEST   *")
  1643.      print("-------------------------")
  1644.      print("*  Operation Unallowed  *")
  1645.      sleep(2)
  1646.     else
  1647.      print("Current passcode")
  1648.      current = read("*")
  1649.      if (p.hash("MD5", current) == pass) then
  1650.       fs.delete("disk/crew/"..login)
  1651.       print("Done")
  1652.       sleep(2)
  1653.       os.shutdown()
  1654.      else
  1655.       print("Invalid Passcode")
  1656.       sleep (2)
  1657.      end
  1658.     end
  1659.    end
  1660.    
  1661.    if input == "J" then
  1662.     os.shutdown()
  1663.    end
  1664.   end
  1665.  else
  1666.   print()
  1667.   print("** IMPROPER REQUEST  **")
  1668.   print("-----------------------")
  1669.   print(" **  ACCESS DENIED  **")
  1670.   sleep(2)
  1671.   os.shutdown()
  1672.  end
  1673.  else
  1674.   print("Refused")
  1675.   sleep(2)
  1676.   os.shutdown()
  1677.  end
  1678. else
  1679.  print("Refused")
  1680.  sleep (2)
  1681.  os.shutdown()
  1682. end
  1683. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement