ha-finder 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/ha-finder.rb +59 -0
  3. metadata +86 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cc500f078add4839757c1c6fb0b805349f38ee28
4
+ data.tar.gz: 8db0ae10f86524f365542faa3c455b009af76285
5
+ SHA512:
6
+ metadata.gz: f5567c45de33ad5bb51c90c2c6780f2e171426b124bf77cc09b5c9d30ae3d1032f6c1988259fc45b36a70371c54d319c3b27a6b4f7786b06f5713a4a7c00b38e
7
+ data.tar.gz: dc451ad314692a5542a0ab91de3eb559759e21dfc93b9e8fa48b73c96451f12fea01d398895eacf493f30250419a730cf95de2a6f78d3625c996ed755fb8f82d
data/lib/ha-finder.rb ADDED
@@ -0,0 +1,59 @@
1
+ require 'whois'
2
+ require 'whois-parser'
3
+ require 'csv'
4
+ require 'set'
5
+ require 'simpleidn'
6
+
7
+ latin_confusables_map = Hash[
8
+ 'a' => 'а',
9
+ 'c' => 'с',
10
+ 'd' => 'ԁ',
11
+ 'e' => 'е',
12
+ 'h' => 'һ',
13
+ 'i' => 'і',
14
+ 'j' => 'ј',
15
+ # 'k' => 'ҟ',
16
+ 'l' => 'ӏ',
17
+ 'm' => 'м',
18
+ 'n' => 'п',
19
+ 'o' => 'о',
20
+ 'p' => 'р',
21
+ 'q' => 'ԛ',
22
+ 'r' => 'г',
23
+ 's' => 'ѕ',
24
+ # 'u' => 'џ',
25
+ 'w' => 'ԝ',
26
+ 'x' => 'х',
27
+ 'y' => 'у'
28
+ ]
29
+
30
+ latin_confusables = latin_confusables_map.keys.to_set
31
+
32
+ (0..9).each{|num| latin_confusables.add num.to_s }
33
+ c = Whois::Client.new
34
+
35
+ puts 'available domains: '
36
+
37
+ domains = CSV.read('/lib/top-1m.csv').map(&:last)
38
+ domains.each do |domain|
39
+ domain_name, tld = domain.split('.', 2)
40
+ if Set[*domain_name.chars].subset?(latin_confusables)
41
+ cyrillic_domain = Array.new
42
+ domain_name.each_char do |char|
43
+ cyrillic_domain.push latin_confusables_map[char]
44
+ end
45
+ cyrillic_domain = cyrillic_domain.join
46
+ cyrillic_domain += '.'
47
+ cyrillic_domain += tld
48
+ punycode_domain = SimpleIDN.to_ascii(cyrillic_domain)
49
+
50
+ begin
51
+ record = Whois.whois(punycode_domain).parser
52
+ if !record.registered?
53
+ puts "#{domain} (#{cyrillic_domain})"
54
+ end
55
+ rescue
56
+ puts "--can't parse-- #{domain} (#{cyrillic_domain})"
57
+ end
58
+ end
59
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ha-finder
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Logan McDonald
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-02-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: whois
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: whois-parser
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: simpleidn
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.0'
55
+ description:
56
+ email: loganmcdona11@gmail.com
57
+ executables: []
58
+ extensions: []
59
+ extra_rdoc_files: []
60
+ files:
61
+ - lib/ha-finder.rb
62
+ homepage:
63
+ licenses:
64
+ - MIT
65
+ metadata: {}
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubyforge_project:
82
+ rubygems_version: 2.4.5.1
83
+ signing_key:
84
+ specification_version: 4
85
+ summary: A finder of homograph attack DNS entries.
86
+ test_files: []