Advertisement
minimite

qpa

May 1st, 2015
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.55 KB | None | 0 0
  1. --Quest Privacy Addon: By Atenefyr
  2. local restricted = true --if "false" then pick from ~60 septillion registers (create new every boot), if "true" then pick from 20 registers (create 20 at setup and pick from those)
  3. local debug = false --show debug lines when choosing IP; true or false
  4.  
  5. if not fs.exists(".quest_ips") and restricted then
  6.   print("Setting up Quest Privacy Addon, please wait..")
  7.   shell.run("/rom/programs/http/pastebin", "run", "XvEebm4K", "20", "silent")
  8. end
  9. if not fs.exists("/.Quest.settings") then
  10.   local open = fs.open("/.Quest.settings", "w")
  11.   open.write(textutils.serialize({Home = 'http://thehub.qst/', ClientIdentifier = nil}))
  12.   open.close()
  13. end
  14. local open = fs.open("/.Quest.settings", "r")
  15. local all = open.readAll()
  16. open.close()
  17. local t = textutils.unserialize(all)
  18.  
  19. if restricted then
  20.   local open = fs.open("/.quest_ips", "r")
  21.   local c = tonumber(open.readLine())
  22.   local mn = math.random(1, c)
  23.   if debug then
  24.     print("Picking IP " .. mn .. "/" .. c)
  25.   end
  26.   for i = 1, mn do
  27.     l = open.readLine()
  28.   end
  29.   if debug then
  30.     print("IP " .. mn .. "/" .. c .. " is ".. l)
  31.   end
  32.   open.close()
  33. else
  34.   if debug then
  35.     print("Creating IP..")
  36.   end
  37.   l = http.get("http://quest.net76.net/registerClient.php").readAll()  
  38.   if debug then
  39.     print("Using IP " .. l .. " (generated from the web)")
  40.   end
  41. end
  42. t["ClientIdentifier"] = l
  43. local open = fs.open("/.Quest.settings", "w")
  44. open.write(textutils.serialize(t))
  45. open.close()
  46. if debug then
  47.   print("Set IP, booting Quest")
  48.   sleep(1) --to see the text
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement