Class: Analyzers::PaddingOracle::Analyzer
- Inherits:
-
Object
- Object
- Analyzers::PaddingOracle::Analyzer
- Includes:
- Utils::Reporting::Console
- Defined in:
- lib/crypto-toolbox/analyzers/padding_oracle/analyzer.rb
Defined Under Namespace
Classes: FailedAnalysis
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
-
#analyze(cipher) ⇒ Object
start with the second to last block to manipulate the final block ( cbc xor behaviour ) from there on we move to the left until we have used the first block (iv) to decrypt the second blick ( first plain text block ).
-
#initialize(oracle = ::Analyzers::PaddingOracle::Oracles::TcpOracle.new) ⇒ Analyzer
constructor
A new instance of Analyzer.
Methods included from Utils::Reporting::Console
Constructor Details
#initialize(oracle = ::Analyzers::PaddingOracle::Oracles::TcpOracle.new) ⇒ Analyzer
Returns a new instance of Analyzer.
13 14 15 16 |
# File 'lib/crypto-toolbox/analyzers/padding_oracle/analyzer.rb', line 13 def initialize(oracle = ::Analyzers::PaddingOracle::Oracles::TcpOracle.new) @result = [ ] @oracle = oracle end |
Instance Attribute Details
#result ⇒ Object (readonly)
Returns the value of attribute result.
10 11 12 |
# File 'lib/crypto-toolbox/analyzers/padding_oracle/analyzer.rb', line 10 def result @result end |
Instance Method Details
#analyze(cipher) ⇒ Object
start with the second to last block to manipulate the final block ( cbc xor behaviour ) from there on we move to the left until we have used the first block (iv) to decrypt the second blick ( first plain text block )
we have to manipulate the block before the one we want to change xxxxxxxxx xxxxxxxxx xxxxxxxxxx changing this byte ^- will change ^- this byte at decryption
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/crypto-toolbox/analyzers/padding_oracle/analyzer.rb', line 25 def analyze(cipher) blocks = CryptBuffer.from_hex(cipher).chunks_of(16) # for whatever reason ranges cant be from high to low (1..(blocks.length() -1)).reverse_each do |block_index| result.unshift analyse_block(blocks,block_index) end report_result(result) end |