#!/usr/bin/env ruby # encoding: UTF-8 =begin BETTERCAP Author : Simone 'evilsocket' Margaritelli Email : [email protected] Blog : http://www.evilsocket.net/ This project is released under the GPL 3 license. =end require 'bettercap' begin # We need this in order to report unhandled exceptions. # Create global context, parse command line arguments and perform basic # error checking. ctx = BetterCap::Options.parse! ctx.start! loop do sleep 10 end rescue SystemExit, Interrupt, SignalException BetterCap::Logger.raw "\n" rescue OptionParser::InvalidOption, OptionParser::AmbiguousOption, OptionParser::MissingArgument => e BetterCap::Logger.error "'#{e.message.capitalize}', verify your command line arguments executing 'bettercap --help'." rescue BetterCap::Error => e BetterCap::Logger.error e.message rescue Exception => e puts "\n\n" BetterCap::Logger.error "Oooops, seems like something weird occurred, please copy paste the following output " \ "and open a new issue on https://github.com/evilsocket/bettercap/issues :\n" BetterCap::Logger.error "Platform : #{RUBY_PLATFORM}" BetterCap::Logger.error "Ruby Version : #{RUBY_VERSION}" BetterCap::Logger.error "BetterCap Version : #{BetterCap::VERSION}" BetterCap::Logger.error "Command Line : #{original_argv.join(" ")}" BetterCap::Logger.error "Exception : #{e.class}" BetterCap::Logger.error "Message : #{e.message}" BetterCap::Logger.error "Backtrace :\n\n #{e.backtrace.join("\n ")}\n" ensure # Make sure all the messages on the logger queue are printed. BetterCap::Logger.wait! ctx.finalize unless ctx.nil? end