.open_browser(url = 'http://google.com/') ⇒ Object

# File 'lib/rex/compat.rb', line 117defself.open_browser(url='http://google.com/')caseRUBY_PLATFORMwhen/cygwin/if(url[0,1]=="/")self.open_file(url)endreturnifnot@@loaded_win32apiWin32API.new("shell32.dll","ShellExecute",["PPPPPL"],"L").call(nil,"open",url,nil,nil,0)when/mswin32|mingw/returnifnot@@loaded_win32apiWin32API.new("shell32.dll","ShellExecute",["PPPPPL"],"L").call(nil,"open",url,nil,nil,0)when/darwin/system("open #{url}")else# Search through the PATH variable (if it exists) and chose a browser
# We are making an assumption about the nature of "PATH" so tread lightly
ifdefined?ENV['PATH']# "xdg-open" is more general than "sensible-browser" and can be useful for lots of
# file types -- text files, pcaps, or URLs. It's nearly always
# going to use the application the user is expecting. If we're not
# on something Debian-based, fall back to likely browsers.
['xdg-open','sensible-browser','firefox','firefox-bin','opera','konqueror','chromium-browser'].eachdo|browser|ENV['PATH'].split(':').eachdo|path|# Does the browser exists?
ifFile.exists?("#{path}/#{browser}")system("#{browser}#{url} &")returnendendendendendend