PrinceOfCookies

Untitled

Feb 5th, 2023
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. --functions
  2.  
  3. function valid(data, array)
  4. local valid = {}
  5. for i = 1, #array do
  6. valid[array[i]] = true
  7. end
  8.  
  9. if valid[data] then
  10. return false
  11. else
  12. return true
  13. end
  14. end
  15.  
  16. function tablefind(tab, el)
  17. for index, value in pairs(tab) do
  18. if value == el then
  19. return index
  20. end
  21. end
  22. end
  23.  
  24. function lines(s)
  25. if s:sub(-1)~="\n" then
  26. s=s.."\n"
  27. end
  28. return s:gmatch("(.-)\n")
  29. end
  30.  
  31. --functions
  32.  
  33. print("Checking Programs . . .")
  34. local FileList = fs.list("/rom/programs")
  35. local MainList = fs.list("/")
  36. local Whitelist = {"advanced", "command", "fun", "http", "pocket", "rednet", "turtle", "adventure.lua", "alias.lua", "apis.lua", "bg.lua", "copy.lua", "clear.lua", "chat.lua", "cd.lua", "delete.lua", "dj.lua", "drive.lua", "edit.lua", "gps.lua", "fg.lua", "exit.lua", "eject.lua", "hello.lua", "help.lua", "id.lua", "label.lua", "monitor.lua", "mkdir.lua", "lua.lua", "list.lua", "move.lua", "multishell.lua", "paint.lua", "pastebin.lua", "redirection.lua", "reboot.lua", "programs.lua", "peripherals.lua", "redstone.lua", "rename.lua", "repeat.lua", "set.lua", "type.lua", "time.lua", "shutdown.lua", "shell.lua", "wget.lua", "worm.lua"}
  37. FoundFiles = {}
  38. -- RootFiles = {}
  39. miscFiles = {}
  40.  
  41. for _, file in ipairs(FileList) do
  42. table.insert(FoundFiles, file)
  43. print("Found Item : "..file)
  44. sleep(0.1)
  45. end
  46.  
  47. print("Checking Root . . .")
  48. for _, file in ipairs(MainList) do
  49. table.insert(FoundFiles, file)
  50. print("Found Item : "..file)
  51. sleep(0.1)
  52. end
  53.  
  54. table.sort(Whitelist)
  55. table.sort(FoundFiles)
  56. table.sort(MainList)
  57. table.sort(FileList)
  58. --table.sort(RootFiles)
  59.  
  60.  
  61. print("Comparing Files . . .")
  62.  
  63.  
  64. for _, foundfile in ipairs(FoundFiles) do
  65. if not valid(foundfile, Whitelist) then
  66.  
  67. else
  68. table.insert(miscFiles, foundfile)
  69. print("Possible script : "..foundfile)
  70. end
  71. end
  72.  
  73. print("Finalizing Search . . .")
  74.  
  75. HackFiles = {}
  76. table.sort(miscFiles)
  77.  
  78. for _, afile in ipairs(miscFiles) do
  79. if afile == "rom" then
  80. --return
  81. elseif afile == "disk" then
  82. --return
  83. else
  84. table.insert(HackFiles, afile)
  85. end
  86. end
  87.  
  88. print("Listing user-made programs . . .")
  89. for _, bfile in ipairs(HackFiles) do
  90. print("Found : "..bfile)
  91. end
  92.  
  93. PPass = {}
  94.  
  95. for _, foundfile in ipairs(HackFiles) do
  96. content = fs.open(foundfile, "r")
  97. --print(content.readAll())
  98. for line in lines(content.readAll()) do
  99. if string.find(line, '"') then
  100. table.insert(PPass, line)
  101. end
  102. end
  103. end
  104. print("DONE!")
  105. sleep(2)
  106. term.clear()
  107. term.setCursorPos(1,1)
  108. print("Possible Passwords (in quotes)")
  109.  
  110. for _, pass in ipairs(PPass) do
  111. print(pass)
  112. end
Add Comment
Please, Sign In to add comment