From 9dcf516b8885011e4f28373aee9760135fc43e89 Mon Sep 17 00:00:00 2001 From: Bucky Wilson Date: Tue, 5 Dec 2017 22:04:32 +1000 Subject: [PATCH] Test,/exercise script to evaluate rate limiting Debug details in the script --- Rakefile | 6 ++---- test/api/beef_rest.rb | 11 +++-------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/Rakefile b/Rakefile index 8067db3bc..32fe200ba 100644 --- a/Rakefile +++ b/Rakefile @@ -4,6 +4,7 @@ # See the file 'doc/COPYING' for copying permission # require 'yaml' +require 'pry-byebug' task :default => ["quick"] @@ -55,7 +56,7 @@ desc 'rest test examples' task :rest_test do Rake::Task['beef_start'].invoke - sh "cd ./tools/rest_api_examples/; ./api_login -v -d --user '#{ENV['TEST_BEEF_USER']}' --pass '#{ENV['TEST_BEEF_PASS']}'" + sh 'cd test/api/; ruby -W2 beef_rest.rb" Rake::Task['beef_stop'].invoke end @@ -199,11 +200,9 @@ task :beef_start => 'beef' do sleep (i) end puts ".\n\n" - end task :beef_stop do - # cleanup tmp/config files puts "\nCleanup config file:\n" rm_f @beef_config_file @@ -213,7 +212,6 @@ task :beef_stop do # shutting down puts "Shutting down BeEF...\n" sh "ps -ef|grep beef|grep -v grep|awk '{print $2}'|xargs kill" - end ################################ diff --git a/test/api/beef_rest.rb b/test/api/beef_rest.rb index 9e21a0ef6..52d849ccb 100644 --- a/test/api/beef_rest.rb +++ b/test/api/beef_rest.rb @@ -3,6 +3,7 @@ # Browser Exploitation Framework (BeEF) - http://beefproject.com # See the file 'doc/COPYING' for copying permission # + require 'pry-byebug' require 'rest-client' require 'json' @@ -17,16 +18,10 @@ passwds.push BEEF_PASSWD apis = passwds.map { |pswd| BeefRestClient.new('http', ATTACK_DOMAIN, '3000', BEEF_USER, pswd) } #binding.pry -t0 = Time.now().usec +t0 = Time.now() l = apis.length (0..50).each do |i| - t = Time.now().usec + t = Time.now() puts "#{i} : #{t - t0} : #{apis[i%l].auth()[:payload]}" t0 = t end - - -#binding.pry -# response = @api.auth - -#@api.version if response[:success]