Pre-creation of actual test
1333_auth_rate - multiple cyles of api auth requests at different speeds. Fast auth attempts should block Solwer attempts, when valid should succeed modified: Rakefile renamed: test/api/beef_rest.rb -> test/api/1333_auth_rate.rb
This commit is contained in:
2
Rakefile
2
Rakefile
@@ -56,7 +56,7 @@ desc 'rest test examples'
|
||||
task :rest_test do
|
||||
Rake::Task['beef_start'].invoke
|
||||
|
||||
sh 'cd test/api/; ruby -W2 beef_rest.rb"
|
||||
sh 'cd test/api/; ruby -W2 1333_auth_rate.rb'
|
||||
|
||||
Rake::Task['beef_stop'].invoke
|
||||
end
|
||||
|
||||
@@ -20,8 +20,21 @@ apis = passwds.map { |pswd| BeefRestClient.new('http', ATTACK_DOMAIN, '3000', BE
|
||||
#binding.pry
|
||||
t0 = Time.now()
|
||||
l = apis.length
|
||||
(0..50).each do |i|
|
||||
t = Time.now()
|
||||
puts "#{i} : #{t - t0} : #{apis[i%l].auth()[:payload]}"
|
||||
t0 = t
|
||||
|
||||
(0..2).each do |again|
|
||||
puts "speed requesets"
|
||||
(0..50).each do |i|
|
||||
t = Time.now()
|
||||
puts "#{i} : #{t - t0} : #{apis[i%l].auth()[:payload]}"
|
||||
t0 = t
|
||||
end
|
||||
|
||||
# again with more time
|
||||
puts "delayed requests"
|
||||
(0..(l*2)).each do |i|
|
||||
t = Time.now()
|
||||
puts "#{i} : #{t - t0} : #{apis[i%l].auth()[:payload]}"
|
||||
sleep(0.5)
|
||||
t0 = t
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user