Class: Aikido::Zen::Attack
- Inherits:
-
Object
- Object
- Aikido::Zen::Attack
- Defined in:
- lib/aikido/zen/attack.rb
Overview
Attack objects gather information about a type of detected attack. They can be used in a few ways, like for reporting an attack event to the Aikido server, or can be raised as errors to block requests if blocking_mode is on.
Direct Known Subclasses
Aikido::Zen::Attacks::SQLInjectionAttack, Aikido::Zen::Attacks::SSRFAttack, Aikido::Zen::Attacks::StoredSSRFAttack
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#operation ⇒ Object
readonly
Returns the value of attribute operation.
-
#sink ⇒ Object
Returns the value of attribute sink.
Instance Method Summary collapse
- #as_json ⇒ Object
- #blocked? ⇒ Boolean
- #exception ⇒ Object
-
#initialize(context:, sink:, operation:) ⇒ Attack
constructor
A new instance of Attack.
- #log_message ⇒ Object
- #will_be_blocked! ⇒ Object
Constructor Details
#initialize(context:, sink:, operation:) ⇒ Attack
Returns a new instance of Attack.
13 14 15 16 17 18 |
# File 'lib/aikido/zen/attack.rb', line 13 def initialize(context:, sink:, operation:) @context = context @operation = operation @sink = sink @blocked = false end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
9 10 11 |
# File 'lib/aikido/zen/attack.rb', line 9 def context @context end |
#operation ⇒ Object (readonly)
Returns the value of attribute operation.
10 11 12 |
# File 'lib/aikido/zen/attack.rb', line 10 def operation @operation end |
#sink ⇒ Object
Returns the value of attribute sink.
11 12 13 |
# File 'lib/aikido/zen/attack.rb', line 11 def sink @sink end |
Instance Method Details
#as_json ⇒ Object
32 33 34 |
# File 'lib/aikido/zen/attack.rb', line 32 def as_json raise NotImplementedError, "implement in subclasses" end |
#blocked? ⇒ Boolean
24 25 26 |
# File 'lib/aikido/zen/attack.rb', line 24 def blocked? @blocked end |
#exception ⇒ Object
36 37 38 |
# File 'lib/aikido/zen/attack.rb', line 36 def exception(*) raise NotImplementedError, "implement in subclasses" end |
#log_message ⇒ Object
28 29 30 |
# File 'lib/aikido/zen/attack.rb', line 28 def raise NotImplementedError, "implement in subclasses" end |
#will_be_blocked! ⇒ Object
20 21 22 |
# File 'lib/aikido/zen/attack.rb', line 20 def will_be_blocked! @blocked = true end |