esearchy 0.2.0.1 → 0.2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/bin/esearchy +207 -117
  2. metadata +2 -2
data/bin/esearchy CHANGED
@@ -18,9 +18,9 @@ if RUBY_PLATFORM =~ /mingw|mswin/
18
18
  end
19
19
 
20
20
  def self.puts(color, text)
21
- self.color(@h,color)
22
- puts text
23
- self.color(@h,7)
21
+ self.color(color)
22
+ Kernel.puts text
23
+ self.color(7)
24
24
  end
25
25
  end
26
26
  end
@@ -28,9 +28,6 @@ end
28
28
 
29
29
  require 'rubygems'
30
30
  require 'getoptlong'
31
- require 'sqlite3' rescue raise "gem install sqlite3"
32
- require 'prawn' rescue raise "gem install prawn"
33
- require 'prawn/layout'
34
31
  require 'esearchy'
35
32
 
36
33
  ESearchy::log = true
@@ -38,15 +35,30 @@ ESearchy::log = true
38
35
  @yahoo_key = nil
39
36
  @bing_key = nil
40
37
  @maxhits = nil
38
+ @docs = true
41
39
  @params = {}
42
40
  @list = []
43
41
  @output = nil
44
42
 
45
- @email_engines = [:Google, :Bing, :Yahoo, :Altavista, :PGP, :Spider ,:Usenet, :GoogleGroups ]
46
- @people_engines = [:LinkedIn, :Naymz, :Classmates, :GoogleProfiles]
43
+ @email_engines = [] #[:Google, :Bing, :Yahoo, :Altavista, :PGP, :Spider ,:Usenet, :GoogleGroups ]
44
+ @people_engines = [] #[:LinkedIn, :Naymz, :Classmates, :GoogleProfiles]
47
45
 
