From 0d0e51452ca63ed57041f9e0ee24d6395a5ed369 Mon Sep 17 00:00:00 2001 From: Isaac Powell <36595182+DeezyE@users.noreply.github.com> Date: Tue, 9 Nov 2021 14:40:51 +1000 Subject: [PATCH] Enhancement - Check for update on launch (#2199) --- beef | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/beef b/beef index 267e05a8a..ccca587e1 100755 --- a/beef +++ b/beef @@ -47,21 +47,21 @@ require 'timeout' # # @note Ask user if they would like to update beef # - -if BeEF::Core::Console::CommandLine.parse[:update_disabled] == false +if File.exist?("#{$root_dir}git") && BeEF::Core::Console::CommandLine.parse[:update_disabled] == false if BeEF::Core::Console::CommandLine.parse[:update_auto] == true - print "Pulling latest BeEF repository and updating" - `git pull && bundle` - else + print 'Checking latest BeEF repository and updating' + `git pull && bundle` + elsif `git rev-parse master` != `git rev-parse origin/master` begin - answer = Timeout::timeout(5) do - print "Would you like to check and download the latest BeEF update? y/n: " + Timeout.timeout(5) do + puts '-- BeEF Update Available --' + print 'Would you like to update to lastest version? y/n: ' response = gets - `git pull && bundle` if response.strip == 'y' - end - rescue Timeout::Error - puts "\nUpdate Skipped with input timeout" + `git pull && bundle` if response.strip == 'y' end + rescue Timeout::Error + puts "\nUpdate Skipped with input timeout" + end end end