Class: UseWeakCryptoAlgorithmsRule

Inherits:
Rule
  • Object
show all
Defined in:
lib/rules/use_weak_crypto_algorithms_rule.rb

Class Method Summary collapse

Methods inherited from Rule

filter_resources, filter_tokens, filter_variables, filter_whitelist, get_comments, get_string_tokens, get_tokens, inherited

Class Method Details

.AnalyzeTokens(tokens) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rules/use_weak_crypto_algorithms_rule.rb', line 12

def self.AnalyzeTokens(tokens)
  result = []

  tokens.each do |token|
    token_value = token.value.downcase
    token_type = token.type.to_s
    if !token.next_token.nil?
      next_token_type = token.next_token.type.to_s
    end
    if (token_value =~ @poor_crypto_conf.value) && (next_token_type.eql? "LPAREN")
      result.append(Sin.new(SinType::WeakCryptoAlgorithm, token.line, token.column, token.line, token.column+token_value.length))
    end
  end

  return result
end