forked from ring0lab/catphish
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcatphish.rb
executable file
·353 lines (331 loc) · 14.4 KB
/
catphish.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
#!/usr/bin/env ruby
# catphish - Domain Suggester
# version: 0.0.6
# author: Viet Luu
# web: www.ring0lab.com
# Next update
# more algorithms
require 'resolv'
require 'getoptlong'
require 'simpleidn'
require 'whois'
require 'whois-parser'
@DOMAIN = nil
@METHOD = nil
@TYPE = nil
@ALL = false
@HELP = false
@VERSION = '0.0.5'
@LOGO = "
██████╗ █████╗ ████████╗██████╗ ██╗ ██╗██╗███████╗██╗ ██╗
██╔════╝██╔══██╗╚══██╔══╝██╔══██╗██║ ██║██║██╔════╝██║ ██║
██║ ███████║ ██║ ██████╔╝███████║██║███████╗███████║
██║ ██╔══██║ ██║ ██╔═══╝ ██╔══██║██║╚════██║██╔══██║
╚██████╗██║ ██║ ██║ ██║ ██║ ██║██║███████║██║ ██║
╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝╚══════╝╚═╝ ╚═╝
[v]#{@VERSION}
Author: Mr. V
Web: ring0lab.com
"
@POPULAR_TOP_DOMAINS = ['.com', '.co', '.net', '.org', '.info']
@COUNTRY_TOP_DOMAINS =
[
".ac", ".ad", ".ae", ".af", ".ag", ".ai", ".al", ".am", ".an", ".ao", ".aq", ".ar", ".as",
".at", ".au", ".aw", ".ax", ".az", ".ba", ".bb", ".bd", ".be", ".bf", ".bg", ".bh", ".bi",
".bj", ".bm", ".bn", ".bo", ".bq", ".br", ".bs", ".bt", ".bv", ".bw", ".by", ".bz", ".ca",
".cc", ".cd", ".cf", ".cg", ".ch", ".ci", ".ck", ".cl", ".cm", ".cn", ".co", ".cr", ".cu",
".cv", ".cw", ".cx", ".cy", ".cz", ".de", ".dj", ".dk", ".dm", ".do", ".dz", ".ec", ".ee",
".eg", ".eh", ".er", ".es", ".et", ".eu", ".fi", ".fj", ".fk", ".fm", ".fo", ".fr", ".ga",
".gb", ".gd", ".ge", ".gf", ".gg", ".gh", ".gi", ".gl", ".gm", ".gn", ".gp", ".gq", ".gr",
".gs", ".gt", ".gu", ".gw", ".gy", ".hk", ".hm", ".hn", ".hr", ".ht", ".hu", ".id", ".ie",
".il", ".im", ".in", ".io", ".iq", ".ir", ".is", ".it", ".je", ".jm", ".jo", ".jp", ".ke",
".kg", ".kh", ".ki", ".km", ".kn", ".kp", ".kr", ".kw", ".ky", ".kz", ".la", ".lb", ".lc",
".li", ".lk", ".lr", ".ls", ".lt", ".lu", ".lv", ".ly", ".ma", ".mc", ".md", ".me", ".mg",
".mh", ".mk", ".ml", ".mm", ".mn", ".mo", ".mp", ".mq", ".mr", ".ms", ".mt", ".mu", ".mv",
".mw", ".mx", ".my", ".mz", ".na", ".nc", ".ne", ".nf", ".ng", ".ni", ".nl", ".no", ".np",
".nr", ".nu", ".nz", ".om", ".pa", ".pe", ".pf", ".pg", ".ph", ".pk", ".pl", ".pm", ".pn",
".pr", ".ps", ".pt", ".pw", ".py", ".qa", ".re", ".ro", ".rs", ".ru", ".rw", ".sa", ".sb",
".sc", ".sd", ".se", ".sg", ".sh", ".si", ".sj", ".sk", ".sl", ".sm", ".sn", ".so", ".sr",
".ss", ".st", ".su", ".sv", ".sx", ".sy", ".sz", ".tc", ".td", ".tf", ".tg", ".th", ".tj",
".tk", ".tl", ".tm", ".tn", ".to", ".tp", ".tr", ".tt", ".tv", ".tw", ".tz", ".ua", ".ug",
".uk", ".us", ".uy", ".uz", ".va", ".vc", ".ve", ".vg", ".vi", ".vn", ".vu", ".wf", ".ws",
".ye", ".yt", ".za", ".zm", ".zw"
]
@GENERIC_DOMAINS =
[
".academy", ".accountant", ".accountants", ".active", ".actor", ".adult", ".aero",
".agency", ".airforce", ".apartments", ".app", ".archi", ".army", ".associates",
".attorney", ".auction", ".audio", ".autos", ".band", ".bar", ".bargains", ".beer",
".best", ".bid", ".bike", ".bingo", ".bio", ".biz", ".black", ".blackfriday", ".blog",
".blue", ".boo", ".boutique", ".build", ".builders", ".business", ".buzz", ".cab", ".cam",
".camera", ".camp", ".cancerresearch", ".capital", ".cards", ".care", ".career", ".careers",
".cars", ".cash", ".casino", ".catering", ".center", ".ceo", ".channel", ".chat", ".cheap",
".christmas", ".church", ".city", ".claims", ".cleaning", ".click", ".clinic", ".clothing",
".cloud", ".club", ".coach", ".codes", ".coffee", ".college", ".community", ".company",
".computer", ".condos", ".construction", ".consulting", ".contractors", ".cooking", ".cool",
".coop", ".country", ".coupons", ".credit", ".creditcard", ".cricket", ".cruises", ".dad",
".dance", ".date", ".dating", ".day", ".deals", ".degree", ".delivery", ".democrat", ".dental",
".dentist", ".design", ".diamonds", ".diet", ".digital", ".direct", ".directory", ".discount",
".dog", ".domains", ".download", ".eat", ".education", ".email", ".energy", ".engineer",
".engineering", ".equipment", ".esq", ".estate", ".events", ".exchange", ".expert", ".exposed",
".express", ".fail", ".faith", ".family", ".fans", ".farm", ".fashion", ".feedback", ".finance",
".financial", ".fish", ".fishing", ".fit", ".fitness", ".flights", ".florist", ".flowers", ".fly",
".foo", ".football", ".forsale", ".foundation", ".fund", ".furniture", ".fyi", ".gallery", ".garden",
".gift", ".gifts", ".gives", ".glass", ".global", ".gold", ".golf", ".gop", ".graphics", ".green",
".gripe", ".guide", ".guitars", ".guru", ".healthcare", ".help", ".here", ".hiphop", ".hiv", ".hockey",
".holdings", ".holiday", ".homes", ".horse", ".host", ".hosting", ".house", ".how", ".info", ".ing",
".ink", ".institute", ".insure", ".international", ".investments", ".jewelry", ".jobs", ".kim", ".kitchen",
".land", ".lawyer", ".lease", ".legal", ".lgbt", ".life", ".lighting", ".limited", ".limo", ".link",
".loan", ".loans", ".lol", ".lotto", ".love", ".luxe", ".luxury", ".management", ".market", ".marketing",
".markets", ".mba", ".media", ".meet", ".meme", ".memorial", ".men", ".menu", ".mobi", ".moe", ".money",
".mortgage", ".motorcycles", ".mov", ".movie", ".museum", ".name", ".navy", ".network", ".new", ".news",
".ngo", ".ninja", ".one", ".ong", ".onl", ".online", ".ooo", ".organic", ".partners", ".parts", ".party",
".pharmacy", ".photo", ".photography", ".photos", ".physio", ".pics", ".pictures", ".pid", ".pink", ".pizza",
".place", ".plumbing", ".plus", ".poker", ".porn", ".post", ".press", ".pro", ".productions", ".prof",
".properties", ".property", ".qpon", ".racing", ".recipes", ".red", ".rehab", ".ren", ".rent", ".rentals",
".repair", ".report", ".republican", ".rest", ".review", ".reviews", ".rich", ".rip", ".rocks", ".rodeo",
".rsvp", ".run", ".sale", ".school", ".science", ".services", ".sex", ".sexy", ".shoes", ".show", ".singles",
".site", ".soccer", ".social", ".software", ".solar", ".solutions", ".space", ".studio", ".style", ".sucks",
".supplies", ".supply", ".support", ".surf", ".surgery", ".systems", ".tattoo", ".tax", ".taxi", ".team",
".store", ".tech", ".technology", ".tel", ".tennis", ".theater", ".tips", ".tires", ".today", ".tools", ".top",
".tours", ".town", ".toys", ".trade", ".training", ".travel", ".university", ".vacations", ".vet", ".video",
".villas", ".vision", ".vodka", ".vote", ".voting", ".voyage", ".wang", ".watch", ".webcam", ".website", ".wed",
".wedding", ".whoswho", ".wiki", ".win", ".wine", ".work", ".works", ".world", ".wtf", ".xxx", ".xyz", ".yoga", ".zone"
]
def analyze_domain
domain = @DOMAIN.split('.')[0]
domain_container = []
if @METHOD
methods = [@METHOD]
else
methods = ['SingularOrPluralise', 'prependOrAppend', 'homoglyphs', 'doubleExtensions', 'mirrorization', 'dashOmission']
end
methods.each do |m|
case m
when 'mirrorization'
domain_container.push(['standard', domain])
(0...domain.size).each do |i|
d = domain.clone
if (i == domain.size - 2 || d[i+1] == '-')
d[i+1] = d[i] + d[i+1]
elsif (d[i] == '-')
d[i] = d[i]
elsif (d[i] == d[i+1] || d[i] == d[i-1])
# do nothing
else
d[i+1] = d[i]
end
domain_container.push([m,d])
end
when 'SingularOrPluralise'
domain_container.push(['standard', domain])
d = domain.clone
if (d[domain.size - 1] == 's')
d = d.chomp(d[domain.size - 1])
domain_container.push([m,d])
else
d[domain.size] = "s"
domain_container.push([m,d])
end
when 'homoglyphs'
domain_container.push(['standard', domain])
substitute_characters =
{
"0" => "o", "1" => "l", "o" => "0", "m" => "rm", "d" => "cl",
"g" => "q", "i" => "l", "l" => "i", "p" => "q", "cl" => "d",
"q" => "g", "u" => "v", "v" => "u", "w" => "vv", "y" => "v"
}
substitute_characters.each do |k, v|
(0...domain.size).each do |i|
d, d2 = domain.clone, domain.clone
if (d[i] == k)
d[i] = v
domain_container.push([m,d])
domain_container.push([m,d2 = d2.gsub(k, v)])
end
end
d = domain.clone
if (d.include?("cl"))
d = d.sub('cl', 'd')
domain_container.push([m,d])
end
end
when 'dashOmission'
domain_container.push(['standard', domain])
d = domain.clone
if (d.include?('-'))
d = d.gsub('-', '')
domain_container.push([m,d])
end
when 'prependOrAppend'
domain_container.push(['standard', domain])
words = ['www-', '-www', 'http-', '-https']
words.each do |w|
d = domain.clone
if (w[0] == '-')
d = d + w
else
d = w + d
end
domain_container.push([m,d])
end
when 'doubleExtensions'
domain_container.push(['standard', domain])
domain_container.push([m, @DOMAIN.split('.')[0] + '-' + @DOMAIN.split('.')[1]])
when 'Punycode'
@D2 = domain.clone
# Current langs: Vietnamese, Croation and Czech
chars_map =
{
"a" => ["\u1EA1", "\u0101", "\u0203", "\u00E0", "\u00E1"],
"e" => ["\u1EB9", "\u0113", "\u0207", "\u00E8", "\u00E9"],
"c" => ["\u0107"],
"d" => ["\u0111", "\u010F"],
"i" => ["\u1EC9", "\u1ECB", "\u012B", "\u00EC", "\u020B"],
"o" => ["\u1ECD", "\u014D", "\u020F", "\u00F2", "\u00F3"],
"u" => ["\u1EE5", "\u016B", "\u0217", "\u00F9", "\u00FA"],
"r" => ["\u0155", "\u0213"],
"t" => ["\u0165"],
"y" => ["\u1EF7", "\u00FD"],
"z" => ["\u017E"]
}
cyrillic_chars_map =
{
"a" => "\u0430", "b" => "\u0432", "c" => "\u0441", "e" => "\u0435",
"f" => "\u0493", "h" => "\u04BB", "i" => "\u0456", "k" => "\u043A",
"l" => "\u04CF", "m" => "\u043C", "n" => "\u04E5", "o" => "\u043E",
"p" => "\u0440", "r" => "\u0433", "s" => "\u0455", "t" => "\u0442",
"u" => "\u0446", "w" => "\u0428", "x" => "\u0445", "y" => "\u0423"
}
chars_map.each do |k, v|
d = domain.clone
(0...domain.size).each do |i|
if (d[i] == k)
(0...v.size).each do |i2|
d[i] = v[i2]
@D2[i] = v[i2]
domain_container.push([m,d, SimpleIDN.to_ascii(d)])
d = domain.clone
end
end
end
domain_container.each do |domain|
temp_domain = []
(0...v.size).each do |i3|
temp_domain.push(domain[1].gsub!(k, v[i3]))
if !temp_domain[0].nil?
domain_container.push([m,temp_domain[0], SimpleIDN.to_ascii(temp_domain[0])])
end
end
end
end
domain_container.push([m,@D2, SimpleIDN.to_ascii(@D2)])
d = domain.clone
punyValid = true
if domain =~ /d|g|q|v|z/
punyValid = false
end
cyrillic_chars_map.each do |k, v|
(0...domain.size).each do |i|
if (d[i] == k)
d[i] = v
end
end
end
if punyValid
domain_container.push([m,d, SimpleIDN.to_ascii(d)])
end
end
end
start_whois(domain_container.uniq)
end
def start_whois(domain)
puts @LOGO
thread = []
if @TLD.nil? || @TLD.empty?
case @TYPE
when 'country'
@TYPE = @COUNTRY_TOP_DOMAINS.clone
when 'generic'
@TYPE = @GENERIC_DOMAINS.clone
else
@TYPE = @POPULAR_TOP_DOMAINS.clone
end
else
@TYPE = @TLD.clone
end
if @METHOD == "Punycode"
printf "%-30s %-30s %-30s %s\n\n", "Type", "Domain", "Punycode", "Status"
extension = ".com"
domain.each do |d|
thread << Thread.new {
if (Whois.whois("#{d[2] + extension}").parser.available?)
printf "%-30s %-30s %-30s %s\n", d[0], d[1] + extension, d[2].to_s + extension, "\e[32mAvailable\e[0m"
else
if @ALL
printf "%-30s %-30s %-30s %s\n", d[0], d[1] + extension, d[2].to_s + extension, "Not Available"
end
end
}
end
thread.each {|t| t.join}
else
printf "%-30s %-30s %s\n\n", "Type", "Domain", "Status"
@TYPE.each do |extension|
domain.each do |d|
thread << Thread.new {
begin
if !(Resolv.getaddress "#{d[1] + extension}").nil?
if @ALL
printf "%-30s %-30s %s\n", d[0], d[1] + extension, "Not Available"
end
end
rescue Exception
printf "%-30s %-30s %s\n", d[0], d[1] + extension, "\e[32mAvailable\e[0m"
end}
end
thread.each {|t| t.join}
end
end
end
def usage
puts @LOGO
puts "USAGE:\n\n#{$0} -d domain [option,..]\n\n"
printf "%-20s %s\n", "\s\s\s-d, --domain", "[REQUIRED ARGUMENT] Domain to analyze"
printf "%-20s %s\n", "\s\s\s-m, --method", "SingularOrPluralise, mirrorization.. -- Default: all"
printf "%-20s %s\n", "\s\s\s-t, --type", "Type of level domains: (popular, country, generic) -- Default: popular"
printf "%-20s %s\n", "\s\s\s--tld", "Limit to specific TLD (overwrites --type if set)"
printf "%-20s %s\n\n", "\s\s\s-a, --all", "Show all domains, including not available ones"
end
if ARGV.length < 2
usage
exit 0
end
if (ARGV.include?('-d') || ARGV.include?('--domain'))
ARGV.each.with_index do |argv, index|
case argv
when '-d', '--domain'
@DOMAIN = ARGV[index + 1]
if (@DOMAIN.split('.')[1]).nil?
puts "\nExtension required. Example: #{@DOMAIN.split('.')[0]}.com\n\n"
exit 0
end
when '--tld'
@TLD = ["."+ARGV[index + 1]]
when '-t', '--type'
@TYPE = ARGV[index + 1]
when '-m', '--method'
@METHOD = ARGV[index + 1]
when '-a', '--all'
@ALL = true
when '-h', '--help'
@HELP = true
usage
end
end
if !(@HELP)
analyze_domain
end
else
usage
end