Class: CyrillicHomographAttack

Inherits:
Rule
  • Object
show all
Defined in:
lib/rules/cyrillic_homograph_attack.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
# File 'lib/rules/cyrillic_homograph_attack.rb', line 12

def self.AnalyzeTokens(tokens)
  result = []

  ftokens = self.filter_tokens(tokens)
  tokens.each do |token|
    token_value = token.value.downcase
    token_type = token.type.to_s
    if ["STRING", "SSTRING"].include? token_type and token_value =~ @site_w_cyrillic_conf.value
      result.append(Sin.new(SinType::CyrillicHomographAttack, token.line, token.column, token.line, token.column+token_value.length))
    end
  end

  return result
end