Sha256: b182cb96c0edd176d7a78375fd8997967de99a6fd9bea5a8404c2db7376c8400

Contents?: true

Size: 903 Bytes

Versions: 18

Compression:

Stored size: 903 Bytes

Contents

require_relative '../configurations/list_configuration'

class CyrillicHomographAttack < Rule
  @name = "Cyrillic Homograph attack"

  @site_w_cyrillic = /^(http(s)?:\/\/)?.*\p{Cyrillic}+/

  @site_w_cyrillic_conf = RegexConfiguration.new("Regular expression of links with Cyrillic characters", @site_w_cyrillic, "Regular expression of website links that have Cyrillic characters.")

  @configurations+=[@site_w_cyrillic_conf]

  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

end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
puppet-sec-lint-1.0.0 lib/rules/cyrillic_homograph_attack.rb
puppet-sec-lint-0.5.17 lib/rules/cyrillic_homograph_attack.rb
puppet-sec-lint-0.5.16 lib/rules/cyrillic_homograph_attack.rb
puppet-sec-lint-0.5.15 lib/rules/cyrillic_homograph_attack.rb
puppet-sec-lint-0.5.14 lib/rules/cyrillic_homograph_attack.rb
puppet-sec-lint-0.5.13 lib/rules/cyrillic_homograph_attack.rb
puppet-sec-lint-0.5.11 lib/rules/cyrillic_homograph_attack.rb
puppet-sec-lint-0.5.10 lib/rules/cyrillic_homograph_attack.rb
puppet-sec-lint-0.5.9 lib/rules/cyrillic_homograph_attack.rb
puppet-sec-lint-0.5.8 lib/rules/cyrillic_homograph_attack.rb
puppet-sec-lint-0.5.7 lib/rules/cyrillic_homograph_attack.rb
puppet-sec-lint-0.5.6 lib/rules/cyrillic_homograph_attack.rb
puppet-sec-lint-0.5.5 lib/rules/cyrillic_homograph_attack.rb
puppet-sec-lint-0.5.4 lib/rules/cyrillic_homograph_attack.rb
puppet-sec-lint-0.5.3 lib/rules/cyrillic_homograph_attack.rb
puppet-sec-lint-0.5.2 lib/rules/cyrillic_homograph_attack.rb
puppet-sec-lint-0.5.1 lib/rules/cyrillic_homograph_attack.rb
puppet-sec-lint-0.5.0 lib/rules/cyrillic_homograph_attack.rb