Guest User

password

a guest
Dec 13th, 2013
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.34 KB | None | 0 0
  1. function drawLine(startX , startY, endX, endY, color)
  2. paintutils.drawLine(startX, startY, endX, endY, color)
  3. end
  4.  
  5. term.setBackgroundColor(colors.white)
  6. paintutils.drawLine(1,1,51,1,colors.black)
  7.  
  8.  
  9. local secretInfo = {
  10.   username = "Strite",
  11.   password = "123456",
  12. }
  13.  
  14. function PrintCustom(msg, color, color2)
  15. msgLen = string.len(msg)
  16. x1, y2 = term.getSize()
  17. term.setCursorPos(math.ceil(x1/2-msgLen+2), math.ceil(y2/2))
  18. term.setTextColor(color)
  19. print (msg)
  20. term.setTextColor(color2)
  21. end
  22.  
  23. function PrintCenter(msg)
  24. msgLen = string.len(msg)
  25. screenWidth,_ = term.getSize()
  26. xCoords = tonumber(math.ceil((screenWidth / 2) - (msgLen / 2)))
  27. termY = term.getCursorPos()
  28. term.setCursorPos(xCoords, termY)
  29. print(msg)
  30. return xCoords
  31. end
  32.  
  33. function clear()
  34. term.clear()
  35. term.setCursorPos(1,1)
  36. end
  37.  
  38. function r()
  39. if term.isColor() == true then
  40. term.setTextColor(16384)
  41. else
  42. end
  43. end
  44.  
  45. function w()
  46. if term.isColor() == true then
  47. term.setTextColor(1)
  48. else
  49. end
  50. end
  51.  
  52. function g()
  53. if term.isColor() == true then
  54. term.setTextColor(8192)
  55. else
  56. end
  57. end
  58.  
  59. function y()
  60. if term.isColor() == true then
  61. term.setTextColor(16)
  62. else
  63. end
  64. end
  65.  
  66. function b()
  67. if term.isColor() == true then
  68. term.setTextColor(colors.black)
  69. else
  70. end
  71. end
  72.  
  73. function press()
  74. print ("Press anything to continue.")
  75. os.pullEvent("key")
  76. sleep(1)
  77. end
  78.  
  79. local v = "v.0.1"
  80.  
  81. clear()
  82.  
  83. function login()
  84. r()
  85. PrintCenter("Login Firewall "..v)
  86. print ()
  87. r()
  88. write("Username: ")
  89. b()
  90. local user = read()
  91. print()
  92. r()
  93. write("Password: ")
  94. b()
  95. local pass = read("*")
  96. if user == (secretInfo.username) and pass == (secretInfo.password) then
  97. print()
  98. PrintCustom("Correct!", 8192, 16384)
  99. r()
  100. elseif user == (secretInfo.username) and pass ~= (secretInfo.password) then
  101. print()
  102. PrintCustom("Password is wrong!", 16384, 16384)
  103. print()
  104. press()
  105. shell.run("password")
  106. elseif user ~= (secretInfo.username) and pass == (secretInfo.password) then
  107. print ()
  108. PrintCustom("Username is wrong!", 16384, 16384)
  109. print()
  110. press()
  111. shell.run("password")
  112. elseif user ~= (secretInfo.username) and pass ~= (secretInfo.password) then
  113. print ()
  114. PrintCustom("Incorrect!", 16384, 16384)
  115. print ()
  116. press()
  117. shell.run("password")
  118. else
  119. PrintCustom("---@Unknown error~ Restarting!@---", 16384, 16384)
  120. print ()
  121. sleep(2)
  122. shell.run("password")
  123. end
  124. end
  125.  
  126. login()
Advertisement
Add Comment
Please, Sign In to add comment