Module: TimingAttack::Attacker

Included in:
BruteForcer, Enumerator
Defined in:
lib/timing_attack/attacker.rb

Instance Method Summary collapse

Instance Method Details

#initialize(options: {}, inputs: []) ⇒ Object

Raises:

  • (ArgumentError)


3
4
5
6
7
8
9
10
11
# File 'lib/timing_attack/attacker.rb', line 3

def initialize(options: {}, inputs: [])
  @options = default_options.merge(options)
  raise ArgumentError.new("Must provide url") if url.nil?
  unless specified_input_option?
    msg = "'#{INPUT_FLAG}' not found in url, parameters, body, headers, or HTTP authentication options"
    raise ArgumentError.new(msg)
  end
  raise ArgumentError.new("Iterations can't be < 3") if iterations < 3
end

#run!Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/timing_attack/attacker.rb', line 13

def run!
  if verbose?
    puts "Target: #{url}"
    puts "Method: #{method.to_s.upcase}"
    puts "Parameters: #{params.inspect}" unless params.empty?
    puts "Headers: #{headers.inspect}" unless headers.empty?
    puts "Body: #{body.inspect}" unless body.empty?
  end
  attack!
end