FreedomCoder-esearchy 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,7 +1,7 @@
1
1
  = Esearch
2
2
 
3
3
  == DESCRIPTION
4
- Esearchy is a small library capable of searching the internet for email addresses. Currently, the supported search methods are engines such as Google, Bing, Yahoo, PGP servers, GoogleGroups, Linkedin, etc , but I intend to add many more.
4
+ Esearchy is a small library capable of searching the internet for email addresses. Currently, the supported search methods are engines such as Google, Bing, Yahoo, PGP servers, GoogleGroups, LinkedIn, etc , but I intend to add many more.
5
5
 
6
6
  Also, the library searches inside .pdf, .docx, .xlsx, .pptx, asn and .txt files for emails addresses and adds them to the list of found accounts. Finally, we have support for .docs files but for now only in Windows Platforms.
7
7
  In order to parse Microsoft Word (.doc):
@@ -52,7 +52,7 @@ We now also have a LinkedIn search which looks for Names in the site. With those
52
52
  * searches Google and Yahoo for emails related to those people.
53
53
 
54
54
  ESearchy.create "domain.com" do |d|
55
- d.engines = { "LinkedIn" => Linkedin.new}
55
+ d.engines = { "LinkedIn" => LinkedIn.new}
56
56
  d.company_name "Domain Corp"
57
57
  d.linkedin_credentials "myuser@linkedin.com", "12345"
58
58
  d.maxhits = 100
data/lib/esearchy.rb CHANGED
@@ -8,15 +8,15 @@ class ESearchy
8
8
  LOG = Logger.new(1, $stdout)
9
9
 
10
10
  def log_type=(value)
11
- ESearchy::LOG.level = value
11
+ ESearchy::LOG.level = value
12
12
  end
13
13
 
14
14
  def log_file=(value)
15
- ESearchy::LOG.file = value
15
+ ESearchy::LOG.file = value
16
16
  end
17
17
 
18
18
  DEFAULT_ENGINES = {"Google" => Google, "Bing" => Bing, "Yahoo" => Yahoo,
19
- "PGP" => PGP, "LinkedIn" => Linkedin }
19
+ "PGP" => PGP, "LinkedIn" => LinkedIn }
20
20
 
21
21
  def initialize(options={}, &block)
22
22
  @query = options[:query]
@@ -78,6 +78,27 @@ class ESearchy
78
78
  end
79
79
  alias_method :company_name=, :company_name
80
80
 
81
+ def search_engine(key, value)
82
+ if [:Google, :Bing, :Yahoo, :PGP, :LinkedIn, :GoogleGroups].include?(key)
83
+ if value == true
84
+ unless @engines[key.to_s]
85
+ @engines[key.to_s] = instance_eval "#{key}.new(@maxhits)"
86
+ end
87
+ elsif value == false
88
+ @engines.delete(key.to_s)
89
+ end
90
+ else
91
+ raise(ArgumentError, "No plugin with that Key")
92
+ end
93
+ end
94
+
95
+ %w{Google Bing Yahoo PGP LinkedIn GoogleGroups}.each do |engine|
96
+ class_eval "
97
+ def search_#{engine}=(value)
98
+ search_engine :#{engine}, value
99
+ end"
100
+ end
101
+
81
102
  def save_to_file(file)
82
103
  open(file,"a") do |f|
83
104
  emails.each { |e| f << e + "\n" }
@@ -2,7 +2,7 @@
2
2
  local_path = "#{File.dirname(__FILE__)}/"
3
3
  %w{yahoo google useragent}.each {|lib| require local_path + lib}
4
4
 
5
- class Linkedin
5
+ class LinkedIn
6
6
  include Searchy
7
7
 
8
8
  def initialize(maxhits=nil)
@@ -49,7 +49,7 @@ class Linkedin
49
49
  begin
50
50
  @cookie = login
51
51
  rescue
52
- ESearchy::LOG.puts "Unable to parse Linkedin. Something went Wrong with the Credentials"
52
+ ESearchy::LOG.puts "Unable to parse LinkedIn. Something went Wrong with the Credentials"
53
53
  return nil
54
54
  end
55
55
  begin
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: FreedomCoder-esearchy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matias P. Brutti