48
46
  opts = GetoptLong.new(
49
47
  [ '--help', '-h', GetoptLong::NO_ARGUMENT ],
48
+ [ '--enable-all', GetoptLong::NO_ARGUMENT ],
49
+ [ '--enable-people', GetoptLong::NO_ARGUMENT ],
50
+ [ '--enable-emails', GetoptLong::NO_ARGUMENT ],
51
+ [ '--enable-google', GetoptLong::NO_ARGUMENT ],
52
+ [ '--enable-yahoo', GetoptLong::NO_ARGUMENT ],
53
+ [ '--enable-bing', GetoptLong::NO_ARGUMENT ],
54
+ [ '--enable-altavisa', GetoptLong::NO_ARGUMENT ],
55
+ [ '--enable-linkedin', GetoptLong::NO_ARGUMENT ],
56
+ [ '--enable-gprofiles', GetoptLong::NO_ARGUMENT ],
57
+ [ '--enable-naymz', GetoptLong::NO_ARGUMENT ],
58
+ [ '--enable-ggroups', GetoptLong::NO_ARGUMENT ],
59
+ [ '--enable-pgp', GetoptLong::NO_ARGUMENT ],
60
+ [ '--enable-usenet', GetoptLong::NO_ARGUMENT ],
61
+ [ '--enable-spider', GetoptLong::NO_ARGUMENT ],
50
62
  [ '--disable-google', GetoptLong::NO_ARGUMENT ],
51
63
  [ '--disable-yahoo', GetoptLong::NO_ARGUMENT ],
52
64
  [ '--disable-bing', GetoptLong::NO_ARGUMENT ],
@@ -58,6 +70,7 @@ opts = GetoptLong.new(
58
70
  [ '--disable-pgp', GetoptLong::NO_ARGUMENT ],
59
71
  [ '--disable-usenet', GetoptLong::NO_ARGUMENT ],
60
72
  [ '--disable-spider', GetoptLong::NO_ARGUMENT ],
73
+ [ '--disable-docs', GetoptLong::NO_ARGUMENT ],
61
74
  [ '--query','-q', GetoptLong::REQUIRED_ARGUMENT ],
62
75
  [ '--company','-c', GetoptLong::REQUIRED_ARGUMENT ],
63
76
  [ '--website','-w', GetoptLong::REQUIRED_ARGUMENT ],
@@ -71,85 +84,144 @@ opts = GetoptLong.new(
71
84
 
72
85
  opts.each do |opt, arg|
73
86
  case opt
74
- when '--help':
87
+ when '--help' then
75
88
  # BEGIN OF HELP
76
- puts "\nHELP for Esearchy\n---------------------\n
77
- --help, -h
78
- \tWell I guess you know what this is for (To obtain this Help).\n
79
- INPUT PARAMS:
80
- --query, -q [@domain.com]
81
- \t The domain name to search.\n
82
- --company, -c [Company Inc]
83
- \t The company name to search.\n
84
- --website, -w [www.domain.com]
85
- \t The website name to spider.\n
86
- --yahookey, -y [key]
87
- \t The Yahoo API Key .\n
88
- --bingkey, -b [key]
89
- \t The Bing API Key .\n
90
- --filter, -p
91
- \t The pattern to use to filter emails.(not fully implemented)\n
92
- --file, -f [file_name]
93
- \tIf we need to search more than one domain we can provide a list.\n
94
- --output, -o
95
- \tThe output file name.\n\n
96
- PLUGIN OPTIONS:
97
- --disable-google
98
- \t Disables Google searches.\n
99
- --disable-yahoo
100
- \t Disables Yahoo searches.\n
101
- --disable-bing
102
- \t Disables Bing searches.\n
103
- --disable-linkedin
104
- \t Disables LinkedIn searches.\n
105
- --disable-gprogiles
106
- \t Disables Google Profiles searches.\n
107
- --disable-naymz
108
- \t Disables Naymz searches.\n
109
- --disable-ggroups
110
- \t Disables Google Groups searches.\n
111
- --disable-pgp
112
- \t Disables PGP searches.\n
113
- --disable-usenet
114
- \t Disables Usenet searches.\n\n
115
- Copyright 2009 - FreedomCoder\n"
89
+ puts "nHELP for Esearchy\n---------------------\n"
90
+ puts "--help, -h"
91
+ puts "\tWell I guess you know what this is for (To obtain this Help).\n"
92
+ puts "INPUT PARAMS:"
93
+ puts "--query, -q [@domain.com]"
94
+ puts "\t The domain name to search.\n"
95
+ puts "--company, -c [Company Inc]"
96
+ puts "\t The company name to search.\n"
97
+ puts "--website, -w [www.domain.com]"
98
+ puts "\t The website name to spider.\n"
99
+ puts "--yahookey, -y [key]"
100
+ puts "\t The Yahoo API Key .\n"
101
+ puts "--bingkey, -b [key]"
102
+ puts "\t The Bing API Key .\n"
103
+ puts "--filter, -p"
104
+ puts "\t The pattern to use to filter emails.(not fully implemented)\n"
105
+ puts "--file, -f [file_name] "
106
+ puts "\tIf we need to search more than one domain we can provide a list.\n"
107
+ puts "--output, -o"
108
+ puts "\tThe output file name.\n\n"
109
+ puts "PLUGIN OPTIONS:"
110
+ puts "--enable-all"
111
+ puts "\t Enables all ( Emails and People) searches.\n"
112
+ puts "--enable-people"
113
+ puts "\t Enables all People searches.\n"
114
+ puts "--enable-emails"
115
+ puts "\t Enables all Email searches.\n"
116
+ puts "--enable-google"
117
+ puts "\t Enables Google searches.\n"
118
+ puts "--enable-yahoo"
119
+ puts "\t Enables Yahoo searches.\n"
120
+ puts "--enable-bing"
121
+ puts "\t Enables Bing searches.\n"
122
+ puts "--enable-linkedin"
123
+ puts "\t Enables LinkedIn searches.\n"
124
+ puts "--enable-gprogiles"
125
+ puts "\t Enables Google Profiles searches.\n"
126
+ puts "--enable-naymz"
127
+ puts "\t Enables Naymz searches.\n"
128
+ puts "--enable-ggroups"
129
+ puts "\t Enables Google Groups searches.\n"
130
+ puts "--enable-pgp"
131
+ puts "\t Enables PGP searches.\n"
132
+ puts "--enable-usenet"
133
+ puts "\t Enables Usenet searches.\n\n"
134
+ puts "--disable-docs"
135
+ puts "\t Disables searches inside docs.\n\n"
136
+ puts "--disable-google"
137
+ puts "\t Disables Google searches.\n"
138
+ puts "--disable-yahoo"
139
+ puts "\t Disables Yahoo searches.\n"
140
+ puts "--disable-bing"
141
+ puts "\t Disables Bing searches.\n"
142
+ puts "--disable-linkedin"
143
+ puts "\t Disables LinkedIn searches.\n"
144
+ puts "--disable-gprogiles"
145
+ puts "\t Disables Google Profiles searches.\n"
146
+ puts "--disable-naymz"
147
+ puts "\t Disables Naymz searches.\n"
148
+ puts "--disable-ggroups"
149
+ puts "\t Disables Google Groups searches.\n"
150
+ puts "--disable-pgp"
151
+ puts "\t Disables PGP searches.\n"
152
+ puts "--disable-usenet"
153
+ puts "\t Disables Usenet searches.\n\n"
154
+ puts "Copyright 2009 - FreedomCoder\n"
116
155
  #END OF HELP
117
156
  exit(0)
118
- when '--disable-people':
119
- @people_engines = []
120
- when '--disable-emails':
121
- @email_engines = []
122
- when '--disable-google':
123
- @email_engines.delete(:Google)
124
- when '--disable-yahoo':
125
- @email_engines.delete(:Yahoo)
126
- when '--disable-bing':
127
- @email_engines.delete(:Bing)
128
- when '--disable-altavisa':
129
- @email_engines.delete(:Altavista)
130
- when '--disable-spider':
131
- @email_engines.delete(:Spider)
132
- when '--disable-linkedin':
133
- @people_engines.delete(:LinkedIn)
134
- when '--disable-gprofiles':
135
- @people_engines.delete(:GoogleProfiles)
136
- when '--disable-naymz':
137
- @people_engines.delete(:Naymz)
138
- when '--disable-classmates':
139
- @email_engines.delete(:Classmates)
140
- when '--disable-ggroups':
141
- @email_engines.delete(:GoogleGroups)
142
- when '--disable-pgp':
143
- @email_engines.delete(:PGP)
144
- when '--disable-usenet':
145
- @email_engines.delete(:Usenet)
146
- when '--query':
157
+ when '--enable-all' then
158
+ @people_engines = [:LinkedIn, :Naymz, :Classmates, :GoogleProfiles]
159
+ @email_engines = [:Google, :Bing, :Yahoo, :Altavista, :PGP, :Spider ,:Usenet, :GoogleGroups ]
160
+ when '--enable-people' then
161
+ @people_engines = [:LinkedIn, :Naymz, :Classmates, :GoogleProfiles]
162
+ when '--enable-emails' then
163
+ @email_engines = [:Google, :Bing, :Yahoo, :Altavista, :PGP, :Spider ,:Usenet, :GoogleGroups ]
164
+ when '--enable-google' then
165
+ @email_engines << :Google
166
+ when '--enable-yahoo' then
167
+ @email_engines << :Yahoo
168
+ when '--enable-bing' then
169
+ @email_engines << :Bing
170
+ when '--enable-altavisa' then
171
+ @email_engines << :Altavista
172
+ when '--enable-spider' then
173
+ @email_engines << :Spider
174
+ when '--enable-linkedin' then
175
+ @people_engines << :LinkedIn
176
+ when '--enable-gprofiles' then
177
+ @people_engines << :GoogleProfiles
178
+ when '--enable-naymz' then
179
+ @people_engines << :Naymz
180
+ when '--enable-classmates' then
181
+ @email_engines << :Classmates
182
+ when '--enable-ggroups' then
183
+ @email_engines << :GoogleGroups
184
+ when '--enable-pgp' then
185
+ @email_engines << :PGP
186
+ when '--enable-usenet' then
187
+ @email_engines << :Usenet
188
+ when '--disable-people' then
189
+ @people_engines = []
190
+ when '--disable-emails' then
191
+ @email_engines = []
192
+ when '--disable-google' then
193
+ @email_engines.delete(:Google)
194
+ when '--disable-yahoo' then
195
+ @email_engines.delete(:Yahoo)
196
+ when '--disable-bing' then
197
+ @email_engines.delete(:Bing)
198
+ when '--disable-altavisa' then
199
+ @email_engines.delete(:Altavista)
200
+ when '--disable-spider' then
201
+ @email_engines.delete(:Spider)
202
+ when '--disable-linkedin' then
203
+ @people_engines.delete(:LinkedIn)
204
+ when '--disable-gprofiles' then
205
+ @people_engines.delete(:GoogleProfiles)
206
+ when '--disable-naymz' then
207
+ @people_engines.delete(:Naymz)
208
+ when '--disable-classmates' then
209
+ @email_engines.delete(:Classmates)
210
+ when '--disable-ggroups' then
211
+ @email_engines.delete(:GoogleGroups)
212
+ when '--disable-pgp' then
213
+ @email_engines.delete(:PGP)
214
+ when '--disable-usenet' then
215
+ @email_engines.delete(:Usenet)
216
+ when '--disable-docs' then
217
+ @docs = false
218
+ when '--query' then
147
219
  @params[:query] = arg
148
- when '--company':
220
+ when '--company' then
149
221
  @params[:company] = arg
150
- when '--website':
222
+ when '--website' then
151
223
  @params[:website] = arg
152
- when '--file':
224
+ when '--file' then
153
225
  if File.exists?(arg)
154
226
  File.open(arg,'r').each_line do |line|
155
227
  temp[:query],temp[:company],temp[:website] = line.split(',')
@@ -159,15 +231,15 @@ opts.each do |opt, arg|
159
231
  raise ArgumentError, "File not found"
160
232
  exit(0)
161
233
  end
162
- when '--yahookey':
234
+ when '--yahookey' then
163
235
  @yahoo_key = arg
164
- when '--bingkey':
236
+ when '--bingkey' then
165
237
  @bing_key = arg
166
- when '--filter':
238
+ when '--filter' then
167
239
  @pattern = arg
168
- when '--output':
240
+ when '--output' then
169
241
  @output = Output.new arg
170
- when '--maxhits':
242
+ when '--maxhits' then
171
243
  @params[:maxhits] = arg.to_i
172
244
  else
173
245
  puts "Unknown command. Please try again"
@@ -188,11 +260,11 @@ def read_conf
188
260
  File.open(ENV['HOME'] + "/.esearchyrc").readlines.each do |line|
189
261
  key, value = line.split("=")
190
262
  case key
191
- when "MAXHITS"
263
+ when "MAXHITS" then
192
264
  @params[:maxhits] ||= value.to_i
193
- when "YAHOOKEY"
265
+ when "YAHOOKEY" then
194
266
  @yahoo_key ||= value
195
- when "BINGKEY"
267
+ when "BINGKEY" then
196
268
  @bing_key ||= value
197
269
  end
198
270
  end
@@ -222,7 +294,7 @@ def print_(list)
222
294
  end
223
295
 
224
296
  def print_linux(email)
225
- if email.match(/#{ESearchy::Search.query.gsub("@","").split('.')[0]}/)
297
+ if email.match(/#{ESearchy::Search.query.gsub("@","").split('.')[0]}/i)
226
298
  puts "\033[31m" + email + "\033\[0m"
227
299
  else
228
300
  puts "\033[32m" + email + "\033\[0m"
@@ -230,10 +302,10 @@ def print_linux(email)
230
302
  end
231
303
 
232
304
  def print_windows(email)
233
- if email.match(/#{ESearchy::Search.query.gsub("@","").split('.')[0]}/)
234
- Wcol::puts(12, email)
305
+ if email.match(/#{ESearchy::Search.query.gsub("@","").split('.')[0]}/i)
306
+ Wcol.puts(12, email)
235
307
  else
236
- Wcol::puts(2, email)
308
+ Wcol.puts(2, email)
237
309
  end
238
310
  end
239
311
 
@@ -262,6 +334,9 @@ class Output
262
334
  end
263
335
 
264
336
  def save_pdf(data)
337
+ require 'prawn'
338
+ require 'prawn/layout'
339
+
265
340
  Prawn::Document.generate(name) do
266
341
  table data,
267
342
  :position => :center,
@@ -275,6 +350,7 @@ class Output
275
350
  end
276
351
 
277
352
  def save_sqlite(data)
353
+ require 'sqlite3'
278
354
  @db = SQLite3::Database.new(file)
279
355
  @db.execute("CREATE TABLE IF NOT EXISTS results (
280
356
  id integer primary key asc,
@@ -296,21 +372,27 @@ def execute(p)
296
372
  search = ESearchy::Search.new(p)
297
373
 
298
374
  search.start do |s|
299
- s.Emails(@email_engines) do |e|
300
- e.Yahoo.appid= @yahoo_key if @yahoo_key
301
- e.Bing.appid= @bing_key if @bing_key
302
- e.search do |x|
303
- dump(x.results)
304
- print_(x.emails.uniq)
305
- end
306
- e.docs do |x|
307
- dump(x.results)
308
- print_(x.emails.uniq)
375
+ unless @email_engines.empty?
376
+ s.Emails(@email_engines) do |e|
377
+ e.Yahoo.appid= @yahoo_key if @yahoo_key and @email_engines.include?(:Yahoo)
378
+ e.Bing.appid= @bing_key if @bing_key and @email_engines.include?(:Bing)
379
+ e.search do |x|
380
+ dump(x.results)
381
+ print_(x.emails.uniq)
382
+ end
383
+ if @docs
384
+ e.docs do |x|
385
+ dump(x.results)
386
+ print_(x.emails.uniq)
387
+ end
388
+ end
309
389
  end
310
390
  end
311
-
312
- s.People(@people_engines) do |p|
313
- p.search { |p| dump(p.results) }
391
+
392
+ unless @people_engines.empty?
393
+ s.People(@people_engines) do |p|
394
+ p.search { |p| dump(p.results) }
395
+ end
314
396
  end
315
397
  end
316
398
  @output.save(search.results) if @output
@@ -319,20 +401,28 @@ def execute(p)
319
401
  print_ search.people
320
402
  end
321
403
  end
322
-
323
- puts "\033[31m------------------------------------------------------------------------------\033\[0m"
324
- puts "\033[31m ||---- \033\[0m //--- ||---- __ //----\\\\ //--- || || \\\\ // "
325
- puts "\033[31m || \033\[0m // || // \\\\ || \\\\ // || || \\\\//"
326
- puts "\033[31m ||---- \033\[0m \\\\ ||---- // \\\\ ||----// || ||-----|| // "
327
- puts "\033[31m || \033\[0m \\\\ || //-----\\\\ || \\\\ \\\\ || || //"
328
- puts "\033[31m ||---- \033\[0m ---// ||---- // \\\\ || \\\\ \\\\--- || || // "
329
- puts "\033[31m------------------------------------------------------------------------------\033\[0m"
404
+ if RUBY_PLATFORM =~ /mingw|mswin/
405
+ puts "___________ _________ .__ "
406
+ puts "\_ _____// _____/ ____ _____ _______ ____ | |__ ___.__."
407
+ puts " | __)_ \_____ \_/ __ \\__ \\_ __ \_/ ___\| | < | |"
408
+ puts " | \/ \ ___/ / __ \| | \/\ \___| Y \___ |"
409
+ puts "/_______ /_______ /\___ >____ /__| \___ >___| / ____|"
410
+ puts " \/ \/ \/ \/ \/ \/\/ "
411
+ else
412
+ puts "\033[31m___________ \033\[0m_________ .__ "
413
+ puts "\033[31m\\_ _____/\033\[0m/ _____/ ____ _____ _______ ____ | |__ ___.__."
414
+ puts "\033[31m | __)_ \033\[0m\\_____ \\_/ __ \\\\__ \\\\_ __ \\_/ ___\\| | < | |"
415
+ puts "\033[31m | \\\033\[0m/ \\ ___/ / __ \\| | \\/\\ \\___| Y \\___ |"
416
+ puts "\033[31m/_______ /\033\[0m_______ /\\___ >____ /__| \___ >___| / ____|"
417
+ puts "\033[31m \\/\033\[0m \\/ \\/ \\/ \\/ \\/\\/"
418
+ end
330
419
  puts "\n"
331
- puts "DISCLOSURE: This is just an example tool ESearchy is more and more a piece
332
- of code intended to work as a Library and you should create your own little.rb file :)"
420
+ puts "DISCLOSURE: This is just an example tool for the library. ESearchy is intended
421
+ to work as a Library/Framework and you should create your own scripts :)"
333
422
  puts "------------------------------------------------------------------------"
334
423
  puts "REMINDER:"
335
- puts "- if you want to use GoogleProfiles, LinkedIn, Classmates or Naymz, you will need to use the --company (-c) <company_name> option"
424
+ puts "- if you want to use GoogleProfiles, LinkedIn, Classmates or Naymz,"
425
+ puts " you will need to use the --company (-c) <company_name> option"
336
426
  puts "- If you want to spider a website you need to use the --website (-w) <URL> option"
337
427
 
338
428
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esearchy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.1
4
+ version: 0.2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matias P. Brutti
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-15 00:00:00 -03:00
12
+ date: 2009-12-16 00:00:00 -03:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency