Advertisement
asteroidsteam

Webbrowser

Feb 17th, 2017
450
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.07 KB | None | 0 0
  1. function pos(x,y)
  2. term.setCursorPos(x,y)
  3. end
  4. pos(1,1)
  5. term.setBackgroundColor(colors.yellow)
  6. term.clear()
  7. pos(1,1)
  8. term.setBackgroundColor(colors.green)
  9. term.clearLine()
  10. pos(1,1)
  11. print("Weblink:")
  12. pos(10,1)
  13. local link = read()
  14. pos(1,2)
  15. write("This program requires Admin priv. Type password or press E to exit. Press any other key to enter passcode")
  16. local event2, key2 = os.pullEvent("key")
  17. if key2 == keys.e then
  18. dofile("os/Desktop")
  19. else
  20. local passcode = read("*")
  21. local file = fs.open("/key", "r")
  22. local data = file.readAll()
  23. file.close()
  24. if passcode == data then
  25. pos(1,1)
  26. term.clear()
  27. if http.checkURL("http://pastebin.com/raw/"..link) == false then
  28. dofile("/os/Desktop")
  29. else
  30. local data = http.get("http://pastebin.com/raw/"..link)
  31. local dt = data.readAll()
  32. local file = fs.open("/.tmp", "w")
  33. file.write(dt)
  34. file.close()
  35. dofile("/.tmp")
  36. fs.delete("/.tmp")
  37. term.setBackgroundColor(colors.red)
  38. print("PRESS E TO EXIT")
  39. while true do
  40. local event, key = os.pullEvent("key")
  41. if key == keys.e then
  42. dofile("os/Desktop")
  43. break
  44. end
  45. end
  46. end
  47. end
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement