Class: Owasp::Esapi::Codec::OracleCodec

Inherits:
BaseCodec
  • Object
show all
Defined in:
lib/codec/oracle_codec.rb

Constant Summary

Constants inherited from BaseCodec

BaseCodec::END_CODE_POINT, BaseCodec::START_CODE_POINT

Instance Method Summary collapse

Methods inherited from BaseCodec

#decode, #encode, #hex, #min

Instance Method Details

#decode_char(input) ⇒ Object

Returns the decoded version of the character starting at index, or nil if no decoding is possible.

Formats all are legal
 '' decodes to '


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/codec/oracle_codec.rb', line 22

def decode_char(input)
  # check first *char*
  input.mark
  first = input.next
  if first.nil?
    input.reset
    return nil
  end
  # if it isnt an encoded string return nil
  unless first == "\'"
    input.reset
    return nil
  end
  # if second isnt an encoded marker return nil
  second = input.next
  unless second == "\'"
    input.reset
    return nil
  end
  return "\'"
end

#encode_char(immune, input) ⇒ Object

Encodes ‘ to ”



12
13
14
15
# File 'lib/codec/oracle_codec.rb', line 12

def encode_char(immune,input)
  return "\'\'" if input == "\'"
  input
end