Class: HomographicSpoofing::Detector::Rule::Idn::ScriptConfusable

Inherits:
Base
  • Object
show all
Defined in:
lib/homographic_spoofing/detector/rule/idn/script_confusable.rb

Overview

  1. and 10. of Google Chrome IDN policy See unicode.org/reports/tr39/#Confusable_Detection

Defined Under Namespace

Classes: Confusable

Instance Method Summary collapse

Instance Method Details

#attack_detected?Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
9
10
# File 'lib/homographic_spoofing/detector/rule/idn/script_confusable.rb', line 3

def attack_detected?
  SCRIPT_CONFUSABLES.any? do |confusable|
    confusable_chars = label.scan(confusable.script)
    confusable_chars.present? &&
      confusable_chars.all? { confusable.latin_lookalike.match?(_1) } &&
      !is_script_confusable_allowed_for_tld?(confusable)
  end
end