Advertisement
Guest User

anon.lua

a guest
Jul 26th, 2017
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.55 KB | None | 0 0
  1. --Anonymise me By rahph
  2.  
  3. --THIS IS THE PART WHERE WE INJECT MY CRAPPY API
  4. print("Injecting menu API (Embeeded)")
  5. _G.menuApi = {}
  6. _G.menuApi.display = function(sTitle,tOptions,tSelectionCallbacks)
  7.     while true do
  8.         term.clear()
  9.         term.setCursorPos(1,1)
  10.         print(sTitle)
  11.         for i=1,#tOptions do
  12.             print(i .. ") " .. tOptions[i])
  13.         end
  14.         write("Selection > ")
  15.         local sel = tonumber(read())
  16.         if sel then
  17.             if tSelectionCallbacks[sel] then
  18.                 tSelectionCallbacks[sel]()
  19.                 break
  20.             else
  21.                 print("Malformed selection")
  22.                 sleep(1)
  23.             end
  24.         else
  25.             print("Malformed selection")
  26.             sleep(1)
  27.         end
  28.     end
  29. end
  30. local shouldRestore
  31. if _G.backup then
  32.     shouldRestore = true
  33. end
  34. print("Done!")
  35. -- Backup routines
  36. if not shouldRestore  then
  37. _G.backup = {}
  38. _G.backup.os = {}
  39. _G.backup.os.version = _G.os.version
  40. _G.backup.os.getComputerLabel = _G.os.getComputerLabel
  41. _G.backup.os.getComputerID = _G.os.getComputerID
  42. end
  43. --Program code
  44.  
  45. function spoofID()
  46.     print("What should be the new ID?")
  47.     local newid = tonumber(read())
  48.     if newid then
  49.         _G.os.getComputerID = function() return newid end
  50.     else
  51.         print("No!")
  52.     end
  53.     sleep(1)
  54. end
  55.  
  56. function spoofLabel()
  57.     print("What should the new label be?")
  58.     local newlabel = read()
  59.     _G.os.getComputerLabel = function() return newLabel end
  60.     sleep(1)
  61. end
  62.  
  63. function spoofVersion()
  64.     print("What should the new version be?")
  65.     local newversion = read()
  66.     _G.os.version = function() return newversion end
  67.     sleep(1)
  68. end
  69.  
  70. function restoreAll()
  71.     _G.os.version = _G.backup.os.version
  72.     _G.os.getComputerID = _G.backup.os.getComputerID
  73.     _G.os.getComputerLabel = _G.backup.os.getComputerLabel
  74.     _G.backup = nil
  75. end
  76.  
  77. local exit = false
  78. if not shouldRestore then
  79. while not exit do
  80.     menuApi.display("What would you like to do?",{
  81.     "Spoof my ID",
  82.     "Spoof the computer label",
  83.     "Spoof the os.version() string",
  84.     "Exit"
  85.     },
  86.     {
  87.     function()
  88.         spoofID()
  89.     end,
  90.     function()
  91.         spoofLabel()
  92.     end,
  93.     function()
  94.         spoofVersion()
  95.     end,
  96.     function()
  97.         exit = true
  98.     end
  99.     })
  100. end
  101. else
  102.     menuApi.display("You already anonymised yourself. Restore to change",{
  103.     "Restore all",
  104.     "Exit"
  105.     },
  106.     {
  107.     function()
  108.         restoreAll()
  109.     end,
  110.     function()
  111.         exit = true
  112.     end
  113.     })
  114. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement