Class: CryptoToolbox::Oracles::PaddingOracle::HttpOracle
- Inherits:
-
Object
- Object
- CryptoToolbox::Oracles::PaddingOracle::HttpOracle
- Defined in:
- lib/crypto-toolbox/oracles/padding_oracle/http_oracle.rb
Instance Method Summary collapse
- #connect ⇒ Object
- #disconnect ⇒ Object
-
#initialize ⇒ HttpOracle
constructor
A new instance of HttpOracle.
- #valid_padding?(input, block_amount) ⇒ Boolean
Constructor Details
#initialize ⇒ HttpOracle
Returns a new instance of HttpOracle.
5 6 7 8 9 10 |
# File 'lib/crypto-toolbox/oracles/padding_oracle/http_oracle.rb', line 5 def initialize require 'net/http' @domain = "crypto-class.appspot.com" @uri_base = "/po?er=" @port = 80 end |
Instance Method Details
#connect ⇒ Object
11 12 13 |
# File 'lib/crypto-toolbox/oracles/padding_oracle/http_oracle.rb', line 11 def connect true end |
#disconnect ⇒ Object
14 15 16 |
# File 'lib/crypto-toolbox/oracles/padding_oracle/http_oracle.rb', line 14 def disconnect true end |
#valid_padding?(input, block_amount) ⇒ Boolean
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/crypto-toolbox/oracles/padding_oracle/http_oracle.rb', line 17 def valid_padding?(input,block_amount) uri = @uri_base + input.hex Net::HTTP.start(@domain,@port) do |http| res = http.request(Net::HTTP::Get.new(uri)) code = res.code.to_i sleep 0.001 # -> howto check this ? (block_index == 3 && pad_index == 9 && code == 200 ) (code == 404 || code == 200) end end |